mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-28 20:39:40 +00:00
Add IPv6 configuration support
For redfish and IPMI devices, support new IPv6 static configuration controls
This commit is contained in:
parent
feed125c86
commit
453d1f9ceb
@ -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'),
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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))
|
||||
|
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user