Skip to content

Commit

Permalink
Provide more general level 3 OS indicators with separate OS versions
Browse files Browse the repository at this point in the history
This helps us perform simpler more granulated checks of each used
vm environment.
  • Loading branch information
pevogam committed Oct 17, 2024
1 parent f28fe57 commit 41b9312
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 32 deletions.
2 changes: 1 addition & 1 deletion avocado_i2n/vmnet/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,7 @@ def _reconfigure_vm_nic(self, interface: VMInterface, vm: VM) -> None:
)
netcmd = 'netsh interface ip add dns name="%s" addr=%s index=1'
vm.session.cmd(netcmd % (network, interface.netconfig.gateway))
elif vm.params["os_variant"] in ["ak", "al", "am"]:
elif vm.params["os_variant"] == "android":
raise exceptions.TestError(
"No static IP can be set for Android devices (%s)" % vm.name
)
Expand Down
46 changes: 25 additions & 21 deletions selftests/isolation/test_cartesian_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ def test_parse_flat_objects_vm(self):
self.assertEqual(len(test_objects), 2)
self.assertRegex(test_objects[1].params["name"], r"vms.vm1\.qemu_kvm_centos.*CentOS.*")
self.assertEqual(test_objects[1].params["vms"], "vm1")
self.assertEqual(test_objects[1].params["os_variant"], "el8")
self.assertEqual(test_objects[1].params["os_variant"], "centos")
self.assertRegex(test_objects[0].params["name"], r"vms.vm1\.qemu_kvm_fedora.*Fedora.*")
self.assertEqual(test_objects[0].params["vms"], "vm1")
self.assertEqual(test_objects[0].params["os_variant"], "f33")
self.assertEqual(test_objects[0].params["os_variant"], "fedora")

test_object = TestGraph.parse_flat_objects("vm1", "vms", "CentOS", unique=True)
self.assertRegex(test_object.params["name"], r"vms.vm1\.qemu_kvm_centos.*CentOS.*")
Expand Down Expand Up @@ -157,12 +157,12 @@ def test_parse_composite_objects_vm(self):
self.assertRegex(test_objects[1].params["name"], r"vm1\.qemu_kvm_centos.*CentOS.*")
self.assertEqual(test_objects[1].params["vms"], "vm1")
self.assertEqual(test_objects[1].params["main_vm"], "vm1")
self.assertEqual(test_objects[1].params["os_variant"], "el8")
self.assertEqual(test_objects[1].params["os_variant"], "centos")
self.assertEqual(test_objects[1].params["cdrom_cd_rip"], "/mnt/local/isos/autotest_rip.iso")
self.assertRegex(test_objects[0].params["name"], r"vm1\.qemu_kvm_fedora.*Fedora.*")
self.assertEqual(test_objects[0].params["vms"], "vm1")
self.assertEqual(test_objects[0].params["main_vm"], "vm1")
self.assertEqual(test_objects[0].params["os_variant"], "f33")
self.assertEqual(test_objects[0].params["os_variant"], "fedora")
self.assertEqual(test_objects[0].params["cdrom_cd_rip"], "/mnt/local/isos/autotest_rip.iso")
self.assertNotIn("only", test_objects[0].params)

