Convert the XML vlan value found from str to int

To update that created a vlan ID parameter for SR-IOV (sriov_vlan_id)
[1], introduces the parameter as an int. When checking the vlan tag in
the guest it will return as a str causing the check to fail e.g.:

"testtools.matchers._impl.MismatchError: 2000 != '2000': Interface should have have vlan tag 2000 but instead it is tagged with 2000"

Casting the vlan tag found in the XML as an int to ensure the check
matches.

[1] f7104a681d

Change-Id: I62f519db8709c23824a0fee1a6ce63ab3bf1f9e2
This commit is contained in:
James Parker 2023-06-06 17:11:16 -04:00
parent 8a82488578
commit 401cb527c6
1 changed files with 3 additions and 2 deletions

View File

@ -89,10 +89,11 @@ class SRIOVBase(base.BaseWhiteboxComputeTest):
:param port: dictionary describing port to find
"""
interface_vlan = port_xml_element.find("./vlan/tag").get('id', None)
found_vlan = int(interface_vlan) if interface_vlan else None
self.assertEqual(
expected_vlan, interface_vlan, 'Interface should have have vlan '
expected_vlan, found_vlan, 'Interface should have have vlan '
'tag %s but instead it is tagged with %s' %
(expected_vlan, interface_vlan))
(expected_vlan, found_vlan))
class SRIOVNumaAffinity(SRIOVBase, numa_helper.NUMAHelperMixin):