From 453d1f9cebea1d1f01cef230e16113226fca8038 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 13 Jan 2023 10:01:28 -0500 Subject: [PATCH] Add IPv6 configuration support For redfish and IPMI devices, support new IPv6 static configuration controls --- confluent_client/bin/nodeconfig | 6 ++++++ confluent_server/confluent/messages.py | 5 ++++- .../confluent/plugins/hardwaremanagement/ipmi.py | 10 +++++++++- .../confluent/plugins/hardwaremanagement/redfish.py | 10 +++++++++- 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/confluent_client/bin/nodeconfig b/confluent_client/bin/nodeconfig index 261ddc32..06d512c7 100755 --- a/confluent_client/bin/nodeconfig +++ b/confluent_client/bin/nodeconfig @@ -90,6 +90,12 @@ cfgpaths = { 'bmc.ipv4_gateway': ( 'configuration/management_controller/net_interfaces/management', 'ipv4_gateway'), + 'bmc.static_ipv6_addresses': ( + 'configuration/management_controller/net_interfaces/management', + 'static_v6_addresses'), + 'bmc.static_ipv6_gateway': ( + 'configuration/management_controller/net_interfaces/management', + 'static_v6_gateway'), 'bmc.hostname': ( 'configuration/management_controller/hostname', 'hostname'), } diff --git a/confluent_server/confluent/messages.py b/confluent_server/confluent/messages.py index 1c9ce2b4..a24a4d78 100644 --- a/confluent_server/confluent/messages.py +++ b/confluent_server/confluent/messages.py @@ -1682,16 +1682,19 @@ class NetworkConfiguration(ConfluentMessage): desc = 'Network configuration' def __init__(self, name=None, ipv4addr=None, ipv4gateway=None, - ipv4cfgmethod=None, hwaddr=None): + ipv4cfgmethod=None, hwaddr=None, staticv6addrs=(), staticv6gateway=None): self.myargs = (name, ipv4addr, ipv4gateway, ipv4cfgmethod, hwaddr) self.notnode = name is None self.stripped = False + v6addrs = ','.join(staticv6addrs) kvpairs = { 'ipv4_address': {'value': ipv4addr}, 'ipv4_gateway': {'value': ipv4gateway}, 'ipv4_configuration': {'value': ipv4cfgmethod}, 'hw_addr': {'value': hwaddr}, + 'static_v6_addresses': {'value': v6addrs}, + 'static_v6_gateway': {'value': staticv6gateway} } if self.notnode: self.kvpairs = kvpairs diff --git a/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py b/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py index 3c1cf047..2fd06da5 100644 --- a/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py +++ b/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py @@ -735,11 +735,14 @@ class IpmiHandler(object): elif len(self.element) == 4 and self.element[-1] == 'management': if self.op == 'read': lancfg = self.ipmicmd.get_net_configuration() + v6cfg = self.ipmicmd.get_net6_configuration() self.output.put(msg.NetworkConfiguration( self.node, ipv4addr=lancfg['ipv4_address'], ipv4gateway=lancfg['ipv4_gateway'], ipv4cfgmethod=lancfg['ipv4_configuration'], - hwaddr=lancfg['mac_address'] + hwaddr=lancfg['mac_address'], + staticv6addrs=v6cfg['static_addrs'], + staticv6gateway=v6cfg['static_gateway'], )) elif self.op == 'update': config = self.inputdata.netconfig(self.node) @@ -748,6 +751,11 @@ class IpmiHandler(object): ipv4_address=config['ipv4_address'], ipv4_configuration=config['ipv4_configuration'], ipv4_gateway=config['ipv4_gateway']) + v6addrs = config.get('static_v6_addresses', None) + if v6addrs is not None: + v6addrs = v6addrs.split(',') + v6gw = config.get('static_v6_gateway', None) + self.ipmicmd.set_net6_configuration(static_addressess=v6addrs, static_gateway=v6gw) except socket.error as se: self.output.put(msg.ConfluentNodeError(self.node, se.message)) diff --git a/confluent_server/confluent/plugins/hardwaremanagement/redfish.py b/confluent_server/confluent/plugins/hardwaremanagement/redfish.py index b4bdc86a..20315134 100644 --- a/confluent_server/confluent/plugins/hardwaremanagement/redfish.py +++ b/confluent_server/confluent/plugins/hardwaremanagement/redfish.py @@ -589,11 +589,14 @@ class IpmiHandler(object): elif len(self.element) == 4 and self.element[-1] == 'management': if self.op == 'read': lancfg = self.ipmicmd.get_net_configuration() + v6cfg = self.ipmicmd.get_net6_configuration() self.output.put(msg.NetworkConfiguration( self.node, ipv4addr=lancfg['ipv4_address'], ipv4gateway=lancfg['ipv4_gateway'], ipv4cfgmethod=lancfg['ipv4_configuration'], - hwaddr=lancfg['mac_address'] + hwaddr=lancfg['mac_address'], + staticv6addrs=v6cfg['static_addrs'], + staticv6gateway=v6cfg['static_gateway'] )) elif self.op == 'update': config = self.inputdata.netconfig(self.node) @@ -602,6 +605,11 @@ class IpmiHandler(object): ipv4_address=config['ipv4_address'], ipv4_configuration=config['ipv4_configuration'], ipv4_gateway=config['ipv4_gateway']) + v6addrs = config.get('static_v6_addresses', None) + if v6addrs is not None: + v6addrs = v6addrs.split(',') + v6gw = config.get('static_v6_gateway', None) + self.ipmicmd.set_net6_configuration(static_addresses=v6addrs, static_gateway=v6gw) except socket.error as se: self.output.put(msg.ConfluentNodeError(self.node, se.message))