Esempio n. 1
0
    def test_positive_create_with_name(self):
        """A host can be created with a random name

        @id: 2e8dd25d-47ed-4131-bba6-1ff024808d05

        @assert: A host is created and the name matches
        """
        for name in valid_hosts_list():
            with self.subTest(name):
                host = entities.Host()
                host.create_missing()
                result = Host.create({
                    u'architecture-id': host.architecture.id,
                    u'domain-id': host.domain.id,
                    u'environment-id': host.environment.id,
                    # pylint:disable=no-member
                    u'location-id': host.location.id,
                    u'mac': host.mac,
                    u'medium-id': host.medium.id,
                    u'name': name,
                    u'operatingsystem-id': host.operatingsystem.id,
                    # pylint:disable=no-member
                    u'organization-id': host.organization.id,
                    u'partition-table-id': host.ptable.id,
                    u'puppet-proxy-id': self.puppet_proxy['id'],
                    u'root-pass': host.root_pass,
                })
                self.assertEqual(
                    '{0}.{1}'.format(name, host.domain.read().name),
                    result['name'],
                )
Esempio n. 2
0
    def test_positive_create_using_libvirt_without_mac(self):
        """Create a libvirt host and not specify a MAC address.

        @id: b003faa9-2810-4176-94d2-ea84bed248eb

        @Assert: Host is created
        """
        compute_resource = entities.LibvirtComputeResource(
            url='qemu+ssh://root@{0}/system'.format(
                settings.compute_resources.libvirt_hostname)).create()
        host = entities.Host()
        host.create_missing()
        result = Host.create({
            u'architecture-id': host.architecture.id,
            u'compute-resource-id': compute_resource.id,
            u'domain-id': host.domain.id,
            u'environment-id': host.environment.id,
            u'location-id': host.location.id,  # pylint:disable=no-member
            u'medium-id': host.medium.id,
            u'name': host.name,
            u'operatingsystem-id': host.operatingsystem.id,
            # pylint:disable=no-member
            u'organization-id': host.organization.id,
            u'partition-table-id': host.ptable.id,
            u'puppet-proxy-id': self.puppet_proxy['id'],
            u'root-pass': host.root_pass,
        })
        self.assertEqual(result['name'], host.name + '.' + host.domain.name)
        Host.delete({'id': result['id']})
Esempio n. 3
0
 def setUpClass(cls):
     """Create host to tests parameters for"""
     super(HostParameterTestCase, cls).setUpClass()
     cls.proxies = Proxy.list()
     assert len(cls.proxies) > 0
     cls.puppet_proxy = cls.proxies[0]
     # using nailgun to create dependencies
     cls.host = entities.Host()
     cls.host.create_missing()
     # using CLI to create host
     cls.host = Host.create({
         u'architecture-id': cls.host.architecture.id,
         u'domain-id': cls.host.domain.id,
         u'environment-id': cls.host.environment.id,
         u'location-id': cls.host.location.id,  # pylint:disable=no-member
         u'mac': cls.host.mac,
         u'medium-id': cls.host.medium.id,
         u'name': cls.host.name,
         u'operatingsystem-id': cls.host.operatingsystem.id,
         # pylint:disable=no-member
         u'organization-id': cls.host.organization.id,
         u'partition-table-id': cls.host.ptable.id,
         u'puppet-proxy-id': cls.puppet_proxy['id'],
         u'root-pass': cls.host.root_pass,
     })
Esempio n. 4
0
 def setUp(self):
     """Create a host to reuse later"""
     super(HostUpdateTestCase, self).setUp()
     self.proxies = Proxy.list()
     self.assertGreater(len(self.proxies), 0)
     self.puppet_proxy = self.proxies[0]
     # using nailgun to create dependencies
     self.host_args = entities.Host()
     self.host_args.create_missing()
     # using CLI to create host
     self.host = Host.create({
         u'architecture-id': self.host_args.architecture.id,
         u'domain-id': self.host_args.domain.id,
         u'environment-id': self.host_args.environment.id,
         # pylint:disable=no-member
         u'location-id': self.host_args.location.id,
         u'mac': self.host_args.mac,
         u'medium-id': self.host_args.medium.id,
         u'name': self.host_args.name,
         u'operatingsystem-id': self.host_args.operatingsystem.id,
         # pylint:disable=no-member
         u'organization-id': self.host_args.organization.id,
         u'partition-table-id': self.host_args.ptable.id,
         u'puppet-proxy-id': self.puppet_proxy['id'],
         u'root-pass': self.host_args.root_pass,
     })
Esempio n. 5
0
 def setUp(self):
     """Create a host to use in tests"""
     super(HostDeleteTestCase, self).setUp()
     # Use the default installation smart proxy
     result = Proxy.list()
     self.assertGreater(len(result), 0)
     self.puppet_proxy = result[0]
     self.host = entities.Host()
     self.host.create_missing()
     self.host = Host.create({
         u'architecture-id': self.host.architecture.id,
         u'domain-id': self.host.domain.id,
         u'environment-id': self.host.environment.id,
         # pylint:disable=no-member
         u'location-id': self.host.location.id,
         u'mac': self.host.mac,
         u'medium-id': self.host.medium.id,
         u'name': gen_string('alphanumeric'),
         u'operatingsystem-id': self.host.operatingsystem.id,
         # pylint:disable=no-member
         u'organization-id': self.host.organization.id,
         u'partition-table-id': self.host.ptable.id,
         u'puppet-proxy-id': self.puppet_proxy['id'],
         u'root-pass': self.host.root_pass,
     })
Esempio n. 6
0
 def class_byos_ft_host(
     self,
     azurermclient,
     module_azurerm_byos_finishimg,
     module_azurerm_cr,
     default_architecture,
     module_domain,
     module_location,
     module_org,
     default_os,
     default_smart_proxy,
     module_puppet_environment,
 ):
     """
     Provisions the host on AzureRM with BYOS Image
     Later in tests this host will be used to perform assertions
     """
     set_hammer_api_timeout()
     skip_yum_update_during_provisioning(
         template='Kickstart default finish')
     host = Host.create(
         {
             'name': self.hostname,
             'compute-resource': module_azurerm_cr.name,
             'compute-attributes': self.compute_attrs,
             'interface': self.interfaces_attributes,
             'location-id': module_location.id,
             'organization-id': module_org.id,
             'domain-id': module_domain.id,
             'architecture-id': default_architecture.id,
             'operatingsystem-id': default_os.id,
             'root-password': gen_string('alpha'),
             'image': module_azurerm_byos_finishimg.name,
             'volume': "disk_size_gb=5",
         },
         timeout=1800,
     )
     yield host
     skip_yum_update_during_provisioning(
         template='Kickstart default finish', reverse=True)
     Host.delete({'name': self.fullhostname}, timeout=1800)
     set_hammer_api_timeout(reverse=True)
Esempio n. 7
0
 def class_host_ft(
     self,
     default_sat,
     azurermclient,
     module_azurerm_finishimg,
     module_azurerm_cr,
     default_architecture,
     module_domain,
     module_location,
     module_org,
     default_os,
     default_smart_proxy,
     module_puppet_environment,
 ):
     """
     Provisions the host on AzureRM using Finish template
     Later in tests this host will be used to perform assertions
     """
     with default_sat.hammer_api_timeout():
         with default_sat.skip_yum_update_during_provisioning(
                 template='Kickstart default finish'):
             host = Host.create(
                 {
                     'name': self.hostname,
                     'compute-resource': module_azurerm_cr.name,
                     'compute-attributes': self.compute_attrs,
                     'interface': self.interfaces_attributes,
                     'location-id': module_location.id,
                     'organization-id': module_org.id,
                     'domain-id': module_domain.id,
                     'architecture-id': default_architecture.id,
                     'operatingsystem-id': default_os.id,
                     'root-password': gen_string('alpha'),
                     'image': module_azurerm_finishimg.name,
                 },
                 timeout=1800000,
             )
             yield host
             with satellite_setting('destroy_vm_on_host_delete=True'):
                 Host.delete({'name': self.fullhostname}, timeout=1800)
Esempio n. 8
0
 def class_host_ud(
     self,
     azurermclient,
     module_azurerm_cloudimg,
     module_azurerm_cr,
     default_architecture,
     module_domain,
     module_location,
     module_org,
     default_os,
     default_smart_proxy,
     module_puppet_environment,
     azurerm_hostgroup,
 ):
     """
     Provisions the host on AzureRM using UserData template
     Later in tests this host will be used to perform assertions
     """
     set_hammer_api_timeout()
     skip_yum_update_during_provisioning(
         template='Kickstart default user data')
     host = Host.create(
         {
             'name': self.hostname,
             'compute-attributes': self.compute_attrs,
             'interface': self.interfaces_attributes,
             'image': module_azurerm_cloudimg.name,
             'hostgroup': azurerm_hostgroup.name,
             'location': module_location.name,
             'organization': module_org.name,
             'operatingsystem-id': default_os.id,
         },
         timeout=1800,
     )
     yield host
     skip_yum_update_during_provisioning(
         template='Kickstart default user data', reverse=True)
     Host.delete({'name': self.fullhostname}, timeout=1800)
     set_hammer_api_timeout(reverse=True)