summaryrefslogtreecommitdiffstats
path: root/components/pm-subscription-handler/tests
diff options
context:
space:
mode:
authoregernug <gerard.nugent@est.tech>2020-10-14 08:52:49 +0100
committeregernug <gerard.nugent@est.tech>2020-11-19 09:16:15 +0000
commit4b2b1445bef3b760ed29efa1c7c78977dde73452 (patch)
treefd92bb19794e9e74567cffa5788725041a66b468 /components/pm-subscription-handler/tests
parent062c4a7c72a1b45bc2e37a04b469321c5abc9d97 (diff)
[PMSH] Add Resource Name to filter options
Issue-ID: DCAEGEN2-2402 Change-Id: I2242d36ca34e0b8ac085ce790b19b7ad51352c63 Signed-off-by: egernug <gerard.nugent@est.tech>
Diffstat (limited to 'components/pm-subscription-handler/tests')
-rw-r--r--components/pm-subscription-handler/tests/data/filter_test_data.json76
-rwxr-xr-xcomponents/pm-subscription-handler/tests/test_aai_event_handler.py2
-rw-r--r--components/pm-subscription-handler/tests/test_aai_service.py2
-rwxr-xr-xcomponents/pm-subscription-handler/tests/test_network_function.py4
-rw-r--r--components/pm-subscription-handler/tests/test_network_function_filter.py18
5 files changed, 94 insertions, 8 deletions
diff --git a/components/pm-subscription-handler/tests/data/filter_test_data.json b/components/pm-subscription-handler/tests/data/filter_test_data.json
index 0d8fc7c8..2033624e 100644
--- a/components/pm-subscription-handler/tests/data/filter_test_data.json
+++ b/components/pm-subscription-handler/tests/data/filter_test_data.json
@@ -1,5 +1,49 @@
[
{
+ "testName": "test_filter_model_name_true",
+ "nfFilter":{
+ "nfNames":[
+ "^pnf.*",
+ "^vnf.*"
+ ],
+ "modelInvariantIDs": [
+ ],
+ "modelVersionIDs": [
+
+ ],
+ "modelNames": [
+ "pnf102"
+ ]
+ },
+ "nfName": "pnf1",
+ "modelInvariantUUID": "7129e420-d396-4efb-af02-6b83499b12f8",
+ "modelVersionID": "e80a6ae3-cafd-4d24-850d-e14c084a5ca9",
+ "modelName": "pnf102",
+ "expectedResult": true
+ },
+ {
+ "testName": "test_filter_model_name_false",
+ "nfFilter":{
+ "nfNames":[
+ "^pnf.*",
+ "^vnf.*"
+ ],
+ "modelInvariantIDs": [
+ ],
+ "modelVersionIDs": [
+
+ ],
+ "modelNames": [
+ "pnf102"
+ ]
+ },
+ "nfName": "pnf1",
+ "modelInvariantUUID": "7129e420-d396-4efb-af02-6b83499b12f8",
+ "modelVersionID": "e80a6ae3-cafd-4d24-850d-e14c084a5ca9",
+ "modelName": "Wrong_Model_Name",
+ "expectedResult": false
+ },
+ {
"testName": "test_filter_true_on_xnf",
"nfFilter":{
"nfNames":[
@@ -11,11 +55,15 @@
],
"modelVersionIDs": [
+ ],
+ "modelNames": [
+
]
},
"nfName": "pnf1",
"modelInvariantUUID": "7129e420-d396-4efb-af02-6b83499b12f8",
"modelVersionID": "e80a6ae3-cafd-4d24-850d-e14c084a5ca9",
+ "modelName": "pnf102",
"expectedResult": true
},
{
@@ -30,11 +78,15 @@
],
"modelVersionIDs": [
+ ],
+ "modelNames": [
+
]
},
"nfName": "PNF-33",
"modelInvariantUUID": "7129e420-d396-4efb-af02-6b83499b12f8",
"modelVersionID": "e80a6ae3-cafd-4d24-850d-e14c084a5ca9",
+ "modelName": "pnf102",
"expectedResult": false
},
{
@@ -48,11 +100,15 @@
],
"modelVersionIDs": [
+ ],
+ "modelNames": [
+
]
},
"nfName": "pnf1",
"modelInvariantUUID": "7129e420-d396-4efb-af02-6b83499b12f8",
"modelVersionID": "e80a6ae3-cafd-4d24-850d-e14c084a5ca9",
+ "modelName": "pnf102",
"expectedResult": true
},
{
@@ -66,11 +122,15 @@
],
"modelVersionIDs": [
+ ],
+ "modelNames": [
+
]
},
"nfName": "pnf1",
"modelInvariantUUID": "WrongModelInvariantUUID",
"modelVersionID": "e80a6ae3-cafd-4d24-850d-e14c084a5ca9",
+ "modelName": "pnf102",
"expectedResult": false
},
{
@@ -85,11 +145,15 @@
],
"modelVersionIDs": [
+ ],
+ "modelNames": [
+
]
},
"nfName": "pnf1",
"modelInvariantUUID": "WrongModelInvariantUUID",
"modelVersionID": "e80a6ae3-cafd-4d24-850d-e14c084a5ca9",
+ "modelName": "pnf102",
"expectedResult": false
},
{
@@ -101,11 +165,15 @@
],
"modelVersionIDs": [
"e80a6ae3-cafd-4d24-850d-e14c084a5ca9"
+ ],
+ "modelNames": [
+
]
},
"nfName": "pnf1",
"modelInvariantUUID": "7129e420-d396-4efb-af02-6b83499b12f8",
"modelVersionID": "e80a6ae3-cafd-4d24-850d-e14c084a5ca9",
+ "modelName": "pnf102",
"expectedResult": true
},
{
@@ -117,11 +185,15 @@
],
"modelVersionIDs": [
"e80a6ae3-cafd-4d24-850d-e14c084a5ca9"
+ ],
+ "modelNames": [
+
]
},
"nfName": "pnf1",
"modelInvariantUUID": "7129e420-d396-4efb-af02-6b83499b12f8",
"modelVersionID": "WrongModelVersionID",
+ "modelName": "pnf102",
"expectedResult": false
},
{
@@ -135,11 +207,15 @@
],
"modelVersionIDs": [
"e80a6ae3-cafd-4d24-850d-e14c084a5ca9"
+ ],
+ "modelNames": [
+
]
},
"nfName": "pnf1",
"modelInvariantUUID": "7129e420-d396-4efb-af02-6b83499b12f8",
"modelVersionID": "WrongModelVersionID",
+ "modelName": "pnf102",
"expectedResult": false
}
]
diff --git a/components/pm-subscription-handler/tests/test_aai_event_handler.py b/components/pm-subscription-handler/tests/test_aai_event_handler.py
index dc5243d7..47a36f5c 100755
--- a/components/pm-subscription-handler/tests/test_aai_event_handler.py
+++ b/components/pm-subscription-handler/tests/test_aai_event_handler.py
@@ -44,7 +44,7 @@ class AAIEventHandlerTest(BaseClassSetup):
def tearDownClass(cls):
super().tearDownClass()
- @patch('mod.network_function.NetworkFunction.set_sdnc_params')
+ @patch('mod.network_function.NetworkFunction.set_nf_model_params')
@patch('mod.subscription.Subscription.activate_subscription')
@patch('mod.aai_event_handler.NetworkFunction.delete')
def test_process_aai_update_and_delete_events(self, mock_nf_delete, mock_activate_sub,
diff --git a/components/pm-subscription-handler/tests/test_aai_service.py b/components/pm-subscription-handler/tests/test_aai_service.py
index 27694851..27c0f402 100644
--- a/components/pm-subscription-handler/tests/test_aai_service.py
+++ b/components/pm-subscription-handler/tests/test_aai_service.py
@@ -47,7 +47,7 @@ class AaiClientTestCase(BaseClassSetup):
def tearDownClass(cls):
super().tearDownClass()
- @patch('mod.network_function.NetworkFunction.set_sdnc_params')
+ @patch('mod.network_function.NetworkFunction.set_nf_model_params')
@patch.object(Session, 'get')
@patch.object(Session, 'put')
def test_aai_client_get_pm_sub_data_success(self, mock_put_session, mock_get_session,
diff --git a/components/pm-subscription-handler/tests/test_network_function.py b/components/pm-subscription-handler/tests/test_network_function.py
index c930c41d..5a1a6ba8 100755
--- a/components/pm-subscription-handler/tests/test_network_function.py
+++ b/components/pm-subscription-handler/tests/test_network_function.py
@@ -90,9 +90,9 @@ class NetworkFunctionTests(BaseClassSetup):
@patch('mod.aai_client.get_aai_model_data')
def test_set_sdnc_params_true(self, mock_get_aai_model):
mock_get_aai_model.return_value = self.good_model_info
- self.assertTrue(self.nf_1.set_sdnc_params(self.app_conf))
+ self.assertTrue(self.nf_1.set_nf_model_params(self.app_conf))
@patch('mod.aai_client.get_aai_model_data')
def test_set_sdnc_params_false(self, mock_get_aai_model):
mock_get_aai_model.return_value = self.bad_model_info
- self.assertFalse(self.nf_1.set_sdnc_params(self.app_conf))
+ self.assertFalse(self.nf_1.set_nf_model_params(self.app_conf))
diff --git a/components/pm-subscription-handler/tests/test_network_function_filter.py b/components/pm-subscription-handler/tests/test_network_function_filter.py
index 2151925d..f5369377 100644
--- a/components/pm-subscription-handler/tests/test_network_function_filter.py
+++ b/components/pm-subscription-handler/tests/test_network_function_filter.py
@@ -44,12 +44,14 @@ def load_test_cases():
class NetworkFunctionFilterTest(TestCase):
@parameterized.expand(load_test_cases, name_func=custom_name_func)
- def test(self, test_name, nf_filter, nf_name, model_invariant_uuid, model_version_id,
+ def test(self, test_name, nf_filter, nf_name, model_invariant_uuid,
+ model_version_id, model_name,
expected_result):
nf_filter = NetworkFunctionFilter(**nf_filter)
self.assertEqual(nf_filter.is_nf_in_filter(NetworkFunction(nf_name=nf_name,
model_invariant_id=model_invariant_uuid,
- model_version_id=model_version_id)),
+ model_version_id=model_version_id,
+ model_name=model_name)),
expected_result)
def test_filter_true_on_multiple_modelInvariantIDs(self):
@@ -61,12 +63,16 @@ class NetworkFunctionFilterTest(TestCase):
'7129e420-d396-4efb-af02-6b83499b12f8'
],
"modelVersionIDs": [
+ ],
+ "modelNames": [
+
]
})
self.assertTrue(nf_filter.is_nf_in_filter(
NetworkFunction(nf_name='pnf1',
model_invariant_id='7129e420-d396-4efb-af02-6b83499b12f8',
- model_version_id='e80a6ae3-cafd-4d24-850d-e14c084a5ca9')))
+ model_version_id='e80a6ae3-cafd-4d24-850d-e14c084a5ca9',
+ model_name='pnf_102')))
def test_filter_false_on_modelInvariantIDs_being_false_and_pnfname_being_true(self):
nf_filter = NetworkFunctionFilter(**{
@@ -79,9 +85,13 @@ class NetworkFunctionFilterTest(TestCase):
'7129e420-d396-4efb-af02-6b83499b12f8'
],
"modelVersionIDs": [
+ ],
+ "modelNames": [
+
]
})
self.assertFalse(nf_filter.is_nf_in_filter(
NetworkFunction(nf_name='pnf1',
model_invariant_id='WrongModelInvariantUUID',
- model_version_id='e80a6ae3-cafd-4d24-850d-e14c084a5ca9')))
+ model_version_id='e80a6ae3-cafd-4d24-850d-e14c084a5ca9',
+ model_name='pnf_102')))