def setUpClass(cls): super().setUpClass() bridge = settings.vlan_networking.bridge # RHV Settings 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.rhv_api = RHEVMSystem( hostname=cls.rhev_url.split('/')[2], username=cls.rhev_username, password=cls.rhev_password, version='4.0', verify=False, ) cls.cluster_id = cls.rhv_api.get_cluster(cls.rhev_datacenter).id cls.storage_id = cls.rhv_api.get_storage_domain(cls.rhev_storage_domain).id cls.network_id = ( cls.rhv_api.api.system_service().networks_service().list(search=f'name={bridge}')[0].id ) if is_open('BZ:1685949'): dc = cls.rhv_api._data_centers_service.list(search=f'name={cls.rhev_datacenter}')[0] dc = cls.rhv_api._data_centers_service.data_center_service(dc.id) cls.quota = dc.quotas_service().list()[0].id else: cls.quota = 'Default' # Vmware Settings cls.vmware_server = settings.vmware.vcenter cls.vmware_password = settings.vmware.password cls.vmware_username = settings.vmware.username cls.vmware_datacenter = settings.vmware.datacenter cls.vmware_img_name = settings.vmware.image_name cls.vmware_img_arch = settings.vmware.image_arch cls.vmware_img_os = settings.vmware.image_os cls.vmware_img_user = settings.vmware.image_username cls.vmware_img_pass = settings.vmware.image_password cls.vmware_vm_name = settings.vmware.vm_name cls.current_interface = VMWARE_CONSTANTS.get('network_interfaces') % bridge cls.vmware_api = VMWareSystem( hostname=cls.vmware_server, username=cls.vmware_username, password=cls.vmware_password ) cls.vmware_net_id = cls.vmware_api.get_network(cls.current_interface)._moId # Provisioning setup 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']
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(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(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.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 )
def setUpClass(cls): super(ComputeResourceHostTestCase, cls).setUpClass() bridge = settings.vlan_networking.bridge # RHV Settings 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.rhv_api = RHEVMSystem(hostname=cls.rhev_url.split('/')[2], username=cls.rhev_username, password=cls.rhev_password, version='4.0', verify=False) cls.cluster_id = cls.rhv_api.get_cluster(cls.rhev_datacenter).id cls.storage_id = cls.rhv_api._get_storage_domain( cls.rhev_storage_domain).id cls.network_id = ( cls.rhv_api.api.system_service().networks_service().list( search='name={0}'.format(bridge))[0].id) # Vmware Settings cls.vmware_server = settings.vmware.vcenter cls.vmware_password = settings.vmware.password cls.vmware_username = settings.vmware.username cls.vmware_datacenter = settings.vmware.datacenter cls.vmware_img_name = settings.vmware.image_name cls.vmware_img_arch = settings.vmware.image_arch cls.vmware_img_os = settings.vmware.image_os cls.vmware_img_user = settings.vmware.image_username cls.vmware_img_pass = settings.vmware.image_password cls.vmware_vm_name = settings.vmware.vm_name cls.current_interface = (VMWARE_CONSTANTS.get('network_interfaces') % bridge) cls.vmware_api = VMWareSystem(hostname=cls.vmware_server, username=cls.vmware_username, password=cls.vmware_password) cls.vmware_net_id = cls.vmware_api.get_obj( vimtype=vim.Network, name=cls.current_interface)._moId # Provisioning setup 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']
def provisioning_env(module_org, module_loc): # Build PXE default template to get default PXE file entities.ConfigTemplate().build_pxe_default() return configure_provisioning( org=module_org, loc=module_loc, os='Redhat {0}'.format(RHELRepository().repo_data['version']), )
def provisioning_env(discovery_org, discovery_location): # Build PXE default template to get default PXE file entities.ProvisioningTemplate().build_pxe_default() return configure_provisioning( org=discovery_org, loc=discovery_location, os='Redhat {}'.format(RHELRepository().repo_data['version']), )
def provisioning(module_org, module_location): provisioning.org_name = module_org.name provisioning.loc_name = module_location.name provisioning.config_env = configure_provisioning( compute=True, org=module_org, loc=module_location, os=None ) provisioning.os_name = provisioning.config_env['os'] return provisioning
def provisioning(module_org, module_location): os = None if hasattr(settings, 'rhev') and hasattr(settings.rhev, 'image_os') and settings.rhev.image_os: os = settings.rhev.image_os provisioning = {} provisioning['org_name'] = module_org.name provisioning['loc_name'] = module_location.name provisioning['config_env'] = configure_provisioning( compute=True, org=module_org, loc=module_location, os=os ) provisioning['os_name'] = provisioning['config_env']['os'] return provisioning
def provisioning(module_org, module_location): os = None if hasattr(settings, 'rhev') and hasattr(settings.rhev, 'image_os') and settings.rhev.image_os: os = settings.rhev.image_os provisioning = type("", (), {})() provisioning.org_name = module_org.name provisioning.loc_name = module_location.name provisioning.config_env = configure_provisioning( compute=True, org=module_org, loc=module_location, os=os ) provisioning.os_name = provisioning.config_env['os'] return provisioning
def setUpClass(cls): """Steps to Configure foreman discovery 1. Build PXE default template 2. Create Organization/Location 3. Update Global parameters to set default org and location for discovered hosts. 4. Enable auto_provision flag to perform discovery via discovery rules. """ super(DiscoveryTestCase, cls).setUpClass() # Build PXE default template to get default PXE file entities.ConfigTemplate().build_pxe_default() # Create Org and location 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() # Update default org and location params to place discovered host cls.discovery_loc = entities.Setting().search( query={'search': 'name="discovery_location"'})[0] cls.discovery_loc.value = cls.loc.name cls.discovery_loc.update({'value'}) cls.discovery_org = entities.Setting().search( query={'search': 'name="discovery_organization"'})[0] cls.discovery_org.value = cls.org.name cls.discovery_org.update({'value'}) # Enable flag to auto provision discovered hosts via discovery rules cls.discovery_auto = entities.Setting().search( query={'search': 'name="discovery_auto"'})[0] cls.default_discovery_auto = str(cls.discovery_auto.value) cls.discovery_auto.value = 'True' cls.discovery_auto.update({'value'}) cls.config_env = configure_provisioning(org=cls.org, loc=cls.loc)
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.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)
def setUpClass(cls): super(ComputeResourceHostTestCase, cls).setUpClass() bridge = settings.vlan_networking.bridge # RHV Settings 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.rhv_api = RHEVMSystem(hostname=cls.rhev_url.split('/')[2], username=cls.rhev_username, password=cls.rhev_password, version='4.0', verify=False ) cls.cluster_id = cls.rhv_api.get_cluster(cls.rhev_datacenter).id cls.storage_id = cls.rhv_api.get_storage_domain( cls.rhev_storage_domain).id cls.network_id = ( cls.rhv_api.api.system_service().networks_service( ).list(search='name={0}'.format(bridge))[0].id ) if bz_bug_is_open(1685949): dc = cls.rhv_api._data_centers_service.list( search='name={0}'.format(cls.rhev_datacenter))[0] dc = cls.rhv_api._data_centers_service.data_center_service(dc.id) cls.quota = dc.quotas_service().list()[0].id else: cls.quota = 'Default' # Vmware Settings cls.vmware_server = settings.vmware.vcenter cls.vmware_password = settings.vmware.password cls.vmware_username = settings.vmware.username cls.vmware_datacenter = settings.vmware.datacenter cls.vmware_img_name = settings.vmware.image_name cls.vmware_img_arch = settings.vmware.image_arch cls.vmware_img_os = settings.vmware.image_os cls.vmware_img_user = settings.vmware.image_username cls.vmware_img_pass = settings.vmware.image_password cls.vmware_vm_name = settings.vmware.vm_name cls.current_interface = ( VMWARE_CONSTANTS.get('network_interfaces') % bridge ) cls.vmware_api = VMWareSystem(hostname=cls.vmware_server, username=cls.vmware_username, password=cls.vmware_password ) cls.vmware_net_id = cls.vmware_api.get_network( cls.current_interface)._moId # Provisioning setup 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']