本文整理汇总了Python中marvin.lib.base.NetworkOffering类的典型用法代码示例。如果您正苦于以下问题:Python NetworkOffering类的具体用法?Python NetworkOffering怎么用?Python NetworkOffering使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NetworkOffering类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: 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)
开发者ID:EdwardBetts,项目名称:blackhole,代码行数:33,代码来源:test_nicira.py
示例2: createEnabledNetworkOffering
def createEnabledNetworkOffering(apiclient, networkServices):
"""Create and enable network offering according to the type
@output: List, containing [ Result,Network Offering,Reason ]
Ist Argument('Result') : FAIL : If exception or assertion error occurs
PASS : If network offering
is created and enabled successfully
IInd Argument(Net Off) : Enabled network offering
In case of exception or
assertion error, it will be None
IIIrd Argument(Reason) : Reason for failure,
default to None
"""
try:
resultSet = [FAIL, None, None]
# Create network offering
network_offering = NetworkOffering.create(apiclient, networkServices, conservemode=False)
# Update network offering state from disabled to enabled.
NetworkOffering.update(network_offering, apiclient, id=network_offering.id,
state="enabled")
except Exception as e:
resultSet[2] = e
return resultSet
return [PASS, network_offering, None]
开发者ID:aali-dincloud,项目名称:cloudstack,代码行数:25,代码来源:common.py
示例3: create_network
def create_network(self, net_offerring, vpc_id, gateway='10.1.1.1'):
try:
self.logger.debug('Create NetworkOffering')
net_offerring["name"] = "NET_OFF-" + str(gateway)
nw_off = NetworkOffering.create(
self.apiclient,
net_offerring,
conservemode=False)
nw_off.update(self.apiclient, state='Enabled')
self.logger.debug('Created and Enabled NetworkOffering')
self.services["network"]["name"] = "NETWORK-" + str(gateway)
self.logger.debug('Adding Network=%s to VPC ID %s' % (self.services["network"], vpc_id))
obj_network = Network.create(
self.apiclient,
self.services["network"],
accountid=self.account.name,
domainid=self.account.domainid,
networkofferingid=nw_off.id,
zoneid=self.zone.id,
gateway=gateway,
vpcid=vpc_id)
self.logger.debug("Created network with ID: %s" % obj_network.id)
except Exception, e:
raise Exception('Unable to create a Network with offering=%s because of %s ' % (net_offerring, e))
开发者ID:PCextreme,项目名称:cloudstack,代码行数:27,代码来源:test_routers_iptables_default_policy.py
示例4: create_network
def create_network(self, net_offerring, gateway='10.1.1.1',vpc=None):
try:
self.debug('Create NetworkOffering')
net_offerring["name"] = "NET_OFF-" + str(gateway)
nw_off = NetworkOffering.create(self.apiclient,
net_offerring,
conservemode=False
)
# Enable Network offering
nw_off.update(self.apiclient, state='Enabled')
self._cleanup.append(nw_off)
self.debug('Created and Enabled NetworkOffering')
self.services["network"]["name"] = "NETWORK-" + str(gateway)
self.debug('Adding Network=%s' % self.services["network"])
obj_network = Network.create(self.apiclient,
self.services["network"],
accountid=self.account.name,
domainid=self.account.domainid,
networkofferingid=nw_off.id,
zoneid=self.zone.id,
gateway=gateway,
vpcid=vpc.id if vpc else self.vpc.id
)
self.debug("Created network with ID: %s" % obj_network.id)
return obj_network
except Exception, e:
self.fail('Unable to create a Network with offering=%s because of %s ' % (net_offerring, e))
开发者ID:abnercosta,项目名称:cloudstack,代码行数:28,代码来源:test_vpc_network_pfrules.py
示例5: setUpClass
def setUpClass(cls):
cls.testClient = super(TestRedundantIsolateNetworks, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = cls.testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services["mode"] = cls.zone.networktype
cls.template = get_template(cls.api_client, cls.zone.id, cls.services["ostype"])
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
# Create an account, network, VM and IP addresses
cls.account = Account.create(cls.api_client, cls.services["account"], admin=True, domainid=cls.domain.id)
cls.service_offering = ServiceOffering.create(cls.api_client, cls.services["service_offering"])
cls.services["nw_off_persistent_RVR"]["egress_policy"] = "true"
cls.network_offering = NetworkOffering.create(
cls.api_client, cls.services["nw_off_persistent_RVR"], conservemode=True
)
cls.network_offering.update(cls.api_client, state="Enabled")
cls._cleanup = [cls.service_offering, cls.network_offering]
cls.logger = logging.getLogger("TestRedundantIsolateNetworks")
cls.stream_handler = logging.StreamHandler()
cls.logger.setLevel(logging.DEBUG)
cls.logger.addHandler(cls.stream_handler)
return
开发者ID:jannyg,项目名称:cloudstack,代码行数:32,代码来源:test_routers_network_ops.py
示例6: setUpClass
def setUpClass(cls):
cls.testClient = super(TestMaxProjectNetworks, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.domain = get_domain(cls.api_client)
cls.services['mode'] = cls.zone.networktype
cls.template = get_template(
cls.api_client,
cls.zone.id,
cls.services["ostype"]
)
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.services["service_offering"]
)
cls.network_offering = NetworkOffering.create(
cls.api_client,
cls.services["network_offering"],
conservemode=True
)
# Enable Network offering
cls.network_offering.update(cls.api_client, state='Enabled')
cls._cleanup = [
cls.service_offering,
cls.network_offering
]
return
开发者ID:diejiazhao,项目名称:cloudstack,代码行数:30,代码来源:test_project_limits.py
示例7: create_network
def create_network(self, net_offerring, gateway='10.1.1.1', vpc=None, nr_vms=2, mark_net_cleanup=True):
if not nr_vms or nr_vms <= 0:
self.fail("At least 1 VM has to be created. You informed nr_vms < 1")
try:
self.logger.debug('Create NetworkOffering')
net_offerring["name"] = "NET_OFF-" + str(gateway)
nw_off = NetworkOffering.create(
self.apiclient,
net_offerring,
conservemode=False)
nw_off.update(self.apiclient, state='Enabled')
self.logger.debug('Created and Enabled NetworkOffering')
self.services["network"]["name"] = "NETWORK-" + str(gateway)
self.logger.debug('Adding Network=%s' % self.services["network"])
obj_network = Network.create(
self.apiclient,
self.services["network"],
accountid=self.account.name,
domainid=self.account.domainid,
networkofferingid=nw_off.id,
zoneid=self.zone.id,
gateway=gateway,
vpcid=vpc.id if vpc else self.vpc.id
)
self.logger.debug("Created network with ID: %s" % obj_network.id)
except Exception, e:
self.fail('Unable to create a Network with offering=%s because of %s ' % (net_offerring, e))
开发者ID:EdwardBetts,项目名称:blackhole,代码行数:31,代码来源:test_vpc_redundant.py
示例8: setUpClass
def setUpClass(cls):
testClient = super(TestIsolatedNetworkInvalidGw, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
cls.services = testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
cls.domain = get_domain(cls.apiclient)
cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
# Create Accounts
cls.account = Account.create(
cls.apiclient,
cls.services["account"],
admin=True,
domainid=cls.domain.id
)
cls.services["network"]["zoneid"] = cls.zone.id
cls.network_offering = NetworkOffering.create(
cls.apiclient,
cls.services["network_offering"],
)
# Enable Network offering
cls.network_offering.update(cls.apiclient, state='Enabled')
cls.services["network"]["networkoffering"] = cls.network_offering.id
cls._cleanup = [
cls.account,
cls.network_offering
]
return
开发者ID:Accelerite,项目名称:cloudstack,代码行数:32,代码来源:test_invalid_gw_nm.py
示例9: setUpClass
def setUpClass(cls):
cls.testClient = super(TestRedundantRouterNetworkCleanups, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
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.network_offering = NetworkOffering.create(
cls.api_client,
cls.services["network_offering"],
conservemode=True
)
# Enable Network offering
cls.network_offering.update(cls.api_client, state='Enabled')
cls._cleanup = [
cls.service_offering,
cls.network_offering,
]
return
开发者ID:Accelerite,项目名称:cloudstack,代码行数:33,代码来源:test_redundant_router_cleanups.py
示例10: create_NetworkOffering
def create_NetworkOffering(self, net_offering, suffix=None, conserve_mode=False):
self.debug("Creating Network offering")
if suffix:
net_offering["name"] = "NET_OFF-" + str(suffix)
nw_off = NetworkOffering.create(self.api_client,
net_offering,
conservemode=conserve_mode
)
# Enable Network offering
nw_off.update(self.api_client, state="Enabled")
self.cleanup.append(nw_off)
self.debug("Created and Enabled Network offering")
return nw_off
开发者ID:CIETstudents,项目名称:cloudstack,代码行数:13,代码来源:nuageTestCase.py
示例11: test_04_network_without_domain_CS19303
def test_04_network_without_domain_CS19303(self):
"""
@Desc: Errors editing a network without a network domain specified
@Steps:
Step1: Create a network offering with SourceNAT,staticNAT and dhcp services
Step2: Verify the network offering creation
Step3: Create an isolated network with the offering created in step1 and without a network domain specified
Step4: Verify the network creation
Step5: Edit the network and verify that updating network should not error out
"""
self.debug(
"Creating n/w offering with SourceNat,StaticNat and DHCP services in VR & conserve mode:off"
)
self.network_offering = NetworkOffering.create(
self.api_client,
self.services["network_offering_withoutDNS"],
conservemode=False
)
self.assertIsNotNone(
self.network_offering,
"Failed to create NO with Sourcenat,staticnat and dhcp only services"
)
self.cleanup.append(self.network_offering)
self.debug("Created n/w offering with ID: %s" % self.network_offering.id)
# Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled')
self.debug("Creating nw without dns service using no id: %s" % self.network_offering.id)
self.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.assertIsNotNone(
self.network,
"Failed to create network without DNS service and network domain"
)
self.debug("Created network with NO: %s" % self.network_offering.id)
try:
self.network_update = self.network.update(
self.apiclient,
name="NW without nw domain"
)
self.debug("Success:Network update has been successful without network domain")
except Exception as e:
self.fail("Error editing a network without network domain specified: %s" % e)
return
开发者ID:miguelaferreira,项目名称:cosmic-core,代码行数:49,代码来源:test_network_offering.py
示例12: setUpClass
def setUpClass(cls):
cls.testClient = super(TestDeployVmWithUserDataMultiNic, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.test_data = cls.testClient.getParsedTestDataConfig()
# 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.test_data["ostype"])
if cls.zone.localstorageenabled:
cls.storagetype = "local"
cls.test_data["service_offerings"]["tiny"]["storagetype"] = "local"
else:
cls.storagetype = "shared"
cls.test_data["service_offerings"]["tiny"]["storagetype"] = "shared"
cls.service_offering = ServiceOffering.create(cls.api_client, cls.test_data["service_offerings"]["tiny"])
# Create Network offering without userdata
cls.network_offering_nouserdata = NetworkOffering.create(cls.api_client, cls.test_data["network_offering"])
# Enable Network offering
cls.network_offering_nouserdata.update(cls.api_client, state="Enabled")
# Create Network Offering with all the serices
cls.network_offering_all = NetworkOffering.create(cls.api_client, cls.test_data["isolated_network_offering"])
# Enable Network offering
cls.network_offering_all.update(cls.api_client, state="Enabled")
cls._cleanup = [cls.service_offering, cls.network_offering_nouserdata, cls.network_offering_all]
# Generate userdata of 2500 bytes. This is larger than the 2048 bytes limit.
# CS however allows for upto 4K bytes in the code. So this must succeed.
# Overall, the query length must not exceed 4K, for then the json decoder
# will fail this operation at the marvin client side itcls.
cls.userdata = "".join(random.choice(string.ascii_uppercase + string.digits) for x in range(2500))
开发者ID:bheuvel,项目名称:cloudstack,代码行数:36,代码来源:test_deploy_vm_userdata_multi_nic.py
示例13: setUpClass
def setUpClass(cls):
cls.apiclient = super(
TestASASetup,
cls
).getClsTestClient().getApiClient()
cls.services = Services().services
cls.network_offering = NetworkOffering.create(
cls.apiclient,
cls.services["network_offering"],
conservemode=True)
# Enable network offering
cls.network_offering.update(cls.apiclient, state='Enabled')
cls._cleanup = [
cls.network_offering,
]
return
开发者ID:Accelerite,项目名称:cloudstack,代码行数:17,代码来源:test_asa1000v_fw.py
示例14: validate_NetworkOffering
def validate_NetworkOffering(self, net_offering, state=None):
"""Validates the Network offering"""
self.debug("Check if the Network offering is created successfully ?")
net_offs = NetworkOffering.list(self.api_client,
id=net_offering.id
)
self.assertEqual(isinstance(net_offs, list), True,
"List Network offering should return a valid list"
)
self.assertEqual(net_offering.name, net_offs[0].name,
"Name of the Network offering should match with the returned list data"
)
if state:
self.assertEqual(net_offs[0].state, state,
"Network offering state should be in state - %s" % state
)
self.debug("Network offering creation successfully validated for %s" % net_offering.name)
开发者ID:CIETstudents,项目名称:cloudstack,代码行数:17,代码来源:nuageTestCase.py
示例15: setUpClass
def setUpClass(cls):
cls.testClient = super(TestAdapterTypeForNic, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.testdata = cls.testClient.getParsedTestDataConfig()
cls.hypervisor = get_hypervisor_type(cls.api_client)
# 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.testdata["ostype"])
# Create Accounts & networks
cls.testdata["isolated_network"]["zoneid"] = cls.zone.id
cls._cleanup = []
cls.account = Account.create(
cls.api_client,
cls.testdata["account"],
domainid=cls.domain.id)
cls._cleanup.append(cls.account)
cls.userapiclient = cls.testClient.getUserApiClient(
UserName=cls.account.name,
DomainName=cls.account.domain
)
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.testdata["service_offering"])
cls._cleanup.append(cls.service_offering)
# Create Shared Network Offering
cls.isolated_network_offering = NetworkOffering.create(
cls.api_client,
cls.testdata["isolated_network_offering"])
cls._cleanup.append(cls.isolated_network_offering)
# Enable Isolated Network offering
cls.isolated_network_offering.update(cls.api_client, state='Enabled')
return
开发者ID:EdwardBetts,项目名称:blackhole,代码行数:45,代码来源:test_nic_adapter_type.py
示例16: setUpClass
def setUpClass(cls):
cls.logger = logging.getLogger('TestVPCSite2SiteVPN')
cls.stream_handler = logging.StreamHandler()
cls.logger.setLevel(logging.DEBUG)
cls.logger.addHandler(cls.stream_handler)
testClient = super(TestVpcSite2SiteVpn, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
cls.services = Services().services
cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
cls.domain = get_domain(cls.apiclient)
cls.compute_offering = ServiceOffering.create(
cls.apiclient,
cls.services["compute_offering"]
)
cls.account = Account.create(
cls.apiclient, services=cls.services["account"])
cls.hypervisor = testClient.getHypervisorInfo()
cls.logger.debug("Downloading Template: %s from: %s" % (cls.services["template"][
cls.hypervisor.lower()], cls.services["template"][cls.hypervisor.lower()]["url"]))
cls.template = Template.register(cls.apiclient, cls.services["template"][cls.hypervisor.lower(
)], cls.zone.id, hypervisor=cls.hypervisor.lower(), account=cls.account.name, domainid=cls.domain.id)
cls.template.download(cls.apiclient)
if cls.template == FAILED:
assert False, "get_template() failed to return template"
cls.logger.debug("Successfully created account: %s, id: \
%s" % (cls.account.name,
cls.account.id))
cls.networkoffering = NetworkOffering.list(
cls.apiclient, name="DefaultIsolatedNetworkOfferingForVpcNetworks")
assert cls.networkoffering is not None and len(
cls.networkoffering) > 0, "No VPC based network offering"
cls._cleanup = [cls.template, cls.account, cls.compute_offering]
return
开发者ID:EdwardBetts,项目名称:blackhole,代码行数:43,代码来源:test_vpc_vpn.py
示例17: create_network_offering
def create_network_offering(self, egress_policy=True, RR=False):
if egress_policy:
self.services["network_offering"]["egress_policy"] = "true"
else:
self.services["network_offering"]["egress_policy"] = "false"
if RR:
self.debug("Redundant Router Enabled")
self.services["network_offering"]["serviceCapabilityList"]["SourceNat"]["RedundantRouter"] = "true"
self.network_offering = NetworkOffering.create(self.apiclient,
self.services["network_offering"],
conservemode=True)
# Cleanup
self.cleanup.append(self.network_offering)
# Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled')
开发者ID:MANIKANDANVEN,项目名称:cloudstack,代码行数:19,代码来源:test_egress_fw_rules.py
示例18: validate_NetworkOffering
def validate_NetworkOffering(self, net_offering, state=None):
"""Validates the Network offering"""
self.debug("Validating the creation and state of Network offering - %s"
% net_offering.name)
net_offs = NetworkOffering.list(self.api_client,
id=net_offering.id
)
self.assertEqual(isinstance(net_offs, list), True,
"List Network offering should return a valid list"
)
self.assertEqual(net_offering.name, net_offs[0].name,
"Name of the Network offering should match with the "
"returned list data"
)
if state:
self.assertEqual(net_offs[0].state, state,
"Network offering state should be '%s'" % state
)
self.debug("Successfully validated the creation and state of Network "
"offering - %s" % net_offering.name)
开发者ID:prashanthvarma,项目名称:cloudstack,代码行数:20,代码来源:nuageTestCase.py
示例19: setUpClass
def setUpClass(cls):
testClient = super(TestL2Networks, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
cls.services = testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
cls.domain = get_domain(cls.apiclient)
cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
cls.hypervisor = testClient.getHypervisorInfo()
cls.services['mode'] = cls.zone.networktype
# Create Accounts & networks
cls.account = Account.create(
cls.apiclient,
cls.services["account"],
admin=True,
domainid=cls.domain.id
)
cls.template = get_test_template(
cls.apiclient,
cls.zone.id,
cls.hypervisor
)
cls.service_offering = ServiceOffering.create(
cls.apiclient,
cls.services["service_offerings"]["tiny"]
)
cls.services["network"]["zoneid"] = cls.zone.id
cls.network_offering = NetworkOffering.create(
cls.apiclient,
cls.services["l2-network_offering"],
)
# Enable Network offering
cls.network_offering.update(cls.apiclient, state='Enabled')
cls._cleanup = [
cls.account,
cls.network_offering,
cls.service_offering
]
return
开发者ID:PCextreme,项目名称:cloudstack,代码行数:41,代码来源:test_network.py
示例20: create_and_enable_network_serviceoffering
def create_and_enable_network_serviceoffering(self, services):
try:
# Create offering
offering = NetworkOffering.create(
self.apiclient, services, conservemode=False)
self.assertIsNotNone(offering, "Failed to create network offering")
self.logger.debug("Created network offering: %s" % offering.id)
if offering:
# Enable offeringq
offering.update(self.apiclient, state="Enabled")
self.assertEqual(self.get_networkoffering_state(
offering), "Enabled", "Failed to enable network offering")
self.logger.debug("Enabled network offering: %s" % offering.id)
return offering
except Exception as e:
self.fail("Failed to create and enable network offering: %s because of %s" % (
offering_name, e))
开发者ID:dxia88,项目名称:cloudstack,代码行数:22,代码来源:test_internal_lb.py
注:本文中的marvin.lib.base.NetworkOffering类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论