Expand All @@ -179,9 +179,9 @@ def test_parse_composite_objects_net(self):
self.assertEqual(test_object.params["vms_vm1"], "vm1")
self.assertEqual(test_object.params["vms_vm2"], "vm2")
self.assertEqual(test_object.params["vms_vm3"], "vm3")
self.assertEqual(test_object.params["os_variant_vm1"], "el8")
self.assertEqual(test_object.params["os_variant_vm1"], "centos")
self.assertEqual(test_object.params["os_variant_vm2"], "win10")
self.assertEqual(test_object.params["os_variant_vm3"], "ubuntutrusty")
self.assertEqual(test_object.params["os_variant_vm3"], "ubuntu")
self.assertEqual(test_object.params["cdrom_cd_rip"], "/mnt/local/isos/autotest_rip.iso")
self.assertNotIn("only", test_object.params)
self.assertNotIn("only_vm1", test_object.params)
Expand Down Expand Up @@ -213,9 +213,9 @@ def test_parse_composite_objects_net_and_cluster(self):
self.assertEqual(test_object.params["vms_vm1"], "vm1")
self.assertEqual(test_object.params["vms_vm2"], "vm2")
self.assertEqual(test_object.params["vms_vm3"], "vm3")
self.assertEqual(test_object.params["os_variant_vm1"], "el8")
self.assertEqual(test_object.params["os_variant_vm1"], "centos")
self.assertEqual(test_object.params["os_variant_vm2"], "win10")
self.assertEqual(test_object.params["os_variant_vm3"], "ubuntutrusty")
self.assertEqual(test_object.params["os_variant_vm3"], "ubuntu")
self.assertEqual(test_object.params["cdrom_cd_rip"], "/mnt/local/isos/autotest_rip.iso")
self.assertNotIn("only", test_object.params)
self.assertNotIn("only_vm1", test_object.params)
Expand Down Expand Up @@ -323,14 +323,14 @@ def assertVariant(test_object, name, vm1_os, vm2_os, vm3_os):
self.assertEqual(test_object.params["os_variant_vm2"], vm2_os)
self.assertEqual(test_object.params["os_variant_vm3"], vm3_os)
self.assertEqual(test_object.params["cdrom_cd_rip"], "/mnt/local/isos/autotest_rip.iso")
assertVariant(nets[0], r"vm1\.qemu_kvm_fedora.*qcow.*Fedora.*vm2\.qemu_kvm_windows_7.*qcow.*Win7.*.vm3.qemu_kvm_ubuntu.*qcow.*Ubuntu.*", "f33", "win7", "ubuntutrusty")
assertVariant(nets[1], r"vm1\.qemu_kvm_fedora.*qcow.*Fedora.*vm2\.qemu_kvm_windows_7.*qcow.*Win7.*.vm3.qemu_kvm_kali.*qcow.*Kali.*", "f33", "win7", "kl")
assertVariant(nets[2], r"vm1\.qemu_kvm_fedora.*qcow.*Fedora.*vm2\.qemu_kvm_windows_10.*qcow.*Win10.*.vm3.qemu_kvm_ubuntu.*qcow.*Ubuntu.*", "f33", "win10", "ubuntutrusty")
assertVariant(nets[3], r"vm1\.qemu_kvm_fedora.*qcow.*Fedora.*vm2\.qemu_kvm_windows_10.*qcow.*Win10.*.vm3.qemu_kvm_kali.*qcow.*Kali.*", "f33", "win10", "kl")
assertVariant(nets[4], r"vm1\.qemu_kvm_centos.*qcow.*CentOS.*vm2\.qemu_kvm_windows_7.*.qcow.*Win7.*vm3.qemu_kvm_ubuntu.*qcow.*Ubuntu.*", "el8", "win7", "ubuntutrusty")
assertVariant(nets[5], r"vm1\.qemu_kvm_centos.*qcow.*CentOS.*vm2\.qemu_kvm_windows_7.*qcow.*Win7.*.vm3.qemu_kvm_kali.*qcow.*Kali.*", "el8", "win7", "kl")
assertVariant(nets[6], r"vm1\.qemu_kvm_centos.*qcow.*CentOS.*vm2\.qemu_kvm_windows_10.*qcow.*Win10.*.vm3.qemu_kvm_ubuntu.*qcow.*Ubuntu.*", "el8", "win10", "ubuntutrusty")
assertVariant(nets[7], r"vm1\.qemu_kvm_centos.*qcow.*CentOS.*vm2\.qemu_kvm_windows_10.*qcow.*Win10.*.vm3.qemu_kvm_kali.*qcow.*Kali.*", "el8", "win10", "kl")
assertVariant(nets[0], r"vm1\.qemu_kvm_fedora.*qcow.*Fedora.*vm2\.qemu_kvm_windows_7.*qcow.*Win7.*.vm3.qemu_kvm_ubuntu.*qcow.*Ubuntu.*", "fedora", "win7", "ubuntu")
assertVariant(nets[1], r"vm1\.qemu_kvm_fedora.*qcow.*Fedora.*vm2\.qemu_kvm_windows_7.*qcow.*Win7.*.vm3.qemu_kvm_kali.*qcow.*Kali.*", "fedora", "win7", "kl")
assertVariant(nets[2], r"vm1\.qemu_kvm_fedora.*qcow.*Fedora.*vm2\.qemu_kvm_windows_10.*qcow.*Win10.*.vm3.qemu_kvm_ubuntu.*qcow.*Ubuntu.*", "fedora", "win10", "ubuntu")
assertVariant(nets[3], r"vm1\.qemu_kvm_fedora.*qcow.*Fedora.*vm2\.qemu_kvm_windows_10.*qcow.*Win10.*.vm3.qemu_kvm_kali.*qcow.*Kali.*", "fedora", "win10", "kl")
assertVariant(nets[4], r"vm1\.qemu_kvm_centos.*qcow.*CentOS.*vm2\.qemu_kvm_windows_7.*.qcow.*Win7.*vm3.qemu_kvm_ubuntu.*qcow.*Ubuntu.*", "centos", "win7", "ubuntu")
assertVariant(nets[5], r"vm1\.qemu_kvm_centos.*qcow.*CentOS.*vm2\.qemu_kvm_windows_7.*qcow.*Win7.*.vm3.qemu_kvm_kali.*qcow.*Kali.*", "centos", "win7", "kl")
assertVariant(nets[6], r"vm1\.qemu_kvm_centos.*qcow.*CentOS.*vm2\.qemu_kvm_windows_10.*qcow.*Win10.*.vm3.qemu_kvm_ubuntu.*qcow.*Ubuntu.*", "centos", "win10", "ubuntu")
assertVariant(nets[7], r"vm1\.qemu_kvm_centos.*qcow.*CentOS.*vm2\.qemu_kvm_windows_10.*qcow.*Win10.*.vm3.qemu_kvm_kali.*qcow.*Kali.*", "centos", "win10", "kl")

