cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sanju1010 <...@git.apache.org>
Subject [GitHub] cloudstack pull request: CLOUDSTACK-8728: Testcase to Verify if VR...
Date Wed, 26 Aug 2015 11:59:02 GMT
Github user sanju1010 commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/684#discussion_r37973271
  
    --- Diff: test/integration/smoke/test_routers.py ---
    @@ -796,3 +830,122 @@ def test_09_reboot_router(self):
                 "Router response after reboot is either is invalid\
                         or in stopped state")
             return
    +
    +    def check_virtual_machine_accessibility(self, virtual_machine):
    +        response = virtual_machine.getState(
    +            self.userapiclient,
    +            VirtualMachine.RUNNING
    +        )
    +        self.assertEqual(response[0], PASS, "Virtual machine is not running")
    +
    +        # Check VM Accessibility
    +        try:
    +            SshClient(host=virtual_machine.ssh_ip,
    +                      port=self.services['natrule']['publicport'],
    +                      user=virtual_machine.username,
    +                      passwd=virtual_machine.password)
    +        except Exception as e:
    +            raise Exception("Error while trying SSH to VM: %s" % e)
    +
    +    def try_ssh_to_host(self):
    +        list_virtual_machine_response = list_virtual_machines(
    +            self.apiclient,
    +            listall=True)
    +        status = validateList(list_virtual_machine_response)
    +        self.assertEqual(
    +            status[0],
    +            PASS,
    +            "VM List Validation Failed due to %s" %
    +            status[2])
    +
    +        host_id = list_virtual_machine_response[0].hostid
    +        list_host_response = list_hosts(self.apiclient, id=host_id)
    +        status = validateList(list_host_response)
    +        self.assertEqual(
    +            status[0],
    +            PASS,
    +            "Host List Validation Failed due to %s" %
    +            status[2])
    +
    +        self.services['hosts'][self.hypervisor.lower()]['password'] = "xenroot"
    +        ssh_object = SshClient(
    +            host=list_host_response[0].ipaddress,
    +            port=self.services['natrule']['publicport'],
    +            user=self.services['hosts'][self.hypervisor.lower()]['username'],
    +            passwd=self.services['hosts'][self.hypervisor.lower()]['password']
    +        )
    +        hostname_from_host = ssh_object.execute("uname -n")
    +        ssh_object.execute("ssh-keygen -R %s" % hostname_from_host[0])
    +        ssh_object.execute("exit")
    +        return ssh_object
    +
    +    def get_inet_address(self, ssh_object):
    +        list_ssvm_response = list_ssvms(
    +            self.apiclient,
    +            systemvmtype='secondarystoragevm'
    +        )
    +        status = validateList(list_ssvm_response)
    +        self.assertEqual(
    +            status[0],
    +            PASS,
    +            "SSVM List Validation Failed due to %s" %
    +            status[2])
    +
    +        command = "ssh  -o StrictHostKeyChecking=no -i /root/.ssh/id_rsa.cloud %s -p
3922 'ifconfig eth0'" \
    +            % list_ssvm_response[0].linklocalip
    +        ssh_response = ssh_object.execute(command)
    +        return ssh_response[1]
    +
    +    @attr(tags=['basic'], required_hardware="true")
    +    def test_10_vr_has_same_ip(self):
    +        """ Check if Virtual Router has same IP after network restart or not.
    +            1. Deploy VM and check it's accessibility
    +            2. Try SSH to host
    +            3. Get link local IP and inet address of SSVM
    +            4. Restart network with cleanup option true
    +            5. Deploy another VM and check it's Inet address
    +        """
    +
    +        # Step 1: Deploy VM and check it's accessibility
    +        self.check_virtual_machine_accessibility(self.vm_1)
    +
    +        # Step 2: Try SSH to host
    +        ssh_object = self.try_ssh_to_host()
    +
    +        # Step 3: Get local IP and inet address of SSVM
    +        inet_address_before_restart = self.get_inet_address(ssh_object)
    +
    +        # Step 4: Restart network with cleanup option true
    +        network_details = list_networks(
    +            self.apiclient,
    +            account=self.account.name
    +        )
    +        status = validateList(network_details)
    +        self.assertEqual(
    +            status[0],
    +            PASS,
    +            "Network List Validation Failed due to %s" %
    +            status[2])
    +
    +        cmd = restartNetwork.restartNetworkCmd()
    +        cmd.id = network_details[0].id
    +        cmd.cleanup = True
    +        self.apiclient.restartNetwork(cmd)
    +
    +        # Step 5: Deploy another VM and check it's inet address
    +        vm_2 = VirtualMachine.create(
    +            self.apiclient,
    +            self.services["virtual_machine"],
    +            templateid=self.template.id,
    +            accountid=self.account.name,
    +            domainid=self.account.domainid,
    +            serviceofferingid=self.service_offering.id,
    +            zoneid=self.zone.id,
    +            mode=self.zone.networktype
    +        )
    +        self.check_virtual_machine_accessibility(vm_2)
    +        ssh_object = self.try_ssh_to_host()
    +        inet_address_after_restart = self.get_inet_address(ssh_object)
    --- End diff --
    
    After network restart we are suppose to verify the VR's IP address not the SSVM ip address.
Can you please double check this test?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message