Example #1
0
    def test_positive_update_subnet(self):
        """Update a host with a new subnet

        @id: c938e6b2-dbc0-4cd2-894a-8f2cc0e31063

        @assert: A host is updated with a new subnet

        @CaseLevel: Integration
        """
        org = entities.Organization().create()
        loc = entities.Location(organization=[org]).create()
        old_subnet = entities.Subnet(
            location=[loc],
            organization=[org],
        ).create()
        host = entities.Host(
            location=loc,
            organization=org,
            subnet=old_subnet,
        ).create()
        new_subnet = entities.Subnet(
            location=[loc],
            organization=[org],
        ).create()
        host.subnet = new_subnet
        host = host.update(['subnet'])
        self.assertEqual(host.subnet.read().name, new_subnet.name)
Example #2
0
    def test_positive_update_subnet(self):
        """Update a hostgroup with a new subnet

        :id: 2b539fd9-5fcf-4d74-9cd8-3b3997bac992

        :expectedresults: A hostgroup is updated with expected subnet

        :CaseLevel: Integration
        """
        subnet = entities.Subnet(
            location=[self.loc],
            organization=[self.org],
        ).create()
        hostgroup = entities.HostGroup(
            location=[self.loc],
            organization=[self.org],
            subnet=subnet,
        ).create()
        new_subnet = entities.Subnet(
            location=[self.loc],
            organization=[self.org],
        ).create()
        hostgroup.subnet = new_subnet
        hostgroup = hostgroup.update(['subnet'])
        self.assertEqual(hostgroup.subnet.read().name, new_subnet.name)
Example #3
0
    def test_positive_update_subnet(self):
        """Update a host with a new subnet

        @feature: Hosts

        @assert: A host is updated with a new subnet
        """
        org = entities.Organization().create()
        loc = entities.Location(organization=[org]).create()
        old_subnet = entities.Subnet(
            location=[loc],
            organization=[org],
        ).create()
        host = entities.Host(
            location=loc,
            organization=org,
            subnet=old_subnet,
        ).create()
        new_subnet = entities.Subnet(
            location=[loc],
            organization=[org],
        ).create()
        host.subnet = new_subnet
        host = host.update(['subnet'])
        self.assertEqual(host.subnet.read().name, new_subnet.name)
Example #4
0
def test_positive_end_to_end(session, module_dom):
    """Perform end to end testing for subnet component in ipv6 network

    :id: f77031c9-2ca8-44db-8afa-d0212aeda540

    :expectedresults: All expected CRUD actions finished successfully

    :CaseLevel: Integration

    :CaseImportance: High
    """
    name = gen_string('alpha')
    new_name = gen_string('alpha')
    description = gen_string('alphanumeric')
    network_address = gen_ipaddr(ip3=True, ipv6=True)
    with session:
        session.subnet.create({
            'subnet.name': name,
            'subnet.description': description,
            'subnet.protocol': 'IPv6',
            'subnet.network_address': network_address,
            'subnet.network_prefix': '24',
            'subnet.ipam': 'EUI-64',
            'subnet.mtu': '1600',
            'domains.resources.assigned': [module_dom.name],
        })
        sn = entities.Subnet().search(
            query={'search': 'name={0}'.format(name)})
        assert sn, 'Subnet {0} expected to exist, but it is not listed'.format(
            sn)
        sn = sn[0]
        subnet_values = session.subnet.read(name,
                                            widget_names=['subnet', 'domains'])
        assert subnet_values['subnet']['name'] == name
        assert subnet_values['subnet']['description'] == description
        assert subnet_values['subnet']['protocol'] == 'IPv6'
        assert subnet_values['subnet']['network_address'] == network_address
        assert subnet_values['subnet']['network_prefix'] == '24'
        assert subnet_values['subnet']['ipam'] == 'EUI-64'
        assert subnet_values['subnet']['mtu'] == '1600'
        assert module_dom.name in subnet_values['domains']['resources'][
            'assigned']
        # Update subnet with new name
        session.subnet.update(name, {'subnet.name': new_name})
        assert sn.read().name == new_name
        # Delete the subnet
        sn.domain = []
        sn.update(['domain'])
        session.subnet.delete(new_name)
        assert not entities.Subnet().search(
            query={'search': 'name={0}'.format(new_name)
                   }), 'The subnet was supposed to be deleted'
