Commit eebd7b53 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin Committed by Cédric Le Ninivin

erp5_computer_immobilisation: Update Compute Node Schema and asJSON

parent f88d3ac1
...@@ -83,21 +83,18 @@ class Computer(Machine, JSONType): ...@@ -83,21 +83,18 @@ class Computer(Machine, JSONType):
) )
for compute_partition in compute_partition_list: for compute_partition in compute_partition_list:
ip_list = [] ip_list = []
full_ip_list = []
for internet_protocol_address in compute_partition.contentValues(portal_type='Internet Protocol Address'): for internet_protocol_address in compute_partition.contentValues(portal_type='Internet Protocol Address'):
# XXX - There is new values, and we must keep compatibility ip_dict = {
address_tuple = ( "ip-address": internet_protocol_address.getIpAddress().decode("UTF-8"),
internet_protocol_address.getNetworkInterface('').decode("UTF-8"), "network-interface": internet_protocol_address.getNetworkInterface('').decode("UTF-8"),
internet_protocol_address.getIpAddress().decode("UTF-8")) }
if internet_protocol_address.getGatewayIpAddress('') and \ if internet_protocol_address.getGatewayIpAddress(''):
internet_protocol_address.getNetmask(''): ip_dict["gateway-ip-address"] = internet_protocol_address.getGatewayIpAddress('').decode("UTF-8")
address_tuple = address_tuple + ( if internet_protocol_address.getNetmask(''):
internet_protocol_address.getGatewayIpAddress().decode("UTF-8"), ip_dict["netmask"] = internet_protocol_address.getNetmask('').decode("UTF-8")
internet_protocol_address.getNetmask().decode("UTF-8"), if internet_protocol_address.getNetworkAddress(''):
internet_protocol_address.getNetworkAddress('').decode("UTF-8")) ip_dict["network-address"] = internet_protocol_address.getNetworkAddress('').decode("UTF-8")
full_ip_list.append(address_tuple) ip_list.append(ip_dict)
else:
ip_list.append(address_tuple)
compute_node_dict["compute_partition_list"].append({ compute_node_dict["compute_partition_list"].append({
"partition_id": compute_partition.getReference(), "partition_id": compute_partition.getReference(),
"ip_list": ip_list, "ip_list": ip_list,
......
...@@ -90,15 +90,38 @@ ...@@ -90,15 +90,38 @@
"ip_list": {\n "ip_list": {\n
"title": "IP List",\n "title": "IP List",\n
"type": "array",\n "type": "array",\n
"descritpion": "List of IPs usable by the Software Instance on the partition",\n "descritpion": "List of IPs usable by the Software Instance on the partition. Used to configure firewall when necessary and allow only related instances to access it.",\n
"items": {\n "items": {\n
"type": "array",\n "type": "object",\n
"items": {\n "title": "Internet Protocol Address",\n
"description": "All element to describe the interface",\n
"properties": {\n
"ip-address": {\n
"title": "IP Address",\n
"type": "string"\n
},\n
"network-interface": {\n
"title": "Network Interface",\n
"type": "string"\n
},\n
"gateway-ip-address": {\n
"title": "Gateway Ip Address",\n
"type": "string"\n
},\n
"netmask": {\n
"title": "Netmask",\n
"type": "string"\n
},\n
"network-address": {\n
"title": "Network Address",\n
"type": "string"\n "type": "string"\n
}\n }\n
},\n
"required": ["ip-address"]\n
}\n }\n
}\n }\n
}\n },\n
"required": ["partition_id"]\n
}\n }\n
},\n },\n
"access_token": {\n "access_token": {\n
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment