def test_positive_provision_pxe_host_with_parameters(self):
        """Provision the pxe-based BIOS discovered host with host parameters from cli using
        SYSLINUX loader

        :id: 4b315fe1-2eba-4e59-bd0a-9d16ce319ce2

        :Setup:
            1. Create a BIOS VM and set it to boot from a network

        :steps:
            1. Build a default PXE template
            2. Configure HostGroup to be used for provisioning the discovered host
               after discovery
            3. PXE Boot the VM (from Network)
            4. Wait for Host to be discovered by Satellite
            5. Provision the discovered host with host parameters

        :expectedresults:
            1. Ensure host appeared in Discovered Hosts on satellite
            2. Ensure the host is provisioned with correct and all the host parameters
               given during provisioning
            3. Ensure the discovered host is no more available to provision

        :CaseImportance: High

        :BZ: 1572947
        """
        param1_key, param1_value = gen_string('alpha'), gen_string('alphanumeric')
        param2_key, param2_value = gen_string('alpha'), gen_string('alphanumeric')
        host_params = [f'{param1_key}={param1_value}, {param2_key}={param2_value}']
        if not self.configured_env:
            self.__class__.configured_env = configure_env_for_provision(org=self.org, loc=self.loc)
        with LibvirtGuest() as pxe_host:
            hostname = pxe_host.guest_name
            discovered_host = self._assertdiscoveredhost(hostname)
            self.assertIsNotNone(discovered_host)
            DiscoveredHost.provision(
                {
                    'name': discovered_host['name'],
                    'hostgroup': self.configured_env['hostgroup']['name'],
                    'root-password': gen_string('alphanumeric'),
                    'parameters': host_params,
                }
            )
            provisioned_host = Host.info(
                {
                    'name': '{}.{}'.format(
                        discovered_host['name'], self.configured_env['domain']['name']
                    )
                }
            )
            self.assertEqual(provisioned_host['parameters'][str(param1_key).lower()], param1_value)
            self.assertEqual(provisioned_host['parameters'][str(param2_key).lower()], param2_value)
            with self.assertRaises(CLIReturnCodeError):
                DiscoveredHost.info({'id': discovered_host['id']})
    def test_positive_provision_pxe_host(self):
        """Provision the pxe based discovered host from cli

        @id: b5385fe3-d532-4373-af64-5492275ff8d4

        @Setup: Host should already be discovered

        @Assert: Host should be provisioned successfully and entry from
        discovered host list should be automatically removed.

        @CaseLevel: System
        """
        if not self.configured_env:
            self.configured_env = configure_env_for_provision(
                org=self.org, loc=self.loc)
        with LibvirtGuest() as pxe_host:
            hostname = pxe_host.guest_name
            discovered_host = self._assertdiscoveredhost(hostname)
            self.assertIsNotNone(discovered_host)
            # Provision just discovered host
            DiscoveredHost.provision({
                'name': discovered_host['name'],
                'hostgroup': self.configured_env['hostgroup']['name'],
                'root-password': gen_string('alphanumeric'),
            })
            provisioned_host = Host.info({
                'name': '{0}.{1}'.format(
                    discovered_host['name'],
                    self.configured_env['domain']['name']
                )
            })
            self.assertEqual(
                provisioned_host['network']['subnet'],
                self.configured_env['subnet']['name']
            )
            self.assertEqual(
                provisioned_host['operating-system']['partition-table'],
                self.configured_env['ptable']['name']
            )
            self.assertEqual(
                provisioned_host['operating-system']['operating-system'],
                self.configured_env['os']['title']
            )
            # Check that provisioned host is not in the list of discovered
            # hosts anymore
            with self.assertRaises(CLIReturnCodeError):
                DiscoveredHost.info({'id': discovered_host['id']})
Esempio n. 3
0
    def test_positive_provision_pxeless_host(self):
        """Provision the pxe-less discovered host from cli

        :id: ae7f3ce2-e66e-44dc-85cb-0c3c4782cbb1

        :Setup: Host should already be discovered

        :expectedresults: Host should be provisioned successfully and entry
            from discovered host list should be auto removed

        :CaseLevel: System
        """
        if not self.configured_env:
            self.configured_env = configure_env_for_provision(
                org=self.org, loc=self.loc)
        with LibvirtGuest(boot_iso=True) as pxe_host:
            hostname = pxe_host.guest_name
            discovered_host = self._assertdiscoveredhost(hostname)
            self.assertIsNotNone(discovered_host)
            # Provision just discovered host
            DiscoveredHost.provision({
                'name': discovered_host['name'],
                'hostgroup': self.configured_env['hostgroup']['name'],
                'root-password': gen_string('alphanumeric'),
            })
            provisioned_host = Host.info({
                'name': '{0}.{1}'.format(
                    discovered_host['name'],
                    self.configured_env['domain']['name']
                )
            })
            self.assertEqual(
                provisioned_host['network']['subnet'],
                self.configured_env['subnet']['name']
            )
            self.assertEqual(
                provisioned_host['operating-system']['partition-table'],
                self.configured_env['ptable']['name']
            )
            self.assertEqual(
                provisioned_host['operating-system']['operating-system'],
                self.configured_env['os']['title']
            )
            # Check that provisioned host is not in the list of discovered
            # hosts anymore
            with self.assertRaises(CLIReturnCodeError):
                DiscoveredHost.info({'id': discovered_host['id']})
