source: trunk/wikifiles/geni-backbone-test/nox-console.patch @ 2387

Last change on this file since 2387 was 1185, checked in by Josh Smift, 12 years ago

Added a directory for files for the GENI backbone test, and a nox-console patch from Aaron Rosen that prints output in a nicer format.

File size: 936 bytes
  • ./nox/src/scripts/nox-console.py

    old new  
    101101    print simplejson.dumps(cmd)
    102102sock.send(simplejson.dumps(cmd))
    103103if (expectReply):
    104     print simplejson.dumps(simplejson.loads(sock.recv(4096)), indent=4)
     104    data=""
     105    while True:
     106        data += sock.recv(4096)
     107        try:
     108            simplejson.loads(data)
     109            break
     110        except ValueError:
     111            continue
     112     
     113    result= simplejson.loads(data)
     114    for i in result['node_id']:
     115        for j in range (0, 16, 2):
     116            if j == 14:
     117                sys.stdout.write(i.zfill(16)[j] + "" +  i.zfill(16)[j+1]) 
     118            else:
     119                sys.stdout.write((i.zfill(16)[j])+ "" + i.zfill(16)[j+1] + ":")
     120
     121        sys.stdout.write("\n")
     122
    105123sock.send("{\"type\":\"disconnect\"}")
    106124sock.shutdown(1)
    107125sock.close()
Note: See TracBrowser for help on using the repository browser.