summaryrefslogtreecommitdiffstats
path: root/components/pm-subscription-handler/tests
diff options
context:
space:
mode:
authorefiacor <fiachra.corcoran@est.tech>2020-10-14 11:17:50 +0100
committerefiacor <fiachra.corcoran@est.tech>2020-10-19 10:03:24 +0100
commit27ec381034605d03285140cff8c21098e13808fe (patch)
tree4fec8438c714a049693d53957a7e91b94f78a0a1 /components/pm-subscription-handler/tests
parent75c997686e5f85709b8c2bfc3f46d9661710a9f8 (diff)
[PMSH] Bug fix to include ip in event1.1.2-pmsh
# Add fix for DB cleardown on exit Signed-off-by: efiacor <fiachra.corcoran@est.tech> Change-Id: I6630f74258d072f683b5b5e42f0da2e63ea1b3c2 Issue-ID: DCAEGEN2-2486
Diffstat (limited to 'components/pm-subscription-handler/tests')
-rwxr-xr-xcomponents/pm-subscription-handler/tests/data/pm_subscription_event.json1
-rw-r--r--components/pm-subscription-handler/tests/test_aai_service.py10
-rwxr-xr-xcomponents/pm-subscription-handler/tests/test_network_function.py2
-rwxr-xr-xcomponents/pm-subscription-handler/tests/test_subscription.py15
4 files changed, 10 insertions, 18 deletions
diff --git a/components/pm-subscription-handler/tests/data/pm_subscription_event.json b/components/pm-subscription-handler/tests/data/pm_subscription_event.json
index 9416ec28..cd547d9d 100755
--- a/components/pm-subscription-handler/tests/data/pm_subscription_event.json
+++ b/components/pm-subscription-handler/tests/data/pm_subscription_event.json
@@ -5,6 +5,7 @@
"policyName":"pmsh-operational-policy",
"changeType":"CREATE",
"closedLoopControlName":"pmsh-control-loop",
+ "ipv4Address": "1.2.3.4",
"subscription":{
"subscriptionName":"ExtraPM-All-gNB-R2B",
"administrativeState":"UNLOCKED",
diff --git a/components/pm-subscription-handler/tests/test_aai_service.py b/components/pm-subscription-handler/tests/test_aai_service.py
index 7a3b846d..27694851 100644
--- a/components/pm-subscription-handler/tests/test_aai_service.py
+++ b/components/pm-subscription-handler/tests/test_aai_service.py
@@ -72,21 +72,21 @@ class AaiClientTestCase(BaseClassSetup):
@responses.activate
def test_aai_client_get_all_aai_xnf_data_not_found(self):
responses.add(responses.PUT,
- 'https://1.2.3.4:8443/aai/v20/query?format=simple&nodesOnly=true',
+ 'https://1.2.3.4:8443/aai/v21/query?format=simple&nodesOnly=true',
json={'error': 'not found'}, status=404)
self.assertIsNone(aai_client._get_all_aai_nf_data(self.app_conf))
@responses.activate
def test_aai_client_get_all_aai_xnf_data_success(self):
responses.add(responses.PUT,
- 'https://aai:8443/aai/v20/query?format=simple&nodesOnly=true',
+ 'https://aai:8443/aai/v21/query?format=simple&nodesOnly=true',
json={'dummy_data': 'blah_blah'}, status=200)
self.assertIsNotNone(aai_client._get_all_aai_nf_data(self.app_conf))
@responses.activate
def test_aai_client_get_sdnc_params_success(self):
responses.add(responses.GET,
- 'https://aai:8443/aai/v20/service-design-and-creation/models/model/'
+ 'https://aai:8443/aai/v21/service-design-and-creation/models/model/'
'6fb9f466-7a79-4109-a2a3-72b340aca53d/model-vers/model-ver/'
'6d25b637-8bca-47e2-af1a-61258424183d',
json=json.loads(self.good_model_info), status=200)
@@ -98,7 +98,7 @@ class AaiClientTestCase(BaseClassSetup):
@responses.activate
def test_aai_client_get_sdnc_params_fail(self):
responses.add(responses.GET,
- 'https://aai:8443/aai/v20/service-design-and-creation/models/model/'
+ 'https://aai:8443/aai/v21/service-design-and-creation/models/model/'
'9fb9f466-7a79-4109-a2a3-72b340aca53d/model-vers/model-ver/'
'b7469cc5-be51-41cc-b37f-361537656771', status=404)
with self.assertRaises(HTTPError):
@@ -111,4 +111,4 @@ class AaiClientTestCase(BaseClassSetup):
aai_client._get_aai_service_url()
def test_aai_client_get_aai_service_url_success(self):
- self.assertEqual('https://aai:8443/aai/v20', aai_client._get_aai_service_url())
+ self.assertEqual('https://aai:8443/aai/v21', aai_client._get_aai_service_url())
diff --git a/components/pm-subscription-handler/tests/test_network_function.py b/components/pm-subscription-handler/tests/test_network_function.py
index ea5d2c7e..c930c41d 100755
--- a/components/pm-subscription-handler/tests/test_network_function.py
+++ b/components/pm-subscription-handler/tests/test_network_function.py
@@ -33,10 +33,12 @@ class NetworkFunctionTests(BaseClassSetup):
super().setUp()
self.nf_1 = NetworkFunction(sdnc_model_name='blah', sdnc_model_version=1.0,
**{'nf_name': 'pnf_1',
+ 'ip_address': '1.2.3.4',
'model_invariant_id': 'some_id',
'model_version_id': 'some_other_id'})
self.nf_2 = NetworkFunction(sdnc_model_name='blah', sdnc_model_version=2.0,
**{'nf_name': 'pnf_2',
+ 'ip_address': '1.2.3.4',
'model_invariant_id': 'some_id',
'model_version_id': 'some_other_id'})
with open(os.path.join(os.path.dirname(__file__), 'data/aai_model_info.json'), 'r') as data:
diff --git a/components/pm-subscription-handler/tests/test_subscription.py b/components/pm-subscription-handler/tests/test_subscription.py
index 9bfe825f..62a9e16e 100755
--- a/components/pm-subscription-handler/tests/test_subscription.py
+++ b/components/pm-subscription-handler/tests/test_subscription.py
@@ -47,6 +47,7 @@ class SubscriptionTest(BaseClassSetup):
mock_session_get.return_value.text = self.aai_model_data
self.mock_mr_sub = Mock()
self.mock_mr_pub = Mock()
+ self.app_conf.subscription.create()
self.xnfs = aai_client.get_pmsh_nfs_from_aai(self.app_conf)
self.sub_model = self.app_conf.subscription.get()
@@ -65,12 +66,10 @@ class SubscriptionTest(BaseClassSetup):
def test_get_subscription(self):
sub_name = 'ExtraPM-All-gNB-R2B'
- self.app_conf.subscription.create()
new_sub = self.app_conf.subscription.get()
self.assertEqual(sub_name, new_sub.subscription_name)
def test_get_nf_names_per_sub(self):
- self.app_conf.subscription.create()
self.app_conf.subscription.add_network_function_to_subscription(list(self.xnfs)[0],
self.sub_model)
self.app_conf.subscription.add_network_function_to_subscription(list(self.xnfs)[1],
@@ -82,16 +81,6 @@ class SubscriptionTest(BaseClassSetup):
self.assertEqual(sub1, same_sub1)
self.assertEqual(1, len(self.app_conf.subscription.get_all()))
- def test_add_network_functions_per_subscription(self):
- for nf in self.xnfs:
- self.app_conf.subscription.add_network_function_to_subscription(nf, self.sub_model)
- nfs_for_sub_1 = Subscription.get_all_nfs_subscription_relations()
- self.assertEqual(3, len(nfs_for_sub_1))
- new_nf = NetworkFunction(nf_name='vnf_3', orchestration_status='Active')
- self.app_conf.subscription.add_network_function_to_subscription(new_nf, self.sub_model)
- nf_subs = Subscription.get_all_nfs_subscription_relations()
- self.assertEqual(4, len(nf_subs))
-
def test_add_duplicate_network_functions_per_subscription(self):
self.app_conf.subscription.add_network_function_to_subscription(list(self.xnfs)[0],
self.sub_model)
@@ -103,7 +92,6 @@ class SubscriptionTest(BaseClassSetup):
self.assertEqual(1, len(nf_subs))
def test_update_subscription_status(self):
- self.app_conf.subscription.create()
self.app_conf.subscription.administrativeState = 'new_status'
self.app_conf.subscription.update_subscription_status()
sub = self.app_conf.subscription.get()
@@ -152,6 +140,7 @@ class SubscriptionTest(BaseClassSetup):
'data/pm_subscription_event.json'), 'r') as data:
expected_sub_event = json.load(data)
nf = NetworkFunction(nf_name='pnf_1',
+ ip_address='1.2.3.4',
model_invariant_id='some-id',
model_version_id='some-id')
nf.sdnc_model_name = 'some-name'