Add missing includes
[contiki-2.x.git] / tools / cooja / contiki_tests / ip_cooja_telnet_ping.csc
blobdd30528643f45d7cd27951f721cdb922341bd4b6
1 <?xml version="1.0" encoding="UTF-8"?>
2 <simconf>
3 <project EXPORT="discard">[CONTIKI_DIR]/tools/cooja/apps/mrm</project>
4 <project EXPORT="discard">[CONTIKI_DIR]/tools/cooja/apps/mspsim</project>
5 <project EXPORT="discard">[CONTIKI_DIR]/tools/cooja/apps/avrora</project>
6 <project EXPORT="discard">[CONTIKI_DIR]/tools/cooja/apps/native_gateway</project>
7 <simulation>
8 <title>My simulation</title>
9 <delaytime>-2147483648</delaytime>
10 <randomseed>generated</randomseed>
11 <motedelay_us>1000000</motedelay_us>
12 <radiomedium>
13 se.sics.cooja.radiomediums.UDGM
14 <transmitting_range>25.0</transmitting_range>
15 <interference_range>0.0</interference_range>
16 <success_ratio_tx>1.0</success_ratio_tx>
17 <success_ratio_rx>1.0</success_ratio_rx>
18 </radiomedium>
19 <events>
20 <logoutput>40000</logoutput>
21 </events>
22 <motetype>
23 se.sics.cooja.contikimote.ContikiMoteType
24 <identifier>mtype611</identifier>
25 <description>Contiki Mote Type #1</description>
26 <contikiapp>[CONTIKI_DIR]/examples/telnet-server/telnet-server.c</contikiapp>
27 <commands>make telnet-server.cooja TARGET=cooja</commands>
28 <moteinterface>se.sics.cooja.interfaces.Position</moteinterface>
29 <moteinterface>se.sics.cooja.interfaces.Battery</moteinterface>
30 <moteinterface>se.sics.cooja.contikimote.interfaces.ContikiVib</moteinterface>
31 <moteinterface>se.sics.cooja.contikimote.interfaces.ContikiMoteID</moteinterface>
32 <moteinterface>se.sics.cooja.contikimote.interfaces.ContikiRS232</moteinterface>
33 <moteinterface>se.sics.cooja.contikimote.interfaces.ContikiBeeper</moteinterface>
34 <moteinterface>se.sics.cooja.interfaces.RimeAddress</moteinterface>
35 <moteinterface>se.sics.cooja.contikimote.interfaces.ContikiIPAddress</moteinterface>
36 <moteinterface>se.sics.cooja.contikimote.interfaces.ContikiRadio</moteinterface>
37 <moteinterface>se.sics.cooja.contikimote.interfaces.ContikiButton</moteinterface>
38 <moteinterface>se.sics.cooja.contikimote.interfaces.ContikiPIR</moteinterface>
39 <moteinterface>se.sics.cooja.contikimote.interfaces.ContikiClock</moteinterface>
40 <moteinterface>se.sics.cooja.contikimote.interfaces.ContikiLED</moteinterface>
41 <moteinterface>se.sics.cooja.contikimote.interfaces.ContikiCFS</moteinterface>
42 <moteinterface>se.sics.cooja.interfaces.Mote2MoteRelations</moteinterface>
43 <symbols>false</symbols>
44 </motetype>
45 <mote>
46 <interface_config>
47 se.sics.cooja.interfaces.Position
48 <x>0.0</x>
49 <y>0.0</y>
50 <z>0.0</z>
51 </interface_config>
52 <interface_config>
53 se.sics.cooja.contikimote.interfaces.ContikiMoteID
54 <id>1</id>
55 </interface_config>
56 <motetype_identifier>mtype611</motetype_identifier>
57 </mote>
58 <mote>
59 <interface_config>
60 se.sics.cooja.interfaces.Position
61 <x>20.0</x>
62 <y>0.0</y>
63 <z>0.0</z>
64 </interface_config>
65 <interface_config>
66 se.sics.cooja.contikimote.interfaces.ContikiMoteID
67 <id>2</id>
68 </interface_config>
69 <motetype_identifier>mtype611</motetype_identifier>
70 </mote>
71 <mote>
72 <interface_config>
73 se.sics.cooja.interfaces.Position
74 <x>40.0</x>
75 <y>0.0</y>
76 <z>0.0</z>
77 </interface_config>
78 <interface_config>
79 se.sics.cooja.contikimote.interfaces.ContikiMoteID
80 <id>3</id>
81 </interface_config>
82 <motetype_identifier>mtype611</motetype_identifier>
83 </mote>
84 <mote>
85 <interface_config>
86 se.sics.cooja.interfaces.Position
87 <x>60.0</x>
88 <y>0.0</y>
89 <z>0.0</z>
90 </interface_config>
91 <interface_config>
92 se.sics.cooja.contikimote.interfaces.ContikiMoteID
93 <id>4</id>
94 </interface_config>
95 <motetype_identifier>mtype611</motetype_identifier>
96 </mote>
97 <mote>
98 <interface_config>
99 se.sics.cooja.interfaces.Position
100 <x>80.0</x>
101 <y>0.0</y>
102 <z>0.0</z>
103 </interface_config>
104 <interface_config>
105 se.sics.cooja.contikimote.interfaces.ContikiMoteID
106 <id>5</id>
107 </interface_config>
108 <motetype_identifier>mtype611</motetype_identifier>
109 </mote>
110 </simulation>
111 <plugin>
112 se.sics.cooja.plugins.SimControl
113 <width>248</width>
114 <z>5</z>
115 <height>200</height>
116 <location_x>0</location_x>
117 <location_y>0</location_y>
118 <minimized>false</minimized>
119 </plugin>
120 <plugin>
121 se.sics.cooja.plugins.Visualizer
122 <plugin_config>
123 <skin>se.sics.cooja.plugins.skins.AddressVisualizerSkin</skin>
124 <skin>se.sics.cooja.plugins.skins.IDVisualizerSkin</skin>
125 <skin>se.sics.cooja.plugins.skins.UDGMVisualizerSkin</skin>
126 <skin>se.sics.cooja.plugins.skins.LEDVisualizerSkin</skin>
127 <skin>se.sics.cooja.plugins.skins.TrafficVisualizerSkin</skin>
128 <skin>se.sics.cooja.plugins.skins.GridVisualizerSkin</skin>
129 <viewport>6.0123843024302435 0.0 0.0 6.0123843024302435 81.22165451665171 95.03179722772279</viewport>
130 <hidden />
131 </plugin_config>
132 <width>659</width>
133 <z>4</z>
134 <height>198</height>
135 <location_x>246</location_x>
136 <location_y>2</location_y>
137 <minimized>false</minimized>
138 </plugin>
139 <plugin>
140 se.sics.cooja.plugins.ScriptRunner
141 <plugin_config>
142 <script>TIMEOUT(300000);
144 /* conf */
145 NR_MOTES = 5;
146 NR_PINGS = 20;
147 NR_PINGS_MIN = 10;
148 osName = java.lang.System.getProperty("os.name").toLowerCase();
149 if (osName.startsWith("win")) {
150 pingCmd = "ping -n " + NR_PINGS + " "; /* + ip */
151 } else {
152 pingCmd = "ping -c " + NR_PINGS + " "; /* + ip */
154 var nrReplies = new Array();
155 replyMsg = "from "; /* + ip */
157 /* wait for all motes to boot */
158 currentMote = 1;
159 while (currentMote &lt;= NR_MOTES) {
160 YIELD_THEN_WAIT_UNTIL(msg.contains('Telnet server'));
161 log.log("Mote " + id + " booted\n");
163 currentMote++;
166 GENERATE_MSG(1000, "continue");
167 WAIT_UNTIL(msg.equals("continue"));
169 /* override simulation delay to realtime */
170 mote.getSimulation().setDelayTime(java.lang.Integer.MIN_VALUE);
172 /* ping motes */
173 currentMote = 1;
174 while (currentMote &lt;= NR_MOTES) {
175 nrReplies[currentMote] = 0;
176 ip = mote.getSimulation().getMoteWithID(currentMote).getInterfaces().getIPAddress().getIPString();
177 log.log("Pinging mote " + currentMote + "\n");
178 motePingCmd = pingCmd + ip;
179 log.log("&gt; " + motePingCmd + "\n");
181 /* ping process */
182 var pingRunnable = new Object();
183 pingRunnable.run = function() {
184 pingProcess = new java.lang.Runtime.getRuntime().exec(motePingCmd);
185 stdIn = new java.io.BufferedReader(new java.io.InputStreamReader(pingProcess.getInputStream()));
186 while ((line = stdIn.readLine()) != null) {
187 if (line != null &amp;&amp; !line.trim().equals("")) {
188 log.log("&lt; " + line + "\n");
190 if (line.contains(replyMsg + ip)) {
191 nrReplies[currentMote]++;
194 pingProcess.destroy();
196 var thread = new java.lang.Thread(new java.lang.Runnable(pingRunnable));
197 thread.start();
199 while (thread.isAlive()) {
200 GENERATE_MSG(500, "continue");
201 YIELD_THEN_WAIT_UNTIL(msg.equals("continue"));
204 currentMote++;
207 log.log("\nTEST SUMMARY:\n")
208 testOK = 1;
209 currentMote = 1;
210 while (currentMote &lt;= NR_MOTES) {
211 log.log("Ping replies from mote " + currentMote + ": " + nrReplies[currentMote] + "/" + NR_PINGS + "\n")
212 if (nrReplies[currentMote] &lt; NR_PINGS_MIN) {
213 testOK = 0;
216 currentMote++;
219 if (testOK == 1) {
220 log.testOK();
222 log.testFailed();</script>
223 <active>true</active>
224 </plugin_config>
225 <width>600</width>
226 <z>2</z>
227 <height>702</height>
228 <location_x>903</location_x>
229 <location_y>1</location_y>
230 <minimized>false</minimized>
231 </plugin>
232 <plugin>
233 se.sics.cooja.plugins.LogListener
234 <plugin_config>
235 <filter />
236 </plugin_config>
237 <width>904</width>
238 <z>1</z>
239 <height>538</height>
240 <location_x>0</location_x>
241 <location_y>519</location_y>
242 <minimized>false</minimized>
243 </plugin>
244 <plugin>
245 se.sics.cooja.plugins.NativeIPGateway
246 <mote_arg>0</mote_arg>
247 <plugin_config>
248 <network_interface>\Device\NPF_{8ABD0E53-3824-4541-B397-5FAF535206CF}</network_interface>
249 <register_routes>true</register_routes>
250 </plugin_config>
251 <width>388</width>
252 <z>6</z>
253 <height>321</height>
254 <location_x>1</location_x>
255 <location_y>200</location_y>
256 <minimized>false</minimized>
257 </plugin>
258 <plugin>
259 se.sics.cooja.plugins.RadioLogger
260 <plugin_config>
261 <split>150</split>
262 </plugin_config>
263 <width>517</width>
264 <z>3</z>
265 <height>321</height>
266 <location_x>389</location_x>
267 <location_y>200</location_y>
268 <minimized>false</minimized>
269 </plugin>
270 <plugin>
271 se.sics.cooja.plugins.TimeLine
272 <plugin_config>
273 <mote>0</mote>
274 <mote>1</mote>
275 <mote>2</mote>
276 <mote>3</mote>
277 <mote>4</mote>
278 <showRadioRXTX />
279 <split>1</split>
280 <zoom>11</zoom>
281 </plugin_config>
282 <width>600</width>
283 <z>0</z>
284 <height>355</height>
285 <location_x>903</location_x>
286 <location_y>702</location_y>
287 <minimized>false</minimized>
288 </plugin>
289 </simconf>