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


Python Network.restart方法代码示例

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


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

示例1: test_01_nuage_Domain_Template_selection_per_VPC

# 需要导入模块: from marvin.lib.base import Network [as 别名]
# 或者: from marvin.lib.base.Network import restart [as 别名]
    def test_01_nuage_Domain_Template_selection_per_VPC(self):
        """Test Nuage VSP Domain Template selection per VPC
        """

        # 1. Associate an invalid/non-existing Nuage VSP domain template to a
        #    VPC; verify that the association fails.
        # 2. Associate a valid/existing pre-configured Nuage VSP domain
        #    template to a VPC; verify that the association is successful, VPC
        #    networks (domains) are instantiated from the associated domain
        #    template in VSD.
        # 3. Verify that the state of such VPC networks (domains) in VSD is not
        #    affected with their restarts in CloudStack with and without
        #    cleanup.
        # 4. Verify that multiple associations (update) of domain templates to
        #    a VPC goes through till the creation of its first VPC network
        #    (tier).
        # 5. Verify that the VPC networks (domains) creation fails in VSD when
        #    the associated domain templates to their corresponding VPCs have
        #    been deleted in VSD.
        # 6. Verify that the VPC networks (domains) creation fails in VSD when
        #    an acl list is associated with them after their corresponding VPCs
        #    have been associated with a pre-configured Nuage VSP domain
        #    template.
        # 7. Delete all the created objects (cleanup).

        # Creating VPC
        vpc_1 = self.create_Vpc(self.vpc_offering, cidr='10.1.0.0/16')

        # Associating pre-configured Nuage VSP Domain Template to VPC
        with self.assertRaises(Exception):
            self.validate_NuageVspDomainTemplate("invalid_domain_template")
        self.debug("There is no domain template with name "
                   "invalid_domain_template in VSD")
        with self.assertRaises(Exception):
            self.associate_NuageVspDomainTemplate(
                "invalid_domain_template", vpc_1)
        self.debug("Association fails as there is no domain template with "
                   "name invalid_domain_template in VSD")
        self.associate_NuageVspDomainTemplate(
            self.domain_template_list[0], vpc_1)

        # Creating VPC networks (tiers)
        vpc_1_tier_1 = self.create_Network(
            self.network_offering, gateway='10.1.3.1', vpc=vpc_1)
        vpc_1_tier_2 = self.create_Network(
            self.network_offering, gateway='10.1.4.1', vpc=vpc_1)

        # VSD verification
        self.verify_vsd_network(
            self.account.domainid, vpc_1_tier_1, vpc_1,
            domain_template_name=self.domain_template_list[0])
        self.verify_vsd_network(
            self.account.domainid, vpc_1_tier_2, vpc_1,
            domain_template_name=self.domain_template_list[0])

        # Restart VPC networks (tiers) without cleanup
        Network.restart(vpc_1_tier_1, self.api_client, cleanup=False)
        Network.restart(vpc_1_tier_2, self.api_client, cleanup=False)

        # VSD verification
        self.verify_vsd_network(
            self.account.domainid, vpc_1_tier_1, vpc_1,
            domain_template_name=self.domain_template_list[0])
        self.verify_vsd_network(
            self.account.domainid, vpc_1_tier_2, vpc_1,
            domain_template_name=self.domain_template_list[0])

        # Restart VPC networks (tiers) with cleanup
        Network.restart(vpc_1_tier_1, self.api_client, cleanup=True)
        Network.restart(vpc_1_tier_2, self.api_client, cleanup=True)

        # VSD verification
        self.verify_vsd_network(
            self.account.domainid, vpc_1_tier_1, vpc_1,
            domain_template_name=self.domain_template_list[0])
        self.verify_vsd_network(
            self.account.domainid, vpc_1_tier_2, vpc_1,
            domain_template_name=self.domain_template_list[0])

        # Restart VPC without cleanup
        self.restart_Vpc(vpc_1, cleanup=False)

        # VSD verification
        self.verify_vsd_network(
            self.account.domainid, vpc_1_tier_1, vpc_1,
            domain_template_name=self.domain_template_list[0])
        self.verify_vsd_network(
            self.account.domainid, vpc_1_tier_2, vpc_1,
            domain_template_name=self.domain_template_list[0])

        # Restart VPC with cleanup
        self.restart_Vpc(vpc_1, cleanup=True)

        # VSD verification
        self.verify_vsd_network(
            self.account.domainid, vpc_1_tier_1, vpc_1,
            domain_template_name=self.domain_template_list[0])
        self.verify_vsd_network(
            self.account.domainid, vpc_1_tier_2, vpc_1,
            domain_template_name=self.domain_template_list[0])
