close Warning: Can't synchronize with repository "(default)" (/common/SVN/wimax does not appear to be a Subversion repository.). Look in the Trac log for more information.

WiMAX/30/05: wimax-iperf-attn.rb

File wimax-iperf-attn.rb, 4.6 KB (added by Nilanjan Paul, 8 years ago)
Line 
1defApplication('modprobe', 'modprobe') {|a|
2 a.name = "modprobe"
3 a.version(0, 0, 1)
4 a.path = "/sbin/modprobe"
5 a.defProperty('args', "Arguments for modprobe command", nil, {:order => 1, :dynamic => false, :type => :string, :use_name => false})
6}
7
8defApplication('wimaxd', 'wimaxd') {|a|
9 a.name = "wimaxd"
10 a.version(0, 0, 1)
11 a.path = "/usr/bin/wimaxd"
12 a.defProperty('args', "Arguments for wimaxd command", nil, {:order => 1, :dynamic => false, :type => :string, :use_name => false})
13}
14
15defApplication('wimaxcu', 'wimaxcu') {|a|
16 a.name = "wimaxcu"
17 a.version(1, 5, 1)
18 a.path = "/usr/bin/wimaxcu"
19 a.defProperty('args', "Arguments for wimaxcu command", nil, {:order => 1, :dynamic => false, :type => :string, :use_name => false})
20}
21
22defApplication('ifconfig', 'ifconfig') {|a|
23 a.name = "ifconfig"
24 a.version(0, 0, 1)
25 a.path = "/sbin/ifconfig"
26 a.defProperty('args', "Arguments for ifconfig command", nil, {:order => 1, :dynamic => false, :type => :string, :use_name => false})
27}
28
29defApplication('oml2-iperf', 'oml2-iperf') {|a|
30 a.name = "oml2-iperf"
31 a.version(0, 0, 1)
32 a.path = "/usr/local/bin/oml2-iperf"
33 a.defProperty('args', "Arguments for ifconfig command", nil, {:order => 1, :dynamic => false, :type => :string, :use_name => false})
34}
35
36
37defGroup('ServerRun', [1,4]) { |node|
38
39
40 #node.net.x0.profile = '51'
41 #node.exec('wimaxcu', ['connect network 51'])
42
43
44 node.exec('ifconfig', ['wmx0 10.41.14.4 netmask 255.255.0.0 up'])
45
46 node.addApplication("oml2-iperf") { |app|
47 app.setProperty('args','-s -B 10.41.14.4 -w 256k')
48 }
49}
50
51defGroup('ClientRun', [1,9]) { |n|
52 n.exec('ifconfig', ['eth0 10.41.4.9 netmask 255.255.0.0 up'])
53
54 #n.exec('oml2-iperf', ['-y o --oml-id 3 --oml-exp-id exp3 --oml-server oml:3003 -c 10.41.14.4 -i 1'])
55 n.addApplication("oml2-iperf") { |app|
56 app.setProperty('args','-y o --oml-id 3 --oml-exp-id exp4 --oml-server oml:3003 -c 10.41.14.4 -i 1 -t 10')
57 }
58}
59
60
61whenAllInstalled() {|node|
62 info "Give machines some time to warm up"
63 wait 10
64
65 #info "--Setting modulation scheme"
66 #system("wget -O status_dl http://cons-wm-01:5052/wimaxrf/bs/mcsProfile?dl=17")
67 #system("wget -O status_ul http://cons-wm-01:5052/wimaxrf/bs/mcsProfile?ul=13")
68 #wait 1
69 #system("wget -O status http://cons-wm-01:5052/wimaxrf/bs/restart")
70 #wait 30
71 #wait 30
72
73
74 info "Connect to base station"
75 system("ssh root@node1-4 'wimaxcu ron ; wimaxcu connect network 51'")
76 wait 5
77
78 info "Setting attenuator level"
79 AttenuatorVector = [0, 5, 10, 15, 20]
80 AttenuatorVector.each do |attenDb|
81 system("wget -O status http://internal2dmz.orbit-lab.org:5052/instr/set?portA=4\\&portB=9\\&att=#{attenDb}")
82 wait 1
83
84 system ("ssh root@node1-4 'wimaxcu status link' > wimaxcu_status")
85 freq = ` cat wimaxcu_status | grep Frequency | awk \'{print$3}\' `
86 rssi = ` cat wimaxcu_status | grep RSSI | awk \'{print$3}\' `
87 cinr = ` cat wimaxcu_status | grep CINR | awk \'{print$3}\' `
88 txpw = ` cat wimaxcu_status | grep "TX PWR" | awk \'{print$4}\' `
89 bsid = ` cat wimaxcu_status | grep "BS ID" | awk \'{print$4}\' `
90
91 puts "freq: #{freq}"
92 puts "rssi: #{rssi}"
93 puts "cinr: #{cinr}"
94 puts "txpw: #{txpw}"
95 puts "bsid: #{bsid}"
96
97 info "Start iperf server"
98 group("ServerRun").startApplications
99 wait 3
100 info "Start iperf client"
101 group("ClientRun").startApplications
102
103 info "Collect measurements for 10 seconds"
104 wait 10
105
106 info "Stop applications"
107 allGroups.stopApplications
108 wait 5
109
110 size = ` sqlite3 /var/lib/oml2/exp4.sq3 \"select * from iperf_transfer\" | tail -1 | awk -F\\| \'{print $9}\' `
111 time = ` sqlite3 /var/lib/oml2/exp4.sq3 \"select * from iperf_transfer\" | tail -1 | awk -F\\| \'{print $8}\' `
112 puts "Size: #{size}"
113 puts "Time: #{time}"
114 kBperS = 8.0 * size.to_f / time.to_f / 1024.0
115 puts "b: #{kBperS}"
116
117 wait 1
118 system(" sqlite3 values.db \"create table t1 (t1key INTEGER PRIMARY KEY, atten INTEGER, nBytes INTEGER, time INTEGER, kBperS FLOAT, freqkhz INTEGER, rssi_dbm INTEGER, cinr_db INTEGER, txpw_dbm INTEGER);\" ")
119 system(" sqlite3 values.db \"insert into t1 (atten,nBytes,time,kBperS,freqkhz,rssi_dbm,cinr_db,txpw_dbm) values (#{attenDb}, #{size}, #{time}, #{kBperS},#{freq},#{rssi},#{cinr},#{txpw});\" ")
120
121 end
122
123 info "Reset attenuator back to zero"
124 system("wget -O status http://internal2dmz.orbit-lab.org:5052/instr/set?portA=4\\&portB=9\\&att=0")
125
126 # Turn off wimax radio gracefully
127 system("ssh root@node1-4 'wimaxcu dconnect ; wimaxcu roff'")
128
129 #system("cp /var/lib/oml2/exp4.sq3 .")
130
131 info "Finish it."
132 Experiment.done
133}
134
135
136
137