Skip to content

Commit 145c7b7

Browse files
committed
Update NTP data return definition
Support returning details regarding individual NTP servers based on openconfig models (/system/ntp/servers/server)
1 parent 99192df commit 145c7b7

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

napalm/base/base.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -921,12 +921,23 @@ def get_ntp_servers(self) -> Dict[str, models.NTPServerDict]:
921921
"""
922922
Returns the NTP servers configuration as dictionary.
923923
The keys of the dictionary represent the IP Addresses of the servers.
924-
Inner dictionaries do not have yet any available keys.
924+
Inner dictionaries MAY contain information regarding per-server configuration.
925925
926926
Example::
927927
928928
{
929-
'192.168.0.1': {},
929+
'192.168.0.1':
930+
{
931+
'address': '192.168.0.1',
932+
'port': 123,
933+
'version': 4,
934+
'association_type': 'SERVER',
935+
'iburst': False,
936+
'prefer': False,
937+
'network_instance': 'default',
938+
'source_address': '192.0.2.1',
939+
'key_id': -1,
940+
},
930941
'17.72.148.53': {},
931942
'37.187.56.220': {},
932943
'162.158.20.18': {}

napalm/base/models.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,15 +224,31 @@
224224
NTPPeerDict = TypedDict(
225225
"NTPPeerDict",
226226
{
227-
# will populate it in the future wit potential keys
227+
"address": str,
228+
"port": int,
229+
"version": int,
230+
"association_type": str,
231+
"iburst": bool,
232+
"prefer": bool,
233+
"network_instance": str,
234+
"source_address": str,
235+
"key_id": int,
228236
},
229237
total=False,
230238
)
231239

232240
NTPServerDict = TypedDict(
233241
"NTPServerDict",
234242
{
235-
# will populate it in the future wit potential keys
243+
"address": str,
244+
"port": int,
245+
"version": int,
246+
"association_type": str,
247+
"iburst": bool,
248+
"prefer": bool,
249+
"network_instance": str,
250+
"source_address": str,
251+
"key_id": int,
236252
},
237253
total=False,
238254
)

0 commit comments

Comments
 (0)