Skip to content

Commit

Permalink
Update get_ntp_servers return definition
Browse files Browse the repository at this point in the history
Support returning details regarding individual NTP servers based
on openconfig models (/system/ntp/servers/server)
  • Loading branch information
bewing committed Jan 22, 2025
1 parent 99192df commit 7f6bf82
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
15 changes: 13 additions & 2 deletions napalm/base/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -921,12 +921,23 @@ def get_ntp_servers(self) -> Dict[str, models.NTPServerDict]:
"""
Returns the NTP servers configuration as dictionary.
The keys of the dictionary represent the IP Addresses of the servers.
Inner dictionaries do not have yet any available keys.
Inner dictionaries MAY contain information regarding per-server configuration.
Example::
{
'192.168.0.1': {},
'192.168.0.1':
{
'address': '192.168.0.1',
'port': 123,
'version': 4,
'association_type': 'SERVER',
'iburst': False,
'prefer': False,
'network_instance': 'default',
'source_address': '192.0.2.1',
'key_id': -1,
},
'17.72.148.53': {},
'37.187.56.220': {},
'162.158.20.18': {}
Expand Down
10 changes: 9 additions & 1 deletion napalm/base/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,15 @@
NTPServerDict = TypedDict(
"NTPServerDict",
{
# will populate it in the future wit potential keys
"address": str,
"port": int,
"version": int,
"association_type": str,
"iburst": bool,
"prefer": bool,
"network_instance": str,
"source_address": str,
"key_id": int,
},
total=False,
)
Expand Down

0 comments on commit 7f6bf82

Please sign in to comment.