Example #5
0
    def test_positive_update_subnet(self):
        """Update location with new subnet

        @Assert: Location updated successfully and has correct subnet assigned

        @Feature: Location - Update
        """
        location = entities.Location(
            subnet=[entities.Subnet().create()],
        ).create()
        subnet = entities.Subnet().create()
        location.subnet = [subnet]
        self.assertEqual(location.update(['subnet']).subnet[0].id, subnet.id)
Example #6
0
    def test_positive_update_subnet(self):
        """Update location with new subnet

        @id: 67e5516a-26e2-4d44-9c62-5bb35486cfa7

        @Assert: Location updated successfully and has correct subnet assigned

        @CaseLevel: Integration
        """
        location = entities.Location(subnet=[entities.Subnet().create()
                                             ], ).create()
        subnet = entities.Subnet().create()
        location.subnet = [subnet]
        self.assertEqual(location.update(['subnet']).subnet[0].id, subnet.id)
    def test_pre_scenario_remoteexecution_satellite(self):
        """Run REX job on client registered with Satellite

        :id: preupgrade-3f338475-fa69-43ef-ac86-f00f4d324b33

        :steps:
            1. Create Subnet.
            2. Create Content host.
            3. Install katello-ca package and register to Satellite host.
            4. Add rex ssh_key of Satellite on content host.
            5. Run the REX job on client vm.

        :expectedresults:
            1. It should create with pre-required details.
            2. REX job should run on it.
        """
        try:
            default_loc_id = entities.Location().search(
                query={'search': 'name="{}"'.format(DEFAULT_LOC)})[0].id
            sn = entities.Subnet(
                domain=self.vm_domain,
                gateway=self.gateway,
                ipam='DHCP',
                location=[default_loc_id],
                mask=self.netmask,
                network=self.subnet,
                organization=[self.org.id],
                remote_execution_proxy=[entities.SmartProxy(id=1)],
            ).create()
            client = VirtualMachine(distro=DISTRO_RHEL7,
                                    provisioning_server=self.libvirt_vm,
                                    bridge=self.bridge)
            client.create()
            client.install_katello_ca()
            client.register_contenthost(org=self.org.label, lce='Library')
            add_remote_execution_ssh_key(hostname=client.ip_addr)
            host = entities.Host().search(
                query={'search': 'name="{}"'.format(client.hostname)})
            host[0].subnet = sn
            host[0].update(['subnet'])
            job = entities.JobInvocation().run(
                data={
                    'job_template_id': 89,
                    'inputs': {
                        'command': "ls"
                    },
                    'targeting_type': 'static_query',
                    'search_query': "name = {0}".format(client.hostname)
                })
            self.assertEqual(job['output']['success_count'], 1)
            global_dict = {
                self.__class__.__name__: {
                    'client_name': client.hostname
                }
            }
            create_dict(global_dict)
        except Exception as exp:
            if client._created:
                self._vm_cleanup(hostname=client.hostname)
            raise Exception(exp)
Example #8
0
def test_negative_create_with_duplicated_parameters():
    """Attempt to create multiple parameters with same key name for the
    same subnet

    :id: aa69bdcc-e833-41e4-8f72-7139bdd64daa

    :steps:

        1. Create Subnet with all the details
        2. Create Multiple parameters having duplicate key names

    :expectedresults:

        1. The subnet parameters should not be created with duplicate
            names
        2. An error for duplicate parameter should be thrown

    :CaseImportance: Low
    """
    subnet = entities.Subnet().create()
    entities.Parameter(name='duplicateParameter', subnet=subnet.id).create()
    with pytest.raises(HTTPError) as context:
        entities.Parameter(name='duplicateParameter',
                           subnet=subnet.id).create()
    assert re.search("Name has already been taken",
                     context.value.response.text)
Example #9
0
def test_negative_create_with_parameter_and_invalid_separator(name):
    """Subnet parameters can not be created with name with invalid
    separators

    :id: 08d10b75-a0db-4a11-a915-965a2a207d16

    :parametrized: yes

    :steps:

        1. Create Subnet with all the details
        2. Create subnet parameter having key with name separated by
            invalid separators(e.g spaces) and value

    :expectedresults:

        1. The parameter with name separated by invalid separators
            should not be saved in subnet
        2. An error for invalid name should be thrown.

    :CaseImportance: Low
    """
    subnet = entities.Subnet().create()
    with pytest.raises(HTTPError):
        entities.Parameter(name=name, subnet=subnet.id).create()
Example #10
0
    def test_positive_subnet_parameters_override_impact_on_subnet(self):
        """Override subnet parameter from host impact on subnet parameter

        :id: 6fe963ed-93a3-496e-bfd9-599bf91a61f3

        :steps:

            1. Create valid subnet with valid parameter
            2. Create host with above subnet
            3. Assign hosts primary interface with subnet
            4. Override subnet parameter value from host with some other value

        :expectedresults: The override value of subnet parameter from host
            should not change actual value in subnet parameter

        CaseLevel: System
        """

        # Create subnet with valid parameters
        parameter = [{'name': gen_string('alpha'), 'value': gen_string('alpha')}]
        org = entities.Organization().create()
        loc = entities.Location(organization=[org]).create()
        org_subnet = entities.Subnet(
            location=[loc],
            organization=[org],
            subnet_parameters_attributes=parameter,
        ).create()
        self.assertEqual(
            org_subnet.subnet_parameters_attributes[0]['name'],
            parameter[0]['name']
        )
        self.assertEqual(
            org_subnet.subnet_parameters_attributes[0]['value'],
            parameter[0]['value']
        )
        # Create host with above subnet
        host = entities.Host(
            location=loc,
            organization=org,
            subnet=org_subnet,
        ).create()
        self.assertEqual(host.subnet.read().name, org_subnet.name)
        parameter_new_value = [{
            'name': org_subnet.subnet_parameters_attributes[0]['name'],
            'value': gen_string('alpha')
        }]
        host.host_parameters_attributes = parameter_new_value
        host = host.update(['host_parameters_attributes'])
        self.assertEqual(
            host.host_parameters_attributes[0]['value'],
            parameter_new_value[0]['value']
        )
        self.assertEqual(
            host.host_parameters_attributes[0]['name'],
            org_subnet.subnet_parameters_attributes[0]['name']
        )
        self.assertEqual(
            org_subnet.read().subnet_parameters_attributes[0]['value'],
            parameter[0]['value']
        )
Example #11
0
    def test_positive_add_subnet(self):
        """Add a subnet by using location name and subnet name

        :id: fe70ffba-e594-48d5-b2c5-be93e827cc60

        :expectedresults: subnet is added

        :CaseLevel: Integration
        """
        strategy, value = common_locators['entity_deselect']
        with Session(self.browser) as session:
            for subnet_name in generate_strings_list():
                with self.subTest(subnet_name):
                    loc_name = gen_string('alpha')
                    subnet = entities.Subnet(
                        name=subnet_name,
                        network=gen_ipaddr(ip3=True),
                        mask='255.255.255.0',
                    ).create()
                    self.assertEqual(subnet.name, subnet_name)
                    make_loc(session, name=loc_name)
                    self.assertIsNotNone(self.location.search(loc_name))
                    self.location.update(loc_name, new_subnets=[subnet_name])
                    self.location.search_and_click(loc_name)
                    session.nav.click(tab_locators['context.tab_subnets'])
                    element = session.nav.wait_until_element(
                        (strategy, value % subnet_name))
                    self.assertIsNotNone(element)