#.........这里部分代码省略.........
开发者ID:Accelerite,项目名称:cloudstack,代码行数:103,代码来源:test_nuage_vsp_domain_template.py

示例2: test_03_Isolated_Network_restarts

# 需要导入模块: from marvin.lib.base import Network [as 别名]
# 或者: from marvin.lib.base.Network import restart [as 别名]
    def test_03_Isolated_Network_restarts(self):
        """ Verify InternalDns on Isolated Network with restart networks and
        ping by hostname
        """

        # Validate the following
        # 1. Create an Isolated network - network1 (10.1.1.1/24) by using DNS
        #    network offering.
        # 2. Deploy vm1 in network1.
        # 3. Verify dhcp option 06 and 0f for subnet
        # 4. Verify dhcp option 06,15 and 0f for vm Interface.
        # 5. Deploy VM2 in network1.
        # 6. Verify end to end by pinging with hostname while restarting
        #    network1 without and with cleanup.

        cmd = updateZone.updateZoneCmd()
        cmd.id = self.zone.id
        cmd.domain = ISOLATED_DOMAIN_NAME
        self.apiclient.updateZone(cmd)

        self.debug("Creating and enabling Nuage Vsp Isolated Network "
                   "offering...")
        network_offering = self.create_NetworkOffering(
            self.dnsdata["isolated_network_offering"])
        self.validate_NetworkOffering(network_offering, state="Enabled")

        network_1 = self.create_Network(network_offering)
        vm_1 = self.create_VM(network_1)

        # VSD verification
        self.verify_vsd_network(self.domain.id, network_1)
        self.verify_vsd_vm(vm_1)

        # Internal DNS check point on VSD
        self.verify_vsd_dhcp_option(self.DNS, "10.1.1.2", network_1)
        self.verify_vsd_dhcp_option(self.DOMAINNAME, ISOLATED_DOMAIN_NAME, network_1)
        for nic in vm_1.nic:
            self.verify_vsd_dhcp_option(self.DNS, "10.1.1.2", nic, True)
            self.verify_vsd_dhcp_option(
                self.DOMAINNAME, ISOLATED_DOMAIN_NAME, nic, True)
            self.verify_vsd_dhcp_option(self.HOSTNAME, "vm1", nic, True)

        self.test_data["virtual_machine"]["displayname"] = "vm2"
        self.test_data["virtual_machine"]["name"] = "vm2"
        vm_2 = self.create_VM(network_1)
        self.test_data["virtual_machine"]["displayname"] = "vm1"
        self.test_data["virtual_machine"]["name"] = "vm1"
        self.verify_vsd_vm(vm_2)
        for nic in vm_2.nic:
            self.verify_vsd_dhcp_option(self.DNS, "10.1.1.2", nic, True)
            self.verify_vsd_dhcp_option(
                self.DOMAINNAME, ISOLATED_DOMAIN_NAME, nic, True)
            self.verify_vsd_dhcp_option(self.HOSTNAME, "vm2", nic, True)

        public_ip_1 = self.acquire_PublicIPAddress(network_1)
        self.create_and_verify_fw(vm_1, public_ip_1, network_1)

        self.vm_verify_ping(vm_1, public_ip_1, vm_2, ISOLATED_DOMAIN_NAME)

        # Restarting Isolated network (cleanup = false)
        self.debug("Restarting the created Isolated network without "
                   "cleanup...")
        Network.restart(network_1, self.api_client, cleanup=False)
        self.validate_Network(network_1, state="Implemented")
        vr = self.get_Router(network_1)
        self.check_Router_state(vr, state="Running")
        self.check_VM_state(vm_1, state="Running")
        self.check_VM_state(vm_2, state="Running")

        # VSD verification
        self.verify_vsd_network(self.domain.id, network_1)
        self.verify_vsd_router(vr)
        self.verify_vsd_vm(vm_1)
        self.verify_vsd_vm(vm_2)

        self.vm_verify_ping(vm_1, public_ip_1, vm_2, ISOLATED_DOMAIN_NAME)

        # Restarting Isolated network (cleanup = true)
        self.debug("Restarting the created Isolated network with cleanup...")
        Network.restart(network_1, self.api_client, cleanup=True)
        self.validate_Network(network_1, state="Implemented")
        vr = self.get_Router(network_1)
        self.check_Router_state(vr, state="Running")
        self.check_VM_state(vm_1, state="Running")
        self.check_VM_state(vm_2, state="Running")

        # VSD verification
        self.verify_vsd_network(self.domain.id, network_1)
        self.verify_vsd_router(vr)
        self.verify_vsd_vm(vm_1)
        self.verify_vsd_vm(vm_2)

        self.vm_verify_ping(vm_1, public_ip_1, vm_2, ISOLATED_DOMAIN_NAME)
