forked from greearb/lanforge-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwlan_capacity_calculator.py
More file actions
executable file
·258 lines (201 loc) · 6.7 KB
/
wlan_capacity_calculator.py
File metadata and controls
executable file
·258 lines (201 loc) · 6.7 KB
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
#!/usr/bin/env python3
"""
Candela Technologies Inc.
Info : Standard Script for WLAN Capacity Calculator
Date :
Author : Anjali Rahamatkar
"""
import sys
import os
import importlib
import argparse
import logging
sys.path.append(os.path.join(os.path.abspath(__file__ + "../../../")))
wlan_theoretical_sta = importlib.import_module("py-json.wlan_theoretical_sta")
def main():
parse = wlan_theoretical_sta.abg11_calculator.create_argparse(prog='wlan_capacity_calculator.py',
formatter_class=argparse.RawTextHelpFormatter,
epilog='''\
This python script calculates the theoretical value of three different stations( 11abg/11n/11ac)''',
description='''\
wlan_capacity_calculator.py
---------------------------------------------------------------------------
Example of command line to run(11ac Station):
./wlan_capacity_calculator.py
-sta 11ac
-t Voice
-d 9
-spa 3
-ch 20
-gu 800
-high 1
-e TKIP
-q Yes
-ip 3
-mc 0
-b 6 12 24 54
-m 1518
-co Greenfield
-cw 15
''')
parse.add_argument('--help_summary', action="store_true", help='Show summary of what this script does')
try:
args = parse.parse_args()
help_summary = '''\
This script calculates the theoretical value of three different stations( 11abg/11n/11ac)
'''
if args.help_summary:
print(help_summary)
exit(0)
# Station
if args.station:
Calculator_name = args.station
else:
Calculator_name = "11abg"
# Traffic Type
if args.traffic:
traffic_name = args.traffic
else:
traffic_name = "Data"
# PHY Bit Rate
if args.phy:
phy_name = args.phy
else:
phy_name = "54"
# Encryption
if args.encryption:
encryption_name = args.encryption
else:
encryption_name = "None"
# QoS
if args.qos:
qos_name = args.qos
else:
if "11abg" in Calculator_name:
qos_name = "No"
if "11n" in Calculator_name or "11ac" in Calculator_name:
qos_name = "Yes"
# 802.11 MAC Frame
if args.mac:
mac_name = args.mac
else:
mac_name = "1518"
# Basic Rate Set
if args.basic:
basic_name = args.basic
else:
basic_name = ['1', '2', '5.5', '11', '6', '12', '24']
# Preamble value
if args.preamble:
preamble_name = args.preamble
else:
preamble_name = "Short"
# Slot Time
if args.slot:
slot_name = args.slot
else:
slot_name = "Short"
# Codec Type (Voice Traffic)
if args.codec:
codec_name = args.codec
else:
if "11abg" in Calculator_name:
codec_name = "G.723"
if "11n" in Calculator_name:
codec_name = "G.711"
if "11ac" in Calculator_name:
codec_name = "Mixed"
# RTS/CTS Handshake
if args.rts:
rts_name = args.rts
else:
rts_name = "No"
# CTS - to - self(protection)
if args.cts:
cts_name = args.cts
else:
cts_name = "No"
# station = 11n and 11ac
# Data/Voice MCS Index
if args.data:
data_name = args.data
else:
if "11n" in Calculator_name:
data_name = "7"
if "11ac" in Calculator_name:
data_name = "9"
# Channel Bandwidth
if args.channel:
channel_name = args.channel
else:
if "11n" in Calculator_name:
channel_name = "40"
if "11ac" in Calculator_name:
channel_name = "80"
# Guard Interval
if args.guard:
guard_name = args.guard
else:
guard_name = "400"
# Highest Basic MCS
if args.highest:
highest_name = args.highest
else:
highest_name = '1'
# PLCP Configuration
if args.plcp:
plcp_name = args.plcp
else:
plcp_name = "Mixed"
# IP Packets per A-MSDU
if args.ip:
ip_name = args.ip
else:
ip_name = "0"
# MAC Frames per A-MPDU
if args.mc:
mc_name = args.mc
else:
if "11n" in Calculator_name:
mc_name = '42'
if "11ac" in Calculator_name:
mc_name = '64'
# CWmin (leave alone for default)
if args.cwin:
cwin_name = args.cwin
else:
cwin_name = '15'
# Spatial Streams
if args.spatial:
spatial_name = args.spatial
else:
spatial_name = '4'
# RTS/CTS Handshake and CTS-to-self
if args.rtscts:
rtscts_name = args.rtscts
else:
rtscts_name = 'No'
except Exception as e:
logging.exception(e)
exit(2)
# Select station(802.11a/b/g/n/ac standards)
if "11abg" in Calculator_name:
Station1 = wlan_theoretical_sta.abg11_calculator(traffic_name, phy_name, encryption_name, qos_name, mac_name, basic_name,
preamble_name, slot_name, codec_name, rts_name, cts_name)
Station1.calculate()
Station1.get_result()
if "11n" in Calculator_name:
Station2 = wlan_theoretical_sta.n11_calculator(traffic_name, data_name, channel_name, guard_name, highest_name, encryption_name,
qos_name, ip_name,
mc_name, basic_name, mac_name,
codec_name, plcp_name, cwin_name, rts_name, cts_name)
Station2.calculate()
Station2.get_result()
if "11ac" in Calculator_name:
Station3 = wlan_theoretical_sta.ac11_calculator(traffic_name, data_name, spatial_name, channel_name, guard_name, highest_name,
encryption_name, qos_name, ip_name, mc_name, basic_name, mac_name,
codec_name, cwin_name, rtscts_name)
Station3.calculate()
Station3.get_result()
if __name__ == "__main__":
main()