aboutsummaryrefslogtreecommitdiffstats
path: root/ice_validator/preload_vnfapi
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/preload_vnfapi
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/preload_vnfapi')
-rw-r--r--ice_validator/preload_vnfapi/vnfapi_generator.py28
1 files changed, 21 insertions, 7 deletions
diff --git a/ice_validator/preload_vnfapi/vnfapi_generator.py b/ice_validator/preload_vnfapi/vnfapi_generator.py
index 517c789..dce1789 100644
--- a/ice_validator/preload_vnfapi/vnfapi_generator.py
+++ b/ice_validator/preload_vnfapi/vnfapi_generator.py
@@ -76,10 +76,30 @@ class VnfApiPreloadGenerator(AbstractPreloadGenerator):
def generate_module(self, vnf_module, output_dir):
preload = get_json_template(DATA_DIR, "preload_template")
self._populate(preload, vnf_module)
- outfile = "{}/{}.json".format(output_dir, vnf_module.vnf_name)
+ incomplete = "_incomplete" if self.module_incomplete else ""
+ outfile = "{}/{}{}.json".format(output_dir, vnf_module.vnf_name, incomplete)
with open(outfile, "w") as f:
json.dump(preload, f, indent=4)
+ def _populate(self, preload, vnf_module):
+ self._add_vnf_metadata(preload)
+ self._add_availability_zones(preload, vnf_module)
+ self._add_vnf_networks(preload, vnf_module)
+ self._add_vms(preload, vnf_module)
+ self._add_parameters(preload, vnf_module)
+
+ def _add_vnf_metadata(self, preload):
+ vnf_meta = preload["input"]["vnf-topology-information"]["vnf-topology-identifier"]
+ vnf_meta["vnf-name"] = self.replace("vnf_name")
+ vnf_meta["generic-vnf-type"] = self.replace(
+ "vnf-type",
+ "VALUE FOR: Concatenation of <Service Name>/"
+ "<VF Instance Name> MUST MATCH SDC",
+ )
+ vnf_meta["vnf-type"] = self.replace(
+ "vf-module-model-name", "VALUE FOR: <vfModuleModelName> from CSAR or SDC"
+ )
+
def add_floating_ips(self, network_template, network):
# only one floating IP is really supported, in the preload model
# so for now we'll just use the last one. We might revisit this
@@ -102,12 +122,6 @@ class VnfApiPreloadGenerator(AbstractPreloadGenerator):
)
network_template["ip-count-ipv6"] += 1
- def _populate(self, preload, vnf_module):
- self._add_availability_zones(preload, vnf_module)
- self._add_vnf_networks(preload, vnf_module)
- self._add_vms(preload, vnf_module)
- self._add_parameters(preload, vnf_module)
-
def _add_availability_zones(self, preload, vnf_module):
zones = preload["input"]["vnf-topology-information"]["vnf-assignments"][
"availability-zones"