Add port and host check for neighbor args in junos_interface (#29941)

pull/29953/head
Ganesh Nalawade 7 years ago committed by GitHub
parent 74ace093b8
commit 5caa47feb9

@ -365,10 +365,12 @@ def main():
have_port = [item.text for item in reply.xpath('lldp-neighbors-information/lldp-neighbor-information/lldp-remote-port-id')]
for neighbor in want_neighbors:
if neighbor['host'] not in have_host:
failed_conditions.append('host ' + neighbor['host'])
if neighbor['port'] not in have_port:
failed_conditions.append('port ' + neighbor['port'])
host = neighbor.get('host')
port = neighbor.get('port')
if host and host not in have_host:
failed_conditions.append('host ' + host)
if port and port not in have_port:
failed_conditions.append('port ' + port)
if failed_conditions:
msg = 'One or more conditional statements have not be satisfied'
module.fail_json(msg=msg, failed_conditions=failed_conditions)

Loading…
Cancel
Save