Exemple #1
0
def setupTopology():
    topology = topologyParser.Topology("topology4.xml")
    hostList = topology.getHost()
    for host in hostList:
        cmd.lxcStart(host)

    openflowSwitchList = topology.getOpenflowSwitch()
    ipList = topology.getInterfaceIp()
    ipList = list(set(ipList))

    dpidlist = cmd.getDpidList()

    for openflowSwitch in openflowSwitchList:
        interfaceList = topology.getOpenflowSwitchInterface(openflowSwitch)

        for interface in interfaceList:
            cmd.ovsDpctl(openflowSwitch, interface)
    i = 0
    for openflowSwitch in openflowSwitchList:
        interfaceList = topology.getOpenflowSwitchInterface(openflowSwitch)
        inportList = cmd.getPort(dpidlist[i])
        for interface in interfaceList:
            for ip in ipList:
                cmd.addFlowSpace(
                    dpidlist[i], "20", "in_port=" + inportList[interface] + ",nw_src=" + ip, "Slice:rfSlice=4"
                )
        i = i + 1
Exemple #2
0
def setupTopology():
	topology = topologyParser.Topology('topology.xml')
	hostList = topology.getHost()
	for host in hostList:
		cmd.lxcStart(host)

	openflowSwitchList = topology.getOpenflowSwitch()
        ipList = topology.getInterfaceIp()
        ipList = list(set(ipList))
        
	dpidlist = cmd.getDpidList()

	openflowSwitchList = topology.getOpenflowSwitch()
	for openflowSwitch in openflowSwitchList:
		interfaceList = topology.getOpenflowSwitchInterface(openflowSwitch)
		cmd.ovsOpenflowd(openflowSwitch, '210.25.137.243', 6633)
		for	 interface in interfaceList:
			cmd.ovsDpctl(openflowSwitch, interface)

	i=0
        for openflowSwitch in openflowSwitchList:
                interfaceList = topology.getOpenflowSwitchInterface(openflowSwitch)
		inportList = cmd.getPort(dpidlist[i])
		for	 interface in interfaceList:
                        for ip in ipList:
                                cmd.addFlowSpace(dpidlist[i],'20','in_port='+ inportList[interface]+',nw_src='+ip,'Slice:rfSlice=4')
                i=i+1   
Exemple #3
0
def setupTopology():
	#从xml文件读取拓扑
	topology = topologyParser.Topology('topology.xml')
	hostList = topology.getHost()
	#启动虚拟机
	for host in hostList:
		cmd.lxcStart(host)
	#获取拓扑中的ip地址
	openflowSwitchList = topology.getOpenflowSwitch()
        ipList = topology.getInterfaceIp()
        ipList = list(set(ipList))
        
	dpidlist = cmd.getDpidList()
	#连接拓扑
	for openflowSwitch in openflowSwitchList:
		interfaceList = topology.getOpenflowSwitchInterface(openflowSwitch)
		
		for	 interface in interfaceList:
			cmd.ovsDpctl(openflowSwitch, interface)
        i=0
	#添加flowspace项
        for openflowSwitch in openflowSwitchList:
                interfaceList = topology.getOpenflowSwitchInterface(openflowSwitch)
		inportList = cmd.getPort(dpidlist[i])
		for	 interface in interfaceList:
                        for ip in ipList:
                                cmd.addFlowSpace(dpidlist[i],'20','in_port='+ inportList[interface]+',nw_src='+ip,'Slice:rfSlice=4')
                i=i+1     
Exemple #4
0
def setupTopology():
	topology = topologyParser.Topology('topology2.xml')
	hostList = topology.getHost()
	for host in hostList:
		cmd.lxcStart(host)

	openflowSwitchList = topology.getOpenflowSwitch()
	openflowSwitchNum = len(openflowSwitchList)
        file = open('/switchDict','rb')
        tmpDict = pickle.load(file)
        file.close()
        sortedList = sorted(tmpDict.items(), lambda x, y: cmp(x[1], y[1]))
        for i in range(0,openflowSwitchNum):
                ovsDict[openflowSwitchList[i]] = sortedList[i][0]
                tmpDict[sortedList[i][0]]=tmpDict[sortedList[i][0]]+1
        file = open('/switchDict','wb')
        pickle.dump(tmpDict,file)
        file.close()

	dpidlist = cmd.getDpidList()
	
	for openflowSwitch in openflowSwitchList:
		interfaceList = topology.getOpenflowSwitchInterface(openflowSwitch)
		
		for	 interface in interfaceList:
			cmd.ovsDpctl(ovsDict[openflowSwitch], interface)
        i=0
        for openflowSwitch in openflowSwitchList:
                interfaceList = topology.getOpenflowSwitchInterface(openflowSwitch)
		inportList = cmd.getPort(dpidlist[i])
		for	 interface in interfaceList:
                        cmd.addFlowSpace(dpidlist[i],'20','in_port='+ inportList[interface],'Slice:slice1=4')
                i=i+1     
Exemple #5
0
def setupTopology():
	topology = topologyParser.Topology('topology.xml')
	hostList = topology.getHost()
	for host in hostList:
		cmd.lxcStart(host)

	openflowSwitchList = topology.getOpenflowSwitch()

	dpidlist = cmd.getDpidList()
	
	for openflowSwitch in openflowSwitchList:
		interfaceList = topology.getOpenflowSwitchInterface(openflowSwitch)
		
		for	 interface in interfaceList:
			cmd.ovsDpctl(openflowSwitch, interface)
        i=0
        for openflowSwitch in openflowSwitchList:
                interfaceList = topology.getOpenflowSwitchInterface(openflowSwitch)
		inportList = cmd.getPort(dpidlist[i])
		for	 interface in interfaceList:
                        cmd.addFlowSpace(dpidlist[i],'20','in_port='+ inportList[interface],'Slice:slice1=4')
                i=i+1