Пример #1
0
    def setUp(self):
        self.apiclient = self.testClient.getApiClient()
        self.account = Account.create(self.apiclient,
                                      self.services["account"],
                                      admin=True,
                                      domainid=self.domain.id)
        self.cleanup = [self.account]
        self.debug("Creating a VPC offering..")
        self.vpc_off = VpcOffering.create(self.apiclient,
                                          self.services["vpc_offering"])

        self.cleanup.append(self.vpc_off)
        self.debug("Enabling the VPC offering created")
        self.vpc_off.update(self.apiclient, state='Enabled')

        self.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)
        return
    def setUp(self):
        self.apiclient = self.testClient.getApiClient()
        self.account = Account.create(
                                                self.apiclient,
                                                self.services["account"],
                                                admin=True,
                                                domainid=self.domain.id
                                                )
        self.cleanup = [self.account]
        self.debug("Creating a VPC offering..")
        self.vpc_off = VpcOffering.create(
                                                self.apiclient,
                                                self.services["vpc_offering"]
                                                )

        self.debug("Enabling the VPC offering created")
        self.vpc_off.update(self.apiclient, state='Enabled')

        self.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
                                )
        return
Пример #3
0
    def create_VPC(self, cidr="10.1.2.1/16"):
        self.debug("Creating a VPC offering..")
        self.services["vpc_offering"]["name"] = self.services["vpc_offering"]["name"] + str(cidr)
        vpc_off = VpcOffering.create(self.apiclient, self.services["vpc_offering"])

        self._cleanup.append(self.vpc_off)
        self.debug("Enabling the VPC offering created")
        vpc_off.update(self.apiclient, state="Enabled")

        self.debug("Creating a VPC network in the account: %s" % self.account.name)
        self.services["vpc"]["cidr"] = cidr
        vpc = VPC.create(
            self.apiclient,
            self.services["vpc"],
            vpcofferingid=vpc_off.id,
            zoneid=self.zone.id,
            account=self.account.name,
            domainid=self.account.domainid,
        )
        return vpc
Пример #4
0
    def setUpClass(cls):
        cloudstackTestClient = super(TestBasicOperations,cls).getClsTestClient()
        cls.api_client = cloudstackTestClient.getApiClient()

        # Fill services from the external config file
        cls.services = cloudstackTestClient.getConfigParser().parsedDict

        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.api_client, cls.services)
        cls.zone = get_zone(cls.api_client, cls.services)
        cls.mode = str(cls.zone.networktype).lower()
        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._cleanup = [cls.service_offering]
        cls.services["shared_network_offering"]["specifyVlan"] = "True"
        cls.services["shared_network_offering"]["specifyIpRanges"] = "True"

        cls.shared_network_offering = CreateEnabledNetworkOffering(cls.api_client,
                                                                      cls.services["shared_network_offering"])
        cls._cleanup.append(cls.shared_network_offering)

        if cls.mode == "advanced":
            cls.isolated_network_offering = CreateEnabledNetworkOffering(cls.api_client,
                                                                      cls.services["isolated_network_offering"])
            cls._cleanup.append(cls.isolated_network_offering)
            cls.isolated_network_offering_vpc = CreateEnabledNetworkOffering(cls.api_client,
                                                    cls.services["nw_offering_isolated_vpc"])
            cls._cleanup.append(cls.isolated_network_offering_vpc)
            cls.vpc_off = VpcOffering.create(cls.api_client, cls.services["vpc_offering"])
            cls.vpc_off.update(cls.api_client, state='Enabled')
            cls._cleanup.append(cls.vpc_off)
        return
Пример #5
0
    def create_VPC(self, cidr='10.1.2.1/16'):
        self.debug("Creating a VPC offering..")
        self.services["vpc_offering"][
            "name"] = self.services["vpc_offering"]["name"] + str(cidr)
        vpc_off = VpcOffering.create(self.apiclient,
                                     self.services["vpc_offering"])

        self.cleanup.append(vpc_off)
        self.debug("Enabling the VPC offering created")
        vpc_off.update(self.apiclient, state='Enabled')

        self.debug("Creating a VPC network in the account: %s" %
                   self.account.name)
        self.services["vpc"]["cidr"] = cidr
        vpc = VPC.create(self.apiclient,
                         self.services["vpc"],
                         vpcofferingid=vpc_off.id,
                         zoneid=self.zone.id,
                         account=self.account.name,
                         domainid=self.account.domainid)
        return vpc