X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ice_validator%2Fapp_tests%2Fpreload_tests%2Ftest_grapi.py;h=10b090dc667cd03978c4a0d5d9ef5924d15d4685;hb=079622e0b69ec1e5c50af08c8312937609929233;hp=7b56440c5fdb01850bc78995c65498dd80b79bd2;hpb=84db7f8f65cd0ec77f09cfde365599df9890ce6c;p=vvp%2Fvalidation-scripts.git diff --git a/ice_validator/app_tests/preload_tests/test_grapi.py b/ice_validator/app_tests/preload_tests/test_grapi.py index 7b56440..10b090d 100644 --- a/ice_validator/app_tests/preload_tests/test_grapi.py +++ b/ice_validator/app_tests/preload_tests/test_grapi.py @@ -41,7 +41,7 @@ from shutil import rmtree import pytest -from preload.environment import PreloadEnvironment +from preload.environment import EnvironmentFileDataSource from preload.model import Vnf, get_heat_templates from preload_grapi import GrApiPreloadGenerator from tests.helpers import first @@ -78,9 +78,9 @@ def preload(pytestconfig, session_dir): pytestconfig.getoption = fake_getoption templates = get_heat_templates(pytestconfig) - env = PreloadEnvironment(THIS_DIR / "sample_env") vnf = Vnf(templates) - generator = GrApiPreloadGenerator(vnf, session_dir, env) + datasource = EnvironmentFileDataSource(THIS_DIR / "sample_env") + generator = GrApiPreloadGenerator(vnf, session_dir, datasource) generator.generate() return session_dir @@ -95,6 +95,13 @@ def incremental(preload): return load_module(preload, "incremental.json") +def test_incomplete_filenames(preload): + base = THIS_DIR / "sample_env/preloads/grapi/base_incomplete.json" + inc = THIS_DIR / "sample_env/preloads/grapi/incremental_incomplete.json" + assert base.exists() + assert inc.exists() + + def test_base_fields(base): data = base["input"]["preload-vf-module-topology-information"][ "vnf-topology-identifier-structure" @@ -122,7 +129,9 @@ def test_base_networks(base): assert oam == { "network-role": "oam", "network-name": "VALUE FOR: network name of oam_net_id", - "subnets-data": {"subnet-data": [{"subnet-id": "VALUE FOR: oam_subnet_id"}]}, + "subnets-data": { + "subnet-data": [{"subnet-name": "VALUE FOR: name of oam_subnet_id"}] + }, } @@ -141,6 +150,7 @@ def test_base_vm_types(base): "vm-network": [ { "network-role": "oam", + "network-role-tag": "oam", "network-information-items": { "network-information-item": [ { @@ -168,17 +178,18 @@ def test_base_vm_types(base): }, { "network-role": "ha", + "network-role-tag": "ha", "network-information-items": { "network-information-item": [ { "ip-version": "4", - "use-dhcp": "N", + "use-dhcp": "Y", "ip-count": 0, "network-ips": {"network-ip": []}, }, { "ip-version": "6", - "use-dhcp": "N", + "use-dhcp": "Y", "ip-count": 0, "network-ips": {"network-ip": []}, }, @@ -210,10 +221,7 @@ def test_base_parameters(base): params = base["input"]["preload-vf-module-topology-information"][ "vf-module-topology" ]["vf-module-parameters"]["param"] - assert params == [ - {"name": "svc_image_name", "value": "svc_image"}, - {"name": "svc_flavor_name", "value": "svc_flavor"}, - ] + assert params == [] def test_incremental(incremental): @@ -235,9 +243,18 @@ def test_incremental_networks(incremental): def test_preload_env_population(preload): - base_path = THIS_DIR / "sample_env/preloads/grapi/base.json" + base_path = THIS_DIR / "sample_env/preloads/grapi/base_incomplete.json" data = load_json(base_path) azs = data["input"]["preload-vf-module-topology-information"][ "vnf-resource-assignments" ]["availability-zones"]["availability-zone"] assert azs == ["az0", "az1"] + + +def test_preload_env_population_missing_value(preload): + base_path = THIS_DIR / "sample_env/preloads/grapi/base_incomplete.json" + data = load_json(base_path) + vnf_name = data["input"]["preload-vf-module-topology-information"][ + "vnf-topology-identifier-structure" + ]["vnf-name"] + assert vnf_name == "VALUE FOR: vnf_name"