def getTopology(desc): # Set the request URL #url = 'http://127.0.0.1:8181/restconf/config/network-topology:network-topology' url = 'http://127.0.0.1:8181/restconf/operational/network-topology:network-topology' # Send the GET request resp = util.requestGET(url) if resp == constants.ERROR_STR: print "ERROR: getTopology() failed" return resp return resp
def loadSwitchNodes(self): url = 'http://%s/restconf/operational/network-topology:network-topology/topology/ovsdb:1' % inputsCommon.odlIpAddr_gc resp = util.requestGET(url) if resp == constants.ERROR_STR: print "ERROR: loadSwitchNodes() failed" return None print resp jsondata=json.loads(resp)["topology"] for topo_item in jsondata: if topo_item["node"] is not None: for ovsdb_node in topo_item["node"]: if ovsdb_node.has_key("ovsdb:datapath-id"): #it's a bridge node self.mapping[ovsdb_node["ovsdb:bridge-name"]] = ovsdb_node["node-id"]