def test_check_firstlaunch_compare(self):
        '''
        :avocado: tags=test_check_firstlaunch_compare
        polarion_id:
        bz#: 1862930
        compare the first launch boot time with Amazon Linux 2 and Ubuntu.
        '''
        self.log.info("3 Nodes (RHEL, AMZ, Ubuntu) needed!")
        max_boot_time = self.params.get('max_boot_time')
        rhel_boot_time_sec = utils_lib.getboottime(self)
        self.rhel_session = self.session
        self.rhel_vm = self.vm
        self.amz_session = None
        self.amz_vm = None
        self.ubuntu_session = None
        self.ubuntu_vm = None
        if utils_lib.is_arm(self):
            cloud = Setup(self.params, self.name, vendor="amzn2_arm")
        else:
            cloud = Setup(self.params, self.name, vendor="amzn2_x86")
        self.amz_vm = cloud.vm
        self.amz_session = cloud.init_vm()
        utils_lib.run_cmd(self,
                          'uname -a',
                          vm=self.amz_vm,
                          session=self.amz_session,
                          msg="Get Amazon Linux 2 version")
        amz_boot_time_sec = utils_lib.getboottime(self,
                                                  vm=self.amz_vm,
                                                  session=self.amz_session)
        self.amz_vm.delete()

        if utils_lib.is_arm(self):
            cloud = Setup(self.params, self.name, vendor="ubuntu_arm")
        else:
            cloud = Setup(self.params, self.name, vendor="ubuntu_x86")
        self.ubuntu_vm = cloud.vm
        self.ubuntu_session = cloud.init_vm()
        utils_lib.run_cmd(self,
                          'uname -a',
                          vm=self.ubuntu_vm,
                          session=self.ubuntu_session,
                          msg="Get Ubuntu version")
        ubuntu_boot_time_sec = utils_lib.getboottime(
            self, vm=self.ubuntu_vm, session=self.ubuntu_session)
        self.ubuntu_vm.delete()
        ratio = self.params.get('boottime_max_ratio')
        utils_lib.compare_nums(self,
                               num1=rhel_boot_time_sec,
                               num2=amz_boot_time_sec,
                               ratio=ratio,
                               msg="Compare with Amazon Linux 2 boot time")
        utils_lib.compare_nums(self,
                               num1=rhel_boot_time_sec,
                               num2=ubuntu_boot_time_sec,
                               ratio=ratio,
                               msg="Compare with Ubuntu boot time")
 def test_check_firstlaunch_time(self):
     '''
     :avocado: tags=test_check_firstlaunch_time,fast_check
     polarion_id:
     bz#: 1862930
     check the first launch boot time.
     '''
     max_boot_time = self.params.get('max_boot_time')
     boot_time_sec = utils_lib.getboottime(self)
     utils_lib.compare_nums(self,
                            num1=boot_time_sec,
                            num2=max_boot_time,
                            ratio=0,
                            msg="Compare with cfg specified max_boot_time")
 def test_check_reboot_time(self):
     '''
     :avocado: tags=test_check_reboot_time
     polarion_id: RHEL7-93100
     check the boot time after reboot.
     '''
     self.vm.reboot()
     if 'metal' in self.vm.instance_type:
         self.log.info("Wait %s" % self.ssh_wait_timeout)
         time.sleep(self.ssh_wait_timeout)
     else:
         self.log.info("Wait 30s")
         time.sleep(30)
     max_boot_time = self.params.get('max_reboot_time')
     self.session.connect(timeout=self.ssh_wait_timeout)
     boot_time_sec = utils_lib.getboottime(self)
     utils_lib.compare_nums(
         self,
         num1=boot_time_sec,
         num2=max_boot_time,
         ratio=0,
         msg="Compare with cfg specified max_reboot_time")
 def test_check_boot_time(self):
     '''
     :avocado: tags=test_check_boot_time,fast_check
     polarion_id: RHEL7-93100
     bz#: 1776710
     check the boot time after stop-start.
     '''
     max_boot_time = self.params.get('max_boot_time')
     self.vm.stop(wait=True, loops=20)
     self.vm.start(wait=True)
     if 'metal' in self.vm.instance_type:
         self.log.info("Wait %s" % self.ssh_wait_timeout)
         time.sleep(self.ssh_wait_timeout)
     else:
         self.log.info("Wait 30s")
         time.sleep(30)
     self.session.connect(timeout=self.ssh_wait_timeout)
     boot_time_sec = utils_lib.getboottime(self)
     utils_lib.compare_nums(self,
                            num1=boot_time_sec,
                            num2=max_boot_time,
                            ratio=0,
                            msg="Compare with cfg specified max_boot_time")