Esempio n. 4
0
    def test_positive_provision_pxe_host(self):
        """Provision the pxe based discovered host from cli

        :id: b5385fe3-d532-4373-af64-5492275ff8d4

        :Setup: Host should already be discovered

        :expectedresults: Host should be provisioned successfully and entry
            from discovered host list should be automatically removed.

        :CaseLevel: System
        """
        if not self.configured_env:
            self.configured_env = configure_env_for_provision(org=self.org,
                                                              loc=self.loc)
        with LibvirtGuest() as pxe_host:
            hostname = pxe_host.guest_name
            discovered_host = self._assertdiscoveredhost(hostname)
            self.assertIsNotNone(discovered_host)
            # Provision just discovered host
            DiscoveredHost.provision({
                'name':
                discovered_host['name'],
                'hostgroup':
                self.configured_env['hostgroup']['name'],
                'root-password':
                gen_string('alphanumeric'),
            })
            provisioned_host = Host.info({
                'name':
                '{0}.{1}'.format(discovered_host['name'],
                                 self.configured_env['domain']['name'])
            })
            self.assertEqual(provisioned_host['network']['subnet'],
                             self.configured_env['subnet']['name'])
            self.assertEqual(
                provisioned_host['operating-system']['partition-table'],
                self.configured_env['ptable']['name'])
            self.assertEqual(
                provisioned_host['operating-system']['operating-system'],
                self.configured_env['os']['title'])
            # Check that provisioned host is not in the list of discovered
            # hosts anymore
            with self.assertRaises(CLIReturnCodeError):
                DiscoveredHost.info({'id': discovered_host['id']})
    def test_positive_provision_pxe_host_with_bios_syslinux(self):
        """Provision the pxe-based BIOS discovered host from cli using SYSLINUX
        loader

        :id: b5385fe3-d532-4373-af64-5492275ff8d4

        :Setup:
            1. Create a BIOS VM and set it to boot from a network
            2. for getting more detailed info from FDI, remaster the image to
               have ssh enabled

        :steps:
            1. Build a default PXE template
            2. Run assertion step #1
            3. Boot the VM (from NW)
            4. Run assertion steps #2-4
            5. Provision the discovered host
            6. Run assertion steps #5-9

        :expectedresults: Host should be provisioned successfully
            1. [TBD] Ensure the tftpboot files are updated

              1.1 Ensure fdi-image files have been placed under tftpboot/boot/
              1.2 Ensure the 'default' pxelinux config has been placed under
              tftpboot/pxelinux.cfg/
              1.3 Ensure the discovery section exists inside pxelinux config,
              it leads to the FDI kernel and the ONTIMEOUT is set to discovery

            2. [TBD] Ensure PXE handoff goes as expected (tcpdump -p tftp)
            3. [TBD] Ensure FDI loaded and successfully sent out facts

                3.1 ping vm
                3.2 ssh to the VM and read the logs (if ssh enabled)
                3.3 optionally sniff the HTTP traffic coming from the host

            4. Ensure host appeared in Discovered Hosts on satellite
            5. [TBD] Ensure the tftpboot files are updated for the hosts mac
            6. [TBD] Ensure PXE handoff goes as expected (tcpdump -p tftp)
            7. [TBD] Optionally ensure anaconda loaded and the installation
               finished
            8. [TBD] Ensure the host is provisioned with correct attributes
            9. Ensure the entry from discovered host list disappeared

        :CaseLevel: System
        """
        # fixme: assertion #1
        if not self.configured_env:
            self.__class__.configured_env = configure_env_for_provision(
                org=self.org, loc=self.loc)
        with LibvirtGuest() as pxe_host:
            hostname = pxe_host.guest_name
            # fixme: assertion #2-3
            # assertion #4
            discovered_host = self._assertdiscoveredhost(hostname)
            self.assertIsNotNone(discovered_host)
            # Provision just discovered host
            DiscoveredHost.provision({
                'name':
                discovered_host['name'],
                'hostgroup':
                self.configured_env['hostgroup']['name'],
                'root-password':
                gen_string('alphanumeric'),
            })
            # fixme: assertion #5-8
            provisioned_host = Host.info({
                'name':
                '{0}.{1}'.format(discovered_host['name'],
                                 self.configured_env['domain']['name'])
            })
            # assertion #8
            self.assertEqual(provisioned_host['network']['subnet-ipv4'],
                             self.configured_env['subnet']['name'])
            self.assertEqual(
                provisioned_host['operating-system']['partition-table'],
                self.configured_env['ptable']['name'])
            self.assertEqual(
                provisioned_host['operating-system']['operating-system'],
                self.configured_env['os']['title'])
            # assertion #9
            with self.assertRaises(CLIReturnCodeError):
                DiscoveredHost.info({'id': discovered_host['id']})
    def test_positive_provision_pxeless_bios_syslinux(self):
        """Provision and discover the pxe-less BIOS host from cli using SYSLINUX
        loader

        :id: ae7f3ce2-e66e-44dc-85cb-0c3c4782cbb1

        :Setup:
            1. Craft the FDI with remaster the image to have ssh enabled

        :Steps:
            1. Create a BIOS VM and set it to boot from the FDI
            2. Run assertion steps #1-2
            3. Provision the discovered host using PXELinux loader
            4. Run assertion steps #3-7

        :expectedresults: Host should be provisioned successfully
            1. [TBD] Ensure FDI loaded and successfully sent out facts

               1.1 ping vm
               1.2 ssh to the VM and read the logs (if ssh enabled)
               1.3 optionally sniff the HTTP traffic coming from the host

            2. Ensure host appeared in Discovered Hosts on satellite
            3. [TBD] Ensure the kexec was successful (e.g. the kexec request
               result in production.log)
            4. [TBD] Ensure anaconda loaded and the installation finished
            5. [TBD] Ensure the host is provisioned with correct attributes
            6. Ensure the host is created in Hosts
            7. Ensure the entry from discovered host list disappeared

        :CaseLevel: System
        """
        if not self.configured_env:
            self.__class__.configured_env = configure_env_for_provision(
                org=self.org, loc=self.loc)
        with LibvirtGuest(boot_iso=True) as pxe_host:
            hostname = pxe_host.guest_name
            # fixme: assertion #1
            discovered_host = self._assertdiscoveredhost(hostname)
            self.assertIsNotNone(discovered_host)
            # Provision just discovered host
            DiscoveredHost.provision({
                'name':
                discovered_host['name'],
                'hostgroup':
                self.configured_env['hostgroup']['name'],
                'root-password':
                gen_string('alphanumeric'),
            })
            # fixme: assertion #2-5
            provisioned_host = Host.info({
                'name':
                '{0}.{1}'.format(discovered_host['name'],
                                 self.configured_env['domain']['name'])
            })
            self.assertEqual(provisioned_host['network']['subnet-ipv4'],
                             self.configured_env['subnet']['name'])
            self.assertEqual(
                provisioned_host['operating-system']['partition-table'],
                self.configured_env['ptable']['name'])
            self.assertEqual(
                provisioned_host['operating-system']['operating-system'],
                self.configured_env['os']['title'])
            # Check that provisioned host is not in the list of discovered
            # hosts anymore
            with self.assertRaises(CLIReturnCodeError):
                DiscoveredHost.info({'id': discovered_host['id']})
