From 8eb4c4bce63c0f3ec77ba6a61566db77ebe47656 Mon Sep 17 00:00:00 2001 From: Sajith Sasidharan Date: Wed, 8 Nov 2023 11:36:51 -0600 Subject: [PATCH] Set up a slice name and use the name to tear it down --- tests/integration/test_L2_with_mflib.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/integration/test_L2_with_mflib.py b/tests/integration/test_L2_with_mflib.py index 932127fe..5aa7cdbd 100644 --- a/tests/integration/test_L2_with_mflib.py +++ b/tests/integration/test_L2_with_mflib.py @@ -31,10 +31,19 @@ from mflib.mflib import MFLib -from fabrictestbed_extensions.fablib.fablib import FablibManager +from fabrictestbed_extensions.fablib.fablib import FablibManager, fablib class L2MFLibTests(unittest.TestCase): + + def setUp(self): + time_stamp = time.strftime("%Y-%m-%d %H:%M:%S") + host = socket.gethostname() + self.slice_name = f"integration test @ {time_stamp} on {host}" + + def tearDown(self): + fablib.get_slice(self.slice_name).delete() + def test_add_l2_measurement_nodes(self): """ Add measurement nodes to L2 network. @@ -45,10 +54,6 @@ def test_add_l2_measurement_nodes(self): self.assertIsNotNone(c) - time_stamp = time.strftime("%Y-%m-%d %H:%M:%S") - host = socket.gethostname() - slice_name = f"integration test @ {time_stamp} on {host}" - [site1, site2] = fablib.get_random_sites(count=2) print(f"Sites: {site1}, {site2}") @@ -60,7 +65,7 @@ def test_add_l2_measurement_nodes(self): network_name = "net1" # Create a slice - slice = fablib.new_slice(name=slice_name) + slice = fablib.new_slice(name=self.slice_name) # Add an L2 network. net1 = slice.add_l2network(