aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLukasz Rajewski <lukasz.rajewski@orange.com>2021-01-05 20:58:12 +0000
committerGerrit Code Review <gerrit@onap.org>2021-01-05 20:58:12 +0000
commitd089e89005df1b4b3b6238a2937e23791c07d9ae (patch)
treef527f96f06985e770cd60be71b62260ae48dfcc2 /tests
parenta2da63228ee409830170239c7ad0d9c073793909 (diff)
parentaf63861d32daac92cfaf1e00842fa23bc6ba7c6b (diff)
Merge "PNF macro instantiation"
Diffstat (limited to 'tests')
-rw-r--r--tests/data/service_macro_template_pnfs.yaml4
-rw-r--r--tests/data/service_macro_template_vnfs.yaml6
-rw-r--r--tests/test_service_macro_instantiation.py42
3 files changed, 52 insertions, 0 deletions
diff --git a/tests/data/service_macro_template_pnfs.yaml b/tests/data/service_macro_template_pnfs.yaml
new file mode 100644
index 0000000..b0559b6
--- /dev/null
+++ b/tests/data/service_macro_template_pnfs.yaml
@@ -0,0 +1,4 @@
+---
+test_pnfs:
+ pnfs:
+ - pnf_name: pnf
diff --git a/tests/data/service_macro_template_vnfs.yaml b/tests/data/service_macro_template_vnfs.yaml
new file mode 100644
index 0000000..28fcc49
--- /dev/null
+++ b/tests/data/service_macro_template_vnfs.yaml
@@ -0,0 +1,6 @@
+---
+test_vnfs:
+ vnfs:
+ - vnf_name: vnf
+ pnfs:
+ - pnf_name: pnf
diff --git a/tests/test_service_macro_instantiation.py b/tests/test_service_macro_instantiation.py
new file mode 100644
index 0000000..382a86e
--- /dev/null
+++ b/tests/test_service_macro_instantiation.py
@@ -0,0 +1,42 @@
+from unittest import mock
+
+from onaptests.steps.instantiate.service_macro import (
+ YamlTemplateServiceMacroInstantiateStep
+)
+
+VNFS_PNFS_YAML = './tests/data/service_macro_template_vnfs.yaml'
+PNFS_YAML = './tests/data/service_macro_template_pnfs.yaml'
+
+
+@mock.patch("onaptests.steps.base.BaseStep.add_step")
+@mock.patch("onaptests.steps.instantiate.service_macro.settings")
+@mock.patch("onaptests.steps.instantiate.service_macro.YamlTemplateServiceOnboardStep")
+@mock.patch("onaptests.steps.instantiate.service_macro.ConnectServiceSubToCloudRegionStep")
+@mock.patch("onaptests.steps.instantiate.service_macro.CustomerServiceSubscriptionCreateStep")
+def test_are_vnfs(CustomerStep, CloudStep, OnboardStep, settings, add_step):
+
+ settings.SERVICE_YAML_TEMPLATE = VNFS_PNFS_YAML
+ settings.ONLY_INSTANTIATE = False
+
+ YamlTemplateServiceMacroInstantiateStep()
+
+ CustomerStep.assert_not_called()
+ assert add_step.mock_calls == [
+ mock.call(OnboardStep()), mock.call(CloudStep())]
+
+
+@mock.patch("onaptests.steps.base.BaseStep.add_step")
+@mock.patch("onaptests.steps.instantiate.service_macro.settings")
+@mock.patch("onaptests.steps.instantiate.service_macro.YamlTemplateServiceOnboardStep")
+@mock.patch("onaptests.steps.instantiate.service_macro.ConnectServiceSubToCloudRegionStep")
+@mock.patch("onaptests.steps.instantiate.service_macro.CustomerServiceSubscriptionCreateStep")
+def test_are_pnfs(CustomerStep, CloudStep, OnboardStep, settings, add_step):
+
+ settings.SERVICE_YAML_TEMPLATE = PNFS_YAML
+ settings.ONLY_INSTANTIATE = False
+
+ YamlTemplateServiceMacroInstantiateStep()
+
+ CloudStep.assert_not_called()
+ assert add_step.mock_calls == [
+ mock.call(OnboardStep()), mock.call(CustomerStep())]