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


Python VpcOffering.list方法代码示例

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


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

示例1: validate_vpc_offering

# 需要导入模块: from marvin.lib.base import VpcOffering [as 别名]
# 或者: from marvin.lib.base.VpcOffering import list [as 别名]
    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,代码行数:33,代码来源:test_region_vpc.py

示例2: create_vpc

# 需要导入模块: from marvin.lib.base import VpcOffering [as 别名]
# 或者: from marvin.lib.base.VpcOffering import list [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: test_vpcnetwork_nuage

# 需要导入模块: from marvin.lib.base import VpcOffering [as 别名]
# 或者: from marvin.lib.base.VpcOffering import list [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

示例4: validate_VpcOffering

# 需要导入模块: from marvin.lib.base import VpcOffering [as 别名]
# 或者: from marvin.lib.base.VpcOffering import list [as 别名]
 def validate_VpcOffering(self, vpc_offering, state=None):
     """Validates the VPC offering"""
     self.debug("Check if the VPC offering is created successfully ?")
     vpc_offs = VpcOffering.list(self.api_client,
                                 id=vpc_offering.id
                                 )
     self.assertEqual(isinstance(vpc_offs, list), True,
                      "List VPC offering should return a valid list"
                      )
     self.assertEqual(vpc_offering.name, vpc_offs[0].name,
                      "Name of the VPC offering should match with the returned list data"
                      )
     if state:
         self.assertEqual(vpc_offs[0].state, state,
                          "VPC offering state should be in state - %s" % state
                          )
     self.debug("VPC offering creation successfully validated for %s" % vpc_offering.name)
开发者ID:CIETstudents,项目名称:cloudstack,代码行数:19,代码来源:nuageTestCase.py

示例5: validate_VpcOffering

# 需要导入模块: from marvin.lib.base import VpcOffering [as 别名]
# 或者: from marvin.lib.base.VpcOffering import list [as 别名]
 def validate_VpcOffering(self, vpc_offering, state=None):
     """Validates the VPC offering"""
     self.debug("Validating the creation and state of VPC offering - %s" %
                vpc_offering.name)
     vpc_offs = VpcOffering.list(self.api_client,
                                 id=vpc_offering.id
                                 )
     self.assertEqual(isinstance(vpc_offs, list), True,
                      "List VPC offering should return a valid list"
                      )
     self.assertEqual(vpc_offering.name, vpc_offs[0].name,
                      "Name of the VPC offering should match with the "
                      "returned list data"
                      )
     if state:
         self.assertEqual(vpc_offs[0].state, state,
                          "VPC offering state should be '%s'" % state
                          )
     self.debug("Successfully validated the creation and state of VPC "
                "offering - %s" % vpc_offering.name)
开发者ID:prashanthvarma,项目名称:cloudstack,代码行数:22,代码来源:nuageTestCase.py

示例6: _validate_vpc_offering

# 需要导入模块: from marvin.lib.base import VpcOffering [as 别名]
# 或者: from marvin.lib.base.VpcOffering import list [as 别名]
    def _validate_vpc_offering(self, vpc_offering):

        self.logger.debug("Check if the VPC offering is created successfully?")
        vpc_offs = VpcOffering.list(
            self.apiclient,
            id=vpc_offering.id
        )
        offering_list = validateList(vpc_offs)
        self.assertEqual(offering_list[0],
                         PASS,
                         "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.logger.debug(
            "VPC offering is created successfully - %s" %
            vpc_offering.name)
        return
开发者ID:Accelerite,项目名称:cloudstack,代码行数:23,代码来源:test_vpc_vpn.py

示例7: test_01_vpc_remote_access_vpn

# 需要导入模块: from marvin.lib.base import VpcOffering [as 别名]
# 或者: from marvin.lib.base.VpcOffering import list [as 别名]
    def test_01_vpc_remote_access_vpn(self):
        """Test Remote Access VPN in VPC"""

        self.logger.debug("Starting test: test_01_vpc_remote_access_vpn")

        # 0) Get the default network offering for VPC
        self.logger.debug("Retrieving default VPC offering")
        networkOffering = NetworkOffering.list(
            self.apiclient, name="DefaultIsolatedNetworkOfferingForVpcNetworks")
        self.assert_(networkOffering is not None and len(
            networkOffering) > 0, "No VPC based network offering")

        # 1) Create VPC
        vpcOffering = VpcOffering.list(self.apiclient, name="Default VPC offering")
        self.assert_(vpcOffering is not None and len(
            vpcOffering) > 0, "No VPC offerings found")

        vpc = None
        try:
            vpc = VPC.create(
                apiclient=self.apiclient,
                services=self.services["vpc"],
                networkDomain="vpc.vpn",
                vpcofferingid=vpcOffering[0].id,
                zoneid=self.zone.id,
                account=self.account.name,
                domainid=self.domain.id
            )
        except Exception as e:
            self.fail(e)
        finally:
            self.assert_(vpc is not None, "VPC creation failed")
            self.logger.debug("VPC %s created" % (vpc.id))

        try:
            # 2) Create network in VPC
            ntwk = Network.create(
                apiclient=self.apiclient,
                services=self.services["network_1"],
                accountid=self.account.name,
                domainid=self.domain.id,
                networkofferingid=networkOffering[0].id,
                zoneid=self.zone.id,
                vpcid=vpc.id
            )
        except Exception as e:
            self.fail(e)
        finally:
            self.assertIsNotNone(ntwk, "Network failed to create")
            self.logger.debug(
                "Network %s created in VPC %s" % (ntwk.id, vpc.id))

        try:
            # 3) Deploy a vm
            vm = VirtualMachine.create(self.apiclient, services=self.services["virtual_machine"],
                                       templateid=self.template.id,
                                       zoneid=self.zone.id,
                                       accountid=self.account.name,
                                       domainid=self.domain.id,
                                       serviceofferingid=self.compute_offering.id,
                                       networkids=ntwk.id,
                                       hypervisor=self.hypervisor
                                       )
            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))
        except Exception as e:
            self.fail(e)
        finally:
            self.logger.debug("Deployed virtual machine: OK")

        try:
            # 4) Enable VPN for VPC
            src_nat_list = PublicIPAddress.list(
                self.apiclient,
                account=self.account.name,
                domainid=self.account.domainid,
                listall=True,
                issourcenat=True,
                vpcid=vpc.id
            )
            ip = src_nat_list[0]
        except Exception as e:
            self.fail(e)
        finally:
            self.logger.debug("Acquired public ip address: OK")

        try:
            vpn = Vpn.create(self.apiclient,
                             publicipid=ip.id,
                             account=self.account.name,
                             domainid=self.account.domainid,
                             iprange=self.services["vpn"]["iprange"],
                             fordisplay=self.services["vpn"]["fordisplay"]
                             )
        except Exception as e:
            self.fail(e)
        finally:
            self.assertIsNotNone(vpn, "Failed to create Remote Access VPN")
            self.logger.debug("Created Remote Access VPN: OK")
