2015-01-06 14:47:15 +00:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
|
|
|
import sys, getopt
|
|
|
|
from mpParamTopo import MpParamTopo
|
|
|
|
from mpMultiInterfaceTopo import MpMultiInterfaceTopo
|
2015-01-07 13:44:44 +00:00
|
|
|
from mpMultiInterfaceConfig import MpMultiInterfaceConfig
|
2015-01-06 14:47:15 +00:00
|
|
|
from mpMininetBuilder import MpMininetBuilder
|
|
|
|
|
|
|
|
topoParamFile = None
|
|
|
|
topoType = "mininet"
|
|
|
|
|
|
|
|
def printHelp():
|
|
|
|
print("Help Menu")
|
|
|
|
|
|
|
|
def parseArgs(argv):
|
|
|
|
global topoParamFile
|
|
|
|
try:
|
|
|
|
opts, args = getopt.getopt(argv, "hf:", ["topoParam="])
|
|
|
|
except getopt.GetoptError:
|
|
|
|
printHelp()
|
|
|
|
sys.exit(1)
|
|
|
|
for opt, arg in opts:
|
|
|
|
if opt == "-h":
|
|
|
|
printHelp()
|
|
|
|
sys.exit(1)
|
|
|
|
elif opt in ("-f","--topoParam"):
|
|
|
|
print("hllo", arg);
|
|
|
|
topoParamFile = arg
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
parseArgs(sys.argv[1:])
|
|
|
|
if topoParamFile is None:
|
|
|
|
print("Use command line param")
|
|
|
|
else:
|
|
|
|
param = MpParamTopo(topoParamFile)
|
|
|
|
|
|
|
|
if topoType == "mininet":
|
|
|
|
if param.getParam('topoType') == "MultiIf":
|
|
|
|
mpTopo = MpMultiInterfaceTopo(MpMininetBuilder(), param)
|
2015-01-07 13:44:44 +00:00
|
|
|
mpConfig = MpMultiInterfaceConfig(mpTopo, param)
|
|
|
|
mpTopo.startNetwork()
|
|
|
|
mpConfig.configureNetwork()
|
|
|
|
mpTopo.getCLI()
|
|
|
|
mpTopo.stopNetwork()
|
2015-01-06 14:47:15 +00:00
|
|
|
else:
|
|
|
|
print("Unrecognized topo type")
|
|
|
|
print(mpTopo)
|