当前位置: 首页>>代码示例>>Python>>正文


Python VPC.create方法代码示例

本文整理汇总了Python中marvin.lib.base.VPC.create方法的典型用法代码示例。如果您正苦于以下问题:Python VPC.create方法的具体用法?Python VPC.create怎么用?Python VPC.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在marvin.lib.base.VPC的用法示例。


在下文中一共展示了VPC.create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_02_create_vpc_from_offering_with_regionlevelvpc_service_capability

# 需要导入模块: from marvin.lib.base import VPC [as 别名]
# 或者: from marvin.lib.base.VPC import create [as 别名]
    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
开发者ID:Accelerite,项目名称:cloudstack,代码行数:35,代码来源:test_region_vpc.py

示例2: create_vpc

# 需要导入模块: from marvin.lib.base import VPC [as 别名]
# 或者: from marvin.lib.base.VPC import create [as 别名]
    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))
开发者ID:dxia88,项目名称:cloudstack,代码行数:29,代码来源:test_internal_lb.py

示例3: setUp

# 需要导入模块: from marvin.lib.base import VPC [as 别名]
# 或者: from marvin.lib.base.VPC import create [as 别名]
    def setUp(self):
        self.routers = []
        self.networks = []
        self.ips = []
        self.apiclient = self.testClient.getApiClient()
        self.account = Account.create(
            self.apiclient,
            self.services["account"],
            admin=True,
            domainid=self.domain.id)

        self.vpc_off = get_default_vpc_offering(self.apiclient)

        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.account]
        return
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:27,代码来源:test_vpc_router_nics.py

示例4: setUp

# 需要导入模块: from marvin.lib.base import VPC [as 别名]
# 或者: from marvin.lib.base.VPC import create [as 别名]
    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
开发者ID:EdwardBetts,项目名称:blackhole,代码行数:36,代码来源:test_vpc_redundant.py

示例5: setUpClass

# 需要导入模块: from marvin.lib.base import VPC [as 别名]
# 或者: from marvin.lib.base.VPC import create [as 别名]
    def setUpClass(cls):
        cls.logger = MarvinLog(MarvinLog.LOGGER_TEST).get_logger()

        # We want to fail quicker if it's failure
        socket.setdefaulttimeout(60)

        cls.testClient = super(TestRouterIpTablesPolicies, cls).getClsTestClient()
        cls.apiclient = cls.testClient.getApiClient()

        cls.services = cls.testClient.getParsedTestDataConfig()
        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.apiclient)
        cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
        cls.template = get_template(
            cls.apiclient,
            cls.zone.id
        )
        cls.services["vpc"]["cidr"] = '10.1.1.1/16'
        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
        cls.services["virtual_machine"]["template"] = cls.template.id
        cls.vpc_offering = get_default_vpc_offering(cls.apiclient)
        cls.logger.debug("VPC Offering '%s' selected", cls.vpc_offering.name)

        cls.network_offering = get_default_network_offering(cls.apiclient)
        cls.logger.debug("Network Offering '%s' selected", cls.network_offering.name)

        cls.default_allow_acl = get_network_acl(cls.apiclient, 'default_allow')
        cls.logger.debug("ACL '%s' selected", cls.default_allow_acl.name)

        cls.account = Account.create(
            cls.apiclient,
            cls.services["account"],
            admin=True,
            domainid=cls.domain.id)
        cls.vpc1 = VPC.create(cls.apiclient,
                               cls.services['vpcs']['vpc1'],
                               vpcofferingid=cls.vpc_offering.id,
                               zoneid=cls.zone.id,
                               domainid=cls.domain.id,
                               account=cls.account.name)
        cls.logger.debug("VPC '%s' created, CIDR: %s", cls.vpc1.name, cls.vpc1.cidr)

        cls.network1 = Network.create(cls.apiclient,
                                       cls.services['networks']['network1'],
                                       networkofferingid=cls.network_offering.id,
                                       aclid=cls.default_allow_acl.id,
                                       vpcid=cls.vpc1.id,
                                       zoneid=cls.zone.id,
                                       domainid=cls.domain.id,
                                       accountid=cls.account.name)
        cls.logger.debug("Network '%s' created, CIDR: %s, Gateway: %s", cls.network1.name, cls.network1.cidr, cls.network1.gateway)

        cls.service_offering = get_default_virtual_machine_offering(cls.apiclient)

        cls.entity_manager = EntityManager(cls.apiclient, cls.services, cls.service_offering, cls.account, cls.zone, cls.network1, cls.logger)

        cls._cleanup = [cls.account]
        return
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:60,代码来源:test_router_ip_tables_policies.py

