Skip to content
This repository has been archived by the owner on Jan 16, 2019. It is now read-only.

NTP peers #186

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions napalm_ios/ios.py
Original file line number Diff line number Diff line change
Expand Up @@ -1694,6 +1694,33 @@ def get_ntp_servers(self):

return ntp_servers

def get_ntp_peers(self):
"""Implementation of get_ntp_peers for IOS.

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.
Example::
{
'192.168.0.1': {},
'17.72.148.53': {},
'37.187.56.220': {},
'162.158.20.18': {}
}
"""
ntp_peers = {}
command = 'show run | include ntp peer'
output = self._send_command(command)

for line in output.splitlines():
split_line = line.split()
if "vrf" == split_line[2]:
ntp_peers[split_line[4]] = {}
else:
ntp_peers[split_line[2]] = {}

return ntp_peers

def get_ntp_stats(self):
"""Implementation of get_ntp_stats for IOS."""
ntp_stats = []
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"2001:DB8:0:0:8:800:200C:417A": {},
"17.72.148.53": {},
"192.168.0.1": {},
"37.187.56.220": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ntp peer 192.168.0.1 prefer
ntp peer 17.72.148.53
ntp peer vrf NAPALM 37.187.56.220
ntp peer 2001:DB8:0:0:8:800:200C:417A version 4
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"2001:DB8:0:0:8:800:200C:417A": {},
"17.72.148.53": {},
"192.168.0.1": {},
"37.187.56.220": {}
"2001:DB8:0:0:8:800:200C:417A": {},
"17.72.148.53": {},
"192.168.0.1": {},
"37.187.56.220": {}
}