def test_09_update_network_offering_isolated_network(self):
        """Test Update network offering for isolated Networks
           with Nuage VSP SDN plugin
        """
        #    Create an Isolated Network with Nuage VSP Isolated Network
        #    offering specifying Services which don't need a VR.
        #    Update the network offering of this network to one that
        #    needs a VR, check that a VR is spawn
        #    After that update network to previous offering
        #    Check that VR is destroyed and removed.

        self.debug("+++Create an Isolated network with a network "
                   "offering which has only services without VR")
        cmd = updateZone.updateZoneCmd()
        cmd.id = self.zone.id
        cmd.domain = "isolated.com"
        self.apiclient.updateZone(cmd)
        self.debug("Creating and enabling Nuage Vsp Isolated Network "
                   "offering which has only service without VR...")
        network_offering = self.create_NetworkOffering(
                self.test_data["nuagevsp"]
                ["isolated_network_offering_without_vr"])
        self.validate_NetworkOffering(network_offering, state="Enabled")

        network_1 = self.create_Network(network_offering)
        self.validate_Network(network_1, state="Allocated")

        self.debug("+++Deploy VM in the created Isolated network "
                   "with only services without VR")
        vm_1 = self.create_VM(network_1)

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

        with self.assertRaises(Exception):
            self.get_Router(network_1)
        self.debug("+++Verified no VR is spawned for this network ")

        self.debug("+++ Upgrade offering of created Isolated network with "
                   "a dns offering which spins a VR")
        self.upgrade_Network(self.test_data["nuagevsp"][
                            "isolated_network_offering"],
                            network_1)
        vr = self.get_Router(network_1)
        self.check_Router_state(vr, state="Running")
        # VSD verification
        self.verify_vsd_network(self.domain.id, network_1)
        self.verify_vsd_router(vr)

        self.debug("+++ Upgrade offering of created Isolated network with "
                   "an offering which removes the VR...")
        self.upgrade_Network(self.test_data["nuagevsp"][
                    "isolated_network_offering_without_vr"],
                    network_1)
        with self.assertRaises(Exception):
            self.get_Router(network_1)
        self.debug("+++Verified no VR is spawned for this network ")
Exemplo n.º 2
0
    def test_02_Isolated_Network(self):
        """ Verify InternalDns on Isolated Network with 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

        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)
Exemplo n.º 3
0
    def test_04_Update_Network_with_Domain(self):
        """ Verify update NetworkDomain for InternalDns on Isolated Network
        """

        # 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. Update Network domain and verify it is properly updated

        # update Network Domain at zone level
        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.com", 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)

        update_response = Network.update(network_1,
                                         self.apiclient,
                                         id=network_1.id,
                                         networkdomain=UPDATED_DOMAIN_NAME,
                                         changecidr=False)
        completeoutput = str(update_response).strip('[]')
        self.debug("network update response is " + completeoutput)
        self.assertEqual(UPDATED_DOMAIN_NAME, update_response.networkdomain,
                         "Network Domain is not updated as expected")
        self.verify_vsd_dhcp_option(self.DNS, "10.1.1.2", network_1)
        self.verify_vsd_dhcp_option(self.DOMAINNAME, UPDATED_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, UPDATED_DOMAIN_NAME,
                                        nic, True)
            self.verify_vsd_dhcp_option(self.HOSTNAME, "vm1", nic, True)
    def test_02_Isolated_Network(self):
        """ Verify InternalDns on Isolated Network with 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

        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)
Exemplo n.º 5
0
    def test_09_update_network_offering_isolated_network(self):
        """Test Update network offering for isolated Networks
           with Nuage VSP SDN plugin
        """
        #    Create an Isolated Network with Nuage VSP Isolated Network
        #    offering specifying Services which don't need a VR.
        #    Update the network offering of this network to one that
        #    needs a VR, check that a VR is spawn
        #    After that update network to previous offering
        #    Check that VR is destroyed and removed.

        self.debug("+++Create an Isolated network with a network "
                   "offering which has only services without VR")
        cmd = updateZone.updateZoneCmd()
        cmd.id = self.zone.id
        cmd.domain = "isolated.com"
        self.apiclient.updateZone(cmd)
        self.debug("Creating and enabling Nuage Vsp Isolated Network "
                   "offering which has only service without VR...")
        network_offering = self.create_NetworkOffering(
            self.test_data["nuagevsp"]["isolated_network_offering_without_vr"])
        self.validate_NetworkOffering(network_offering, state="Enabled")

        network_1 = self.create_Network(network_offering)
        self.validate_Network(network_1, state="Allocated")

        self.debug("+++Deploy VM in the created Isolated network "
                   "with only services without VR")
        vm_1 = self.create_VM(network_1)

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

        with self.assertRaises(Exception):
            self.get_Router(network_1)
        self.debug("+++Verified no VR is spawned for this network ")

        self.debug("+++ Upgrade offering of created Isolated network with "
                   "a dns offering which spins a VR")
        self.upgrade_Network(
            self.test_data["nuagevsp"]["isolated_network_offering"], network_1)
        vr = self.get_Router(network_1)
        self.check_Router_state(vr, state="Running")
        # VSD verification
        self.verify_vsd_network(self.domain.id, network_1)
        self.verify_vsd_router(vr)

        self.debug("+++ Upgrade offering of created Isolated network with "
                   "an offering which removes the VR...")
        self.upgrade_Network(
            self.test_data["nuagevsp"]["isolated_network_offering_without_vr"],
            network_1)
        with self.assertRaises(Exception):
            self.get_Router(network_1)
        self.debug("+++Verified no VR is spawned for this network ")
    def test_03_Update_Network_with_Domain(self):
        """ Verify update NetworkDomain for InternalDns on Isolated Network
        """

        # 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. Update Network domain and verify it is properly updated

        # update Network Domain at zone level
        cmd = updateZone.updateZoneCmd()
        cmd.id = self.zone.id
        cmd.domain = "isolated.com"
        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.com", 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.com", nic, True)
            self.verify_vsd_dhcp_option(self.HOSTNAME, "vm1", nic, True)

        update_response = Network.update(
            network_1, self.apiclient, id=network_1.id,
            networkdomain="update.com", changecidr=False)
        completeoutput = str(update_response).strip('[]')
        self.debug("network update response is " + completeoutput)
        self.assertEqual("update.com", update_response.networkdomain,
                         "Network Domain is not updated as expected"
                         )
        self.verify_vsd_dhcp_option(self.DNS, "10.1.1.2", network_1)
        self.verify_vsd_dhcp_option(self.DOMAINNAME, "update.com", 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, "update.com", nic, True)
            self.verify_vsd_dhcp_option(self.HOSTNAME, "vm1", nic, True)
 def tearDownClass(cls):
     try:
         zoneList = Zone.list(cls.apiclient, id=cls.zone.id)
         if zoneList[0].allocationstate == DISABLED:
             cmd = updateZone.updateZoneCmd()
             cmd.id = zoneList[0].id
             cmd.allocationstate = ENABLED
             cls.apiclient.updateZone(cmd)
         cleanup_resources(cls.apiclient, cls._cleanup)
     except Exception as e:
         raise Exception("Warning: Exception during cleanup : %s" % e)
