-
Notifications
You must be signed in to change notification settings - Fork 0
/
usr4.py
42 lines (31 loc) · 1.2 KB
/
usr4.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# -*- coding: utf-8 -*-
import command as cmd
import topologyParser
isDebug = True;
#ovsList = {}
def setSlices():
cmd.createSlice('rfSlice','tcp:210.25.137.238:6666','rf@visor.com')
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
if __name__ == '__main__':
setSlices()
setupTopology()