Example #12
0
 def setupScenario(self):
     """Create hostgroup and its dependant entities
     """
     self.org = entities.Organization().create()
     self.loc = entities.Location(organization=[self.org]).create()
     self.parent_hostgroup = entities.HostGroup(
         location=[self.loc.id],
         organization=[self.org.id],
         name=self.parent_name).create()
     self.lc_env = entities.LifecycleEnvironment(
         name=gen_string('alpha'),
         organization=self.org,
     ).create()
     self.domain = entities.Domain(name=self.domain_name).create()
     self.architecture = entities.Architecture().create()
     self.ptable = entities.PartitionTable().create()
     self.operatingsystem = entities.OperatingSystem(
         architecture=[self.architecture],
         ptable=[self.ptable],
         name=self.os_name).create()
     self.medium = entities.Media(
         operatingsystem=[self.operatingsystem]).create()
     self.subnet = entities.Subnet(location=[self.loc],
                                   organization=[self.org],
                                   name=self.subnet_name).create()
Example #13
0
def test_negative_update_parameter(new_name):
    """Subnet parameter can not be updated with invalid names

    :id: fcdbad13-ad96-4152-8e20-e023d61a2853

    :parametrized: yes

    :steps:

        1. Create valid subnet with valid parameter
        2. Update above subnet parameter with some invalid
            name. e.g name with spaces

    :expectedresults:

        1. The parameter should not be updated with invalid name
        2. An error for invalid name should be thrown

    :CaseImportance: Medium
    """
    subnet = entities.Subnet().create()
    sub_param = entities.Parameter(name=gen_string('utf8'),
                                   subnet=subnet.id,
                                   value=gen_string('utf8')).create()
    with pytest.raises(HTTPError):
        sub_param.name = new_name
        sub_param.update(['name'])
Example #14
0
def test_positive_update_subnet(session):
    """Add/Remove subnet from/to location

    :id: fe70ffba-e594-48d5-b2c5-be93e827cc60

    :expectedresults: subnet is added and removed from the location

    :CaseLevel: Integration
    """
    ip_addres = gen_ipaddr(ip3=True)
    subnet = entities.Subnet(
        network=ip_addres,
        mask='255.255.255.0',
    ).create()
    loc = entities.Location().create()
    with session:
        subnet_name = '{0} ({1}/{2})'.format(subnet.name, subnet.network,
                                             subnet.cidr)
        session.location.update(loc.name,
                                {'subnets.resources.assigned': [subnet_name]})
        loc_values = session.location.read(loc.name)
        assert loc_values['subnets']['resources']['assigned'][0] == subnet_name
        session.location.update(
            loc.name, {'subnets.resources.unassigned': [subnet_name]})
        loc_values = session.location.read(loc.name)
        assert len(loc_values['subnets']['resources']['assigned']) == 0
        assert subnet_name in loc_values['subnets']['resources']['unassigned']