开发者ID:PCextreme,项目名称:cloudstack,代码行数:95,代码来源:test_nuage_internal_dns.py

示例3: test_08_VPC_Network_Restarts_With_InternalDns

# 需要导入模块: from marvin.lib.base import Network [as 别名]
# 或者: from marvin.lib.base.Network import restart [as 别名]
    def test_08_VPC_Network_Restarts_With_InternalDns(self):
        """ Verify InternalDns on VPC Network with restarts and ping by
        hostname
        """

        # Validate the following
        # 1. Create a VPC and Tier network by using DNS network offering.
        # 2. Deploy vm1 in Tier network network1.
        # 3. Verify dhcp option 06 and 0f for subnet
        # 4. Verify dhcp option 06,15 and 0f for vm Interface.
        # 5. Deploy Vm2.
        # 6. Verify end to end by pinging with hostname while restarting
        #    VPC and Tier without and with cleanup.

        cmd = updateZone.updateZoneCmd()
        cmd.id = self.zone.id
        cmd.domain = VPC_DOMAIN_NAME
        self.apiclient.updateZone(cmd)

        vpc_off = self.create_VpcOffering(self.dnsdata["vpc_offering"])
        self.validate_VpcOffering(vpc_off, state="Enabled")
        vpc = self.create_Vpc(vpc_off, cidr='10.1.0.0/16', cleanup=False)

        self.debug("Creating Nuage Vsp VPC Network offering...")
        network_offering = self.create_NetworkOffering(
            self.dnsdata["vpc_network_offering"])
        self.validate_NetworkOffering(network_offering, state="Enabled")
        network_1 = self.create_Network(
            network_offering, gateway='10.1.1.1', vpc=vpc)

        vm_1 = self.create_VM(network_1)

        # VSD verification
        self.verify_vsd_network(self.domain.id, network_1, vpc)
        self.verify_vsd_vm(vm_1)
        # Internal DNS check point on VSD
        self.verify_vsd_dhcp_option(self.DNS, "10.1.1.2", network_1)
        self.verify_vsd_dhcp_option(self.DOMAINNAME, VPC_DOMAIN_NAME, network_1)
        for nic in vm_1.nic:
            self.verify_vsd_dhcp_option(self.DNS, "10.1.1.2", nic, True)
            self.verify_vsd_dhcp_option(self.DOMAINNAME, VPC_DOMAIN_NAME, nic, True)
            self.verify_vsd_dhcp_option(self.HOSTNAME, "vm1", nic, True)

        self.test_data["virtual_machine"]["displayname"] = "vm2"
        self.test_data["virtual_machine"]["name"] = "vm2"
        vm_2 = self.create_VM(network_1)
        self.test_data["virtual_machine"]["displayname"] = "vm1"
        self.test_data["virtual_machine"]["name"] = "vm1"
        self.verify_vsd_vm(vm_2)
        for nic in vm_2.nic:
            self.verify_vsd_dhcp_option(self.DNS, "10.1.1.2", nic, True)
            self.verify_vsd_dhcp_option(self.DOMAINNAME, VPC_DOMAIN_NAME, nic, True)
            self.verify_vsd_dhcp_option(self.HOSTNAME, "vm2", nic, True)

        public_ip_1 = self.acquire_PublicIPAddress(network_1, vpc)
        self.create_StaticNatRule_For_VM(vm_1, public_ip_1, network_1)
        # Adding Network ACL rule in the Public tier
        self.debug("Adding Network ACL rule to make the created NAT rule "
                   "(SSH) accessible...")
        public_ssh_rule = self.create_NetworkAclRule(
            self.test_data["ingress_rule"], network=network_1)

        # VSD verification
        self.verify_vsd_firewall_rule(public_ssh_rule)

        self.vm_verify_ping(vm_1, public_ip_1, vm_2, VPC_DOMAIN_NAME)

        # Restarting VPC network (cleanup = false)
        self.debug("Restarting the created VPC network without cleanup...")
        Network.restart(network_1, self.api_client, cleanup=False)
        self.validate_Network(network_1, state="Implemented")
        vr = self.get_Router(network_1)
        self.check_Router_state(vr, state="Running")
        self.check_VM_state(vm_1, state="Running")
        self.check_VM_state(vm_2, state="Running")

        # VSD verification
        self.verify_vsd_network(self.domain.id, network_1, vpc)
        self.verify_vsd_router(vr)
        self.verify_vsd_vm(vm_1)
        self.verify_vsd_vm(vm_2)

        self.vm_verify_ping(vm_1, public_ip_1, vm_2, VPC_DOMAIN_NAME)

        # Restarting VPC network (cleanup = true)
        self.debug("Restarting the created VPC network with cleanup...")
        Network.restart(network_1, self.api_client, cleanup=True)
        self.validate_Network(network_1, state="Implemented")
        vr = self.get_Router(network_1)
        self.check_Router_state(vr, state="Running")
        self.check_VM_state(vm_1, state="Running")
        self.check_VM_state(vm_2, state="Running")

        # VSD verification
        self.verify_vsd_network(self.domain.id, network_1, vpc)
        self.verify_vsd_router(vr)
        self.verify_vsd_vm(vm_1)
        self.verify_vsd_vm(vm_2)

        self.vm_verify_ping(vm_1, public_ip_1, vm_2, VPC_DOMAIN_NAME)