Esempio n. 7
0
    def test_positive_provision_pxe_host_with_bios_syslinux(self):
        """Provision the pxe-based BIOS discovered host from cli using SYSLINUX
        loader

        :id: b5385fe3-d532-4373-af64-5492275ff8d4

        :Setup:
            1. Create a BIOS VM and set it to boot from a network
            2. for getting more detailed info from FDI, remaster the image to
               have ssh enabled

        :steps:
            1. Build a default PXE template
            2. Run assertion step #1
            3. Boot the VM (from NW)
            4. Run assertion steps #2-4
            5. Provision the discovered host
            6. Run assertion steps #5-9

        :expectedresults: Host should be provisioned successfully
            1. [TBD] Ensure the tftpboot files are updated

              1.1 Ensure fdi-image files have been placed under tftpboot/boot/
              1.2 Ensure the 'default' pxelinux config has been placed under
              tftpboot/pxelinux.cfg/
              1.3 Ensure the discovery section exists inside pxelinux config,
              it leads to the FDI kernel and the ONTIMEOUT is set to discovery

            2. [TBD] Ensure PXE handoff goes as expected (tcpdump -p tftp)
            3. [TBD] Ensure FDI loaded and successfully sent out facts

                3.1 ping vm
                3.2 ssh to the VM and read the logs (if ssh enabled)
                3.3 optionally sniff the HTTP traffic coming from the host

            4. Ensure host appeared in Discovered Hosts on satellite
            5. [TBD] Ensure the tftpboot files are updated for the hosts mac
            6. [TBD] Ensure PXE handoff goes as expected (tcpdump -p tftp)
            7. [TBD] Optionally ensure anaconda loaded and the installation
               finished
            8. [TBD] Ensure the host is provisioned with correct attributes
            9. Ensure the entry from discovered host list disappeared

        :CaseLevel: System
        """
        # fixme: assertion #1
        if not self.configured_env:
            self.__class__.configured_env = configure_env_for_provision(
                org=self.org, loc=self.loc)
        with LibvirtGuest() as pxe_host:
            hostname = pxe_host.guest_name
            # fixme: assertion #2-3
            # assertion #4
            discovered_host = self._assertdiscoveredhost(hostname)
            self.assertIsNotNone(discovered_host)
            # Provision just discovered host
            DiscoveredHost.provision({
                'name': discovered_host['name'],
                'hostgroup': self.configured_env['hostgroup']['name'],
                'root-password': gen_string('alphanumeric'),
            })
            # fixme: assertion #5-8
            provisioned_host = Host.info({
                'name': '{0}.{1}'.format(
                    discovered_host['name'],
                    self.configured_env['domain']['name']
                )
            })
            # assertion #8
            self.assertEqual(
                provisioned_host['network']['subnet-ipv4'],
                self.configured_env['subnet']['name']
            )
            self.assertEqual(
                provisioned_host['operating-system']['partition-table'],
                self.configured_env['ptable']['name']
            )
            self.assertEqual(
                provisioned_host['operating-system']['operating-system'],
                self.configured_env['os']['title']
            )
            # assertion #9
            with self.assertRaises(CLIReturnCodeError):
                DiscoveredHost.info({'id': discovered_host['id']})