Example #15
0
    def test_positive_add_parameter(self):
        """Parameters can be created in subnet

        :id: c1dae6f4-45b1-45db-8529-d7918e41a99b

        :steps:

            1. Create Subnet with all the details
            2. Create subnet parameter with single key and single value

        :expectedresults: The parameter should be created in subnet

        :CaseImportance: Medium
        """
        subnet = entities.Subnet().create()
        for name in generate_strings_list():
            with self.subTest(name):
                value = gen_string('utf8')
                subnet_param = entities.Parameter(
                    subnet=subnet.id,
                    name=name,
                    value=value
                ).create()
                self.assertEqual(subnet_param.name, name)
                self.assertEqual(subnet_param.value, value)
    def test_positive_add_subnet(self):
        """Add a subnet using organization name and subnet name.

        @feature: Organizations associate subnet.

        @assert: subnet is added.
        """
        strategy, value = common_locators['entity_deselect']
        with Session(self.browser) as session:
            for subnet_name in generate_strings_list():
                with self.subTest(subnet_name):
                    org_name = gen_string('alpha')
                    # Create subnet using nailgun
                    subnet = entities.Subnet(name=subnet_name,
                                             network=gen_ipaddr(ip3=True),
                                             mask='255.255.255.0').create()
                    self.assertEqual(subnet.name, subnet_name)
                    make_org(session, org_name=org_name)
                    self.assertIsNotNone(self.org.search(org_name))
                    self.org.update(org_name, new_subnets=[subnet_name])
                    self.org.search(org_name).click()
                    session.nav.click(tab_locators['context.tab_subnets'])
                    element = session.nav.wait_until_element(
                        (strategy, value % subnet_name))
                    self.assertIsNotNone(element)
Example #17
0
    def test_positive_add_subnet(self):
        """Add a subnet by using location name and subnet name

        @feature: Locations

        @assert: subnet is added
        """
        strategy, value = common_locators['entity_deselect']
        with Session(self.browser) as session:
            for subnet_name in generate_strings_list():
                with self.subTest(subnet_name):
                    loc_name = gen_string('alpha')
                    subnet = entities.Subnet(
                        name=subnet_name,
                        network=gen_ipaddr(ip3=True),
                        mask='255.255.255.0',
                    ).create()
                    self.assertEqual(subnet.name, subnet_name)
                    make_loc(session, name=loc_name)
                    self.assertIsNotNone(self.location.search(loc_name))
                    self.location.update(loc_name, new_subnets=[subnet_name])
                    self.location.search(loc_name).click()
                    session.nav.click(tab_locators['context.tab_subnets'])
                    element = session.nav.wait_until_element(
                        (strategy, value % subnet_name))
                    self.assertIsNotNone(element)
 def setUpClass(cls):
     super(RhevComputeResourceHostTestCase, cls).setUpClass()
     cls.rhev_url = settings.rhev.hostname
     cls.rhev_password = settings.rhev.password
     cls.rhev_username = settings.rhev.username
     cls.rhev_datacenter = settings.rhev.datacenter
     cls.rhev_img_name = settings.rhev.image_name
     cls.rhev_img_arch = settings.rhev.image_arch
     cls.rhev_img_os = settings.rhev.image_os
     cls.rhev_img_user = settings.rhev.image_username
     cls.rhev_img_pass = settings.rhev.image_password
     cls.rhev_vm_name = settings.rhev.vm_name
     cls.rhev_storage_domain = settings.rhev.storage_domain
     cls.rhev_cacert = requests.get(settings.rhev.ca_cert).content.decode()
     cls.org = entities.Organization(name=gen_string('alpha')).create()
     cls.org_name = cls.org.name
     cls.loc = entities.Location(
         name=gen_string('alpha'),
         organization=[cls.org],
     ).create()
     cls.loc_name = cls.loc.name
     cls.config_env = configure_provisioning(compute=True,
                                             org=cls.org,
                                             loc=cls.loc,
                                             os=cls.rhev_img_os)
     cls.os_name = cls.config_env['os']
     subnet = entities.Subnet().search(
         query={u'search': u'name={0}'.format(cls.config_env['subnet'])})
     if len(subnet) == 1:
         subnet = subnet[0].read()
         subnet.ipam = "DHCP"
         subnet.update(['ipam'])
 def setUpClass(cls):
     super(AnsibleREXTestCase, cls).setUpClass()
     cls.sat6_hostname = settings.server.hostname
     # register and setup a host here and tests will share the host, step 0.
     cls.org = entities.Organization().create()
     # create subnet for current org, default loc and domain
     # add rex proxy to subnet, default is internal proxy (id 1)
     # using API due BZ#1370460
     cls.sn = entities.Subnet(
         domain=[1],
         gateway=settings.vlan_networking.gateway,
         ipam='DHCP',
         location=[DEFAULT_LOC_ID],
         mask=settings.vlan_networking.netmask,
         network=settings.vlan_networking.subnet,
         organization=[cls.org.id],
         remote_execution_proxy=[entities.SmartProxy(id=1)],
     ).create()
     # Create VM and register content host
     cls.client = VirtualMachine(
         distro=DISTRO_RHEL7,
         provisioning_server=settings.compute_resources.libvirt_hostname,
         bridge=settings.vlan_networking.bridge)
     cls.addCleanup(vm_cleanup, cls.client)
     cls.client.create()
     cls.client.install_katello_ca()
     cls.client.register_contenthost(org=cls.org['label'], lce='Library')
     cls.assertTrue(cls.client.subscribed)
     Host.set_parameter({
         'host': cls.client.hostname,
         'name': 'remote_execution_connect_by_ip',
         'value': 'True',
     })
     add_remote_execution_ssh_key(cls.client.ip_addr)
