• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python base.VPC类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: validate_vpc_network

    def validate_vpc_network(self, network, state=None):
        """Validates the VPC network"""

        self.debug("Check if the VPC network is created successfully?")
        vpc_networks = VPC.list(
            self.api_client,
            id=network.id
        )
        self.assertEqual(
            isinstance(vpc_networks, list),
            True,
            "List VPC network should return a valid list"
        )
        self.assertEqual(
            network.name,
            vpc_networks[0].name,
            "Name of the VPC network should match with listVPC data"
        )
        if state:
            self.assertEqual(
                vpc_networks[0].state,
                state,
                "VPC state should be '%s'" % state
            )
        self.debug("VPC network validated - %s" % network.name)
        return
开发者ID:EdwardBetts,项目名称:blackhole,代码行数:26,代码来源:test_vpc_routers.py


示例2: 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
开发者ID:Accelerite,项目名称:cloudstack,代码行数:33,代码来源:test_region_vpc.py


示例3: 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))
开发者ID:dxia88,项目名称:cloudstack,代码行数:27,代码来源:test_internal_lb.py


示例4: setUp

    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,代码行数:25,代码来源:test_vpc_router_nics.py


示例5: 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
开发者ID:EdwardBetts,项目名称:blackhole,代码行数:34,代码来源:test_vpc_redundant.py


示例6: test_02_create_vpc_wait_gc

    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,代码行数:46,代码来源:test_vpc_on_host_maintenance.py


示例7: setUpClass

    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,代码行数:58,代码来源:test_router_ip_tables_policies.py


示例8: 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
开发者ID:Accelerite,项目名称:cloudstack,代码行数:55,代码来源:test_vpc_routers.py


示例9: 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))
开发者ID:DiegoSanjuan,项目名称:cloudstack,代码行数:54,代码来源:test_vpcnetwork_nuage.py


示例10: setUp

    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,代码行数:14,代码来源:test_vpc_ip_tables_policies.py


示例11: create_Vpc

 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,代码行数:15,代码来源:nuageTestCase.py


示例12: create_Vpc

 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,代码行数:16,代码来源:nuageTestCase.py


示例13: createVPC

    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,代码行数:16,代码来源:test_password_server.py


示例14: validate_Vpc

 def validate_Vpc(self, vpc, state=None):
     """Validates the VPC"""
     self.debug("Check if the VPC is created successfully ?")
     vpcs = VPC.list(self.api_client,
                     id=vpc.id
                     )
     self.assertEqual(isinstance(vpcs, list), True,
                      "List VPC should return a valid list"
                      )
     self.assertEqual(vpc.name, vpcs[0].name,
                      "Name of the VPC should match with the returned list data"
                      )
     if state:
         self.assertEqual(vpcs[0].state, state,
                          "VPC state should be in state - %s" % state
                          )
     self.debug("VPC creation successfully validated for %s" % vpc.name)
开发者ID:CIETstudents,项目名称:cloudstack,代码行数:17,代码来源:nuageTestCase.py


示例15: deploy_vpc

    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,代码行数:17,代码来源:testScenarioManager.py


示例16: validate_Vpc

 def validate_Vpc(self, vpc, state=None):
     """Validates the VPC"""
     self.debug("Validating the creation and state of VPC - %s" % vpc.name)
     vpcs = VPC.list(self.api_client,
                     id=vpc.id
                     )
     self.assertEqual(isinstance(vpcs, list), True,
                      "List VPC should return a valid list"
                      )
     self.assertEqual(vpc.name, vpcs[0].name,
                      "Name of the VPC should match with the returned "
                      "list data"
                      )
     if state:
         self.assertEqual(vpcs[0].state, state,
                          "VPC state should be '%s'" % state
                          )
     self.debug("Successfully validated the creation and state of VPC - %s"
                % vpc.name)
开发者ID:prashanthvarma,项目名称:cloudstack,代码行数:19,代码来源:nuageTestCase.py


示例17: setUp

    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,代码行数:19,代码来源:test_routers_iptables_default_policy.py


示例18: create_Vpc

 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,代码行数:20,代码来源:nuageTestCase.py


示例19: create_vpc

    def create_vpc(self, vpc_offering):
        self.logger.debug("Creating VPC using offering ==> ID %s / Name %s" % (vpc_offering.id, vpc_offering.name))
        try:
            vpc = VPC.create(
                apiclient=self.apiclient,
                services=self.services["vpc"],
                networkDomain="vpc.internallb",
                vpcofferingid=vpc_offering.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)

            self.cleanup.insert(0, vpc)
            return vpc

        except Exception as e:
            self.fail("Failed to create VPC due to %s" % e)
开发者ID:PCextreme,项目名称:cloudstack,代码行数:21,代码来源:test_internal_lb.py


示例20: create_Vpc

 def create_Vpc(self, vpc_offering, cidr='10.1.0.0/16', testdata=None, account=None, networkDomain=None,
                cleanup=True):
     if not account:
         account = self.account
     self.debug("Creating a VPC in the account - %s" % account.name)
     if not testdata:
         testdata = self.test_data["vpc"]
         testdata["name"] = "TestVPC-" + cidr + "-" + str(vpc_offering.name)
         testdata["displaytext"] = "Test VPC"
         testdata["cidr"] = cidr
     vpc = VPC.create(self.api_client,
                      testdata,
                      vpcofferingid=vpc_offering.id,
                      zoneid=self.zone.id,
                      account=account.name,
                      domainid=account.domainid,
                      networkDomain=networkDomain
                      )
     self.debug("Created VPC with ID - %s" % vpc.id)
     if cleanup:
         self.cleanup.append(vpc)
     return vpc
开发者ID:KamilStupak,项目名称:cloudstack,代码行数:22,代码来源:nuageTestCase.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python base.VirtualMachine类代码示例发布时间:2022-05-27
下一篇:
Python base.User类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap