aboutsummaryrefslogtreecommitdiffstats
path: root/ice_validator/app_tests
diff options
context:
space:
mode:
Diffstat (limited to 'ice_validator/app_tests')
-rw-r--r--ice_validator/app_tests/preload_tests/test_grapi.py32
-rw-r--r--ice_validator/app_tests/preload_tests/test_vnfapi.py27
-rw-r--r--ice_validator/app_tests/test_config.py6
3 files changed, 32 insertions, 33 deletions
diff --git a/ice_validator/app_tests/preload_tests/test_grapi.py b/ice_validator/app_tests/preload_tests/test_grapi.py
index 99498ec..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,21 +78,28 @@ 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
@pytest.fixture(scope="session")
def base(preload):
- return load_module(preload, "base_incomplete.json")
+ return load_module(preload, "base.json")
@pytest.fixture(scope="session")
def incremental(preload):
- return load_module(preload, "incremental_incomplete.json")
+ 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):
@@ -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": "db_vol0_id", "value": "VALUE FOR: db_vol0_id"},
- {"name": "db_vol1_id", "value": "VALUE FOR: db_vol1_id"},
- ]
+ assert params == []
def test_incremental(incremental):
diff --git a/ice_validator/app_tests/preload_tests/test_vnfapi.py b/ice_validator/app_tests/preload_tests/test_vnfapi.py
index a49043f..312c418 100644
--- a/ice_validator/app_tests/preload_tests/test_vnfapi.py
+++ b/ice_validator/app_tests/preload_tests/test_vnfapi.py
@@ -41,7 +41,7 @@ from shutil import rmtree
import pytest
from app_tests.preload_tests.test_grapi import load_json
-from preload.environment import PreloadEnvironment
+from preload.environment import EnvironmentFileDataSource
from preload.model import Vnf, get_heat_templates
from preload_vnfapi import VnfApiPreloadGenerator
from tests.helpers import load_yaml, first
@@ -74,20 +74,20 @@ def preload(pytestconfig, session_dir):
pytestconfig.getoption = fake_getoption
templates = get_heat_templates(pytestconfig)
vnf = Vnf(templates)
- preload_env = PreloadEnvironment(THIS_DIR / "sample_env")
- generator = VnfApiPreloadGenerator(vnf, session_dir, preload_env)
+ datasource = EnvironmentFileDataSource(THIS_DIR / "sample_env")
+ generator = VnfApiPreloadGenerator(vnf, session_dir, datasource)
generator.generate()
return session_dir
@pytest.fixture(scope="session")
def base(preload):
- return load_module(preload, "base_incomplete.json")
+ return load_module(preload, "base.json")
@pytest.fixture(scope="session")
def incremental(preload):
- return load_module(preload, "incremental_incomplete.json")
+ return load_module(preload, "incremental.json")
def test_base_azs(base):
@@ -106,13 +106,13 @@ def test_base_networks(base):
{
"network-role": "oam",
"network-name": "VALUE FOR: network name for oam_net_id",
- "subnet-id": "oam_subnet_id",
+ "subnet-name": "VALUE FOR: name for oam_subnet_id",
},
{"network-role": "ha", "network-name": "VALUE FOR: network name for ha_net_id"},
{
"network-role": "ctrl",
"network-name": "VALUE FOR: network name for ctrl_net_id",
- "subnet-id": "ctrl_subnet_id",
+ "subnet-name": "VALUE FOR: name for ctrl_subnet_id",
},
]
@@ -154,7 +154,7 @@ def test_base_vm_types(base):
"network-ips-v6": [],
"network-macs": [],
"interface-route-prefixes": [],
- "use-dhcp": "N",
+ "use-dhcp": "Y",
},
],
}
@@ -162,16 +162,7 @@ def test_base_vm_types(base):
def test_base_parameters(base):
params = base["input"]["vnf-topology-information"]["vnf-parameters"]
- assert params == [
- {
- "vnf-parameter-name": "db_vol0_id",
- "vnf-parameter-value": "VALUE FOR: db_vol0_id",
- },
- {
- "vnf-parameter-name": "db_vol1_id",
- "vnf-parameter-value": "VALUE FOR: db_vol1_id",
- },
- ]
+ assert params == []
def test_incremental(incremental):
diff --git a/ice_validator/app_tests/test_config.py b/ice_validator/app_tests/test_config.py
index a41cfbf..dca7ae1 100644
--- a/ice_validator/app_tests/test_config.py
+++ b/ice_validator/app_tests/test_config.py
@@ -41,9 +41,9 @@ from io import StringIO
import pytest
import yaml
-from config import Config, get_generator_plugin_names, to_uri
+from config import Config, to_uri
import vvp
-
+from preload.engine import PLUGIN_MGR
DEFAULT_CONFIG = """
namespace: {namespace}
@@ -160,7 +160,7 @@ def test_env_specs(config):
def test_get_generator_plugin_names(config):
- names = get_generator_plugin_names()
+ names = [g.format_name() for g in PLUGIN_MGR.preload_generators]
assert "VNF-API" in names
assert "GR-API" in names