-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrightOffice.py
57 lines (42 loc) · 2.42 KB
/
rightOffice.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env python
# coding: utf-8
from helpers import *
def setUpRightOffice(cmd):
logHeader("Constructing right office")
roHosts = createRightOfficeWifiNodes(cmd)
logNodes("Right office wifi node count: ", roHosts)
roWifiPhy = setUpWifiPhy()
roWifiMac = setUpWifiMac(cmd.wifiMacType, Ssid(cmd.rightOfficeWifiSsid))
roWifiDev = setUpWifi(roWifiPhy, roWifiMac, roHosts)
setUpWifiHostsMobility(roHosts, cmd.wifiNodesDistance)
roWifiInterfaces = setUpIPAddresses(cmd.rightOfficeWifiNetwork, cmd.networkMask, roWifiDev)
roInfra = createRightOfficeInfraNodes(cmd)
logNodes("Right office infra node count: ", roInfra)
roInfraWithWifiAP = addToContainer(roInfra, roHosts.Get(cmd.rightOfficeWifiRouter))
roInfraDev = installCSMA(cmd.rightOfficeCsmaDataRate, cmd.rightOfficeCsmaDelay, roInfraWithWifiAP)
roInfraInterfaces = setUpIPAddresses(cmd.rightOfficeInfraNetwork, cmd.networkMask, roInfraDev)
rightOfficeGw = setUpRoApplications(roWifiInterfaces, roInfraInterfaces, roHosts, roInfra, cmd)
doRightOfficeTracing(roWifiPhy, roHosts, roInfra, cmd)
return rightOfficeGw
def setUpRoApplications(roWifiInterfaces, roInfraInterfaces, roHosts, roInfra, cmd):
roServerNode = roInfra.Get(cmd.rightOfficeUdpEchoServer)
roRouterNode = roHosts.Get(cmd.rightOfficeWifiRouter)
installUdpEchoServer(roRouterNode, cmd.discardPort, cmd.serverStart, cmd.stopTime)
roServerAddress = roInfraInterfaces.GetAddress(cmd.rightOfficeUdpEchoServer)
roServerClient = setUpUdpEchoClient(roServerAddress, cmd.discardPort, cmd.packetInterval, cmd.packetSize)
log("Right office server node #", roServerNode.GetId())
logDebug("Right office server node address: ", roServerAddress)
assertTrue(roServerAddress, cmd.rightOfficeServerIp)
log("Right office router node #", roRouterNode.GetId())
cloudClient = setUpCloudUdpEchoClient(cmd)
installUdpEchoWifiClients(cloudClient, roServerClient, roHosts, [cmd.rightOfficeWifiRouter], cmd)
return roRouterNode
def doRightOfficeTracing(wifiPhy, wifiNodes, csmaNodes, cmd):
doWifiTracing(cmd.rightOfficeTracePrefix, wifiPhy, wifiNodes, cmd)
doCSMATracing(cmd.rightOfficeTracePrefix, csmaNodes, cmd)
def createRightOfficeWifiNodes(cmd):
log("Creating ", cmd.rightOfficeWifiNodes, " right office wifi nodes")
return createNodesWithStack(cmd.rightOfficeWifiNodes)
def createRightOfficeInfraNodes(cmd):
log("Creating ", cmd.rightOfficeInfraNodes, " right office infra nodes")
return createNodesWithStack(cmd.rightOfficeInfraNodes)