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


Python base.VpcOffering类代码示例

本文整理汇总了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
开发者ID:Accelerite,项目名称:cloudstack,代码行数:33,代码来源:test_region_vpc.py

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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