Esempio n. 8
0
    def test_positive_provision_pxeless_bios_syslinux(self):
        """Provision and discover the pxe-less BIOS host from cli using SYSLINUX
        loader

        :id: ae7f3ce2-e66e-44dc-85cb-0c3c4782cbb1

        :Setup:
            1. Craft the FDI with remaster the image to have ssh enabled

        :Steps:
            1. Create a BIOS VM and set it to boot from the FDI
            2. Run assertion steps #1-2
            3. Provision the discovered host using PXELinux loader
            4. Run assertion steps #3-7

        :expectedresults: Host should be provisioned successfully
            1. [TBD] Ensure FDI loaded and successfully sent out facts

               1.1 ping vm
               1.2 ssh to the VM and read the logs (if ssh enabled)
               1.3 optionally sniff the HTTP traffic coming from the host

            2. Ensure host appeared in Discovered Hosts on satellite
            3. [TBD] Ensure the kexec was successful (e.g. the kexec request
               result in production.log)
            4. [TBD] Ensure anaconda loaded and the installation finished
            5. [TBD] Ensure the host is provisioned with correct attributes
            6. Ensure the host is created in Hosts
            7. Ensure the entry from discovered host list disappeared

        :CaseLevel: System
        """
        if not self.configured_env:
            self.__class__.configured_env = configure_env_for_provision(
                org=self.org, loc=self.loc)
        with LibvirtGuest(boot_iso=True) as pxe_host:
            hostname = pxe_host.guest_name
            # fixme: assertion #1
            discovered_host = self._assertdiscoveredhost(hostname)
            self.assertIsNotNone(discovered_host)
            # Provision just discovered host
            DiscoveredHost.provision({
                'name': discovered_host['name'],
                'hostgroup': self.configured_env['hostgroup']['name'],
                'root-password': gen_string('alphanumeric'),
            })
            # fixme: assertion #2-5
            provisioned_host = Host.info({
                'name': '{0}.{1}'.format(
                    discovered_host['name'],
                    self.configured_env['domain']['name']
                )
            })
            self.assertEqual(
                provisioned_host['network']['subnet-ipv4'],
                self.configured_env['subnet']['name']
            )
            self.assertEqual(
                provisioned_host['operating-system']['partition-table'],
                self.configured_env['ptable']['name']
            )
            self.assertEqual(
                provisioned_host['operating-system']['operating-system'],
                self.configured_env['os']['title']
            )
            # Check that provisioned host is not in the list of discovered
            # hosts anymore
            with self.assertRaises(CLIReturnCodeError):
                DiscoveredHost.info({'id': discovered_host['id']})