def test_05_stop_start_vm_with_multiple_nic(self):
        """ Stop and Start a VM with Multple NIC

            Steps:
            # 1) Create a Vm with multiple NIC's
            # 2) Configure secondary IP's on the VM
            # 3) Try to stop/start the VM
            # 4) Ping the IP's of the vm
            # 5) Remove Secondary IP from one of the NIC
        :return:
        """
        ipaddress1 = NIC.addIp(self.apiclient,
                               id=self.virtual_machine2.nic[0].id)

        ipaddress2 = NIC.addIp(self.apiclient,
                               id=self.virtual_machine2.nic[1].id)
        # Stop the VM with multiple NIC's
        self.virtual_machine2.stop(self.apiclient)

        virtual_machine = VirtualMachine.list(self.apiclient,
                                              id=self.virtual_machine2.id)

        self.assertEqual(virtual_machine[0]['state'], 'Stopped',
                         "Could not stop the VM with multiple NIC's")

        if virtual_machine[0]['state'] == 'Stopped':
            # If stopped then try to start the VM
            self.virtual_machine2.start(self.apiclient)
            virtual_machine = VirtualMachine.list(self.apiclient,
                                                  id=self.virtual_machine2.id)
            self.assertEqual(virtual_machine[0]['state'], 'Running',
                             "Could not start the VM with multiple NIC's")

        self.verify_network_rules(self.virtual_machine2.id)
    def test_04_add_ip_to_remaining_nics(self):
        """ Add secondary IP's to remaining NIC's

            Steps:
            # 1) Create a VM with more than 1 NIC
            # 2)Navigate to Instances-NIC's->Edit Secondary IP's
            # ->Acquire new Secondary IP
            # 3) Add secondary IP to all the NIC's of the VM
            # 4) Confiugre the secondary IP's by referring to "Configure the
            # secondary IP's" in the "Action Item" section
        :return:
        """

        self.virtual_machine1.add_nic(self.apiclient, self.network3.id)

        vms = VirtualMachine.list(self.apiclient, id=self.virtual_machine1.id)

        self.assertIsNotNone(vms[0].nic[2],
                             "Third NIC is not added successfully to the VM")

        vms1_nic1_id = vms[0].nic[1]['id']
        vms1_nic2_id = vms[0].nic[2]['id']

        ipaddress21 = NIC.addIp(self.apiclient, id=vms1_nic1_id)

        ipaddress22 = NIC.addIp(self.apiclient, id=vms1_nic1_id)

        self.assertIsNotNone(
            ipaddress21, "Unable to add first secondary IP to the second nic")
        self.assertIsNotNone(
            ipaddress22, "Unable to add second secondary IP to second NIC")

        ipaddress31 = NIC.addIp(self.apiclient, id=vms1_nic2_id)

        ipaddress32 = NIC.addIp(self.apiclient, id=vms1_nic2_id)

        self.assertIsNotNone(ipaddress31,
                             "Unable to add first secondary IP to third NIC")
        self.assertIsNotNone(ipaddress32,
                             "Unable to add second secondary IP to third NIC")

        self.verify_network_rules(self.virtual_machine1.id)
    def test_03_add_ip_to_default_nic(self):
        """ Add secondary IP's to the VM

            Steps:
            # 1. Create a VM with more than 1 NIC
            # 2) Navigate to Instances->NIC->Edit Secondary IP's
            # ->Aquire new Secondary IP"
            # 3) Add as many secondary Ip as possible to the VM
            # 4) Configure the secondary IP's by referring to "Configure
            # the secondary IP's" in the "Action Item" section
        :return:
        """
        ipaddress = NIC.addIp(self.apiclient,
                              id=self.virtual_machine2.nic[0].id)

        self.assertIsNotNone(ipaddress,
                             "Unable to add secondary IP to the default NIC")

        self.verify_network_rules(self.virtual_machine2.id)