You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2018/02/20 14:13:04 UTC

[GitHub] dmytro-shevchenko commented on issue #2457: CLOUDSTACK-10295 Marvin: add support for password-enabled templates

dmytro-shevchenko commented on issue #2457: CLOUDSTACK-10295 Marvin: add support for password-enabled templates
URL: https://github.com/apache/cloudstack/pull/2457#issuecomment-366989305
 
 
   Here is result from our test. As testdata['templates']['builtin'] we using password enabled Ubuntu 14.04.
   Test code:
   
       from marvin.cloudstackTestCase import cloudstackTestCase
       from marvin.lib.common import get_zone, get_domain, get_template
       from marvin.lib.base import ServiceOffering, Account, VirtualMachine
       from marvin.lib.utils import cleanup_resources
   
       class TestVMConnectivity(cloudstackTestCase):
   
           @classmethod
           def setUpClass(cls):
               cls.testdata = cls.clstestclient.getParsedTestDataConfig()
               cls.api_client = cls.clstestclient.getApiClient()
               cls.domain = get_domain(cls.api_client)
               cls.zone = get_zone(cls.api_client, cls.clstestclient.getZoneForTests())
               cls.template = get_template(cls.api_client, zone_id=cls.zone.id,
                                           template_name=cls.testdata['templates']['builtin'])
               cls.service_offering = ServiceOffering.list(cls.api_client, name=cls.testdata['offerings']['compute'])[0]
               cls.account = Account.create(cls.api_client, cls.testdata["account"], domainid=cls.domain.id)
               cls.cleanup = [cls.account]
   
           @classmethod
           def tearDownClass(cls):
               cleanup_resources(cls.api_client, cls.cleanup)
   
           def test_vm_connectivity(self):
               self.debug('Creating new VM: {}'.format(self.testdata["virtual_machine"]))
               virtual_machine = VirtualMachine.create(self.api_client, self.testdata["virtual_machine"],
                                                       accountid=self.account.name, domainid=self.account.domainid,
                                                       serviceofferingid=self.service_offering.id,
                                                       templateid=self.template.id, zoneid=self.zone.id,
                                                       mode=self.zone.networktype)
               self.assertTrue(virtual_machine.passwordenabled)
               self.debug('VM name: {}, SSH IP: {}, SSH password: {}'.format(virtual_machine.instancename,
                                                                             virtual_machine.ssh_ip,
                                                                             virtual_machine.password))
               self.debug('Trying to ping 8.8.8.8')
               ssh = virtual_machine.get_ssh_client(ipaddress=virtual_machine.ssh_ip, retries=3)
               response = ssh.execute("ping -c 3 8.8.8.8")
               self.assertIn("0% packet loss", '\n'.join(response))
               self.debug('Ping response: {}'.format('\n'.join(response)))
   
   Here is part of MarvinLogs/8ODF2N/runinfo.txt output:
   
       2018-02-20 16:01:21,117 - DEBUG - ::::::::::::STARTED : TC: test_vm_connectivity :::::::::::
       2018-02-20 16:01:21,117 - DEBUG - Creating new VM: {'username': 'root', 'displayname': 'AutoTest VM', 'ssh_port': 22, 'privateport': 22, 'protocol': 'TCP', 'password': 'password', 'publicport': 22}
       2018-02-20 16:02:31,567 - DEBUG - VM name: i-30-20-VM, SSH IP: 185.39.*.*, SSH password: J8gkqU
       2018-02-20 16:02:31,567 - DEBUG - Trying to ping 8.8.8.8
       2018-02-20 16:02:34,471 - DEBUG - Ping response: PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
       64 bytes from 8.8.8.8: icmp_seq=1 ttl=60 time=0.397 ms
       64 bytes from 8.8.8.8: icmp_seq=2 ttl=60 time=0.491 ms
       64 bytes from 8.8.8.8: icmp_seq=3 ttl=60 time=0.554 ms
       --- 8.8.8.8 ping statistics ---
       3 packets transmitted, 3 received, 0% packet loss, time 1999ms
       rtt min/avg/max/mdev = 0.397/0.480/0.554/0.069 ms
       2018-02-20 16:02:34,474 - DEBUG - TestCaseName: test_vm_connectivity; Time Taken: 73 Seconds; StartTime: Tue Feb 20 16:01:21 2018; EndTime: Tue Feb 20 16:02:34 2018; Result: SUCCESS
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services