Example #20
0
    def test_negative_update_parameter(self):
        """Subnet parameter can not be updated with invalid names

        :id: fcdbad13-ad96-4152-8e20-e023d61a2853

        :steps:

            1. Create valid subnet with valid parameter
            2. Update above subnet parameter with some invalid
                name. e.g name with spaces

        :expectedresults:

            1. The parameter should not be updated with invalid name
            2. An error for invalid name should be thrown
        """
        subnet = entities.Subnet().create()
        sub_param = entities.Parameter(
            name=gen_string('utf8'),
            subnet=subnet.id,
            value=gen_string('utf8')
        ).create()
        invalid_values = invalid_values_list() + ['name with space']
        for new_name in invalid_values:
            with self.subTest(new_name):
                with self.assertRaises(HTTPError):
                    sub_param.name = new_name
                    sub_param.update(['name'])
Example #21
0
    def test_positive_add_parameter_with_values_and_separator(self):
        """Subnet parameters can be created with values separated by comma

        :id: b3de6f96-7c39-4c44-b91c-a6d141f5dd6a

        :steps:

            1. Create Subnet with all the details
            2. Create subnet parameter having single key and values
                separated with comma

        :expectedresults: The parameter with values separated by comma should
            be saved in subnet
        """
        subnet = entities.Subnet().create()
        name = gen_string('alpha')
        values = ', '.join(generate_strings_list())
        with self.subTest(name):
            subnet_param = entities.Parameter(
                name=name,
                subnet=subnet.id,
                value=values
            ).create()
            self.assertEqual(subnet_param.name, name)
            self.assertEqual(subnet_param.value, values)
Example #22
0
    def test_positive_update_parameter(self):
        """Subnet parameter can be updated

        :id: 8c389c3f-60ef-4856-b8fc-c5b066c67a2f

        :steps:

            1. Create valid subnet with valid parameter
            2. Update above subnet parameter with new name and
                value

        :expectedresults: The parameter name and value should be updated
        """
        parameter = [{
            'name': gen_string('alpha'), 'value': gen_string('alpha')
        }]
        subnet = entities.Subnet(
            subnet_parameters_attributes=parameter).create()
        update_parameter = [{
            'name': gen_string('utf8'), 'value': gen_string('utf8')
        }]
        subnet.subnet_parameters_attributes = update_parameter
        up_subnet = subnet.update(['subnet_parameters_attributes'])
        self.assertEqual(
            up_subnet.subnet_parameters_attributes[0]['name'],
            update_parameter[0]['name']
        )
        self.assertEqual(
            up_subnet.subnet_parameters_attributes[0]['value'],
            update_parameter[0]['value']
        )