#.........这里部分代码省略.........
开发者ID:PCextreme,项目名称:cloudstack,代码行数:103,代码来源:test_nuage_internal_dns.py

示例4: test_nuage_vsp

# 需要导入模块: from marvin.lib.base import Network [as 别名]
# 或者: from marvin.lib.base.Network import restart [as 别名]
    def test_nuage_vsp(self):
        """ Test Nuage VSP SDN plugin with basic Isolated Network functionality
        """

        # 1. Verify that the Nuage VSP network service provider is successfully
        #    created and enabled.
        # 2. Create and enable Nuage VSP Isolated Network offering, check if it
        #    is successfully created and enabled.
        # 3. Create an Isolated Network with Nuage VSP Isolated Network
        #    offering, check if it is successfully created and is in the
        #    "Allocated" state.
        # 4. Deploy a VM in the created Isolated network, check if the Isolated
        #    network state is changed to "Implemented", and both the VM & VR
        #    are successfully deployed and are in the "Running" state.
        # 5. Verify that the VPC VR has no Public IP and NIC as it is not the
        #    Source NAT service provider.
        # 6. Deploy one more VM in the created Isolated network, check if the
        #    VM is successfully deployed and is in the "Running" state.
        # 7. Delete the created Isolated Network after destroying its VMs,
        #    check if the Isolated network is successfully deleted.
        # 8. Delete all the created objects (cleanup).

        for zone in self.zones:
            self.debug("Zone - %s" % zone.name)
            # Get Zone details
            self.getZoneDetails(zone=zone)
            # Configure VSD sessions
            self.configureVSDSessions()

            # Creating a network offering
            self.debug("Creating and enabling Nuage VSP Isolated Network "
                       "offering...")
            network_offering = self.create_NetworkOffering(
                self.test_data["nuagevsp"]["isolated_network_offering"])
            self.validate_NetworkOffering(network_offering, state="Enabled")

            # Creating a network
            self.debug("Creating an Isolated Network with Nuage VSP Isolated "
                       "Network offering...")
            network = self.create_Network(network_offering)
            self.validate_Network(network, state="Allocated")

            # Deploying a VM in the network
            vm_1 = self.create_VM(network)
            self.validate_Network(network, state="Implemented")
            vr = self.get_Router(network)
            self.check_Router_state(vr, state="Running")
            self.check_VM_state(vm_1, state="Running")

            # Verifying that the VR has no public IP and NIC
            self.verify_VRWithoutPublicIPNIC(vr)

            # VSD verification
            self.verify_vsd_network(self.domain.id, network)
            self.verify_vsd_router(vr)
            self.verify_vsd_vm(vm_1)

            # Deploying one more VM in the network
            vm_2 = self.create_VM(network)
            self.check_VM_state(vm_2, state="Running")

            # VSD verification
            self.verify_vsd_vm(vm_2)

            Network.restart(network, self.api_client, cleanup=True)

            self.validate_Network(network, state="Implemented")
            vr = self.get_Router(network)
            self.verify_vsd_router(vr)

            # Deleting the network
            self.debug("Deleting the Isolated Network with Nuage VSP Isolated "
                       "Network offering...")
            self.delete_VM(vm_1)
            self.delete_VM(vm_2)
            self.delete_Network(network)
            with self.assertRaises(Exception):
                self.validate_Network(network)
            self.debug("Isolated Network successfully deleted in CloudStack")

            # VSD verification
            with self.assertRaises(Exception):
                self.verify_vsd_network(self.domain.id, network)
            self.debug("Isolated Network successfully deleted in VSD")
开发者ID:PCextreme,项目名称:cloudstack,代码行数:86,代码来源:test_nuage_vsp.py


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