Skip to content

Commit

Permalink
Update VMware CR tests (#12773)
Browse files Browse the repository at this point in the history
Update VMware tests

Signed-off-by: Shubham Ganar <[email protected]>
  • Loading branch information
shubhamsg199 authored Oct 6, 2023
1 parent 35252d1 commit 8a3f8a4
Show file tree
Hide file tree
Showing 7 changed files with 253 additions and 482 deletions.
36 changes: 17 additions & 19 deletions conf/vmware.yaml.template
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
VMWARE:
# Vmware to be added as a compute resource
# vmware vcenter URL, e.g. example.com
# VMware to be added as a compute resource
# VCENTER: vmware vcenter URL
VCENTER:
# Login for vmware
# USERNAME: Login for vmware
USERNAME:
# Password for vmware
# PASSWORD: Password for vmware
PASSWORD:
# vmware datacenter
# DATACENTER: vmware datacenter
DATACENTER:
# cluster: vmware cluster
# CLUSTER: vmware cluster
CLUSTER:
# Name of VM that should be used
# DATASTORE: vmware datastore
DATASTORE:
# VM_NAME: Name of VM to power On/Off & delete
VM_NAME:
# mac_address: Mac address of the vm
# MAC_ADDRESS: Mac address of the vm
MAC_ADDRESS:
# hypervisor: IP address of the hypervisor
# HYPERVISOR: IP address or hostname of the hypervisor
HYPERVISOR:


# Vmware Compute resource image data
# Operating system of the image
# VMware Compute resource image data
# IMAGE_OS: Operating system of the image
IMAGE_OS:
# Architecture of the image
# IMAGE_ARCH: Architecture of the image
IMAGE_ARCH:
# Login to the image
# IMAGE_USERNAME: Login to the image
IMAGE_USERNAME:
# Password of that user
# IMAGE_PASSWORD: Password to the image
IMAGE_PASSWORD:
# Image name on the external provider
# IMAGE_NAME: Image name on the external provider
IMAGE_NAME:
# Interface used for some tests; not required to work with provisioning, not required to be in VLAN
INTERFACE:
1 change: 1 addition & 0 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
'pytest_fixtures.component.provision_gce',
'pytest_fixtures.component.provision_libvirt',
'pytest_fixtures.component.provision_pxe',
'pytest_fixtures.component.provision_vmware',
'pytest_fixtures.component.provisioning_template',
'pytest_fixtures.component.puppet',
'pytest_fixtures.component.repository',
Expand Down
59 changes: 59 additions & 0 deletions pytest_fixtures/component/provision_vmware.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
from fauxfactory import gen_string
import pytest

from robottelo.config import settings


@pytest.fixture(scope='module')
def module_vmware_cr(module_provisioning_sat, module_sca_manifest_org, module_location):
vmware_cr = module_provisioning_sat.sat.api.VMWareComputeResource(
name=gen_string('alpha'),
provider='Vmware',
url=settings.vmware.vcenter,
user=settings.vmware.username,
password=settings.vmware.password,
datacenter=settings.vmware.datacenter,
organization=[module_sca_manifest_org],
location=[module_location],
).create()
return vmware_cr


@pytest.fixture
def module_vmware_hostgroup(
module_vmware_cr,
module_provisioning_sat,
module_sca_manifest_org,
module_location,
default_architecture,
module_provisioning_rhel_content,
module_lce_library,
default_partitiontable,
module_provisioning_capsule,
pxe_loader,
):
return module_provisioning_sat.sat.api.HostGroup(
name=gen_string('alpha'),
organization=[module_sca_manifest_org],
location=[module_location],
architecture=default_architecture,
domain=module_provisioning_sat.domain,
content_source=module_provisioning_capsule.id,
content_view=module_provisioning_rhel_content.cv,
compute_resource=module_vmware_cr,
kickstart_repository=module_provisioning_rhel_content.ksrepo,
lifecycle_environment=module_lce_library,
root_pass=settings.provisioning.host_root_password,
operatingsystem=module_provisioning_rhel_content.os,
ptable=default_partitiontable,
subnet=module_provisioning_sat.subnet,
pxe_loader=pxe_loader.pxe_loader,
group_parameters_attributes=[
# assign AK in order the hosts to be subscribed
{
'name': 'kt_activation_keys',
'parameter_type': 'string',
'value': module_provisioning_rhel_content.ak.name,
},
],
).create()
6 changes: 2 additions & 4 deletions robottelo/constants/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1725,17 +1725,15 @@ class Colored(Box):
STRING_TYPES = ['alpha', 'numeric', 'alphanumeric', 'latin1', 'utf8', 'cjk', 'html']

VMWARE_CONSTANTS = {
'cluster': 'Satellite-Engineering',
'folder': 'vm',
'guest_os': 'Red Hat Enterprise Linux 7 (64-bit)',
'guest_os': 'Red Hat Enterprise Linux 8 (64-bit)',
'scsicontroller': 'LSI Logic Parallel',
'virtualhw_version': 'Default',
'pool': 'Resources',
'network_interface_name': 'VMXNET 3',
'datastore': 'Local-Ironforge',
'network_interfaces': 'qe_%s',
}


HAMMER_CONFIG = "~/.hammer/cli.modules.d/foreman.yml"
HAMMER_SESSIONS = "~/.hammer/sessions"

Expand Down
Loading

0 comments on commit 8a3f8a4

Please sign in to comment.