|
|
|
|
@ -131,11 +131,12 @@ def check_cli(module, cli):
|
|
|
|
|
nic_str = module.params['pn_nic']
|
|
|
|
|
|
|
|
|
|
# Check for vRouter
|
|
|
|
|
check_vrouter = cli + ' vrouter-show name %s format name no-show-headers ' % vrouter_name
|
|
|
|
|
check_vrouter = cli + ' vrouter-show format name no-show-headers'
|
|
|
|
|
out = run_commands(module, check_vrouter)[1]
|
|
|
|
|
out = out.split()
|
|
|
|
|
if out:
|
|
|
|
|
out = out.split()
|
|
|
|
|
|
|
|
|
|
VROUTER_EXISTS = True if vrouter_name in out[-1] else False
|
|
|
|
|
VROUTER_EXISTS = True if vrouter_name in out else False
|
|
|
|
|
|
|
|
|
|
if interface_ip:
|
|
|
|
|
# Check for interface and VRRP and fetch nic for VRRP
|
|
|
|
|
@ -151,9 +152,11 @@ def check_cli(module, cli):
|
|
|
|
|
if nic_str:
|
|
|
|
|
# Check for nic
|
|
|
|
|
show = cli + ' vrouter-interface-show vrouter-name %s ' % vrouter_name
|
|
|
|
|
show += ' format nic no-show-headers'
|
|
|
|
|
show += 'format nic no-show-headers'
|
|
|
|
|
out = run_commands(module, show)[1]
|
|
|
|
|
out = out.split()
|
|
|
|
|
|
|
|
|
|
if out:
|
|
|
|
|
out = out.split()
|
|
|
|
|
|
|
|
|
|
NIC_EXISTS = True if nic_str in out else False
|
|
|
|
|
|
|
|
|
|
@ -221,7 +224,7 @@ def main():
|
|
|
|
|
if INTERFACE_EXISTS is True:
|
|
|
|
|
module.exit_json(
|
|
|
|
|
skipped=True,
|
|
|
|
|
msg='vRouter with interface %s exist' % ip
|
|
|
|
|
msg='vRouter with interface ip %s exist' % ip
|
|
|
|
|
)
|
|
|
|
|
cli += ' nic %s ip %s ' % (nic, ip)
|
|
|
|
|
|
|
|
|
|
@ -236,7 +239,7 @@ def main():
|
|
|
|
|
if INTERFACE_EXISTS is False:
|
|
|
|
|
module.exit_json(
|
|
|
|
|
skipped=True,
|
|
|
|
|
msg='vRouter with interface %s does not exist' % ip
|
|
|
|
|
msg='vRouter with interface ip %s does not exist' % ip
|
|
|
|
|
)
|
|
|
|
|
if nic:
|
|
|
|
|
cli += ' nic %s ' % nic
|
|
|
|
|
|