Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable connectivity-check functionality to support VRF #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
12 changes: 9 additions & 3 deletions src/usr/lib/ztp/plugins/connectivity-check
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ConnectivityCheck:
'''!
Constructor. We only store the json data input file, all the logic is
managed by the main() method

@param input_file (str) json data input file to be used by the plugin
'''
self.__input_file = input_file
Expand Down Expand Up @@ -62,7 +62,13 @@ class ConnectivityCheck:
# Loop through current host list
for host in iter_list:
if isString(host):
pingCmd = "ping -q -c " + str(ping_count) + " "
if '@' in host:
ip, vrf = host.split('@')
pingCmd = "ip vrf exec " + str(vrf) + " "
else:
ip = host
pingCmd = ""
pingCmd += "ping -q -c " + str(ping_count) + " "
if deadline is not None:
pingCmd += "-w " + str(deadline) + " "
if timeout is not None:
Expand All @@ -72,7 +78,7 @@ class ConnectivityCheck:
logger.info('connectivity-check: Pinging host \'%s\'.' % (host))
updateActivity('connectivity-check: Pinging host \'%s\'.' % (host))
# Ping the host
rv = runCommand(pingCmd + host, False)
rv = runCommand(pingCmd + ip, False)
if rv == 0:
# Host is alive, remove it from the list
_host_list.remove(host)
Expand Down
Loading