本文整理汇总了Python中marvin.lib.base.VpcOffering类的典型用法代码示例。如果您正苦于以下问题:Python VpcOffering类的具体用法?Python VpcOffering怎么用?Python VpcOffering使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VpcOffering类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_02_create_vpc_from_offering_with_regionlevelvpc_service_capability
def test_02_create_vpc_from_offering_with_regionlevelvpc_service_capability(self):
""" Test create VPC offering
"""
# Steps for validation
# 1. Create VPC Offering by specifying all supported Services
# 2. VPC offering should be created successfully.
if not self.isOvsPluginEnabled:
self.skipTest("OVS plugin should be enabled to run this test case")
self.debug("Creating inter VPC offering")
vpc_off = VpcOffering.create(
self.apiclient,
self.services["vpc_offering"]
)
vpc_off.update(self.apiclient, state='Enabled')
vpc = VPC.create(
self.apiclient,
self.services["vpc"],
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
domainid=self.account.domainid,
networkDomain=self.account.domainid
)
self.assertEqual(vpc.distributedvpcrouter, True, "VPC created should have 'distributedvpcrouter' set to True")
try:
vpc.delete(self.apiclient)
except Exception as e:
self.fail("Failed to delete VPC network - %s" % e)
return
示例2: create_vpc
def create_vpc(self, name, cidr):
print name, cidr
try:
vpcOffering = VpcOffering.list(self.apiclient, isdefault=True)
self.assert_(vpcOffering is not None and len(
vpcOffering) > 0, "No VPC offerings found")
self.services["vpc"] = {}
self.services["vpc"]["name"] = name
self.services["vpc"]["displaytext"] = name
self.services["vpc"]["cidr"] = cidr
vpc = VPC.create(
apiclient=self.apiclient,
services=self.services["vpc"],
networkDomain="vpc.internallb",
vpcofferingid=vpcOffering[0].id,
zoneid=self.zone.id,
account=self.account.name,
domainid=self.domain.id
)
self.assertIsNotNone(vpc, "VPC creation failed")
self.logger.debug("Created VPC %s" % vpc.id)
return vpc
except Exception as e:
self.fail("Failed to create VPC: %s due to %s" % (name, e))
示例3: validate_vpc_offering
def validate_vpc_offering(self, vpc_offering):
"""Validates the VPC offering"""
self.debug("Check if the VPC offering is created successfully?")
vpc_offs = VpcOffering.list(
self.apiclient,
id=vpc_offering.id
)
self.assertEqual(
isinstance(vpc_offs, list),
True,
"List VPC offerings should return a valid list"
)
self.assertEqual(
vpc_offering.name,
vpc_offs[0].name,
"Name of the VPC offering should match with listVPCOff data"
)
self.assertEqual(
vpc_offering.name,
vpc_offs[0].name,
"Name of the VPC offering should match with listVPCOff data"
)
self.assertEqual(
vpc_offs[0].supportsregionLevelvpc,True,
"VPC offering is not set up for region level VPC"
)
self.debug(
"VPC offering is created successfully - %s" %
vpc_offering.name)
return
示例4: test_04_vpc_private_gateway_with_invalid_lswitch
def test_04_vpc_private_gateway_with_invalid_lswitch(self):
self.logger.debug('Adding NSX device')
self.add_nicira_device(self.nicira_master_controller)
self.logger.debug('Creating VPC offering')
self.vpc_offering = VpcOffering.create(self.api_client, self.vpc_offering_services)
self.vpc_offering.update(self.api_client, state='Enabled')
self.test_cleanup.append(self.vpc_offering)
self.logger.debug('Creating VPC tier offering')
self.vpc_tier_offering = NetworkOffering.create(self.api_client, self.vpc_tier_offering_services, conservemode=False)
self.vpc_tier_offering.update(self.api_client, state='Enabled')
self.test_cleanup.append(self.vpc_tier_offering)
self.logger.debug('Creating private network offering')
self.private_network_offering = NetworkOffering.create(self.api_client, self.private_network_offering_services)
self.private_network_offering.update(self.api_client, state='Enabled')
self.test_cleanup.append(self.private_network_offering)
allow_all_acl_id = 'bd6d44f8-fc11-11e5-8fe8-5254001daa61'
bad_lswitch = 'lswitch:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
vpc = self.create_vpc()
network = self.create_vpc_tier(vpc)
virtual_machine = self.create_virtual_machine(network)
self.logger.debug('Creating private gateway')
with self.assertRaises(CloudstackAPIException) as cm:
self.create_private_gateway(vpc, "10.0.3.99", "10.0.3.100", allow_all_acl_id, bad_lswitch)
the_exception = cm.exception
the_message_matcher = "^.*Refusing to design this network because the specified lswitch (%s) does not exist.*$" % bad_lswitch
self.assertRegexpMatches(str(the_exception), the_message_matcher)
示例5: setUpClass
def setUpClass(cls):
cls.testClient = super(TestVPC, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.hypervisor = cls.testClient.getHypervisorInfo()
cls.mgtSvrDetails = cls.config.__dict__["mgtSvr"][0].__dict__
cls.unsupportedHypervisor = False
if cls.hypervisor.lower() == 'hyperv':
cls._cleanup = []
cls.unsupportedHypervisor = True
return
cls.services = Services().services
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.template = get_template(
cls.api_client,
cls.zone.id,
cls.services["ostype"]
)
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["template"] = cls.template.id
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.services["service_offering"]
)
cls.vpc_off = VpcOffering.create(
cls.api_client,
cls.services["vpc_offering"]
)
cls.vpc_off.update(cls.api_client, state='Enabled')
cls._cleanup = [
cls.service_offering,
]
return
示例6: setUp
def setUp(self):
self.routers = []
self.networks = []
self.ips = []
self.apiclient = self.testClient.getApiClient()
self.hypervisor = self.testClient.getHypervisorInfo()
self.account = Account.create(
self.apiclient,
self.services["account"],
admin=True,
domainid=self.domain.id)
self.logger.debug("Creating a VPC offering..")
self.vpc_off = VpcOffering.create(
self.apiclient,
self.services["vpc_offering"])
self.logger.debug("Enabling the VPC offering created")
self.vpc_off.update(self.apiclient, state='Enabled')
self.logger.debug("Creating a VPC network in the account: %s" % self.account.name)
self.services["vpc"]["cidr"] = '10.1.1.1/16'
self.vpc = VPC.create(
self.apiclient,
self.services["vpc"],
vpcofferingid=self.vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
domainid=self.account.domainid)
self.cleanup = [self.vpc, self.vpc_off, self.account]
return
示例7: setUpClass
def setUpClass(cls):
cls.testClient = super(TestVPCRoutersBasic, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.hypervisor = cls.testClient.getHypervisorInfo()
cls.vpcSupported = True
cls._cleanup = []
if cls.hypervisor.lower() == 'hyperv':
cls.vpcSupported = False
return
cls.services = Services().services
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.template = get_template(
cls.api_client,
cls.zone.id,
cls.services["ostype"]
)
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["template"] = cls.template.id
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.services["service_offering"]
)
cls.vpc_off = VpcOffering.create(
cls.api_client,
cls.services["vpc_offering"]
)
cls.vpc_off.update(cls.api_client, state='Enabled')
cls.account = Account.create(
cls.api_client,
cls.services["account"],
admin=True,
domainid=cls.domain.id
)
cls._cleanup = [cls.account]
cls._cleanup.append(cls.vpc_off)
#cls.debug("Enabling the VPC offering created")
cls.vpc_off.update(cls.api_client, state='Enabled')
# cls.debug("creating a VPC network in the account: %s" %
# cls.account.name)
cls.services["vpc"]["cidr"] = '10.1.1.1/16'
cls.vpc = VPC.create(
cls.api_client,
cls.services["vpc"],
vpcofferingid=cls.vpc_off.id,
zoneid=cls.zone.id,
account=cls.account.name,
domainid=cls.account.domainid
)
cls._cleanup.append(cls.service_offering)
return
示例8: test_vpcnetwork_nuage
def test_vpcnetwork_nuage(self):
"""Test network VPC for Nuage"""
# 1) Create VPC with Nuage VPC offering
vpcOffering = VpcOffering.list(self.apiclient,name="Nuage VSP VPC offering")
self.assert_(vpcOffering is not None and len(vpcOffering)>0, "Nuage VPC offering not found")
vpc = VPC.create(
apiclient=self.apiclient,
services=self.services["vpc"],
networkDomain="vpc.networkacl",
vpcofferingid=vpcOffering[0].id,
zoneid=self.zone.id,
account=self.account.name,
domainid=self.account.domainid
)
self.assert_(vpc is not None, "VPC creation failed")
# 2) Create ACL
aclgroup = NetworkACLList.create(apiclient=self.apiclient, services={}, name="acl", description="acl", vpcid=vpc.id)
self.assertIsNotNone(aclgroup, "Failed to create NetworkACL list")
self.debug("Created a network ACL list %s" % aclgroup.name)
# 3) Create ACL Item
aclitem = NetworkACL.create(apiclient=self.apiclient, services={},
protocol="TCP", number="10", action="Deny", aclid=aclgroup.id, cidrlist=["0.0.0.0/0"])
self.assertIsNotNone(aclitem, "Network failed to aclItem")
self.debug("Added a network ACL %s to ACL list %s" % (aclitem.id, aclgroup.name))
# 4) Create network with ACL
nwNuage = Network.create(
self.apiclient,
self.services["vpcnetwork"],
accountid=self.account.name,
domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id,
vpcid=vpc.id,
aclid=aclgroup.id,
gateway='10.1.0.1'
)
self.debug("Network %s created in VPC %s" %(nwNuage.id, vpc.id))
# 5) Deploy a vm
vm = VirtualMachine.create(
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(nwNuage.id)]
)
self.assert_(vm is not None, "VM failed to deploy")
self.assert_(vm.state == 'Running', "VM is not running")
self.debug("VM %s deployed in VPC %s" %(vm.id, vpc.id))
示例9: create_VpcOffering
def create_VpcOffering(cls, vpc_offering, suffix=None):
cls.debug("Creating VPC offering")
if suffix:
vpc_offering["name"] = "VPC_OFF-" + str(suffix)
vpc_off = VpcOffering.create(cls.api_client,
vpc_offering
)
# Enable VPC offering
vpc_off.update(cls.api_client, state="Enabled")
cls.debug("Created and Enabled VPC offering")
return vpc_off
示例10: create_VpcOffering
def create_VpcOffering(self, vpc_offering, suffix=None):
self.debug("Creating VPC offering")
if suffix:
vpc_offering["name"] = "VPC_OFF-" + str(suffix)
vpc_off = VpcOffering.create(self.api_client,
vpc_offering
)
# Enable VPC offering
vpc_off.update(self.api_client, state="Enabled")
self.cleanup.append(vpc_off)
self.debug("Created and Enabled VPC offering")
return vpc_off
示例11: test_02_internallb_roundrobin_1RVPC_3VM_HTTP_port80
def test_02_internallb_roundrobin_1RVPC_3VM_HTTP_port80(self):
"""
Test create, assign, remove of an Internal LB with roundrobin http traffic to 3 vm's in a Redundant VPC
"""
self.logger.debug("Starting test_02_internallb_roundrobin_1RVPC_3VM_HTTP_port80")
self.logger.debug("Creating a Redundant VPC offering..")
redundant_vpc_offering = VpcOffering.create(self.apiclient, self.services["redundant_vpc_offering"])
self.logger.debug("Enabling the Redundant VPC offering created")
redundant_vpc_offering.update(self.apiclient, state="Enabled")
self.cleanup.insert(0, redundant_vpc_offering)
self.execute_internallb_roundrobin_tests(redundant_vpc_offering)
示例12: _create_vpc_offering
def _create_vpc_offering(self, offering_name):
vpc_off = None
if offering_name is not None:
self.logger.debug("Creating VPC offering: %s", offering_name)
vpc_off = VpcOffering.create(
self.apiclient,
self.services[offering_name]
)
self._validate_vpc_offering(vpc_off)
return vpc_off
示例13: test_01_create_vpc_offering_with_distributedrouter_service_capability
def test_01_create_vpc_offering_with_distributedrouter_service_capability(self):
""" Test create VPC offering
"""
# Steps for validation
# 1. Create VPC Offering by specifying all supported Services
# 2. VPC offering should be created successfully.
self.debug("Creating inter VPC offering")
vpc_off = VpcOffering.create(self.apiclient, self.services["vpc_offering"])
self.debug("Check if the VPC offering is created successfully?")
self.cleanup.append(vpc_off)
self.validate_vpc_offering(vpc_off)
return
示例14: setUpClass
def setUpClass(cls):
try:
cls._cleanup = []
cls.testClient = super(TestPortForwardingRules, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = cls.testClient.getParsedTestDataConfig()
cls.hypervisor = cls.testClient.getHypervisorInfo()
# Get Domain, Zone, Template
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(
cls.api_client,
cls.testClient.getZoneForTests())
cls.template = get_template(
cls.api_client,
cls.zone.id,
cls.services["ostype"]
)
if cls.zone.localstorageenabled:
cls.storagetype = 'local'
cls.services["service_offerings"][
"tiny"]["storagetype"] = 'local'
else:
cls.storagetype = 'shared'
cls.services["service_offerings"][
"tiny"]["storagetype"] = 'shared'
cls.services['mode'] = cls.zone.networktype
cls.services["virtual_machine"][
"hypervisor"] = cls.hypervisor
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["template"] = cls.template.id
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.services["service_offerings"]["tiny"]
)
cls._cleanup.append(cls.service_offering)
cls.services['mode'] = cls.zone.networktype
cls.vpc_offering = VpcOffering.create(cls.api_client,
cls.services["vpc_offering"]
)
cls.vpc_offering.update(cls.api_client, state='Enabled')
cls._cleanup.append(cls.vpc_offering)
except Exception as e:
cls.tearDownClass()
raise Exception("Warning: Exception in setup : %s" % e)
return
示例15: test_04_rvpc_internallb_haproxy_stats_on_all_interfaces
def test_04_rvpc_internallb_haproxy_stats_on_all_interfaces(self):
""" Test to verify access to loadbalancer haproxy admin stats page
when global setting network.loadbalancer.haproxy.stats.visibility is set to 'all'
with credentials from global setting network.loadbalancer.haproxy.stats.auth
using the uri from global setting network.loadbalancer.haproxy.stats.uri.
It uses a Redundant Routers VPC
"""
self.logger.debug("Starting test_04_rvpc_internallb_haproxy_stats_on_all_interfaces")
self.logger.debug("Creating a Redundant VPC offering..")
redundant_vpc_offering = VpcOffering.create(self.apiclient, self.services["redundant_vpc_offering"])
self.logger.debug("Enabling the Redundant VPC offering created")
redundant_vpc_offering.update(self.apiclient, state="Enabled")
self.execute_internallb_haproxy_tests(redundant_vpc_offering)