本文整理汇总了Python中marvin.lib.base.Router.change_service_offering方法的典型用法代码示例。如果您正苦于以下问题:Python Router.change_service_offering方法的具体用法?Python Router.change_service_offering怎么用?Python Router.change_service_offering使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类marvin.lib.base.Router
的用法示例。
在下文中一共展示了Router.change_service_offering方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_04_change_service_offerring_vpc
# 需要导入模块: from marvin.lib.base import Router [as 别名]
# 或者: from marvin.lib.base.Router import change_service_offering [as 别名]
def test_04_change_service_offerring_vpc(self):
""" Tests to change service offering of the Router after
creating a vpc
"""
# Validate the following
# 1. Create a VPC with cidr - 10.1.1.1/16
# 2. Change the service offerings of the VPC Virtual Router which is
# created as a result of VPC creation.
self.validate_vpc_offering(self.vpc_off)
self.validate_vpc_network(self.vpc)
routers = Router.list(
self.api_client,
account=self.account.name,
domainid=self.account.domainid,
listall=True
)
self.assertEqual(
isinstance(routers, list),
True,
"List Routers should return a valid list"
)
# Stop the router
router = routers[0]
self.debug("Stopping the router with ID: %s" % router.id)
cmd = stopRouter.stopRouterCmd()
cmd.id = router.id
self.api_client.stopRouter(cmd)
service_offering = ServiceOffering.create(
self.api_client,
self.services["service_offering_new"]
)
self.debug("Changing service offering for the Router %s" % router.id)
try:
router = Router.change_service_offering(self.api_client,
router.id,
service_offering.id
)
except:
self.fail("Changing service offering failed")
self.debug("Router %s" % router)
routers = Router.list(
self.api_client,
account=self.account.name,
domainid=self.account.domainid,
listall=True
)
router = routers[0]
self.assertEqual(
router.serviceofferingid,
service_offering.id,
"Changing service offering failed as id is %s and expected"
"is %s" % (router.serviceofferingid, service_offering.id)
)
return
示例2: test_04_chg_srv_off_router_after_addition_of_one_guest_network
# 需要导入模块: from marvin.lib.base import Router [as 别名]
# 或者: from marvin.lib.base.Router import change_service_offering [as 别名]
def test_04_chg_srv_off_router_after_addition_of_one_guest_network(self):
""" Test to change service offering of router after addition of one guest network
"""
# Validations
# 1. Create a VPC with cidr - 10.1.1.1/16
# 2. Add network1(10.1.1.1/24) to this VPC.
# 3. Deploy vm1,vm2 and vm3 such that they are part of network1.
# 4. Create a PF /Static Nat/LB rule for vms in network1.
# 5. Create ingress network ACL for allowing all the above rules from a public ip range on network1.
# 6. Create egress network ACL for network1 to access google.com.
# 7. Create a private gateway for this VPC and add a static route to this gateway.
# 8. Create a VPN gateway for this VPC and add a static route to this gateway.
# 9. Make sure that all the PF,LB and Static NAT rules work as expected.
# 10. Make sure that we are able to access google.com from all the user Vms.
# 11. Make sure that the newly added private gateway's and VPN
# gateway's static routes work as expected
self.validate_vpc_offering(self.vpc_off)
self.validate_vpc_network(self.vpc)
self.assertEqual(
isinstance(self.gateways, list),
True,
"List private gateways should return a valid response"
)
self.assertEqual(
isinstance(self.static_routes, list),
True,
"List static route should return a valid response"
)
routers = Router.list(
self.api_client,
account=self.account.name,
domainid=self.account.domainid,
listall=True
)
self.assertEqual(
isinstance(routers, list),
True,
"List Routers should return a valid list"
)
# Stop the router
router = routers[0]
self.debug("Stopping the router with ID: %s" % router.id)
cmd = stopRouter.stopRouterCmd()
cmd.id = router.id
self.api_client.stopRouter(cmd)
service_offering = ServiceOffering.create(
self.api_client,
self.services["service_offering_new"]
)
self.debug("Changing service offering for the Router %s" % router.id)
try:
router = Router.change_service_offering(self.api_client,
router.id,
service_offering.id
)
except:
self.fail("Changing service offering failed")
self.debug("Router %s" % router)
routers = Router.list(
self.api_client,
account=self.account.name,
domainid=self.account.domainid,
listall=True
)
router = routers[0]
self.assertEqual(
router.serviceofferingid,
service_offering.id,
"Changing service offering failed as id is %s and expected"
"is %s" % (router.serviceofferingid, service_offering.id)
)
return