diff options
Diffstat (limited to 'components/pm-subscription-handler/tests')
4 files changed, 29 insertions, 8 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 cd547d9d..6b94373a 100755 --- a/components/pm-subscription-handler/tests/data/pm_subscription_event.json +++ b/components/pm-subscription-handler/tests/data/pm_subscription_event.json @@ -5,7 +5,7 @@ "policyName":"pmsh-operational-policy",
"changeType":"CREATE",
"closedLoopControlName":"pmsh-control-loop",
- "ipv4Address": "1.2.3.4",
+ "ipAddress": "204.120.0.15",
"subscription":{
"subscriptionName":"ExtraPM-All-gNB-R2B",
"administrativeState":"UNLOCKED",
diff --git a/components/pm-subscription-handler/tests/test_network_function.py b/components/pm-subscription-handler/tests/test_network_function.py index 5a1a6ba8..3e38b9c6 100755 --- a/components/pm-subscription-handler/tests/test_network_function.py +++ b/components/pm-subscription-handler/tests/test_network_function.py @@ -1,5 +1,5 @@ # ============LICENSE_START=================================================== -# Copyright (C) 2019-2020 Nordix Foundation. +# Copyright (C) 2019-2021 Nordix Foundation. # ============================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -33,12 +33,14 @@ 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', + 'ipv4_address': '204.120.0.15', + 'ipv6_address': '2001:db8:3333:4444:5555:6666:7777:8888', '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', + 'ipv4_address': '204.120.0.15', + 'ipv6_address': '2001:db8:3333:4444:5555:6666:7777:8888', '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 b18f41e8..01c573e3 100755 --- a/components/pm-subscription-handler/tests/test_subscription.py +++ b/components/pm-subscription-handler/tests/test_subscription.py @@ -1,5 +1,5 @@ # ============LICENSE_START=================================================== -# Copyright (C) 2019-2020 Nordix Foundation. +# Copyright (C) 2019-2021 Nordix Foundation. # ============================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -140,7 +140,24 @@ 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', + ipv4_address='204.120.0.15', + ipv6_address='', + model_invariant_id='some-id', + model_version_id='some-id') + nf.sdnc_model_name = 'some-name' + nf.sdnc_model_version = 'some-version' + actual_sub_event = self.app_conf.subscription.prepare_subscription_event(nf, self.app_conf) + print(actual_sub_event) + self.assertEqual(expected_sub_event, actual_sub_event) + + def test_prepare_subscription_event_with_ipv6(self): + with open(os.path.join(os.path.dirname(__file__), + 'data/pm_subscription_event.json'), 'r') as data: + expected_sub_event = json.load(data) + expected_sub_event['ipAddress'] = '2001:db8:3333:4444:5555:6666:7777:8888' + nf = NetworkFunction(nf_name='pnf_1', + ipv4_address='204.120.0.15', + ipv6_address='2001:db8:3333:4444:5555:6666:7777:8888', model_invariant_id='some-id', model_version_id='some-id') nf.sdnc_model_name = 'some-name' diff --git a/components/pm-subscription-handler/tests/test_subscription_handler.py b/components/pm-subscription-handler/tests/test_subscription_handler.py index 2293ee50..ecc45f66 100644 --- a/components/pm-subscription-handler/tests/test_subscription_handler.py +++ b/components/pm-subscription-handler/tests/test_subscription_handler.py @@ -109,7 +109,8 @@ class SubscriptionHandlerTest(BaseClassSetup): MagicMock(return_value=NetworkFunctionModel(nf_name='pnf_1', model_invariant_id='some-id', model_version_id='some-id', - ip_address='ip_address', + ipv4_address='ip_address4', + ipv6_address='ip_address6', model_name='model_name', sdnc_model_name='sdnc_model_name', sdnc_model_version='sdnc_model_version'))) @@ -145,7 +146,8 @@ class SubscriptionHandlerTest(BaseClassSetup): MagicMock(return_value=NetworkFunctionModel(nf_name='pnf_1', model_invariant_id='some-id', model_version_id='some-id', - ip_address='ip_address', + ipv4_address='ip_address4', + ipv6_address='ip_address6', model_name='model_name', sdnc_model_name='sdnc_model_name', sdnc_model_version='sdnc_model_version', |