aboutsummaryrefslogtreecommitdiffstats
path: root/ice_validator/app_tests
diff options
context:
space:
mode:
authorLovett, Trevor <trevor.lovett@att.com>2019-09-05 08:25:32 -0500
committerLovett, Trevor (tl2972) <tl2972@att.com>2019-09-05 08:27:19 -0500
commitd7f6c7ca8191822cf437997337129d087a6533f6 (patch)
treedcd64d1942657beed2cde10d80715a2fe7992db3 /ice_validator/app_tests
parent083e8d0575d80d5d539a4ef83d8f4800074b7bcd (diff)
[VVP] Preload Generation Enhancements and Fixes
- All values flow to preload env templates (availability zones were not) - defaults.yaml should be in preload_env (includes vnf_name) - Ensure SDC Model Identifiers are documented in VNF API format (ex: vnf-type, etc.) - Ensure CSAR is used in VNF and GR API where appropriate and available - Flag populated preload templates with _incomplete when they are not fully resolved - If a value is still set to CHANGEME in the preload env, then revert to the original VALUE FOR from the blank preload template - Ensure app_tests/preload_tests/sample_heat passes all vvp validations - Added missing depedency (bandit) to requirements.txt Change-Id: Idf1d5e6e5237debcf3e94bed5fcf7c15e41c9e82 Issue-ID: VVP-283 Signed-off-by: Lovett, Trevor <trevor.lovett@att.com>
Diffstat (limited to 'ice_validator/app_tests')
-rw-r--r--ice_validator/app_tests/preload_tests/sample_env/base.env1
-rw-r--r--ice_validator/app_tests/preload_tests/sample_heat/base.env11
-rw-r--r--ice_validator/app_tests/preload_tests/sample_heat/base.yaml4
-rw-r--r--ice_validator/app_tests/preload_tests/sample_heat/base_volume.yaml4
-rw-r--r--ice_validator/app_tests/preload_tests/test_environment.py16
-rw-r--r--ice_validator/app_tests/preload_tests/test_grapi.py14
-rw-r--r--ice_validator/app_tests/preload_tests/test_vnfapi.py6
7 files changed, 38 insertions, 18 deletions
diff --git a/ice_validator/app_tests/preload_tests/sample_env/base.env b/ice_validator/app_tests/preload_tests/sample_env/base.env
index 0650c68..d72b1ea 100644
--- a/ice_validator/app_tests/preload_tests/sample_env/base.env
+++ b/ice_validator/app_tests/preload_tests/sample_env/base.env
@@ -37,3 +37,4 @@
parameters:
availability_zone_0: az0
availability_zone_1: az1
+ vnf_name: CHANGEME
diff --git a/ice_validator/app_tests/preload_tests/sample_heat/base.env b/ice_validator/app_tests/preload_tests/sample_heat/base.env
index 3784ea0..e3ef442 100644
--- a/ice_validator/app_tests/preload_tests/sample_heat/base.env
+++ b/ice_validator/app_tests/preload_tests/sample_heat/base.env
@@ -1,15 +1,10 @@
parameters:
-
db_image_name: db_image
-
db_flavor_name: db_flavor
-
lb_image_name: lb_image
-
lb_flavor_name: lb_flavor
-
svc_image_name: svc_image
-
svc_flavor_name: svc_flavor
-
- svc_count: 3 \ No newline at end of file
+ svc_count: 3
+ mgmt_image_name: mgmt_image
+ mgmt_flavor_name: mgmt_flavor
diff --git a/ice_validator/app_tests/preload_tests/sample_heat/base.yaml b/ice_validator/app_tests/preload_tests/sample_heat/base.yaml
index 327d2ee..fdf34e0 100644
--- a/ice_validator/app_tests/preload_tests/sample_heat/base.yaml
+++ b/ice_validator/app_tests/preload_tests/sample_heat/base.yaml
@@ -270,13 +270,13 @@ resources:
type: OS::Cinder::VolumeAttachment
properties:
volume_id: { get_param: db_vol0_id }
- server: { get_resource: db_server_0 }
+ instance_uuid: { get_resource: db_server_0 }
db_volume_attachment_1:
type: OS::Cinder::VolumeAttachment
properties:
volume_id: { get_param: db_vol1_id }
- server: { get_resource: db_server_1 }
+ instance_uuid: { get_resource: db_server_1 }
mgmt_server_0:
type: OS::Nova::Server
diff --git a/ice_validator/app_tests/preload_tests/sample_heat/base_volume.yaml b/ice_validator/app_tests/preload_tests/sample_heat/base_volume.yaml
index 4d47766..e326357 100644
--- a/ice_validator/app_tests/preload_tests/sample_heat/base_volume.yaml
+++ b/ice_validator/app_tests/preload_tests/sample_heat/base_volume.yaml
@@ -26,7 +26,7 @@ resources:
params:
VNF_NAME: {get_param: vnf_name}
volume_type: "solidfire"
- volume_size: { get_param: volume_size }
+ size: { get_param: volume_size }
db_vol1:
type: OS::Cinder::Volume
@@ -37,7 +37,7 @@ resources:
params:
VNF_NAME: {get_param: vnf_name}
volume_type: "solidfire"
- volume_size: { get_param: volume_size }
+ size: { get_param: volume_size }
outputs:
db_vol0_id:
diff --git a/ice_validator/app_tests/preload_tests/test_environment.py b/ice_validator/app_tests/preload_tests/test_environment.py
index b627b4b..c815bb2 100644
--- a/ice_validator/app_tests/preload_tests/test_environment.py
+++ b/ice_validator/app_tests/preload_tests/test_environment.py
@@ -37,6 +37,7 @@
from pathlib import Path
import pytest
+from mock import mock
from preload.environment import CloudServiceArchive, PreloadEnvironment
@@ -74,6 +75,10 @@ def test_csar_get_vf_module_resource_name(csar):
assert csar.get_vf_module_resource_name("base_vIECCF") == "stark_vccf_vf"
+def test_csar_get_vnf_type(csar):
+ assert csar.get_vnf_type("base_vIECCF") == "stark_vccf_svc/stark_vccf_vf"
+
+
def test_csar_get_vf_module_resource_name_not_found(csar):
assert csar.get_vf_module_resource_name("unknown") is None
@@ -178,3 +183,14 @@ def test_preload_environment_defaults_in_module_env(env):
"common": "ABC",
"my_ip": "192.168.0.1",
}
+
+
+def test_preload_environment_uses_csar(env, monkeypatch):
+ csar = mock.MagicMock(spec=CloudServiceArchive)
+ csar.get_vnf_type = mock.Mock(return_value="stark_vccf_svc/stark_vccf_vf")
+ csar.get_vf_module_model_name = mock.Mock(return_value="model_name")
+ env = env.get_environment("env_three")
+ monkeypatch.setattr(env, "csar", csar)
+ mod = env.get_module("base")
+ assert mod["vnf-type"] == "stark_vccf_svc/stark_vccf_vf"
+ assert mod["vf-module-model-name"] == "model_name"
diff --git a/ice_validator/app_tests/preload_tests/test_grapi.py b/ice_validator/app_tests/preload_tests/test_grapi.py
index 7b56440..eea1a67 100644
--- a/ice_validator/app_tests/preload_tests/test_grapi.py
+++ b/ice_validator/app_tests/preload_tests/test_grapi.py
@@ -87,12 +87,12 @@ def preload(pytestconfig, session_dir):
@pytest.fixture(scope="session")
def base(preload):
- return load_module(preload, "base.json")
+ return load_module(preload, "base_incomplete.json")
@pytest.fixture(scope="session")
def incremental(preload):
- return load_module(preload, "incremental.json")
+ return load_module(preload, "incremental_incomplete.json")
def test_base_fields(base):
@@ -235,9 +235,17 @@ 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"
diff --git a/ice_validator/app_tests/preload_tests/test_vnfapi.py b/ice_validator/app_tests/preload_tests/test_vnfapi.py
index 5732335..16a3140 100644
--- a/ice_validator/app_tests/preload_tests/test_vnfapi.py
+++ b/ice_validator/app_tests/preload_tests/test_vnfapi.py
@@ -82,12 +82,12 @@ def preload(pytestconfig, session_dir):
@pytest.fixture(scope="session")
def base(preload):
- return load_module(preload, "base.json")
+ return load_module(preload, "base_incomplete.json")
@pytest.fixture(scope="session")
def incremental(preload):
- return load_module(preload, "incremental.json")
+ return load_module(preload, "incremental_incomplete.json")
def test_base_azs(base):
@@ -187,7 +187,7 @@ def test_incremental_networks(incremental):
def test_preload_env_population(preload):
- base_path = THIS_DIR / "sample_env/preloads/vnfapi/base.json"
+ base_path = THIS_DIR / "sample_env/preloads/vnfapi/base_incomplete.json"
data = load_json(base_path)
azs = data["input"]["vnf-topology-information"]["vnf-assignments"][
"availability-zones"