def verifyRouterState(apiclient, routerid, allowedstates): """List the router and verify that its state is in allowed states @output: List, containing [Result, Reason] Ist Argument ('Result'): FAIL: If router state is not in allowed states PASS: If router state is in allowed states""" try: cmd = listRouters.listRoutersCmd() cmd.id = routerid cmd.listall = True routers = apiclient.listRouters(cmd) except Exception as e: return [FAIL, e] listvalidationresult = validateList(routers) if listvalidationresult[0] == FAIL: return [FAIL, listvalidationresult[2]] if routers[0].state.lower() not in allowedstates: return [ FAIL, "state of the router should be in %s but is %s" % (allowedstates, routers[0].state) ] return [PASS, None]
def list_routers(apiclient, **kwargs): """List all Routers matching criteria""" cmd = listRouters.listRoutersCmd() [setattr(cmd, k, v) for k, v in kwargs.items()] if "account" in kwargs.keys() and "domainid" in kwargs.keys(): cmd.listall = True return apiclient.listRouters(cmd)
def list_routers(api_client, **kwargs): """List all Routers matching criteria""" cmd = listRouters.listRoutersCmd() [setattr(cmd, k, v) for k, v in kwargs.items()] if 'account' in kwargs.keys() and 'domainid' in kwargs.keys(): cmd.listall = True return api_client.listRouters(cmd)
def verifyRouterState(apiclient, routerid, allowedstates): """List the router and verify that its state is in allowed states @output: List, containing [Result, Reason] Ist Argument ('Result'): FAIL: If router state is not in allowed states PASS: If router state is in allowed states""" try: cmd = listRouters.listRoutersCmd() cmd.id = routerid cmd.listall = True routers = apiclient.listRouters(cmd) except Exception as e: return [FAIL, e] listvalidationresult = validateList(routers) if listvalidationresult[0] == FAIL: return [FAIL, listvalidationresult[2]] if routers[0].state.lower() not in allowedstates: return [FAIL, "state of the router should be in %s but is %s" % (allowedstates, routers[0].state)] return [PASS, None]
def list_routers(apiclient, **kwargs): """List all Routers matching criteria""" cmd = listRouters.listRoutersCmd() [setattr(cmd, k, v) for k, v in kwargs.items()] return(apiclient.listRouters(cmd))
def list_routers(apiclient, **kwargs): """List all Routers matching criteria""" cmd = listRouters.listRoutersCmd() [setattr(cmd, k, v) for k, v in kwargs.items()] return (apiclient.listRouters(cmd))