Example #23
0
    def test_negative_create_with_duplicated_parameters(self):
        """Attempt to create multiple parameters with same key name for the
        same subnet

        :id: aa69bdcc-e833-41e4-8f72-7139bdd64daa

        :steps:

            1. Create Subnet with all the details
            2. Create Multiple parameters having duplicate key names

        :expectedresults:

            1. The subnet parameters should not be created with duplicate
                names
            2. An error for duplicate parameter should be thrown
        """
        subnet = entities.Subnet().create()
        entities.Parameter(
            name='duplicateParameter', subnet=subnet.id
        ).create()
        with self.assertRaises(HTTPError) as context:
            entities.Parameter(
                name='duplicateParameter', subnet=subnet.id
            ).create()
        self.assertRegexpMatches(
            context.exception.response.text,
            "Name has already been taken"
        )
Example #24
0
    def test_negative_create_with_parameter_and_invalid_separator(self):
        """Subnet parameters can not be created with name with invalid
        separators

        :id: 08d10b75-a0db-4a11-a915-965a2a207d16

        :steps:

            1. Create Subnet with all the details
            2. Create subnet parameter having key with name separated by
                invalid separators(e.g spaces) and value

        :expectedresults:

            1. The parameter with name separated by invalid separators
                should not be saved in subnet
            2. An error for invalid name should be thrown.
        """
        subnet = entities.Subnet().create()
        invalid_values = invalid_values_list() + ['name with space']
        for name in invalid_values:
            with self.subTest(name):
                with self.assertRaises(HTTPError):
                    entities.Parameter(
                        name=name,
                        subnet=subnet.id
                    ).create()
Example #25
0
    def test_positive_create_with_parameter_and_valid_separator(self):
        """Subnet parameters can be created with name with valid separators

        :id: d1e2d75a-a1e8-4767-93f1-0bb1b75e10a0

        :steps:
            1. Create Subnet with all the details
            2. Create subnet parameter having key with name separated
                by valid separators(e.g fwd slash) and value

        :expectedresults: The parameter with name separated by valid
            separators should be saved in subnet
        """
        subnet = entities.Subnet().create()
        valid_separators = [',', '/', '-', '|']
        valid_names = []
        for separator in valid_separators:
            valid_names.append(
                '{}'.format(separator).join(generate_strings_list())
            )
        value = gen_string('utf8')
        for name in valid_names:
            with self.subTest(name):
                subnet_param = entities.Parameter(
                    name=name,
                    subnet=subnet.id,
                    value=value
                ).create()
                self.assertEqual(subnet_param.name, name)
                self.assertEqual(subnet_param.value, value)
Example #26
0
    def api_components(cls, id=None):
        """Components for which the post upgrade existence will be
        validated from API end

        :param str id: The id of an entity to get its data
        :returns dict: The dict of entities, where each key is component name
            and value is a list. In list the first item will be used to get
            list of a component entities and second will be used to get
            particular component entity data
        """
        api_comps = {
            'domain': [entities.Domain(), entities.Domain(id=id)],
            'subnet': [entities.Subnet(), entities.Subnet(id=id)],
            'contentview': [
                entities.ContentView(), entities.ContentView(id=id)]
        }
        return api_comps
Example #27
0
 def make_entities(self):
     """Set up reusable entities for tests."""
     return dict(
         domain=entities.Domain().create(),
         subnet=entities.Subnet().create(),
         env=entities.Environment().create(),
         host_group=entities.HostGroup().create(),
         template=entities.ProvisioningTemplate().create(),
         test_cr=entities.LibvirtComputeResource().create(),
         new_user=entities.User().create(),
     )
