summaryrefslogtreecommitdiffstats
path: root/tests/unit/benchmark/contexts/test_standalone.py
diff options
context:
space:
mode:
authorRex Lee <limingjiang@huawei.com>2017-07-17 01:15:07 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-07-17 01:15:07 +0000
commit90e407589014ecba0719fc123ed2e8b2bf86309c (patch)
tree3b03847ed91738f3153a1a19c459f8c7dab9634e /tests/unit/benchmark/contexts/test_standalone.py
parent92104932aa57b703d86926fc3aad13d742a41652 (diff)
parent7a32c18b2fb3f220f099218871ba29115ef31ee9 (diff)
Merge "add network info to topology"
Diffstat (limited to 'tests/unit/benchmark/contexts/test_standalone.py')
-rw-r--r--tests/unit/benchmark/contexts/test_standalone.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/unit/benchmark/contexts/test_standalone.py b/tests/unit/benchmark/contexts/test_standalone.py
index 687ef7305..a6fd776e8 100644
--- a/tests/unit/benchmark/contexts/test_standalone.py
+++ b/tests/unit/benchmark/contexts/test_standalone.py
@@ -129,3 +129,48 @@ class StandaloneContextTestCase(unittest.TestCase):
curr_path = os.path.dirname(os.path.abspath(__file__))
file_path = os.path.join(curr_path, filename)
return file_path
+
+ def test__get_network(self):
+ network1 = {
+ 'name': 'net_1',
+ 'vld_id': 'vld111',
+ 'segmentation_id': 'seg54',
+ 'network_type': 'type_a',
+ 'physical_network': 'phys',
+ }
+ network2 = {
+ 'name': 'net_2',
+ 'vld_id': 'vld999',
+ }
+ self.test_context.networks = {
+ 'a': network1,
+ 'b': network2,
+ }
+
+ attr_name = None
+ self.assertIsNone(self.test_context._get_network(attr_name))
+
+ attr_name = {}
+ self.assertIsNone(self.test_context._get_network(attr_name))
+
+ attr_name = {'vld_id': 'vld777'}
+ self.assertIsNone(self.test_context._get_network(attr_name))
+
+ attr_name = 'vld777'
+ self.assertIsNone(self.test_context._get_network(attr_name))
+
+ attr_name = {'vld_id': 'vld999'}
+ expected = {
+ "name": 'net_2',
+ "vld_id": 'vld999',
+ "segmentation_id": None,
+ "network_type": None,
+ "physical_network": None,
+ }
+ result = self.test_context._get_network(attr_name)
+ self.assertDictEqual(result, expected)
+
+ attr_name = 'a'
+ expected = network1
+ result = self.test_context._get_network(attr_name)
+ self.assertDictEqual(result, expected)