def check_cli(module, cli):
 vrouter_name = module.params['pn_vrouter_name']
 interface_ip = module.params['pn_interface_ip']
 global VROUTER_EXISTS, LB_INTERFACE_EXISTS
 check_vrouter = (cli + ' vrouter-show format name no-show-headers ')
 check_vrouter = shlex.split(check_vrouter)
 out = module.run_command(check_vrouter)[1]
 out = out.split()
 if (vrouter_name in out):
  VROUTER_EXISTS = True
 else:
  VROUTER_EXISTS = False
 show = (cli + (' vrouter-loopback-interface-show vrouter-name %s format ip no-show-headers' % vrouter_name))
 show = shlex.split(show)
 out = module.run_command(show)[1]
 out = out.split()
 if (interface_ip in out):
  LB_INTERFACE_EXISTS = True
 else:
  LB_INTERFACE_EXISTS = False

def check_cli ( module , cli ) : vrouter_name = module . params [ 'pn_vrouter_name' ] interface_ip = module . params [ 'pn_interface_ip' ] global VROUTER_EXISTS , LB_INTERFACE_EXISTS check_vrouter = ( cli + ' vrouter-show format name no-show-headers ' ) check_vrouter = shlex . split ( check_vrouter ) out = module . run_command ( check_vrouter ) [ 1 ] out = out . split ( ) if ( vrouter_name in out ) : VROUTER_EXISTS = True else : VROUTER_EXISTS = False show = ( cli + ( ' vrouter-loopback-interface-show vrouter-name %s format ip no-show-headers' % vrouter_name ) ) show = shlex . split ( show ) out = module . run_command ( show ) [ 1 ] out = out . split ( ) if ( interface_ip in out ) : LB_INTERFACE_EXISTS = True else : LB_INTERFACE_EXISTS = False
this method checks if vrouter exists on the target node .