@@ -91,6 +91,18 @@ def _server_primary_ip(self):
9191 return ip
9292 raise RuntimeError ("could not determine server primary IP" )
9393
94+ def bash_at_server (self , cmd , * args , ** kwargs ):
95+ print (
96+ self .dc .execute (
97+ "tester_1-ff00_0_111" ,
98+ "bash" ,
99+ "-c" ,
100+ cmd ,
101+ * args ,
102+ ** kwargs ,
103+ )
104+ )
105+
94106 def _run (self ):
95107 # Wait until SCION control-plane/path connectivity is established.
96108 self .await_connectivity ()
@@ -108,7 +120,7 @@ def _run(self):
108120 bound_port = 31001
109121 multihomed_port = 31000
110122
111- # SERVERLOGFILE="/tmp/log.txt"
123+ SERVERLOGFILE = "/tmp/log.txt"
112124
113125 print (f"server IPs configured: primary={ primary_ip } , secondary={ secondary_ip } " )
114126
@@ -144,40 +156,23 @@ def _run(self):
144156 print ("server terminated successfully" )
145157 time .sleep (2 )
146158
147-
148- def bash_at_server (cmd , * args , ** kwargs ):
149- print (
150- self .dc .execute (
151- "tester_1-ff00_0_111" ,
152- "bash" ,
153- "-c" ,
154- cmd ,
155- * args ,
156- ** kwargs ,
157- )
158- )
159-
160- # # bash(f"ls -l / ; echo ; ls -l /tmp ; echo ; ls -l /share")
161- # # bash("whoami ; id")
162- # bash_at_server(f"touch {SERVERLOGFILE} ; " +
163- # f"chown {os.getuid()}:{os.getgid()} {SERVERLOGFILE}",
164- # user="0:0")
165- # # bash(f"ls -l {LOGFILE}")
166-
167-
168- # 2) Multihomed check using server primary IP while server is unbound (0.0.0.0).
159+ # Multihomed server.
160+ self .bash_at_server (f"touch { SERVERLOGFILE } ; " +
161+ f"chown { os .getuid ()} :{ os .getgid ()} { SERVERLOGFILE } " ,
162+ user = "0:0" )
163+ self .bash_at_server (f"ls -l { SERVERLOGFILE } " )
169164 self .dc .execute_detached (
170165 "tester_1-ff00_0_111" ,
171166 "bash" ,
172167 "-c" ,
173- # f"test-server -bind 0.0.0.0 -port {multihomed_port} > {SERVERLOGFILE} 2>&1",
174- f"test-server -bind 0.0.0.0 -port { multihomed_port } " ,
168+ f"test-server -bind 0.0.0.0 -port { multihomed_port } > { SERVERLOGFILE } 2>&1" ,
175169 )
176170 time .sleep (2 )
177171 print ("---------------------------------------------------" )
178- bash_at_server (f "ifconfig ; echo -e ' \n \n ' ; route -n" )
172+ self . bash_at_server ("ifconfig ; echo ; route -n ; echo ; ps aux " )
179173 print ("---------------------------------------------------" )
180174
175+ # 2) Multihomed check using server primary IP while server is unbound (0.0.0.0).
181176 remote_primary = f"1-ff00:0:111,{ primary_ip } :{ multihomed_port } "
182177 print (f"running client against primary IP: { remote_primary } " )
183178 result_primary = self .dc .execute (
@@ -194,33 +189,19 @@ def bash_at_server(cmd, *args, **kwargs):
194189 # through the secondary destination without enforcing the response source address.
195190 remote_secondary = f"1-ff00:0:111,{ secondary_ip } :{ multihomed_port } "
196191 print (f"running client against secondary IP: { remote_secondary } " )
197- result_secondary = self .dc .execute (
198- "tester_1-ff00_0_112" ,
199- "bash" ,
200- "-c" ,
201- f'test-client -local "{ local_addr } " -remote "{ remote_secondary } "' ,
202- )
203- print (result_secondary )
204-
205-
206-
207-
208- # print("bringing one interface down at the server")
209- # print("---------------------------------------------------")
210- # # bash_at_server(f"ifconfig eth1 down ; echo 'removed eth0' ; sleep 2 ; " +
211- # # "ifconfig ; echo -n '\n' ; route -n", user="0:0")
212- # bash_at_server(f"ip addr del 192.168.200.11/24 dev eth1 ; sleep 1 ; ifconfig ; route -n",
213- # user="0:0")
214- # print("---------------------------------------------------")
215- # # Give docker some time to bring down the interface in the container.
216- # time.sleep(5)
217-
218-
219-
220-
221-
222-
223-
192+ result_secondary = ""
193+ try :
194+ result_secondary = self .dc .execute (
195+ "tester_1-ff00_0_112" ,
196+ "bash" ,
197+ "-c" ,
198+ f'test-client -local "{ local_addr } " -remote "{ remote_secondary } "' ,
199+ )
200+ finally :
201+ print ("Client results:" )
202+ print (result_secondary )
203+ print ("\n \n Server log:" )
204+ self .bash_at_server (f"cat { SERVERLOGFILE } " )
224205
225206
226207if __name__ == "__main__" :
0 commit comments