mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-26 19:40:12 +00:00
Merge pull request #5 from jjohnson42/master
Implement read network configuration
This commit is contained in:
commit
680f60114e
@ -131,6 +131,10 @@ noderesources = {
|
||||
'pluginattrs': ['hardwaremanagement.method'],
|
||||
'default': 'ipmi',
|
||||
}),
|
||||
'net_interfaces': PluginCollection({
|
||||
'pluginattrs': ['hardwaremanagement.method'],
|
||||
'default': 'ipmi',
|
||||
}),
|
||||
}
|
||||
},
|
||||
'_console': {
|
||||
|
@ -778,6 +778,27 @@ class KeyValueData(ConfluentMessage):
|
||||
else:
|
||||
self.kvpairs = {name: kvdata}
|
||||
|
||||
|
||||
class NetworkConfiguration(ConfluentMessage):
|
||||
desc = 'Network configuration'
|
||||
|
||||
def __init__(self, name=None, ipv4addr=None, ipv4gateway=None,
|
||||
ipv4cfgmethod=None, hwaddr=None):
|
||||
self.notnode = name is None
|
||||
self.stripped = False
|
||||
|
||||
kvpairs = {
|
||||
'ipv4_address': {'value': ipv4addr},
|
||||
'ipv4_gateway': {'value': ipv4gateway},
|
||||
'ipv4_configuration': {'value': ipv4cfgmethod},
|
||||
'hw_addr': {'value': hwaddr},
|
||||
}
|
||||
if self.notnode:
|
||||
self.kvpairs = kvpairs
|
||||
else:
|
||||
self.kvpairs = {name: kvpairs}
|
||||
|
||||
|
||||
class HealthSummary(ConfluentMessage):
|
||||
readonly = True
|
||||
valid_values = valid_health_values
|
||||
|
@ -372,10 +372,12 @@ class IpmiHandler(object):
|
||||
raise Exception('Not Implemented')
|
||||
|
||||
def handle_configuration(self):
|
||||
if self.element[1:3] == ['management_controller', 'alerts' ]:
|
||||
if self.element[1:3] == ['management_controller', 'alerts']:
|
||||
return self.handle_alerts()
|
||||
elif self.element[1:3] == ['management_controller', 'users' ]:
|
||||
elif self.element[1:3] == ['management_controller', 'users']:
|
||||
return self.handle_users()
|
||||
elif self.element[1:3] == ['management_controller', 'net_interfaces']:
|
||||
return self.handle_nets()
|
||||
raise Exception('Not implemented')
|
||||
|
||||
def decode_alert(self):
|
||||
@ -426,6 +428,26 @@ class IpmiHandler(object):
|
||||
return
|
||||
raise Exception('Not implemented')
|
||||
|
||||
def handle_nets(self):
|
||||
if len(self.element) == 3:
|
||||
if self.op != 'read':
|
||||
self.output.put(
|
||||
msg.ConfluentNodeError(self.node, 'Unsupported operation'))
|
||||
return
|
||||
self.output.put(msg.ChildCollection('management'))
|
||||
elif len(self.element) == 4 and self.element[-1] == 'management':
|
||||
if self.op == 'read':
|
||||
lancfg = self.ipmicmd.get_net_configuration()
|
||||
self.output.put(msg.NetworkConfiguration(
|
||||
self.node, ipv4addr=lancfg['ipv4_address'],
|
||||
ipv4gateway=lancfg['ipv4_gateway'],
|
||||
ipv4cfgmethod=lancfg['ipv4_configuration'],
|
||||
hwaddr=lancfg['mac_address']
|
||||
))
|
||||
else:
|
||||
self.output.put(msg.ConfluentNodeError(self.node,
|
||||
'Not yet implemented'))
|
||||
|
||||
def handle_users(self):
|
||||
# Create user
|
||||
if len(self.element) == 3:
|
||||
|
Loading…
Reference in New Issue
Block a user