Skip to content

Commit

Permalink
Add a test about keeping management address type when disabling
Browse files Browse the repository at this point in the history
Before it was forced to change into IPv4 and would break
IPv6 setups

Signed-off-by: Benjamin Reis <[email protected]>
  • Loading branch information
benjamreis committed Nov 25, 2024
1 parent d1fb97a commit 0902d4b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from packaging import version

import lib.commands as commands
import lib.pif as pif

from lib.common import _param_add, _param_clear, _param_get, _param_remove, _param_set
from lib.common import safe_split, strip_suffix, to_xapi_bool, wait_for, wait_for_not
Expand Down Expand Up @@ -420,6 +421,10 @@ def reboot(self, verify=False):
def management_network(self):
return self.xe('network-list', {'bridge': self.inventory['MANAGEMENT_INTERFACE']}, minimal=True)

def management_pif(self):
uuid = self.xe('pif-list', {'management': True, 'host-uuid': self.uuid}, minimal=True)
return pif.PIF(uuid, self)

def disks(self):
""" List of SCSI disks, e.g ['sda', 'sdb', 'nvme0n1']. """
disks = self.ssh(['lsblk', '-nd', '-I', '8,259', '--output', 'NAME']).splitlines()
Expand Down
12 changes: 12 additions & 0 deletions tests/network/test_management_disable_address_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Requirements:
# - one XCP-ng host (--host) (>= 8.3 for IPv6 test)

def test_management_disable_address_type(host):
management_pif = host.management_pif()
type = management_pif.param_get("primary-address-type").lower()

host.xe("host-management-disable")
assert management_pif.param_get("primary-address-type").lower() == type

host.xe("host-management-reconfigure", {"pif-uuid": management_pif.uuid})
assert management_pif.param_get("primary-address-type").lower() == type

0 comments on commit 0902d4b

Please sign in to comment.