#.........这里部分代码省略.........
开发者ID:Accelerite,项目名称:cloudstack,代码行数:103,代码来源:test_vpc_vpn.py

示例8: test_vpc_site2site_vpn

# 需要导入模块: from marvin.lib.base import VpcOffering [as 别名]
# 或者: from marvin.lib.base.VpcOffering import list [as 别名]
    def test_vpc_site2site_vpn(self):
        """Test VPN in VPC"""

        # 0) Get the default network offering for VPC
        networkOffering = NetworkOffering.list(
            self.apiclient, name="DefaultIsolatedNetworkOfferingForVpcNetworks")
        self.assert_(networkOffering is not None and len(
            networkOffering) > 0, "No VPC based network offering")

        # 1) Create VPC offering
        vpcOffering = VpcOffering.list(self.apiclient, isdefault=True)
        self.assert_(vpcOffering is not None and len(
            vpcOffering) > 0, "No VPC offerings found")

        # Create VPC 1
        try:
            vpc1 = VPC.create(
                apiclient=self.apiclient,
                services=self.services["vpc"],
                networkDomain="vpc1.vpn",
                vpcofferingid=vpcOffering[0].id,
                zoneid=self.zone.id,
                account=self.account.name,
                domainid=self.domain.id
            )
        except Exception as e:
            self.fail(e)
        finally:
            self.assert_(vpc1 is not None, "VPC1 creation failed")

        self.logger.debug("VPC1 %s created" % (vpc1.id))

        # Create VPC 2
        try:
            vpc2 = VPC.create(
                apiclient=self.apiclient,
                services=self.services["vpc2"],
                networkDomain="vpc2.vpn",
                vpcofferingid=vpcOffering[0].id,
                zoneid=self.zone.id,
                account=self.account.name,
                domainid=self.account.domainid
            )
        except Exception as e:
            self.fail(e)
        finally:
            self.assert_(vpc2 is not None, "VPC2 creation failed")

        self.logger.debug("VPC2 %s created" % (vpc2.id))

        default_acl = NetworkACLList.list(
            self.apiclient, name="default_allow")[0]

        # Create network in VPC 1
        try:
            ntwk1 = Network.create(
                apiclient=self.apiclient,
                services=self.services["network_1"],
                accountid=self.account.name,
                domainid=self.account.domainid,
                networkofferingid=networkOffering[0].id,
                zoneid=self.zone.id,
                vpcid=vpc1.id,
                aclid=default_acl.id
            )
        except Exception as e:
            self.fail(e)
        finally:
            self.assertIsNotNone(ntwk1, "Network failed to create")

        self.logger.debug("Network %s created in VPC %s" % (ntwk1.id, vpc1.id))

        # Create network in VPC 2
        try:
            ntwk2 = Network.create(
                apiclient=self.apiclient,
                services=self.services["network_2"],
                accountid=self.account.name,
                domainid=self.account.domainid,
                networkofferingid=networkOffering[0].id,
                zoneid=self.zone.id,
                vpcid=vpc2.id,
                aclid=default_acl.id
            )
        except Exception as e:
            self.fail(e)
        finally:
            self.assertIsNotNone(ntwk2, "Network failed to create")

        self.logger.debug("Network %s created in VPC %s" % (ntwk2.id, vpc2.id))

        # Deploy a vm in network 2
        try:
            vm1 = VirtualMachine.create(self.apiclient, services=self.services["virtual_machine"],
                                        templateid=self.template.id,
                                        zoneid=self.zone.id,
                                        accountid=self.account.name,
                                        domainid=self.account.domainid,
                                        serviceofferingid=self.service_offering.id,
                                        networkids=ntwk1.id,
#.........这里部分代码省略.........
开发者ID:tianshangjun,项目名称:cloudstack,代码行数:103,代码来源:test_vpc_vpn.py


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