Example #1
0
for line in f:
    jsonfile += line
f.close()
topology = json.loads(jsonfile)

#create lxc

lxcList = topology["nodes"].keys()
address=101
for lxc in lxcList:
    cmd.createLxcDir(lxc)
    time.sleep(10)
    vmInterfaceList=topology["nodes"][lxc]["interface"].keys()
    vmInterfaceDict=topology["nodes"][lxc]["interface"]
    cmd.createRfConfig(lxc,vmInterfaceList)
    cmd.createFstab(lxc)
    cmd.createRfInterface(lxc,vmInterfaceList,vmInterfaceDict,address)
    cmd.createDaemons(lxc,topology["nodes"][lxc]["attrs"]["protocol"])
    if(topology["nodes"][lxc]["attrs"]["protocol"]=="rip"):
        cmd.createRipd(lxc,vmInterfaceList,vmInterfaceDict)
    elif(topology["nodes"][lxc]["attrs"]["protocol"]=="ospf"):
        cmd.createOspf(lxc,vmInterfaceList,vmInterfaceDict,address)
    address+=1
    #else
 

#start rf

cmd.startNox("switch","6363")
cmd.startNox("routeflowc","6666")
cmd.startRf()