Exemplo n.º 8
0
    def test_06_VPC_Network_With_InternalDns(self):
        """ Verify InternalDns on VPC Network
        """

        # Validate the following
        # 1. Create a VPC and tier network by using DNS network offering.
        # 2. Deploy vm1 in tier network.
        # 3. Verify dhcp option 06 and 0f for subnet
        # 4. Verify dhcp option 06,15 and 0f for vm Interface.
        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)
    def test_05_VPC_Network_With_InternalDns(self):
        """ Verify InternalDns on VPC Network
        """

        # Validate the following
        # 1. Create a VPC and tier network by using DNS network offering.
        # 2. Deploy vm1 in tier network.
        # 3. Verify dhcp option 06 and 0f for subnet
        # 4. Verify dhcp option 06,15 and 0f for vm Interface.

        cmd = updateZone.updateZoneCmd()
        cmd.id = self.zone.id
        cmd.domain = "vpc.com"
        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.com", 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.com", nic, True)
            self.verify_vsd_dhcp_option(self.HOSTNAME, "vm1", nic, True)
Exemplo n.º 10
0
    def test_01_Isolated_Network_with_zone(self):
        """ Verify InternalDns on Isolated Network
        """

        # 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.

        # update Network Domain at zone level
        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)
    def test_01_Isolated_Network_with_zone(self):
        """ Verify InternalDns on Isolated Network
        """

        # 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.

        # update Network Domain at zone level
        cmd = updateZone.updateZoneCmd()
        cmd.id = self.zone.id
        cmd.domain = "isolated.com"
        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.com", 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.com", nic, True)
            self.verify_vsd_dhcp_option(self.HOSTNAME, "vm1", nic, True)
Exemplo n.º 12
0
    def test_05_Update_Network_with_Domain(self):
        """ Verify update NetworkDomain for InternalDns on Isolated Network
        with ping VM
        """

        # 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. Update Network domain and verify it is properly updated

        # update Network Domain at zone level
        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)

        update_response = Network.update(network_1,
                                         self.apiclient,
                                         id=network_1.id,
                                         networkdomain=UPDATED_DOMAIN_NAME,
                                         changecidr=False)
        completeoutput = str(update_response).strip('[]')
        self.debug("network update response is " + completeoutput)
        self.assertEqual(UPDATED_DOMAIN_NAME, update_response.networkdomain,
                         "Network Domain is not updated as expected")
        self.verify_vsd_dhcp_option(self.DNS, "10.1.1.2", network_1)
        self.verify_vsd_dhcp_option(self.DOMAINNAME, UPDATED_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, UPDATED_DOMAIN_NAME,
                                        nic, True)
            self.verify_vsd_dhcp_option(self.HOSTNAME, "vm1", nic, True)

        # stop and start VM to get new DHCP option
        try:
            vm_1.stop(self.apiclient)
        except Exception as e:
            self.fail("Failed to stop the virtual instances, %s" % e)

        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, UPDATED_DOMAIN_NAME,
                                        nic, True)
            self.verify_vsd_dhcp_option(self.HOSTNAME, "vm2", nic, True)

        try:
            vm_1.start(self.apiclient)
        except Exception as e:
            self.fail("Failed to start the virtual instances, %s" % e)

        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, UPDATED_DOMAIN_NAME)
Exemplo n.º 13
0
    def test_05_Update_Network_with_Domain(self):
        """ Verify update NetworkDomain for InternalDns on Isolated Network
        with ping VM
        """

        # 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. Update Network domain and verify it is properly updated

        # update Network Domain at zone level
        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)

        update_response = Network.update(
            network_1, self.apiclient, id=network_1.id,
            networkdomain=UPDATED_DOMAIN_NAME, changecidr=False)
        completeoutput = str(update_response).strip('[]')
        self.debug("network update response is " + completeoutput)
        self.assertEqual(UPDATED_DOMAIN_NAME, update_response.networkdomain,
                         "Network Domain is not updated as expected"
                         )
        self.verify_vsd_dhcp_option(self.DNS, "10.1.1.2", network_1)
        self.verify_vsd_dhcp_option(self.DOMAINNAME, UPDATED_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, UPDATED_DOMAIN_NAME, nic, True)
            self.verify_vsd_dhcp_option(self.HOSTNAME, "vm1", nic, True)

        # stop and start VM to get new DHCP option
        try:
            vm_1.stop(self.apiclient)
        except Exception as e:
            self.fail("Failed to stop the virtual instances, %s" % e)

        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, UPDATED_DOMAIN_NAME, nic, True)
            self.verify_vsd_dhcp_option(self.HOSTNAME, "vm2", nic, True)

        try:
            vm_1.start(self.apiclient)
        except Exception as e:
            self.fail("Failed to start the virtual instances, %s" % e)

        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, UPDATED_DOMAIN_NAME)
