Commit 05dc48bc authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Restore (not) dead code I over-zealously pruned.

parent a9bfb282
...@@ -5058,7 +5058,7 @@ class elabinelab: ...@@ -5058,7 +5058,7 @@ class elabinelab:
# #
# First map the mac to a node by looking in the interfaces table. # First map the mac to a node by looking in the interfaces table.
# #
dbres = DBQueryFatal("select node_id from interfaces " dbres = DBQueryFatal("select node_id,role,IP from interfaces "
"where mac=%s", "where mac=%s",
(argdict["mac"],)) (argdict["mac"],))
...@@ -5066,12 +5066,44 @@ class elabinelab: ...@@ -5066,12 +5066,44 @@ class elabinelab:
if len(dbres) == 0: if len(dbres) == 0:
return EmulabResponse(RESPONSE_ERROR, return EmulabResponse(RESPONSE_ERROR,
output="Cannot map MAC to nodeid") output="Cannot map MAC to nodeid")
#
# This is all the inner boss cares about now.
#
nodeid = dbres[0][0] nodeid = dbres[0][0]
dbres = DBQueryFatal("select i.mac,i.role,i.IP "
" from interfaces as i "
"where node_id=%s ",
(nodeid,))
result = {} result = {}
result["nodeid"] = nodeid result["nodeid"] = nodeid
result["type"] = ""
interfaces = {}
for res in dbres:
tmp = {}
#
# The current control network becomes the outer control network.
# The experimental network with an IP assigned becomes the
# inner control network.
#
imac = res[0]
role = res[1]
IP = res[2]
if role == "ctrl":
role = "outer_ctrl"
pass
elif role == "expt" and IP != "":
role = "ctrl"
pass
tmp["role"] = role
tmp["IP"] = IP
interfaces[imac] = tmp
pass
result["interfaces"] = interfaces
return EmulabResponse(RESPONSE_SUCCESS, result, output=str(result)) return EmulabResponse(RESPONSE_SUCCESS, result, output=str(result))
pass pass
......
Supports Markdown
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