self.create_files(structure["files"], output, package_type)
return "Created"
- def validate(self, base_directory, recursive=True):
+ def validate(self, base_directory, recursive=True, old_format=False):
"""
**Validate OSM Descriptors given a path**
desc_type = "-"
try:
desc_type, descriptor_data = validation_im.yaml_validation(self, descriptor_data)
+ if not old_format:
+ if ( desc_type=="vnfd" or desc_type=="nsd" ):
+ print("OSM descriptor '{}' written in an unsupported format. Please update to ETSI SOL006 format".format(desc_path))
+ print("Package validation skipped. It can still be done with 'osm package-validate --old'")
+ print("Package build can still be done with 'osm package-build --skip-validation'")
+ raise Exception("Not SOL006 format")
validation_im.pyangbind_validation(self, desc_type, descriptor_data)
table.append({"type": desc_type, "path": desc_path, "valid": "OK", "error": "-"})
except Exception as e:
:returns: cloud-init content
"""
+ self._logger.debug("")
return "---\n#cloud-config"
def create_files(self, files, file_content, package_type):
table = PrettyTable(['nfpkg name', 'id', 'desc type'])
for vnfd in resp:
name = vnfd.get('id', vnfd.get('name','-'))
- descriptor_type = 'sol005' if 'product-name' in vnfd else 'rel8'
+ descriptor_type = 'sol006' if 'product-name' in vnfd else 'rel8'
if long:
onb_state = vnfd['_admin'].get('onboardingState','-')
op_state = vnfd['_admin'].get('operationalState','-')
# exit(1)
@cli_osm.command(name='package-validate',
- short_help='Validate a package descriptor')
+ short_help='Validate a package descriptor')
@click.argument('base-directory',
default=".",
required=False)
default=True,
help='The activated recursive option will validate the yaml files'
' within the indicated directory and in its subdirectories')
+@click.option('--old',
+ is_flag=True,
+ default=False,
+ help='Validates also the descriptors using the previous OSM format (pre SOL006)')
@click.pass_context
def package_validate(ctx,
base_directory,
- recursive):
+ recursive,
+ old):
"""
Validate descriptors given a base directory.
"""
# try:
check_client_version(ctx.obj, ctx.command.name)
- results = ctx.obj.package_tool.validate(base_directory, recursive)
+ results = ctx.obj.package_tool.validate(base_directory, recursive, old)
table = PrettyTable()
table.field_names = ["TYPE", "PATH", "VALID", "ERROR"]
# Print the dictionary generated by the validation function