Exemplo n.º 14
0
    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)

        # Restarting VPC (cleanup = false)
        self.debug("Restarting the VPC without cleanup...")
        self.restart_Vpc(vpc, 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.vm_verify_ping(vm_1, public_ip_1, vm_2, VPC_DOMAIN_NAME)

        # Restarting VPC (cleanup = true)
        self.debug("Restarting the VPC with cleanup...")
        self.restart_Vpc(vpc, 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.vm_verify_ping(vm_1, public_ip_1, vm_2, VPC_DOMAIN_NAME)
Exemplo n.º 15
0
    def test_06_VPC_Network_With_InternalDns(self):
        """ Verify InternalDns on VPC Network by ping with 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

        cmd = updateZone.updateZoneCmd()
        cmd.id = self.zone.id
        cmd.domain = "vpc.com"
        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.com", 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.com", 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.com", 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)
        vm_public_ip = public_ip_1.ipaddress.ipaddress

        try:
            vm_1.ssh_ip = vm_public_ip
            vm_1.ssh_port = self.test_data["virtual_machine"]["ssh_port"]
            vm_1.username = self.test_data["virtual_machine"]["username"]
            vm_1.password = self.test_data["virtual_machine"]["password"]
            self.debug("SSHing into VM: %s with %s" %
                       (vm_1.ssh_ip, vm_1.password))

            ssh = vm_1.get_ssh_client(ipaddress=vm_public_ip)

        except Exception as e:
            self.fail("SSH into VM failed with exception %s" % e)

        cmd = 'ping -c 2 vm2'
        self.debug("ping vm2 by hostname with command: " + cmd)
        outputlist = ssh.execute(cmd)
        self.debug("command is executed properly " + cmd)
        completeoutput = str(outputlist).strip('[]')
        self.debug("complete output is " + completeoutput)
        expectedlist = ['2 received', 'vm2.vpc.com', vm_2.ipaddress]
        for item in expectedlist:
            if item in completeoutput:
                self.debug("excepted value found in vm: " + item)
            else:
                self.fail("excepted value not found in vm: " + item)
Exemplo n.º 16
0
    def test_04_Update_Network_with_Domain(self):
        """ Verify update NetworkDomain for InternalDns on Isolated Network
        with ping VM
        """

        # 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. Update Network domain and verify it is properly updated

        # update Network Domain at zone level
        cmd = updateZone.updateZoneCmd()
        cmd.id = self.zone.id
        cmd.domain = "isolated.com"
        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.com", 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.com", nic,
                                        True)
            self.verify_vsd_dhcp_option(self.HOSTNAME, "vm1", nic, True)

        update_response = Network.update(network_1,
                                         self.apiclient,
                                         id=network_1.id,
                                         networkdomain="update.com",
                                         changecidr=False)
        completeoutput = str(update_response).strip('[]')
        self.debug("network update response is " + completeoutput)
        self.assertEqual("update.com", update_response.networkdomain,
                         "Network Domain is not updated as expected")
        self.verify_vsd_dhcp_option(self.DNS, "10.1.1.2", network_1)
        self.verify_vsd_dhcp_option(self.DOMAINNAME, "update.com", 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, "update.com", nic,
                                        True)
            self.verify_vsd_dhcp_option(self.HOSTNAME, "vm1", nic, True)

        # stop and start VM to get new DHCP option
        try:
            vm_1.stop(self.apiclient)
        except Exception as e:
            self.fail("Failed to stop the virtual instances, %s" % e)

        try:
            vm_1.start(self.apiclient)
        except Exception as e:
            self.fail("Failed to start the virtual instances, %s" % e)

        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, "update.com", 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)

        vm_public_ip = public_ip_1.ipaddress.ipaddress

        try:
            vm_1.ssh_ip = vm_public_ip
            vm_1.ssh_port = self.test_data["virtual_machine"]["ssh_port"]
            vm_1.username = self.test_data["virtual_machine"]["username"]
            vm_1.password = self.test_data["virtual_machine"]["password"]
            self.debug("SSHing into VM: %s with %s" %
                       (vm_1.ssh_ip, vm_1.password))

            ssh = vm_1.get_ssh_client(ipaddress=vm_public_ip)

        except Exception as e:
            self.fail("SSH into VM failed with exception: %s " % e)

        cmd = 'ping -c 2 vm2'
        self.debug("ping vm2 by hostname with command: " + cmd)
        outputlist = ssh.execute(cmd)
        self.debug("command is executed properly " + cmd)
        completeoutput = str(outputlist).strip('[]')
        self.debug("complete output is " + completeoutput)
        expectedlist = ['2 received', 'vm2.update.com', vm_2.ipaddress]
        for item in expectedlist:
            if item in completeoutput:
                self.debug("excepted value found in vm: " + item)
            else:
                self.fail("excepted value not found in vm: " + item)
Exemplo n.º 17
0
    def test_02_Isolated_Network(self):
        """ Verify InternalDns on Isolated Network with 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

        cmd = updateZone.updateZoneCmd()
        cmd.id = self.zone.id
        cmd.domain = "isolated.com"
        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.com", 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.com", 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.com", 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)

        vm_public_ip = public_ip_1.ipaddress.ipaddress

        try:
            vm_1.ssh_ip = vm_public_ip
            vm_1.ssh_port = self.test_data["virtual_machine"]["ssh_port"]
            vm_1.username = self.test_data["virtual_machine"]["username"]
            vm_1.password = self.test_data["virtual_machine"]["password"]
            self.debug("SSHing into VM: %s with %s" %
                       (vm_1.ssh_ip, vm_1.password))

            ssh = vm_1.get_ssh_client(ipaddress=vm_public_ip)

        except Exception as e:
            self.fail("SSH into VM failed with exception %s" % e)

        cmd = 'ping -c 2 vm2'
        self.debug("ping vm2 by hostname with command: " + cmd)
        outputlist = ssh.execute(cmd)
        self.debug("command is executed properly " + cmd)
        completeoutput = str(outputlist).strip('[]')
        self.debug("complete output is " + completeoutput)
        expectedlist = ['2 received', 'vm2.isolated.com', vm_2.ipaddress]
        for item in expectedlist:
            if item in completeoutput:
                self.debug("excepted value found in vm: " + item)
            else:
                self.fail("excepted value not found in vm: " + item)
    def test_01_disable_enable_zone(self):
        """disable enable zone
            1. Disable zone and verify following things:
                For admin user:
                    1. Should be create to start/stop exsiting vms
                    2. Should be create to deploy new vm, snapshot,volume,
                       template,iso in the same zone
                For Non-admin user:
                    1. Should be create to start/stop exsiting vms
                    2. Should not be create to deploy new vm, snapshot,volume,
                       template,iso in the same zone
            2. Enable the above disabled zone and verify that:
                -All users should be create to deploy new vm,
                    snapshot,volume,template,iso in the same zone
            3. Try to delete the zone and it should fail with error message:
                -"The zone is not deletable because there are
                    servers running in this zone"
        """
        # Step 1
        vm_user = VirtualMachine.create(
            self.userapiclient,
            self.testdata["small"],
            templateid=self.template.id,
            accountid=self.account.name,
            domainid=self.account.domainid,
            serviceofferingid=self.service_offering.id,
            zoneid=self.zone.id
        )

        vm_root = VirtualMachine.create(
            self.apiclient,
            self.testdata["small"],
            templateid=self.template.id,
            accountid=self.account.name,
            domainid=self.account.domainid,
            serviceofferingid=self.service_offering.id,
            zoneid=self.zone.id
        )

        cmd = updateZone.updateZoneCmd()
        cmd.id = self.zone.id
        cmd.allocationstate = DISABLED
        self.apiclient.updateZone(cmd)
        zoneList = Zone.list(self.apiclient, id=self.zone.id)

        self.assertEqual(zoneList[0].allocationstate,
                         DISABLED,
                         "Check if the zone is in disabled state"
                         )

        # Both user and admin vms shoul be running
        self.assertEqual(vm_user.state,
                         RUNNING,
                         "Verify that the user vm is running")

        self.assertEqual(vm_root.state,
                         RUNNING,
                         "Verify that the admin vm is running")

        vm_root.stop(self.apiclient)
        vm_user.stop(self.apiclient)

        root_state = self.dbclient.execute(
            "select state from vm_instance where name='%s'" %
            vm_root.name)[0][0]

        user_state = self.dbclient.execute(
            "select state from vm_instance where name='%s'" %
            vm_user.name)[0][0]

        self.assertEqual(root_state,
                         STOPPED,
                         "verify that vm is Stopped")

        self.assertEqual(user_state,
                         STOPPED,
                         "verify that vm is stopped")

        root_volume = list_volumes(
            self.userapiclient,
            virtualmachineid=vm_root.id,
            type='ROOT',
            listall=True
        )

        snap = Snapshot.create(
            self.apiclient,
            root_volume[0].id)

        self.assertNotEqual(snap,
                            None,
                            "Verify that admin should be \
                                    able to create snapshot")

        snapshots = list_snapshots(
            self.apiclient,
            volumeid=root_volume[0].id,
            listall=True)

        template_from_snapshot = Template.create_from_snapshot(
            self.apiclient,
            snapshots[0],
            self.testdata["privatetemplate"])

        self.assertNotEqual(
            template_from_snapshot,
            None,
            "Verify that admin should be able to create template"
        )

        builtin_info = get_builtin_template_info(self.apiclient, self.zone.id)
        self.testdata["privatetemplate"]["url"] = builtin_info[0]
        self.testdata["privatetemplate"]["hypervisor"] = builtin_info[1]
        self.testdata["privatetemplate"]["format"] = builtin_info[2]

        template_regis = Template.register(
            self.apiclient,
            self.testdata["privatetemplate"],
            zoneid=self.zone.id)

        self.assertNotEqual(
            template_regis,
            None,
            "Check if template gets created"
        )
        self.assertNotEqual(
            template_from_snapshot,
            None,
            "Check if template gets created"
        )

        data_volume = Volume.create(
            self.apiclient,
            self.testdata["volume"],
            zoneid=self.zone.id,
            account=self.account.name,
            domainid=self.account.domainid,
            diskofferingid=self.disk_offering.id
        )
        self.assertNotEqual(
            data_volume,
            None,
            "Check if volume gets created"
        )

        ISO = Iso.create(
            self.apiclient,
            self.testdata["iso2"],
            zoneid=self.zone.id,
            account=self.account.name,
            domainid=self.account.domainid,
        )

        self.assertNotEqual(
            ISO,
            None,
            "Check if volume gets created"
        )
        # non-admin user should fail to create vm, snap, temp etc
        with self.assertRaises(Exception):
            VirtualMachine.create(self.userapiclient,
                                  self.testdata["small"],
                                  templateid=self.template.id,
                                  accountid=self.account.name,
                                  domainid=self.account.domainid,
                                  serviceofferingid=self.service_offering.id,
                                  zoneid=self.zone.id
                                  )

        root_volume = list_volumes(
            self.userapiclient,
            virtualmachineid=vm_user.id,
            type='ROOT',
            listall=True
        )

        with self.assertRaises(Exception):
            snap = Snapshot.create(
                self.userapiclient,
                root_volume[0].id)

        with self.assertRaises(Exception):
            Template.register(
                self.userapiclient,
                self.testdata["privatetemplate"],
                zoneid=self.zone.id)

        with self.assertRaises(Exception):
            Volume.create(
                self.userapiclient,
                self.testdata["volume"],
                zoneid=self.zone.id,
                account=self.account.name,
                domainid=self.account.domainid,
                diskofferingid=self.disk_offering.id
            )

        with self.assertRaises(Exception):
            ISO = Iso.create(
                self.userapiclient,
                self.testdata["iso2"],
                zoneid=self.zone.id,
                account=self.account.name,
                domainid=self.account.domainid,
            )

        # Step 2
        cmd.allocationstate = ENABLED
        self.apiclient.updateZone(cmd)

        # After enabling the zone all users should be able to add new VM,
        # volume, template and iso

        root_vm_new = VirtualMachine.create(
            self.apiclient,
            self.testdata["small"],
            templateid=self.template.id,
            accountid=self.account.name,
            domainid=self.account.domainid,
            serviceofferingid=self.service_offering.id,
            zoneid=self.zone.id
        )

        self.assertNotEqual(root_vm_new,
                            None,
                            "Verify that admin should create new VM")

        snap = Snapshot.create(
            self.apiclient,
            root_volume[0].id)

        self.assertNotEqual(snap,
                            None,
                            "Verify that admin should snashot")

        snapshots = list_snapshots(
            self.apiclient,
            volumeid=root_volume[0].id,
            listall=True)

        template_from_snapshot = Template.create_from_snapshot(
            self.apiclient,
            snapshots[0],
            self.testdata["privatetemplate"])

        self.assertNotEqual(
            template_from_snapshot,
            None,
            "Check if template gets created"
        )

        template_regis = Template.register(
            self.apiclient,
            self.testdata["privatetemplate"],
            zoneid=self.zone.id)

        self.assertNotEqual(
            template_regis,
            None,
            "Check if template gets created"
        )
        self.assertNotEqual(
            template_from_snapshot,
            None,
            "Check if template gets created"
        )

        data_volume = Volume.create(
            self.apiclient,
            self.testdata["volume"],
            zoneid=self.zone.id,
            account=self.account.name,
            domainid=self.account.domainid,
            diskofferingid=self.disk_offering.id
        )
        self.assertNotEqual(
            data_volume,
            None,
            "Check if volume gets created"
        )

        ISO = Iso.create(
            self.apiclient,
            self.testdata["iso2"],
            zoneid=self.zone.id,
            account=self.account.name,
            domainid=self.account.domainid,
        )

        self.assertNotEqual(
            ISO,
            None,
            "Check if volume gets created"
        )
        root_vm_new.delete(self.apiclient)
        # Non root user
        user_vm_new = VirtualMachine.create(
            self.userapiclient,
            self.testdata["small"],
            templateid=self.template.id,
            accountid=self.account.name,
            domainid=self.account.domainid,
            serviceofferingid=self.service_offering.id,
            zoneid=self.zone.id
        )

        self.assertNotEqual(user_vm_new,
                            None,
                            "Verify that admin should create new VM")

        snap = Snapshot.create(
            self.userapiclient,
            root_volume[0].id)

        self.assertNotEqual(snap,
                            None,
                            "Verify that admin should snashot")

        snapshots = list_snapshots(
            self.userapiclient,
            volumeid=root_volume[0].id,
            listall=True)

        template_regis = Template.register(
            self.userapiclient,
            self.testdata["privatetemplate"],
            zoneid=self.zone.id)

        self.assertNotEqual(
            template_regis,
            None,
            "Check if template gets created"
        )
        self.assertNotEqual(
            template_from_snapshot,
            None,
            "Check if template gets created"
        )

        data_volume = Volume.create(
            self.userapiclient,
            self.testdata["volume"],
            zoneid=self.zone.id,
            account=self.account.name,
            domainid=self.account.domainid,
            diskofferingid=self.disk_offering.id
        )
        self.assertNotEqual(
            data_volume,
            None,
            "Check if volume gets created"
        )

        ISO = Iso.create(
            self.userapiclient,
            self.testdata["iso2"],
            zoneid=self.zone.id,
            account=self.account.name,
            domainid=self.account.domainid,
        )

        self.assertNotEqual(
            ISO,
            None,
            "Check if volume gets created"
        )
        user_vm_new.delete(self.apiclient)

        # Step 3
        # Deletion of zone should fail if vm,volume is present on the zone
        with self.assertRaises(Exception):
            self.zone.delete(self.apiclient)

        return
Exemplo n.º 19
0
    def test_02_nuage_mngd_subnets_vpc(self):
        """Test Nuage VSP Managed Subnets for vpc and tier networks
        """

        # 1. Create multiple L3DomainTemplate with Zone and Subnet on VSP
        #    Create Ingress & Egress ACL Top & Bottom Templates
        #    Add ACL rules to allow intra-subnet traffic
        #    Instiantiate these L3Domains and store its Subnet VSD ID
        # 2. Create a vpc network offering and create a VPC
        #    create vpc tier network offerings with and without VirtualRouter
        # 3. Create vpc tier networks specifying above offerings and
        #    specifying the stored Subnet ID's of VSP
        # 4. Verify ACL rules and connectivity via deploying VM's ,
        #    Enabling staticNAT, applying firewall and egress rules
        # 5. Verify negative tests like uniqueness of vsd subnet

        # Create all items on vsd required for this test
        enterprise = self.fetch_by_externalID(self._session.user.enterprises,
                                              self.domain)
        domain_template = self.create_vsd_domain_template(enterprise)

        self.create_vsd_default_acls(domain_template)

        domain1 = self.create_vsd_domain(domain_template, enterprise,
                                         "L3DomainToBeConsumedByACS")
        zone1 = self.create_vsd_zone(domain1, "ZoneToBeConsumedByACS")
        subnet1 = self.create_vsd_subnet(zone1, "SubnetToBeConsumedByACS",
                                         "10.1.0.1/24")
        subnet2 = self.create_vsd_subnet(zone1, "2ndSubnetToBeConsumedByACS",
                                         "10.1.128.1/24")

        domain2 = self.create_vsd_domain(domain_template, enterprise,
                                         "2ndL3DomainToBeConsumedByACS")
        zone2 = self.create_vsd_zone(domain2, "2ndZoneToBeConsumedByACS")
        subnet3 = self.create_vsd_subnet(zone2, "3rdSubnetToBeConsumedByACS",
                                         "10.2.128.1/24")

        cmd = updateZone.updateZoneCmd()
        cmd.id = self.zone.id
        cmd.domain = "vpc.com"
        self.api_client.updateZone(cmd)
        self.debug("Creating a VPC with Static NAT service provider as "
                   "VpcVirtualRouter")
        vpc = self.create_Vpc(self.nuage_vpc_offering, cidr='10.1.0.0/16')
        self.validate_Vpc(vpc, state="Enabled")
        acl_list = self.create_NetworkAclList(
            name="acl", description="acl", vpc=vpc)
        self.create_NetworkAclRule(
            self.test_data["ingress_rule"], acl_list=acl_list)
        self.create_NetworkAclRule(
            self.test_data["icmprule"], acl_list=acl_list)

        self.debug("Creating another VPC with Static NAT service provider "
                   "as VpcVirtualRouter")
        vpc2 = self.create_Vpc(self.nuage_vpc_offering, cidr='10.2.0.0/16')
        self.validate_Vpc(vpc2, state="Enabled")
        acl_list2 = self.create_NetworkAclList(
                name="acl", description="acl", vpc=vpc2)
        self.create_NetworkAclRule(
                self.test_data["ingress_rule"], acl_list=acl_list2)
        self.create_NetworkAclRule(
                self.test_data["icmprule"], acl_list=acl_list2)

        self.debug("Creating an unmanaged VPC tier network with Static NAT")
        vpc2_tier_unmngd = self.create_Network(self.nuage_vpc_network_offering,
                                               gateway='10.2.0.1',
                                               vpc=vpc2,
                                               acl_list=acl_list2)
        self.validate_Network(vpc2_tier_unmngd, state="Implemented")

        # VPC Tier Network creation should fail as VPC is unmanaged already
        with self.assertRaises(Exception):
            self.create_Network(self.nuage_vpc_network_offering,
                                gateway='10.2.128.1',
                                vpc=vpc2,
                                acl_list=acl_list2,
                                externalid=subnet3.id)

        vpc2_tier_unmngd.delete(self.api_client)
        vpc2.delete(self.api_client)

        # VPC tier network creation fails when cidr does not match on VSD
        with self.assertRaises(Exception):
            self.create_Network(self.nuage_vpc_network_offering,
                                gateway='10.1.1.1',
                                vpc=vpc,
                                acl_list=acl_list,
                                externalid=subnet1.id)

        for i in range(1, 3):
            self.debug("Creating a mngd VPC tier with Static NAT service")
            vpc_tier = self.create_Network(self.nuage_vpc_network_offering,
                                           gateway='10.1.0.1',
                                           vpc=vpc,
                                           acl_list=acl_list,
                                           externalid=subnet1.id,
                                           cleanup=False)
            self.validate_Network(vpc_tier, state="Implemented")
            self.debug("Creating 2nd VPC tier network with Static NAT service")

            # VPC 2nd tier creation fails when cidr doesn't match on VSD
            with self.assertRaises(Exception):
                self.create_Network(self.nuage_vpc_network_offering,
                                    gateway='10.1.129.1',
                                    vpc=vpc,
                                    acl_list=acl_list,
                                    externalid=subnet2.id)

            vpc_2ndtier = self.create_Network(self.nuage_vpc_network_offering,
                                              gateway='10.1.128.1',
                                              vpc=vpc,
                                              acl_list=acl_list,
                                              externalid=subnet2.id,
                                              cleanup=False)
            self.validate_Network(vpc_2ndtier, state="Implemented")
            vpc_vr = self.get_Router(vpc_tier)
            self.check_Router_state(vpc_vr, state="Running")

            # VSD verification
            self.verify_vsd_network_not_present(vpc_tier, vpc)
            self.verify_vsd_network_not_present(vpc_2ndtier, vpc)

            # On ACS create VPCTier network when VSDSubnet is already in use
            with self.assertRaises(Exception):
                self.create_Network(self.nuage_vpc_network_offering,
                                    gateway='10.1.128.1',
                                    vpc=vpc,
                                    acl_list=acl_list,
                                    externalid=subnet2.id)

            # On ACS create VPCTier network when VSDSubnet does not exist
            with self.assertRaises(Exception):
                self.create_Network(self.nuage_vpc_network_offering,
                                    gateway='10.1.128.1',
                                    vpc=vpc,
                                    acl_list=acl_list,
                                    externalid=subnet2.id+1)

            # On ACS create VPCTier network without VSDSubnet should fail
            with self.assertRaises(Exception):
                self.create_Network(self.nuage_vpc_network_offering,
                                    gateway='10.1.203.1',
                                    vpc=vpc,
                                    acl_list=acl_list)

            self.debug("Creating another VPC with Static NAT service provider "
                       "as VpcVirtualRouter With same CIDR")
            vpc3 = self.create_Vpc(self.nuage_vpc_offering, cidr='10.1.0.0/16')
            self.validate_Vpc(vpc3, state="Enabled")
            acl_list3 = self.create_NetworkAclList(
                    name="acl", description="acl", vpc=vpc3)
            self.create_NetworkAclRule(
                    self.test_data["ingress_rule"], acl_list=acl_list3)
            self.create_NetworkAclRule(
                    self.test_data["icmprule"], acl_list=acl_list3)

            self.debug("Creating a mngd VPC tier with Static NAT service")
            vpc3_tier_unmngd = \
                self.create_Network(self.nuage_vpc_network_offering,
                                    gateway='10.1.0.1',
                                    vpc=vpc3,
                                    acl_list=acl_list3)
            self.validate_Network(vpc3_tier_unmngd, state="Implemented")
            vpc3_tier_unmngd.delete(self.api_client)
            vpc3.delete(self.api_client)

            self.debug("Deploying a VM in the created VPC tier network")
            self.test_data["virtual_machine"]["displayname"] = "vpcvm1"
            self.test_data["virtual_machine"]["name"] = "vpcvm1"
            vpc_vm_1 = self.create_VM(vpc_tier, cleanup=False)
            self.check_VM_state(vpc_vm_1, state="Running")
            self.debug("Deploying another VM in the created VPC tier network")
            self.test_data["virtual_machine"]["displayname"] = "vpcvm2"
            self.test_data["virtual_machine"]["name"] = "vpcvm2"
            vpc_vm_2 = self.create_VM(vpc_tier, cleanup=False)
            self.check_VM_state(vpc_vm_2, state="Running")
            self.debug("Deploying a VM in the 2nd VPC tier network")
            self.test_data["virtual_machine"]["displayname"] = "vpcvm12"
            self.test_data["virtual_machine"]["name"] = "vpcvm12"
            vpc_vm_12 = self.create_VM(vpc_2ndtier, cleanup=False)
            self.check_VM_state(vpc_vm_2, state="Running")
            self.test_data["virtual_machine"]["displayname"] = None
            self.test_data["virtual_machine"]["name"] = None

            # VSD verification
            self.verify_vsdmngd_vm(vpc_vm_1, subnet1)
            self.verify_vsdmngd_vm(vpc_vm_2, subnet1)
            self.verify_vsdmngd_vm(vpc_vm_12, subnet2)

            self.debug("Creating Static NAT rule for the deployed VM "
                       "in the created VPC network...")
            public_ip_1 = self.acquire_PublicIPAddress(vpc_tier, vpc=vpc)
            self.validate_PublicIPAddress(public_ip_1, vpc_tier)
            self.create_StaticNatRule_For_VM(vpc_vm_1, public_ip_1, vpc_tier)
            self.validate_PublicIPAddress(
                    public_ip_1, vpc_tier, static_nat=True, vm=vpc_vm_1)

            self.verify_ping_to_vm(vpc_vm_1, vpc_vm_2, public_ip_1)
            self.verify_ping_to_vm(vpc_vm_1, vpc_vm_12, public_ip_1)

            vpc_vm_1.delete(self.api_client, expunge=True)
            vpc_vm_2.delete(self.api_client, expunge=True)
            vpc_vm_12.delete(self.api_client, expunge=True)
            vpc_tier.delete(self.api_client)
            vpc_2ndtier.delete(self.api_client)
            self.debug("Number of loops %s" % i)
    def test_01_disable_enable_zone(self):
        """disable enable zone
            1. Disable zone and verify following things:
                For admin user:
                    1. Should be create to start/stop exsiting vms
                    2. Should be create to deploy new vm, snapshot,volume,
                       template,iso in the same zone
                For Non-admin user:
                    1. Should be create to start/stop exsiting vms
                    2. Should not be create to deploy new vm, snapshot,volume,
                       template,iso in the same zone
            2. Enable the above disabled zone and verify that:
                -All users should be create to deploy new vm,
                    snapshot,volume,template,iso in the same zone
            3. Try to delete the zone and it should fail with error message:
                -"The zone is not deletable because there are
                    servers running in this zone"
        """
        # Step 1
        vm_user = VirtualMachine.create(
            self.userapiclient,
            self.testdata["small"],
            templateid=self.template.id,
            accountid=self.account.name,
            domainid=self.account.domainid,
            serviceofferingid=self.service_offering.id,
            zoneid=self.zone.id,
        )

        vm_root = VirtualMachine.create(
            self.apiclient,
            self.testdata["small"],
            templateid=self.template.id,
            accountid=self.admin_account.name,
            domainid=self.admin_account.domainid,
            serviceofferingid=self.service_offering.id,
            zoneid=self.zone.id,
        )

        cmd = updateZone.updateZoneCmd()
        cmd.id = self.zone.id
        cmd.allocationstate = DISABLED
        self.apiclient.updateZone(cmd)
        zoneList = Zone.list(self.apiclient, id=self.zone.id)

        self.assertEqual(zoneList[0].allocationstate, DISABLED, "Check if the zone is in disabled state")

        # Both user and admin vms shoul be running
        self.assertEqual(vm_user.state.lower(), "running", "Verify that the user vm is running")

        self.assertEqual(vm_root.state.lower(), "running", "Verify that the admin vm is running")

        vm_root.stop(self.apiclient)
        vm_user.stop(self.apiclient)

        root_state = self.dbclient.execute("select state from vm_instance where name='%s'" % vm_root.name)[0][0]

        user_state = self.dbclient.execute("select state from vm_instance where name='%s'" % vm_user.name)[0][0]

        self.assertEqual(root_state.lower(), "stopped", "verify that vm is Stopped")

        self.assertEqual(user_state.lower(), "stopped", "verify that vm is stopped")

        root_volume = list_volumes(self.apiclient, virtualmachineid=vm_root.id, type="ROOT", listall=True)

        self.assertEqual(validateList(root_volume)[0], PASS, "list volume  is empty for vmid %s" % vm_root.id)
        root_vm_new = VirtualMachine.create(
            self.apiclient,
            self.testdata["small"],
            templateid=self.template.id,
            accountid=self.admin_account.name,
            domainid=self.admin_account.domainid,
            serviceofferingid=self.service_offering.id,
            zoneid=self.zone.id,
        )

        self.assertEqual(root_vm_new.state.lower(), "running", "Verify that admin should create new VM")

        if self.snapshotSupported:
            Snapshot.create(self.apiclient, root_volume[0].id)

            snapshots = list_snapshots(self.apiclient, volumeid=root_volume[0].id, listall=True)

            self.assertEqual(
                validateList(snapshots)[0], PASS, "list snapshot  is empty for volume id %s" % root_volume[0].id
            )

            Template.create_from_snapshot(self.apiclient, snapshots[0], self.testdata["privatetemplate"])

        builtin_info = get_builtin_template_info(self.apiclient, self.zone.id)
        self.testdata["privatetemplate"]["url"] = builtin_info[0]
        self.testdata["privatetemplate"]["hypervisor"] = builtin_info[1]
        self.testdata["privatetemplate"]["format"] = builtin_info[2]
        """
        //commenting it for now will uncomment  once expected behaviour is known
        Template.register(
            self.apiclient,
            self.testdata["privatetemplate"],
            zoneid=self.zone.id)
        """
        Volume.create(
            self.apiclient,
            self.testdata["volume"],
            zoneid=self.zone.id,
            account=self.admin_account.name,
            domainid=self.admin_account.domainid,
            diskofferingid=self.disk_offering.id,
        )
        """
        //commenting it for now will uncomment  once expected behaviour is known
        Iso.create(
            self.apiclient,
            self.testdata["iso2"],
            zoneid=self.zone.id,
            account=self.admin_account.name,
            domainid=self.admin_account.domainid,
        )
        """
        # non-admin user should fail to create vm, snap, temp etc
        with self.assertRaises(Exception):
            VirtualMachine.create(
                self.userapiclient,
                self.testdata["small"],
                templateid=self.template.id,
                accountid=self.account.name,
                domainid=self.account.domainid,
                serviceofferingid=self.service_offering.id,
                zoneid=self.zone.id,
            )

        root_volume = list_volumes(self.userapiclient, virtualmachineid=vm_user.id, type="ROOT", listall=True)
        self.assertEqual(validateList(root_volume)[0], PASS, "list volume  is empty for vmid id %s" % vm_user.id)

        if self.snapshotSupported:
            with self.assertRaises(Exception):
                Snapshot.create(self.userapiclient, root_volume[0].id)

        with self.assertRaises(Exception):
            Template.register(self.userapiclient, self.testdata["privatetemplate"], zoneid=self.zone.id)

        with self.assertRaises(Exception):
            Volume.create(
                self.userapiclient,
                self.testdata["volume"],
                zoneid=self.zone.id,
                account=self.account.name,
                domainid=self.account.domainid,
                diskofferingid=self.disk_offering.id,
            )

        with self.assertRaises(Exception):
            Iso.create(
                self.userapiclient,
                self.testdata["iso2"],
                zoneid=self.zone.id,
                account=self.account.name,
                domainid=self.account.domainid,
            )

        # Step 2
        cmd.allocationstate = ENABLED
        self.apiclient.updateZone(cmd)

        # After enabling the zone all users should be able to add new VM,
        # volume, template and iso

        root_vm_new = VirtualMachine.create(
            self.apiclient,
            self.testdata["small"],
            templateid=self.template.id,
            accountid=self.admin_account.name,
            domainid=self.admin_account.domainid,
            serviceofferingid=self.service_offering.id,
            zoneid=self.zone.id,
        )

        self.assertEqual(root_vm_new.state.lower(), "running", "Verify that admin should create new VM")

        if self.snapshotSupported:
            Snapshot.create(self.apiclient, root_volume[0].id)

            snapshots = list_snapshots(self.apiclient, volumeid=root_volume[0].id, listall=True)

            self.assertEqual(
                validateList(snapshots)[0], PASS, "list snapshot  is empty for volume id %s" % root_volume[0].id
            )

            Template.create_from_snapshot(self.apiclient, snapshots[0], self.testdata["privatetemplate"])

        Template.register(self.apiclient, self.testdata["privatetemplate"], zoneid=self.zone.id)

        Volume.create(
            self.apiclient,
            self.testdata["volume"],
            zoneid=self.zone.id,
            account=self.admin_account.name,
            domainid=self.admin_account.domainid,
            diskofferingid=self.disk_offering.id,
        )

        Iso.create(
            self.apiclient,
            self.testdata["iso2"],
            zoneid=self.zone.id,
            account=self.admin_account.name,
            domainid=self.admin_account.domainid,
        )

        # Non root user
        user_vm_new = VirtualMachine.create(
            self.userapiclient,
            self.testdata["small"],
            templateid=self.template.id,
            accountid=self.account.name,
            domainid=self.account.domainid,
            serviceofferingid=self.service_offering.id,
            zoneid=self.zone.id,
        )

        self.assertEqual(user_vm_new.state.lower(), "running", "Verify that admin should create new VM")

        if self.snapshotSupported:
            Snapshot.create(self.userapiclient, root_volume[0].id)

            snapshots = list_snapshots(self.userapiclient, volumeid=root_volume[0].id, listall=True)

            self.assertEqual(
                validateList(snapshots)[0], PASS, "list snapshot  is empty for volume id %s" % root_volume[0].id
            )

        Template.register(self.userapiclient, self.testdata["privatetemplate"], zoneid=self.zone.id)

        Volume.create(
            self.userapiclient,
            self.testdata["volume"],
            zoneid=self.zone.id,
            account=self.account.name,
            domainid=self.account.domainid,
            diskofferingid=self.disk_offering.id,
        )
        Iso.create(
            self.userapiclient,
            self.testdata["iso2"],
            zoneid=self.zone.id,
            account=self.account.name,
            domainid=self.account.domainid,
        )

        # Step 3
        # Deletion of zone should fail if vm,volume is present on the zone
        with self.assertRaises(Exception):
            self.zone.delete(self.apiclient)

        return
Exemplo n.º 21
0
    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)

        # Restarting VPC (cleanup = false)
        self.debug("Restarting the VPC without cleanup...")
        self.restart_Vpc(vpc, 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.vm_verify_ping(vm_1, public_ip_1, vm_2, VPC_DOMAIN_NAME)

        # Restarting VPC (cleanup = true)
        self.debug("Restarting the VPC with cleanup...")
        self.restart_Vpc(vpc, 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.vm_verify_ping(vm_1, public_ip_1, vm_2, VPC_DOMAIN_NAME)
    def test_04_Update_Network_with_Domain(self):
        """ Verify update NetworkDomain for InternalDns on Isolated Network
        with ping VM
        """

        # 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. Update Network domain and verify it is properly updated

        # update Network Domain at zone level
        cmd = updateZone.updateZoneCmd()
        cmd.id = self.zone.id
        cmd.domain = "isolated.com"
        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.com", 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.com", nic, True)
            self.verify_vsd_dhcp_option(self.HOSTNAME, "vm1", nic, True)

        update_response = Network.update(
            network_1, self.apiclient, id=network_1.id,
            networkdomain="update.com", changecidr=False)
        completeoutput = str(update_response).strip('[]')
        self.debug("network update response is " + completeoutput)
        self.assertEqual("update.com", update_response.networkdomain,
                         "Network Domain is not updated as expected"
                         )
        self.verify_vsd_dhcp_option(self.DNS, "10.1.1.2", network_1)
        self.verify_vsd_dhcp_option(self.DOMAINNAME, "update.com", 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, "update.com", nic, True)
            self.verify_vsd_dhcp_option(self.HOSTNAME, "vm1", nic, True)

        # stop and start VM to get new DHCP option
        try:
            vm_1.stop(self.apiclient)
        except Exception as e:
            self.fail("Failed to stop the virtual instances, %s" % e)

        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, "update.com", nic, True)
            self.verify_vsd_dhcp_option(self.HOSTNAME, "vm2", nic, True)

        try:
            vm_1.start(self.apiclient)
        except Exception as e:
            self.fail("Failed to start the virtual instances, %s" % e)

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

        vm_public_ip = public_ip_1.ipaddress.ipaddress

        try:
            vm_1.ssh_ip = vm_public_ip
            vm_1.ssh_port = self.test_data["virtual_machine"]["ssh_port"]
            vm_1.username = self.test_data["virtual_machine"]["username"]
            vm_1.password = self.test_data["virtual_machine"]["password"]
            self.debug("SSHing into VM: %s with %s" %
                       (vm_1.ssh_ip, vm_1.password))

            ssh = vm_1.get_ssh_client(ipaddress=vm_public_ip)

        except Exception as e:
            self.fail("SSH into VM failed with exception: %s " % e)

        cmd = 'ping -c 2 vm2'
        self.debug("ping vm2 by hostname with command: " + cmd)
        outputlist = ssh.execute(cmd)
        self.debug("command is executed properly " + cmd)
        completeoutput = str(outputlist).strip('[]')
        self.debug("complete output is " + completeoutput)
        expectedlist = ['2 received', 'vm2.update.com', vm_2.ipaddress]
        for item in expectedlist:
            if item in completeoutput:
                self.debug("excepted value found in vm: " + item)
            else:
                self.fail("excepted value not found in vm: " + item)
    def test_02_Isolated_Network(self):
        """ Verify InternalDns on Isolated Network with 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

        cmd = updateZone.updateZoneCmd()
        cmd.id = self.zone.id
        cmd.domain = "isolated.com"
        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.com", 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.com", 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.com", 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)

        vm_public_ip = public_ip_1.ipaddress.ipaddress

        try:
            vm_1.ssh_ip = vm_public_ip
            vm_1.ssh_port = self.test_data["virtual_machine"]["ssh_port"]
            vm_1.username = self.test_data["virtual_machine"]["username"]
            vm_1.password = self.test_data["virtual_machine"]["password"]
            self.debug("SSHing into VM: %s with %s" %
                       (vm_1.ssh_ip, vm_1.password))

            ssh = vm_1.get_ssh_client(ipaddress=vm_public_ip)

        except Exception as e:
            self.fail("SSH into VM failed with exception %s" % e)

        cmd = 'ping -c 2 vm2'
        self.debug("ping vm2 by hostname with command: " + cmd)
        outputlist = ssh.execute(cmd)
        self.debug("command is executed properly " + cmd)
        completeoutput = str(outputlist).strip('[]')
        self.debug("complete output is " + completeoutput)
        expectedlist = ['2 received', 'vm2.isolated.com', vm_2.ipaddress]
        for item in expectedlist:
            if item in completeoutput:
                self.debug("excepted value found in vm: " + item)
            else:
                self.fail("excepted value not found in vm: " + item)
    def test_06_VPC_Network_With_InternalDns(self):
        """ Verify InternalDns on VPC Network by ping with 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

        cmd = updateZone.updateZoneCmd()
        cmd.id = self.zone.id
        cmd.domain = "vpc.com"
        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.com", 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.com", 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.com", 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)
        vm_public_ip = public_ip_1.ipaddress.ipaddress

        try:
            vm_1.ssh_ip = vm_public_ip
            vm_1.ssh_port = self.test_data["virtual_machine"]["ssh_port"]
            vm_1.username = self.test_data["virtual_machine"]["username"]
            vm_1.password = self.test_data["virtual_machine"]["password"]
            self.debug("SSHing into VM: %s with %s" %
                       (vm_1.ssh_ip, vm_1.password))

            ssh = vm_1.get_ssh_client(ipaddress=vm_public_ip)

        except Exception as e:
            self.fail("SSH into VM failed with exception %s" % e)

        cmd = 'ping -c 2 vm2'
        self.debug("ping vm2 by hostname with command: " + cmd)
        outputlist = ssh.execute(cmd)
        self.debug("command is executed properly " + cmd)
        completeoutput = str(outputlist).strip('[]')
        self.debug("complete output is " + completeoutput)
        expectedlist = ['2 received', 'vm2.vpc.com', vm_2.ipaddress]
        for item in expectedlist:
            if item in completeoutput:
                self.debug("excepted value found in vm: " + item)
            else:
                self.fail("excepted value not found in vm: " + item)
Exemplo n.º 25
0
    def test_02_nuage_mngd_subnets_vpc(self):
        """Test Nuage VSP Managed Subnets for vpc and tier networks
        """

        # 1. Create multiple L3DomainTemplate with Zone and Subnet on VSP
        #    Create Ingress & Egress ACL Top & Bottom Templates
        #    Add ACL rules to allow intra-subnet traffic
        #    Instiantiate these L3Domains and store its Subnet VSD ID
        # 2. Create a vpc network offering and create a VPC
        #    create vpc tier network offerings with and without VirtualRouter
        # 3. Create vpc tier networks specifying above offerings and
        #    specifying the stored Subnet ID's of VSP
        # 4. Verify ACL rules and connectivity via deploying VM's ,
        #    Enabling staticNAT, applying firewall and egress rules

        # Create all items on vsd required for this test
        enterprise = self.fetch_by_externalID(self._session.user.enterprises,
                                              self.domain)
        domain_template = self.create_vsd_domain_template(enterprise)

        self.create_vsd_default_acls(domain_template)

        domain1 = self.create_vsd_domain(domain_template, enterprise,
                                         "L3DomainToBeConsumedByACS")
        zone1 = self.create_vsd_zone(domain1, "ZoneToBeConsumedByACS")
        subnet1 = self.create_vsd_subnet(zone1, "SubnetToBeConsumedByACS",
                                         "10.1.0.1/24")
        subnet2 = self.create_vsd_subnet(zone1, "2ndSubnetToBeConsumedByACS",
                                         "10.1.128.1/24")

        cmd = updateZone.updateZoneCmd()
        cmd.id = self.zone.id
        cmd.domain = "vpc.com"
        self.api_client.updateZone(cmd)
        self.debug("Creating a VPC with Static NAT service provider as "
                   "VpcVirtualRouter")
        vpc = self.create_Vpc(self.nuage_vpc_offering, cidr='10.1.0.0/16')
        self.validate_Vpc(vpc, state="Enabled")
        acl_list = self.create_NetworkAclList(name="acl",
                                              description="acl",
                                              vpc=vpc)
        self.create_NetworkAclRule(self.test_data["ingress_rule"],
                                   acl_list=acl_list)
        self.create_NetworkAclRule(self.test_data["icmprule"],
                                   acl_list=acl_list)
        self.debug("Creating a VPC tier network with Static NAT service")
        vpc_tier = self.create_Network(self.nuage_vpc_network_offering,
                                       gateway='10.1.0.1',
                                       vpc=vpc,
                                       acl_list=acl_list,
                                       externalid=subnet1.id)
        self.validate_Network(vpc_tier, state="Implemented")
        self.debug("Creating 2nd VPC tier network with Static NAT service")
        vpc_2ndtier = self.create_Network(self.nuage_vpc_network_offering,
                                          gateway='10.1.128.1',
                                          vpc=vpc,
                                          acl_list=acl_list,
                                          externalid=subnet2.id)
        self.validate_Network(vpc_2ndtier, state="Implemented")
        vpc_vr = self.get_Router(vpc_tier)
        self.check_Router_state(vpc_vr, state="Running")

        self.debug("Deploying a VM in the created VPC tier network")
        self.test_data["virtual_machine"]["displayname"] = "vpcvm1"
        self.test_data["virtual_machine"]["name"] = "vpcvm1"
        vpc_vm_1 = self.create_VM(vpc_tier)
        self.check_VM_state(vpc_vm_1, state="Running")
        self.debug("Deploying another VM in the created VPC tier network")
        self.test_data["virtual_machine"]["displayname"] = "vpcvm2"
        self.test_data["virtual_machine"]["name"] = "vpcvm2"
        vpc_vm_2 = self.create_VM(vpc_tier)
        self.check_VM_state(vpc_vm_2, state="Running")
        self.debug("Deploying a VM in the 2nd VPC tier network")
        self.test_data["virtual_machine"]["displayname"] = "vpcvm12"
        self.test_data["virtual_machine"]["name"] = "vpcvm12"
        vpc_vm_12 = self.create_VM(vpc_2ndtier)
        self.check_VM_state(vpc_vm_2, state="Running")
        self.test_data["virtual_machine"]["displayname"] = None
        self.test_data["virtual_machine"]["name"] = None
        self.debug("Creating Static NAT rule for the deployed VM "
                   "in the created VPC network...")
        public_ip_1 = self.acquire_PublicIPAddress(vpc_tier, vpc=vpc)
        self.validate_PublicIPAddress(public_ip_1, vpc_tier)
        self.create_StaticNatRule_For_VM(vpc_vm_1, public_ip_1, vpc_tier)
        self.validate_PublicIPAddress(public_ip_1,
                                      vpc_tier,
                                      static_nat=True,
                                      vm=vpc_vm_1)

        if not self.isSimulator:
            vm_public_ip_1 = public_ip_1.ipaddress.ipaddress
            try:
                vpc_vm_1.ssh_ip = vm_public_ip_1
                vpc_vm_1.ssh_port = \
                    self.test_data["virtual_machine"]["ssh_port"]
                vpc_vm_1.username = \
                    self.test_data["virtual_machine"]["username"]
                vpc_vm_1.password = \
                    self.test_data["virtual_machine"]["password"]
                self.debug("SSHing into VM: %s with %s" %
                           (vpc_vm_1.ssh_ip, vpc_vm_1.password))

                ssh = vpc_vm_1.get_ssh_client(ipaddress=vm_public_ip_1)

            except Exception as e:
                self.fail("SSH into VM failed with exception %s" % e)

            self.verify_pingtovmipaddress(ssh, vpc_vm_2.ipaddress)
            self.verify_pingtovmipaddress(ssh, vpc_vm_12.ipaddress)