Commit b5e88e3e by Rahul Dutta

Bug fixes for compose node id

parent cf7c1023
......@@ -615,6 +615,7 @@ def node_details(node_index, show_detail=True):
:param show_detail: show more node detail when set to True.
:returns: node detail info.
"""
LOG.error('Node details triggered ')
headers = {
'Content-Type': 'application/json',
}
......@@ -628,6 +629,7 @@ def node_details(node_index, show_detail=True):
"resource_uri": json_data['@odata.id']
}
if show_detail:
LOG.error( "Show details Triggered")
#need to add more details of node components
......@@ -635,6 +637,7 @@ def node_details(node_index, show_detail=True):
"connectionSets":json_data['ConnectionSets'][0],
"components":json_data['ContainedResources'][0:],
"description": json_data['Description']})
return node_detail
......@@ -648,8 +651,9 @@ def allocate_node(name, description, requirements):
if "system" in requirements:
if "number" in requirements["system"]:
no_of_system=requirements["system"]["number"]
LOG.error('Allocate No'+no_of_system)
l_available_Systems=available_Systems()
allocated_systems=l_available_Systems[:no_of_system]
allocated_systems=l_available_Systems[:int(no_of_system)]
allocated_details["Systems"]=allocated_systems
for item in allocated_systems:
allocated_details[item]=get_system_details(item)
......@@ -676,24 +680,28 @@ def allocate_node(name, description, requirements):
payload = '{"Name": "' + name + '",\n"Description": "' + description + '",\n"Systems": [' + allocate_json[:-1] + ']}'
return_value = requests.post(RECS_URL+'ComposedNodes/Actions/ComposedNodeCollection.Allocate',
headers=headers, data=payload, auth=('admin', 'admin'))
allocate_id=str(return_value.headers['location']).split("/")[6]
allocated_details["compose_id"]=allocate_id
return allocated_details
#Method added for M2DC project. This method will return
#Deatils of assembled node
def assemble_node(name, description, requirements):
def assemble_node(name, description, compose_id, requirements):
LOG.error('Assembled query Triggered')
endpoint_no = 65
list_systems=[]
s_json=""
name = name
desc = description
if "system" in requirements:
list_systems = requirements["system"]["list"]
list_of_systems = requirements["system"]["list"]
width=requirements["system"]["width"]
connSet=requirements["system"]["connection"]
list_systems=list_of_systems.split(",")
for item in list_systems:
s_json += "\n\"Endpoint" + chr(
endpoint_no) + "\": {\n\"@odata.id\": \"/redfish/v1/Systems/" + item + "/HSLLInterface\"\n}"
......@@ -703,11 +711,10 @@ def assemble_node(name, description, requirements):
assemble_load = '{\n"ConnectionSets": [{\n"Connections": [{' + s_json + '\n"Width": ' + str(
width) + '\n}],\n"Description": "' + desc + '",\n"Name": "' + name + '"\n}],\n"ActiveConnectionSet": "' + connSet + '",\n"ResetNetworkSettings": "true"\n} '
response = requests.post(RECS_URL+'ComposedNodes/CN_0/Actions/ComposedNode.Assemble',
response = requests.post(RECS_URL+'ComposedNodes/'+compose_id+'/Actions/ComposedNode.Assemble',
headers=headers, data=assemble_load, auth=('admin', 'admin'))
node_index='CN_0'
return node_details(node_index)
return node_details(compose_id)
......
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 sign in to comment