示例6: setUpClass

# 需要导入模块: from marvin.lib.base import VPC [as 别名]
# 或者: from marvin.lib.base.VPC import create [as 别名]
    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
开发者ID:Accelerite,项目名称:cloudstack,代码行数:57,代码来源:test_vpc_routers.py

示例7: test_vpcnetwork_nuage

# 需要导入模块: from marvin.lib.base import VPC [as 别名]
# 或者: from marvin.lib.base.VPC import create [as 别名]
    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))
开发者ID:DiegoSanjuan,项目名称:cloudstack,代码行数:56,代码来源:test_vpcnetwork_nuage.py

示例8: setUp

# 需要导入模块: from marvin.lib.base import VPC [as 别名]
# 或者: from marvin.lib.base.VPC import create [as 别名]
    def setUp(self):
        self.vpc_off = get_default_vpc_offering(self.apiclient)

        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.entity_manager.set_cleanup(self.cleanup)
        return
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:16,代码来源:test_vpc_ip_tables_policies.py

示例9: create_Vpc

# 需要导入模块: from marvin.lib.base import VPC [as 别名]
# 或者: from marvin.lib.base.VPC import create [as 别名]
 def create_Vpc(self, vpc_offering, cidr='10.1.1.1/16', cleanup=True):
     self.debug("Creating a VPC network in the account: %s" % self.account.name)
     self.test_data["vpc"]["cidr"] = cidr
     vpc = VPC.create(
         self.api_client,
         self.test_data["vpc"],
         vpcofferingid=vpc_offering.id,
         zoneid=self.zone.id,
         account=self.account.name,
         domainid=self.account.domainid
     )
     self.debug("Created VPC with ID: %s" % vpc.id)
     if cleanup:
         self.cleanup.append(vpc)
     return vpc
开发者ID:DKrul,项目名称:cloudstack,代码行数:17,代码来源:nuageTestCase.py

示例10: create_Vpc

# 需要导入模块: from marvin.lib.base import VPC [as 别名]
# 或者: from marvin.lib.base.VPC import create [as 别名]
 def create_Vpc(self, vpc_offering, cidr="10.1.1.1/16", cleanup=True):
     self.debug("Creating a VPC in the account - %s" % self.account.name)
     self.test_data["vpc"]["name"] = "TestVPC"
     self.test_data["vpc"]["displaytext"] = "TestVPC"
     self.test_data["vpc"]["cidr"] = cidr
     vpc = VPC.create(self.api_client,
                      self.test_data["vpc"],
                      vpcofferingid=vpc_offering.id,
                      zoneid=self.zone.id,
                      account=self.account.name,
                      domainid=self.account.domainid
                      )
     self.debug("Created VPC with ID - %s" % vpc.id)
     if cleanup:
         self.cleanup.append(vpc)
     return vpc
开发者ID:CIETstudents,项目名称:cloudstack,代码行数:18,代码来源:nuageTestCase.py

示例11: createVPC

# 需要导入模块: from marvin.lib.base import VPC [as 别名]
# 或者: from marvin.lib.base.VPC import create [as 别名]
    def createVPC(self, vpc_offering, cidr='10.1.1.1/16'):
        try:
            self.logger.debug("Creating a VPC in the account: %s" % self.account.name)
            self.services["vpc"]["cidr"] = cidr

            vpc = VPC.create(
                self.apiclient,
                self.services["vpc"],
                vpcofferingid=vpc_offering.id,
                zoneid=self.zone.id,
                account=self.account.name,
                domainid=self.account.domainid)

            self.logger.debug("Created VPC with ID: %s" % vpc.id)
        except Exception, e:
            self.fail('Unable to create VPC due to %s ' % e)
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:18,代码来源:test_password_server.py

示例12: deploy_vpc

# 需要导入模块: from marvin.lib.base import VPC [as 别名]
# 或者: from marvin.lib.base.VPC import create [as 别名]
    def deploy_vpc(self, vpc_data, account):
        self.logger.debug('>>>  VPC  =>  Creating "%s"...', vpc_data['name'])
        vpc = VPC.create(
            api_client=self.api_client,
            data=vpc_data,
            zone=self.zone,
            account=account,
            randomizeID=self.randomizeNames
        )
        self.dynamic_names['vpcs'][vpc_data['name']] = vpc.name

        self.logger.debug('>>>  VPC  =>  ID: %s  =>  Name: %s  =>  CIDR: %s  =>  State: %s  =>  Offering: %s  '
                          '=>  Account: %s  =>  Domain: %s', vpc.id, vpc.name, vpc.cidr, vpc.state, vpc.vpcofferingid,
                          vpc.account, vpc.domainid)

        self.deploy_acls(vpc_data['acls'], vpc)
        self.deploy_networks(vpc_data['networks'], vpc)
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:19,代码来源:testScenarioManager.py

示例13: test_02_create_vpc_wait_gc

# 需要导入模块: from marvin.lib.base import VPC [as 别名]
# 或者: from marvin.lib.base.VPC import create [as 别名]
    def test_02_create_vpc_wait_gc(self):
        """ Test VPC when host is in maintenance mode and wait till nw gc
        """

        # Validate the following
        # 1. Put the host in maintenance mode.
        # 2. Attempt to Create a VPC with cidr - 10.1.1.1/16
        # 3. Wait for the VPC GC thread to run.
        # 3. VPC will be created but will be in "Disabled" state and should
        #    get deleted

        self.debug("creating a VPC network in the account: %s" %
                   self.account.name)
        self.services["vpc"]["cidr"] = '10.1.1.1/16'
        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,
            start=False
        )
        self.validate_vpc_network(vpc, state='inactive')
        interval = list_configurations(
            self.apiclient,
            name='network.gc.interval'
        )
        wait = list_configurations(
            self.apiclient,
            name='network.gc.wait'
        )
        self.debug("Sleep till network gc thread runs..")
        # Sleep to ensure that all resources are deleted
        time.sleep(int(interval[0].value) + int(wait[0].value))
        vpcs = VPC.list(
            self.apiclient,
            id=vpc.id,
            listall=True
        )
        self.assertEqual(
            vpcs,
            None,
            "List VPC should not return anything after network gc"
        )
        return
开发者ID:K0zka,项目名称:cloudstack,代码行数:48,代码来源:test_vpc_on_host_maintenance.py

示例14: setUp

# 需要导入模块: from marvin.lib.base import VPC [as 别名]
# 或者: from marvin.lib.base.VPC import create [as 别名]
    def setUp(self):
        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.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,
        )

        return
开发者ID:radu-stefanache,项目名称:cloudstack,代码行数:21,代码来源:test_routers_iptables_default_policy.py

示例15: create_Vpc

# 需要导入模块: from marvin.lib.base import VPC [as 别名]
# 或者: from marvin.lib.base.VPC import create [as 别名]
 def create_Vpc(cls, vpc_offering, cidr='10.1.0.0/16', testdata=None,
                account=None, networkDomain=None):
     if not account:
         account = cls.account
     cls.debug("Creating a VPC in the account - %s" % account.name)
     if not testdata:
         testdata = cls.test_data["vpc"]
         testdata["name"] = "TestVPC-" + cidr + "-" + str(vpc_offering.name)
         testdata["displaytext"] = "Test VPC"
         testdata["cidr"] = cidr
     vpc = VPC.create(cls.api_client,
                      testdata,
                      vpcofferingid=vpc_offering.id,
                      zoneid=cls.zone.id,
                      account=account.name,
                      domainid=account.domainid,
                      networkDomain=networkDomain
                      )
     cls.debug("Created VPC with ID - %s" % vpc.id)
     return vpc
开发者ID:prashanthvarma,项目名称:cloudstack,代码行数:22,代码来源:nuageTestCase.py


注:本文中的marvin.lib.base.VPC.create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。