def test_parse_components_for_net_restricted(self):
"""Test for correctly parsed restricted vm components with unflattened net."""
Expand All @@ -348,10 +348,14 @@ def assertVariant(test_object, name, vm1_os, vm2_os, vm3_os):
self.assertEqual(test_object.params["os_variant_vm2"], vm2_os)
self.assertEqual(test_object.params["os_variant_vm3"], vm3_os)
self.assertEqual(test_object.params["cdrom_cd_rip"], "/mnt/local/isos/autotest_rip.iso")
assertVariant(nets[0], r"vm1\.qemu_kvm_centos.*CentOS.*vm2\.qemu_kvm_windows_7.*Win7.*.vm3.qemu_kvm_ubuntu.*Ubuntu.*", "el8", "win7", "ubuntutrusty")
assertVariant(nets[1], r"vm1\.qemu_kvm_centos.*CentOS.*vm2\.qemu_kvm_windows_7.*Win7.*.vm3.qemu_kvm_kali.*Kali.*", "el8", "win7", "kl")
assertVariant(nets[2], r"vm1\.qemu_kvm_centos.*CentOS.*vm2\.qemu_kvm_windows_10.*Win10.*.vm3.qemu_kvm_ubuntu.*Ubuntu.*", "el8", "win10", "ubuntutrusty")
assertVariant(nets[3], r"vm1\.qemu_kvm_centos.*CentOS.*vm2\.qemu_kvm_windows_10.*Win10.*.vm3.qemu_kvm_kali.*Kali.*", "el8", "win10", "kl")
assertVariant(nets[0], r"vm1\.qemu_kvm_centos.*CentOS.*vm2\.qemu_kvm_windows_7.*Win7.*.vm3.qemu_kvm_ubuntu.*Ubuntu.*",
"centos", "win7", "ubuntu")
assertVariant(nets[1], r"vm1\.qemu_kvm_centos.*CentOS.*vm2\.qemu_kvm_windows_7.*Win7.*.vm3.qemu_kvm_kali.*Kali.*",
"centos", "win7", "kl")
assertVariant(nets[2], r"vm1\.qemu_kvm_centos.*CentOS.*vm2\.qemu_kvm_windows_10.*Win10.*.vm3.qemu_kvm_ubuntu.*Ubuntu.*",
"centos", "win10", "ubuntu")
assertVariant(nets[3], r"vm1\.qemu_kvm_centos.*CentOS.*vm2\.qemu_kvm_windows_10.*Win10.*.vm3.qemu_kvm_kali.*Kali.*",
"centos", "win10", "kl")

