mirror of
https://github.com/xcat2/confluent.git
synced 2026-07-29 17:19:41 +00:00
Add vlan_id management to redfish and ipmi plugins
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python2
|
||||
#!/usr/bin/python3
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
# Copyright 2017 Lenovo
|
||||
# Copyright 2025 Lenovo
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -96,6 +96,12 @@ cfgpaths = {
|
||||
'bmc.static_ipv6_gateway': (
|
||||
'configuration/management_controller/net_interfaces/management',
|
||||
'static_v6_gateway'),
|
||||
'bmc.vlan_id': (
|
||||
'configuration/management_controller/net_interfaces/management',
|
||||
'vlan_id'),
|
||||
'bmc.mac_address': (
|
||||
'configuration/management_controller/net_interfaces/management',
|
||||
'hw_addr'),
|
||||
'bmc.hostname': (
|
||||
'configuration/management_controller/hostname', 'hostname'),
|
||||
}
|
||||
|
||||
@@ -1148,6 +1148,9 @@ class InputNetworkConfiguration(ConfluentInputMessage):
|
||||
if 'ipv4_gateway' not in inputdata:
|
||||
inputdata['ipv4_gateway'] = None
|
||||
|
||||
if 'vlan_id' not in inputdata:
|
||||
inputdata['vlan_id'] = None
|
||||
|
||||
if 'ipv4_configuration' in inputdata and inputdata['ipv4_configuration']:
|
||||
if inputdata['ipv4_configuration'].lower() not in ['dhcp','static']:
|
||||
raise exc.InvalidArgumentException(
|
||||
@@ -1736,8 +1739,8 @@ class NetworkConfiguration(ConfluentMessage):
|
||||
desc = 'Network configuration'
|
||||
|
||||
def __init__(self, name=None, ipv4addr=None, ipv4gateway=None,
|
||||
ipv4cfgmethod=None, hwaddr=None, staticv6addrs=(), staticv6gateway=None):
|
||||
self.myargs = (name, ipv4addr, ipv4gateway, ipv4cfgmethod, hwaddr)
|
||||
ipv4cfgmethod=None, hwaddr=None, staticv6addrs=(), staticv6gateway=None, vlan_id=None):
|
||||
self.myargs = (name, ipv4addr, ipv4gateway, ipv4cfgmethod, hwaddr, staticv6addrs, staticv6gateway, vlan_id)
|
||||
self.notnode = name is None
|
||||
self.stripped = False
|
||||
v6addrs = ','.join(staticv6addrs)
|
||||
@@ -1748,7 +1751,8 @@ class NetworkConfiguration(ConfluentMessage):
|
||||
'ipv4_configuration': {'value': ipv4cfgmethod},
|
||||
'hw_addr': {'value': hwaddr},
|
||||
'static_v6_addresses': {'value': v6addrs},
|
||||
'static_v6_gateway': {'value': staticv6gateway}
|
||||
'static_v6_gateway': {'value': staticv6gateway},
|
||||
'vlan_id': {'value': vlan_id}
|
||||
}
|
||||
if self.notnode:
|
||||
self.kvpairs = kvpairs
|
||||
|
||||
@@ -773,6 +773,7 @@ class IpmiHandler(object):
|
||||
hwaddr=lancfg['mac_address'],
|
||||
staticv6addrs=v6cfg.get('static_addrs', ''),
|
||||
staticv6gateway=v6cfg.get('static_gateway', ''),
|
||||
vlan_id=lancfg.get('vlan_id', None)
|
||||
))
|
||||
elif self.op == 'update':
|
||||
config = self.inputdata.netconfig(self.node)
|
||||
@@ -780,7 +781,8 @@ class IpmiHandler(object):
|
||||
self.ipmicmd.set_net_configuration(
|
||||
ipv4_address=config['ipv4_address'],
|
||||
ipv4_configuration=config['ipv4_configuration'],
|
||||
ipv4_gateway=config['ipv4_gateway'])
|
||||
ipv4_gateway=config['ipv4_gateway'],
|
||||
vlan_id=config.get('vlan_id', None))
|
||||
v6addrs = config.get('static_v6_addresses', None)
|
||||
if v6addrs is not None:
|
||||
v6addrs = v6addrs.split(',')
|
||||
|
||||
@@ -632,7 +632,8 @@ class IpmiHandler(object):
|
||||
ipv4cfgmethod=lancfg['ipv4_configuration'],
|
||||
hwaddr=lancfg['mac_address'],
|
||||
staticv6addrs=v6cfg['static_addrs'],
|
||||
staticv6gateway=v6cfg['static_gateway']
|
||||
staticv6gateway=v6cfg['static_gateway'],
|
||||
vlan_id=lancfg.get('vlan_id', None)
|
||||
))
|
||||
elif self.op == 'update':
|
||||
config = self.inputdata.netconfig(self.node)
|
||||
@@ -640,7 +641,8 @@ class IpmiHandler(object):
|
||||
self.ipmicmd.set_net_configuration(
|
||||
ipv4_address=config['ipv4_address'],
|
||||
ipv4_configuration=config['ipv4_configuration'],
|
||||
ipv4_gateway=config['ipv4_gateway'])
|
||||
ipv4_gateway=config['ipv4_gateway'],
|
||||
vlan_id=config.get('vlan_id', None))
|
||||
v6addrs = config.get('static_v6_addresses', None)
|
||||
if v6addrs is not None:
|
||||
v6addrs = v6addrs.split(',')
|
||||
|
||||
Reference in New Issue
Block a user