~comnets/openwns-systemtest-wifimac/systemtest-wifimac--main--1.0

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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#! /usr/bin/python
###############################################################################
# This file is part of openWNS (open Wireless Network Simulator)
# _____________________________________________________________________________
#
# Copyright (C) 2004-2008
# Chair of Communication Networks (ComNets)
# Kopernikusstr. 16, D-52074 Aachen, Germany
# phone: ++49-241-80-27910,
# fax: ++49-241-80-22242
# email: info@openwns.org
# www: http://www.openwns.org
# _____________________________________________________________________________
#
# openWNS is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License version 2 as published by the
# Free Software Foundation;
#
# openWNS is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################

# this is needed, so that the script can be called from everywhere
import os
import sys
base, tail = os.path.split(sys.argv[0])
os.chdir(base)

# Append the python sub-dir of WNS--main--x.y ...
sys.path.append(os.path.join('..', '..', '..', 'sandbox', 'default', 'lib', 'python2.4', 'site-packages'))

# ... because the module WNS unit test framework is located there.
import pywns.WNSUnit

enabled = []
if __name__ == '__main__':
    # This is only evaluated if the script is called by hand
    for arg in sys.argv[1:]:
        enabled.append(int(arg))

testSuite = pywns.WNSUnit.TestSuite()

# create a system test
testSuite.addTest(pywns.WNSUnit.ProbesTestSuite(sandboxPath = os.path.join('..', '..', '..', 'sandbox'),
                                                configFile = 'config.py',
                                                runSimulations = True,
                                                shortDescription = '1AP, 1 STA, overload DL w RTS/CTS',
                                                requireReferenceOutput = True,
                                                disabled = (len(enabled) > 0) and (1 not in enabled),
                                                disabledReason = "Disabled by command-line switch"))

testSuite.addTest(pywns.WNSUnit.ProbesTestSuite(sandboxPath = os.path.join('..', '..', '..', 'sandbox'),
                                                configFile = 'configSmallMesh.py',
                                                runSimulations = True,
                                                shortDescription = '2APs/1MPs network with 3 STAs',
                                                requireReferenceOutput = True,
                                                disabled = (len(enabled) > 0) and (2 not in enabled),
                                                disabledReason = "Disabled by command-line switch"))

testSuite.addTest(pywns.WNSUnit.ProbesTestSuite(sandboxPath = os.path.join('..', '..', '..', 'sandbox'),
                                                configFile = 'configActiveMP.py',
                                                runSimulations = True,
                                                shortDescription = '1AP/1MP/1STA, MP and STA send/receive traffic',
                                                requireReferenceOutput = True,
                                                disabled = (len(enabled) > 0) and (3 not in enabled),
                                                disabledReason = "Disabled by command-line switch"))

testSuite.addTest(pywns.WNSUnit.ProbesTestSuite(sandboxPath = os.path.join('..', '..', '..', 'sandbox'),
                                                configFile = 'configDraftN.py',
                                                runSimulations = True,
                                                shortDescription = '1AP/1STA with DraftN 50Mbit/s',
                                                requireReferenceOutput = True,
                                                disabled = (len(enabled) > 0) and (4 not in enabled),
                                                disabledReason = "Disabled by command-line switch"))

testSuite.addTest(pywns.WNSUnit.ProbesTestSuite(sandboxPath = os.path.join('..', '..', '..', 'sandbox'),
                                                configFile = 'configBianchi.py',
                                                runSimulations = True,
                                                shortDescription = 'Bianchi Model setup',
                                                requireReferenceOutput = True,
                                                disabled = (len(enabled) > 0) and (5 not in enabled),
                                                disabledReason = "Disabled by command-line switch"))

testSuite.addTest(pywns.WNSUnit.ProbesTestSuite(sandboxPath = os.path.join('..', '..', '..', 'sandbox'),
                                                configFile = 'config.py',
                                                runSimulations = True,
                                                shortDescription = 'WiFiMAC-Tutorial: Experiment 1',
                                                requireReferenceOutput = True,
                                                disabled = (len(enabled) > 0) and (6 not in enabled),
                                                disabledReason = "Disabled by command-line switch",
                                                workingDir = "PyConfig/experiment1"))