Example #28
0
    def test_pre_create_hostgroup(self, request):
        """Hostgroup with different data type are created

        :id: preupgrade-79958754-94b6-4bfe-af12-7d4031cd2dd2

        :steps: In Preupgrade Satellite, Create hostgroup with different entities.

        :expectedresults: Hostgroup should be create successfully.
        """

        proxy = entities.SmartProxy().search(
            query={'search': f'url = https://{settings.server.hostname}:9090'
                   })[0]
        test_name = request.node.name
        org = entities.Organization(name=f"{test_name}_org").create()
        loc = entities.Location(organization=[org],
                                name=f"{test_name}_loc").create()
        parent_hostgroup = entities.HostGroup(
            location=[loc.id],
            organization=[org.id],
            name=f'{test_name}_parent_host_grp').create()
        lc_env = entities.LifecycleEnvironment(name=f"{test_name}_lce",
                                               organization=org).create()

        domain = entities.Domain(name=f"{test_name}_domain").create()
        architecture = entities.Architecture().create()
        ptable = entities.PartitionTable().create()
        operatingsystem = entities.OperatingSystem(
            architecture=[architecture],
            ptable=[ptable],
            name=f"{test_name}_os").create()
        medium = entities.Media(operatingsystem=[operatingsystem]).create()
        subnet = entities.Subnet(location=[loc],
                                 organization=[org],
                                 name=f"{test_name}_subnet").create()

        host_group = entities.HostGroup(
            architecture=architecture,
            domain=domain,
            location=[loc.id],
            medium=medium,
            name=f"{test_name}_host_grp",
            operatingsystem=operatingsystem,
            organization=[org.id],
            ptable=ptable,
            puppet_proxy=proxy,
            puppet_ca_proxy=proxy,
            subnet=subnet,
            parent=parent_hostgroup,
            lifecycle_environment=lc_env,
            content_source=proxy,
            root_pass='******',
        ).create()
        assert host_group.name == f"{test_name}_host_grp"
Example #29
0
def valid_search_queries():
    """Generates a list of all the input strings, (excluding html)"""
    return [
        'cpu_count ^ 10',
        'disk_count > 5',
        'disks_size <= {0}'.format(gen_string('numeric', 8)),
        'ip = {0}'.format(gen_ipaddr()),
        'model = KVM',
        u'organization ~ {0}'.format(entities.Organization().create().name),
        u'subnet = {0}'.format(entities.Subnet().create().name),
    ]
Example #30
0
    def test_pre_scenario_remoteexecution_external_capsule(
            self, request, default_location, rhel7_contenthost):
        """Run REX job on client registered with external capsule

        :id: preupgrade-261dd2aa-be01-4c34-b877-54b8ee346561

        :steps:
            1. Create Subnet.
            2. Create Content host.
            3. Install katello-ca package and register to Satellite host.
            4. add rex ssh_key of external capsule on content host.
            5. run the REX job on client vm.

        :expectedresults:
            1. Content host should create with pre-required details.
            2. REX job should run on it.

        :parametrized: yes
        """
        sn = entities.Subnet(
            domain=self.vm_domain,
            gateway=self.gateway,
            ipam='DHCP',
            location=[default_location.id],
            mask=self.netmask,
            network=self.subnet,
            organization=[self.org.id],
            remote_execution_proxy=[entities.SmartProxy(id=2)],
        ).create()
        rhel7_contenthost.install_capsule_katello_ca(capsule=self.proxy_name)
        rhel7_contenthost.register_contenthost(org=self.org.label,
                                               lce='Library')
        capsule = Capsule(self.proxy_name)
        rhel7_contenthost.add_rex_key(satellite=capsule)
        host = entities.Host().search(
            query={'search': f'name="{rhel7_contenthost.hostname}"'})
        host[0].subnet = sn
        host[0].update(['subnet'])
        job = entities.JobInvocation().run(
            data={
                'job_template_id': 89,
                'inputs': {
                    'command': 'ls'
                },
                'targeting_type': 'static_query',
                'search_query': f'name = {rhel7_contenthost.hostname}',
            })
        assert job['output']['success_count'] == 1
        global_dict = {
            self.__class__.__name__: {
                'client_name': rhel7_contenthost.hostname
            }
        }
        create_dict(global_dict)