summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMichal Jagiello <michal.jagiello@t-mobile.pl>2022-01-19 11:54:17 +0000
committerMichal Jagiello <michal.jagiello@t-mobile.pl>2022-01-20 07:23:33 +0000
commit3a370dbe49a9cfae415d5254c91840374330a7ff (patch)
tree6b09591ba0f0437df400f19fa2a0da1c2138aecd /tests
parentd7966b32c11b772ca4a86b600154d79eeeed7f04 (diff)
Add PNF instantiation support
Issue-ID: INT-2047 Signed-off-by: Michal Jagiello <michal.jagiello@t-mobile.pl> Change-Id: I55f124cfee3f8f8260c967cc24e52cd79e680e0b
Diffstat (limited to 'tests')
-rw-r--r--tests/test_service_instance_resource.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/test_service_instance_resource.py b/tests/test_service_instance_resource.py
index 69a9e57..662aa32 100644
--- a/tests/test_service_instance_resource.py
+++ b/tests/test_service_instance_resource.py
@@ -65,6 +65,21 @@ INSTANTIATION_PARAMETERS_DATA = {
]
}
+PNF_VNF_INSTANTIATION_PARAMETERS_DATA = {
+ "service_name": "service1",
+ "service_subscripion_type": "ss_1",
+ "instantiation_parameters": [
+ {
+ "vnf_name": "test_vnf",
+ "parameters": {"a": "b", "c": "d"}
+ },
+ {
+ "pnf_name": "test_pnf",
+ "instance_name": "test_pnf_instance"
+ }
+ ]
+}
+
@patch(
"onap_data_provider.resources.service_instance_resource.ServiceInstanceResource.service_instance",
@@ -139,3 +154,21 @@ def test_service_instance_resource_version_1_0_and_1_1(mock_aai_service_get_all)
si_resource_1_0 = ServiceInstanceResource(RESOURCE_DATA_1_1)
assert si_resource_1_0.aai_service is not None
mock_aai_service_get_all.assert_called_once()
+
+
+@patch("onap_data_provider.resources.service_instance_resource.ServiceInstanceResource.service_subscription", new_callable=PropertyMock)
+def test_test_service_instance_resource_vnf_and_pnf_instantiation(mock_service_subscription):
+ si_resource = ServiceInstanceResource(PNF_VNF_INSTANTIATION_PARAMETERS_DATA)
+
+ so_service = si_resource.so_service
+ assert len(so_service.vnfs) == 1
+ assert len(so_service.pnfs) == 1
+
+ vnf = so_service.vnfs[0]
+ assert vnf.instance_name == "test_vnf"
+ assert vnf.model_name == "test_vnf"
+ assert vnf.parameters == {"a": "b", "c": "d"}
+
+ pnf = so_service.pnfs[0]
+ assert pnf.instance_name == "test_pnf_instance"
+ assert pnf.model_name == "test_pnf"