Validation will fail by default if not using SOL006 format
[osm/osmclient.git] / osmclient / scripts / osm.py
index c97f984..3af70c6 100755 (executable)
@@ -543,7 +543,7 @@ def vnfd_list(ctx, nf_type, filter, long):
             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','-')
@@ -4312,7 +4312,7 @@ def package_create(ctx,
     #     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)
@@ -4320,10 +4320,15 @@ def package_create(ctx,
               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.
 
@@ -4332,7 +4337,7 @@ def package_validate(ctx,
     """
     # 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