testSuite.addTest(pywns.WNSUnit.ProbesTestSuite(sandboxPath = os.path.join('..', '..', '..', 'sandbox'),
                                                configFile = 'config.py',
                                                runSimulations = True,
                                                shortDescription = 'WiFiMAC-Tutorial: Experiment 3',
                                                requireReferenceOutput = True,
                                                disabled = (len(enabled) > 0) and (7 not in enabled),
                                                disabledReason = "Disabled by command-line switch",
                                                workingDir = "PyConfig/experiment3"))

testSuite.addTest(pywns.WNSUnit.ProbesTestSuite(sandboxPath = os.path.join('..', '..', '..', 'sandbox'),
                                                configFile = 'config.py',
                                                runSimulations = True,
                                                shortDescription = 'WiFiMAC-Tutorial: Experiment 4',
                                                requireReferenceOutput = True,
                                                disabled = (len(enabled) > 0) and (8 not in enabled),
                                                disabledReason = "Disabled by command-line switch",
                                                workingDir = "PyConfig/experiment4"))

testSuite.addTest(pywns.WNSUnit.ProbesTestSuite(sandboxPath = os.path.join('..', '..', '..', 'sandbox'),
                                                configFile = 'config.py',
                                                runSimulations = True,
                                                shortDescription = 'WiFiMAC-Tutorial: Experiment 5',
                                                requireReferenceOutput = True,
                                                disabled = (len(enabled) > 0) and (9 not in enabled),
                                                disabledReason = "Disabled by command-line switch",
                                                workingDir = "PyConfig/experiment5"))

testSuite.addTest(pywns.WNSUnit.ProbesTestSuite(sandboxPath = os.path.join('..', '..', '..', 'sandbox'),
                                                configFile = 'config.py',
                                                runSimulations = True,
                                                shortDescription = 'WiFiMAC-Tutorial: Experiment 6',
                                                requireReferenceOutput = True,
                                                disabled = (len(enabled) > 0) and (10 not in enabled),
                                                disabledReason = "Disabled by command-line switch",
                                                workingDir = "PyConfig/experiment6"))

testSuite.addTest(pywns.WNSUnit.ProbesTestSuite(sandboxPath = os.path.join('..', '..', '..', 'sandbox'),
                                                configFile = 'config.py',
                                                runSimulations = True,
                                                shortDescription = 'WiFiMAC-Tutorial: Experiment 7',
                                                requireReferenceOutput = True,
                                                disabled = (len(enabled) > 0) and (11 not in enabled),
                                                disabledReason = "Disabled by command-line switch",
                                                workingDir = "PyConfig/experiment7"))

testSuite.addTest(pywns.WNSUnit.ProbesTestSuite(sandboxPath = os.path.join('..', '..', '..', 'sandbox'),
                                                configFile = 'configInterference.py',
                                                runSimulations = True,
                                                shortDescription = 'Interference Characterization Setup',
                                                requireReferenceOutput = True,
                                                disabled = (len(enabled) > 0) and (12 not in enabled),
                                                disabledReason = "Disabled by command-line switch"))

testSuite.addTest(pywns.WNSUnit.ProbesTestSuite(sandboxPath = os.path.join('..', '..', '..', 'sandbox'),
                                                configFile = 'configDraftN_IMTA.py',
                                                runSimulations = True,
                                                shortDescription = 'Correlated MIMO DraftN',
                                                requireReferenceOutput = True,
                                                disabled = (len(enabled) > 0) and (13 not in enabled),
                                                disabledReason = "Disabled by command-line switch"))
if __name__ == '__main__':
    # This is only evaluated if the script is called by hand

    # if you need to change the verbosity do it here
    verbosity = 2

    pywns.WNSUnit.verbosity = verbosity

    # Create test runner
    testRunner = pywns.WNSUnit.TextTestRunner(verbosity=verbosity)

    if (len(enabled) > 0):
        print "Enabled tests ", enabled

    # Finally, run the tests.
    testRunner.run(testSuite)