Skip to content
Snippets Groups Projects
Commit 7f80a994 authored by subh's avatar subh
Browse files

added exception handling for the device curl call.

parent 9e304078
No related branches found
No related tags found
No related merge requests found
......@@ -94,14 +94,26 @@ if args.action=='add':
result = os.popen(command).read()
parsedResult = json.loads(result)
print command+"\n"
sourceSwitch = parsedResult[0]['attachmentPoint'][0]['switchDPID']
try:
sourceSwitch = parsedResult[0]['attachmentPoint'][0]['switchDPID']
except IndexError:
print "ERROR : the specified end point (%s) must already been known to the controller (i.e., already have sent packets on the network, easy way to assure this is to do a ping (to any target) from the two hosts." % (args.srcAddress)
sys.exit()
sourcePort = parsedResult[0]['attachmentPoint'][0]['port']
command = "curl -s http://%s/wm/device/?ipv4=%s" % (args.controllerRestIp, args.dstAddress)
result = os.popen(command).read()
parsedResult = json.loads(result)
print command+"\n"
destSwitch = parsedResult[0]['attachmentPoint'][0]['switchDPID']
try:
destSwitch = parsedResult[0]['attachmentPoint'][0]['switchDPID']
except IndexError:
print "ERROR : the specified end point (%s) must already been known to the controller (i.e., already have sent packets on the network, easy way to assure this is to do a ping (to any target) from the two hosts." % (args.dstAddress)
sys.exit()
destPort = parsedResult[0]['attachmentPoint'][0]['port']
print "Creating circuit:"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment