pl_ssh_key = os.environ.get(
"PL_SSH_KEY",
"%s/.ssh/id_rsa_planetlab" % (os.environ['HOME'],) )
+ slicename = os.environ.get(
+ "PL_SLICE",
+ slicename)
pl_user, pl_pwd = test_util.pl_auth()
instance.defer_configure("homeDirectory", self.root_dir)
instance.defer_configure("plcHost", plchost)
instance.defer_configure("tapPortBase", self.port_base)
instance.defer_configure("p2pDeployment", False) # it's interactive, we don't want it in tests
+ instance.defer_configure("dedicatedSlice", True)
+
+ # Hack, but we need vsys_vnet
+ instance.do_setup()
+ vnet = instance.vsys_vnet
+ self.net_prefix = vnet.rsplit('.',1)[0]
return instance
ping_result = instance.trace(7, "stdout") or ""
instance.stop()
finally:
- instance.shutdown()
+ try:
+ instance.shutdown()
+ except:
+ pass
# asserts at the end, to make sure there's proper cleanup
self.assertTrue(re.match(comp_result, ping_result, re.MULTILINE),
comp_result = r".*GNU Fortran \(GCC\).*"
instance.stop()
finally:
- instance.shutdown()
+ try:
+ instance.shutdown()
+ except:
+ pass
# asserts at the end, to make sure there's proper cleanup
self.assertTrue(re.match(comp_result, ping_result, re.MULTILINE),
ping_result = instance.trace(10, "stdout") or ""
instance.stop()
finally:
- instance.shutdown()
+ try:
+ instance.shutdown()
+ except:
+ pass
# asserts at the end, to make sure there's proper cleanup
self.assertTrue(re.match(comp_result, ping_result, re.MULTILINE),
instance.defer_create(4, "Internet")
instance.defer_connect(3, "inet", 4, "devs")
instance.defer_create(5, "TunInterface")
- instance.defer_add_address(5, "192.168.2.2", 24, False)
+ instance.defer_add_address(5, self.net_prefix+".2", 24, False)
instance.defer_connect(2, "devs", 5, "node")
instance.defer_create(6, "Application")
instance.defer_create_set(6, "command", """
comp_result = "OKIDOKI"
instance.stop()
finally:
- instance.shutdown()
+ try:
+ instance.shutdown()
+ except:
+ pass
# asserts at the end, to make sure there's proper cleanup
self.assertEqual(comp_result, test_result)
instance.stop()
finally:
- instance.shutdown()
+ try:
+ instance.shutdown()
+ except:
+ pass
# asserts at the end, to make sure there's proper cleanup
match = re.match(comp_result, test_result, re.MULTILINE)
instance.defer_create(7, TunClass)
instance.defer_create_set(7, "tun_cipher", Cipher)
instance.defer_add_trace(7, "packets")
- instance.defer_add_address(7, "192.168.2.2", 24, False)
+ instance.defer_add_address(7, self.net_prefix+".2", 24, False)
instance.defer_connect(2, "devs", 7, "node")
instance.defer_create(8, TunClass)
instance.defer_create_set(8, "tun_cipher", Cipher)
instance.defer_add_trace(8, "packets")
- instance.defer_add_address(8, "192.168.2.3", 24, False)
+ instance.defer_add_address(8, self.net_prefix+".3", 24, False)
instance.defer_connect(3, "devs", 8, "node")
instance.defer_create(9, "Application")
instance.defer_create_set(9, "command", "ping -qc10 {#[GUID-8].addr[0].[Address]#}")
comp_result = r"""PING .* \(.*\) \d*\(\d*\) bytes of data.
--- .* ping statistics ---
-10 packets transmitted, [0-9]+ received, %s%% packet loss, time \d*ms.*
+10 packets transmitted, [0-9]+ received,.* %s%% packet loss, time \d*ms.*
""" % (plr,)
try:
packets2 = instance.trace(8, "packets") or ""
instance.stop()
finally:
- instance.shutdown()
+ try:
+ instance.shutdown()
+ except:
+ pass
# asserts at the end, to make sure there's proper cleanup
self.assertTrue(re.match(comp_result, ping_result, re.MULTILINE),
ping_result = (instance.trace(12, "stderr") or "").strip()
instance.stop()
finally:
- instance.shutdown()
+ try:
+ instance.shutdown()
+ except:
+ pass
# asserts at the end, to make sure there's proper cleanup
self.assertEqual(ping_result, "")
ping_result = (instance.trace(12, "stderr") or "").strip()
instance.stop()
finally:
- instance.shutdown()
+ try:
+ instance.shutdown()
+ except:
+ pass
# asserts at the end, to make sure there's proper cleanup
self.assertEqual(ping_result, "")
ping_result = instance.trace(7, "stdout") or ""
instance.stop()
finally:
- instance.shutdown()
+ try:
+ instance.shutdown()
+ except:
+ pass
# asserts at the end, to make sure there's proper cleanup
self.assertTrue(re.match(comp_result, ping_result, re.MULTILINE),