def test_params(self):
"""Test for correctly parsed and regenerated test object parameters."""
Expand Down Expand Up @@ -2248,7 +2252,7 @@ def test_get_objects(self):
self.assertEqual(len(get_objects), 1)
get_objects = graph.get_objects("os_type", param_val="linux", subset=get_objects)
self.assertEqual(len(get_objects), 1)
get_objects = graph.get_objects(param_key="os_variant", param_val="el8", subset=get_objects)
get_objects = graph.get_objects(param_key="os_variant", param_val="centos", subset=get_objects)
self.assertEqual(len(get_objects), 1)
get_node = graph.get_nodes(param_key="os_type", param_val="linux",
subset=get_objects, unique=True)
Expand Down
32 changes: 24 additions & 8 deletions tp_folder/configs/guest-os.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ variants:
variants:
- 17.64:
# os level 2 indicator
os_variant = f17
os_variant = fedora
# os level 3 indicator
os_version = 17
image_name = f17-64
# install subvariant configuration
unattended_install:
Expand All @@ -60,7 +62,9 @@ variants:

- 18.64:
# os level 2 indicator
os_variant = f18
os_variant = fedora
# os level 3 indicator
os_version = 18
image_name = f18-64
vm_arch_name = x86_64
# install subvariant configuration
Expand All @@ -83,7 +87,9 @@ variants:
url = http://dl.fedoraproject.org/pub/fedora/linux/releases/18/Fedora/x86_64/os
- 33.64:
# os level 2 indicator
os_variant = f33
os_variant = fedora
# os level 3 indicator
os_version = 33
image_name = f33-64
vm_arch_name = x86_64
# install subvariant configuration
Expand Down Expand Up @@ -118,7 +124,9 @@ variants:
variants:
- 6.6:
# os level 2 indicator
os_variant = el6
os_variant = centos
# os level 3 indicator
os_version = 6
image_name = el6
# install subvariant configuration
unattended_install:
Expand Down Expand Up @@ -159,7 +167,9 @@ variants:
floppy_name = images/centos66-64/ks.vfd
- 7.0:
# os level 2 indicator
os_variant = el7
os_variant = centos
# os level 3 indicator
os_version = 7
image_name = el7
# install subvariant configuration
unattended_install:
Expand All @@ -186,7 +196,9 @@ variants:
floppy_name = images/rhel70-64/ks.vfd
- 8.0:
# os level 2 indicator
os_variant = el8
os_variant = centos
# os level 3 indicator
os_version = 8
image_name = el8
# install subvariant configuration
unattended_install:
Expand Down Expand Up @@ -230,7 +242,8 @@ variants:
- 14.04.3-server.x86_64:
image_name += -14.04.3-server-64
vm_arch_name = x86_64
os_variant = ubuntutrusty
# os level 2 indicator
os_variant = ubuntu
# install subvariant configuration
unattended_install:
cdroms = cd1
Expand All @@ -248,7 +261,8 @@ variants:
- 16.04-server.s390x:
image_name += -16.04-server-s390x
vm_arch_name = s390x
os_variant = ubuntutrusty
# os level 2 indicator
os_variant = ubuntu
# install subvariant configuration
unattended_install:
cdroms = cd1
Expand Down Expand Up @@ -591,6 +605,7 @@ variants:
cd_format = ahci

- Win8:
# os level 2 indicator
os_variant = win8
image_name = win8
nic_wname = "Ethernet"
Expand Down Expand Up @@ -646,6 +661,7 @@ variants:
cdrom_unattended = "images/win8.1-64/autounattend.iso"

- Win10:
# os level 2 indicator
os_variant = win10
image_name = win10
nic_wname = "Ethernet"
Expand Down
2 changes: 1 addition & 1 deletion tp_folder/tests/shared_connect_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def run(test, params, env):
vm, session = vmnet.get_single_vm_with_session()

vmnet.ping_all()
if vm.params["os_variant"] == "el8":
if vm.params["os_variant"] == "centos":
session.cmd("pip3 install Pyro4")
else:
test.log.info(f"No remote support for OS variant {vm.params['os_variant']}")
2 changes: 1 addition & 1 deletion tp_folder/tests/shared_customize_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def run(test, params, env):
vmnet = env.get_vmnet()
vm, session, params = vmnet.get_single_vm_with_session_and_params()
os_type = params.get("os_type", "linux")
os_variant = params.get("os_variant", "ibs")
os_variant = params.get("os_variant", "fedora")
tmp_dir = params.get("tmp_dir", "/tmp")

# main deployment part
Expand Down

0 comments on commit 41b9312

Please sign in to comment.