本文整理汇总了Python中marvin.lib.base.Router.stop方法的典型用法代码示例。如果您正苦于以下问题:Python Router.stop方法的具体用法?Python Router.stop怎么用?Python Router.stop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类marvin.lib.base.Router
的用法示例。
在下文中一共展示了Router.stop方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_08_create_policy_router_stopped
# 需要导入模块: from marvin.lib.base import Router [as 别名]
# 或者: from marvin.lib.base.Router import stop [as 别名]
def test_08_create_policy_router_stopped(self):
"""Test verify create stickiness policy when router is stopped state"""
# Validate the following
# 1. stop the router
# 2. create stikiness policy from UI
# 3. start the router. listLBStickinessPolicies Api should show created
# stikiness policy
self.debug("Creating LB rule for account: %s" % self.account.name)
lb_rule = self.create_LB_Rule(
self.public_ip,
network=self.get_Network(self.account),
vmarray=[self.virtual_machine, self.virtual_machine_2],
)
self.debug("Fetching routers for the account: %s" % self.account.name)
router = self.get_router(self.account)
self.debug("Stopping the router: %s" % router.name)
Router.stop(self.apiclient, id=router.id)
policies = self.configure_Stickiness_Policy(lb_rule, method="LbCookie")
policy = policies.stickinesspolicy[0]
self.debug("Starting the router: %s" % router.name)
Router.start(self.apiclient, id=router.id)
self.debug("Policy: %s" % str(policy))
self.debug("Validating the stickiness policy")
self.validate_Stickiness_Policy(lb_rule, "LbCookie", self.public_ip.ipaddress.ipaddress)
return
示例2: test_13_1_egress_fr13
# 需要导入模块: from marvin.lib.base import Router [as 别名]
# 或者: from marvin.lib.base.Router import stop [as 别名]
def test_13_1_egress_fr13(self):
"""Test Redundant Router : Master failover
"""
# Validate the following:
# 1. deploy VM using network offering with egress policy false.
# 2. create egress rule valid cidr valid port range.
# 3. redundant router
# 3. All should work fine.
#TODO: setup network with RR
self.create_vm(RR=True, egress_policy=False)
self.createEgressRule()
vm_network_id = self.virtual_machine.nic[0].networkid
self.debug("Listing routers for network: %s" % vm_network_id)
routers = Router.list(self.apiclient,
networkid=vm_network_id,
listall=True)
self.assertEqual(isinstance(routers, list),
True,
"list router should return Master and backup routers")
self.assertEqual(len(routers),
2,
"Length of the list router should be 2 (Backup & master)")
if routers[0].redundantstate == 'MASTER':
master_router = routers[0]
backup_router = routers[1]
else:
master_router = routers[1]
backup_router = routers[0]
self.debug("Redundant states: %s, %s" % (master_router.redundantstate,
backup_router.redundantstate))
self.debug("Stopping the Master router")
try:
Router.stop(self.apiclient, id=master_router.id)
except Exception as e:
self.fail("Failed to stop master router: %s" % e)
# wait for VR update state
time.sleep(60)
self.debug("Checking state of the master router in %s" % self.network.name)
routers = Router.list(self.apiclient,
id=master_router.id,
listall=True)
self.assertEqual(isinstance(routers, list),
True,
"list router should return Master and backup routers")
self.exec_script_on_user_vm('ping -c 1 www.google.com',
"| grep -oP \'\d+(?=% packet loss)\'",
"['0']",
negative_test=False)
示例3: setUp
# 需要导入模块: from marvin.lib.base import Router [as 别名]
# 或者: from marvin.lib.base.Router import stop [as 别名]
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
self.debug("Check the status of VPC virtual router")
routers = Router.list(
self.apiclient,
networkid=self.network_1.id,
listall=True
)
if not isinstance(routers, list):
raise Exception("No response from list routers API")
self.router = routers[0]
if self.router.state == "Running":
Router.stop(self.apiclient, id=self.router.id)
self.cleanup = []
return
示例4: test_restart_network_with_destroyed_masterVR
# 需要导入模块: from marvin.lib.base import Router [as 别名]
# 或者: from marvin.lib.base.Router import stop [as 别名]
def test_restart_network_with_destroyed_masterVR(self):
"""Test restarting RvR network without cleanup after destroying master VR
"""
# Steps to validate
# 1. createNetwork using network offering for redundant virtual router
# 2. listRouters in above network
# 3. deployVM in above user account in the created network
# 4. Destroy master VR
# 5. restartNetwork cleanup=false
# 6. Verify RVR status after network restart
# Creating network using the network offering created
self.debug("Creating network with network offering: %s" %
self.network_offering.id)
network = Network.create(
self.apiclient,
self.services["network"],
accountid=self.account.name,
domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
self.debug("Created network with ID: %s" % network.id)
networks = Network.list(
self.apiclient,
id=network.id,
listall=True
)
self.assertEqual(
validateList(networks)[0],
PASS,
"List networks should return a valid response for created network"
)
self.debug("Deploying VM in account: %s" % self.account.name)
# Spawn an instance in that network
virtual_machine = VirtualMachine.create(
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network.id)]
)
self.debug("Deployed VM in network: %s" % network.id)
vms = VirtualMachine.list(
self.apiclient,
id=virtual_machine.id,
listall=True
)
self.assertEqual(
validateList(vms)[0],
PASS,
"List Vms should return a valid list"
)
vm = vms[0]
self.assertEqual(
vm.state,
"Running",
"Vm should be in running state after deployment"
)
self.debug("Listing routers for network: %s" % network.name)
routers = Router.list(
self.apiclient,
networkid=network.id,
listall=True
)
self.assertEqual(
validateList(routers)[0],
PASS,
"list router should return Master and backup routers"
)
self.assertEqual(
len(routers),
2,
"Length of the list router should be 2 (Backup & master)"
)
if routers[0].redundantstate == 'MASTER' and\
routers[1].redundantstate == 'BACKUP':
master_router = routers[0]
backup_router = routers[1]
elif routers[1].redundantstate == 'MASTER' and \
routers[0].redundantstate == 'BACKUP':
master_router = routers[1]
backup_router = routers[0]
else:
self.fail("Both the routers in RVR are in BackupState")
Router.stop(
self.apiclient,
id=master_router.id
)
Router.destroy(
self.apiclient,
id=master_router.id
)
masterVR = Router.list(
self.apiclient,
#.........这里部分代码省略.........
示例5: test_07_stop_start_VR_verify_ip_alias
# 需要导入模块: from marvin.lib.base import Router [as 别名]
# 或者: from marvin.lib.base.Router import stop [as 别名]
def test_07_stop_start_VR_verify_ip_alias(self):
"""Reboot VR and verify ip alias
1.Deploy guest vm in new cidr
2.Verify ip alias creation
3.Stop and Start VR
4.Verify ip alias on VR
"""
list_router_response = list_routers(
self.apiclient,
zoneid=self.zone.id,
listall=True
)
self.assertEqual(
isinstance(list_router_response, list),
True,
"Check list response returns a valid list"
)
router = list_router_response[0]
hosts = list_hosts(
self.apiclient,
zoneid=router.zoneid,
type='Routing',
state='Up',
id=router.hostid
)
self.assertEqual(
isinstance(hosts, list),
True,
"Check list host returns a valid list"
)
host = hosts[0]
self.debug("Router ID: %s, state: %s" % (router.id, router.state))
self.assertEqual(
router.state,
'Running',
"Check list router response for router state"
)
port = self.testdata['configurableData']['host']["publicport"]
username = self.testdata['configurableData']['host']["username"]
password = self.testdata['configurableData']['host']["password"]
# SSH to host so that host key is saved in first
# attempt
SshClient(host.ipaddress, port, username, password)
proc = "ip addr show eth0"
result = get_process_status(
host.ipaddress,
port,
username,
password,
router.linklocalip,
proc
)
res = str(result)
self.debug("ip alias configuration on VR: %s" % res)
self.assertNotEqual(
res.find(self.alias_ip)
- 1,
"ip alias is not created on VR eth0"
)
self.debug("Stopping VR")
Router.stop(
self.apiclient,
router.id,
)
self.debug("Starting VR")
Router.start(
self.apiclient,
router.id
)
list_router_response = list_routers(
self.apiclient,
zoneid=self.zone.id,
listall=True
)
self.assertEqual(
isinstance(list_router_response, list),
True,
"Check list response returns a valid list"
)
router = list_router_response[0]
self.assertEqual(
router.state,
'Running',
"Router is not in running state after reboot"
)
self.debug("VR is up and Running")
result = get_process_status(
host.ipaddress,
port,
username,
password,
router.linklocalip,
proc
)
res = str(result)
self.assertNotEqual(
res.find(self.alias_ip),
#.........这里部分代码省略.........