summaryrefslogtreecommitdiffstats
path: root/csarvalidation/python/main
diff options
context:
space:
mode:
authorEdyta Krukowska <edyta.krukowska@nokia.com>2021-01-21 11:18:16 +0100
committerEdyta Krukowska <edyta.krukowska@nokia.com>2021-01-21 12:30:29 +0100
commitc837fd4f62ca8d468ac48302ff535a024e53e0be (patch)
treeef9507aa673bd0e9dac8be644895fdf494ebe7d4 /csarvalidation/python/main
parent398dcd3e75651e047e307a3207fb2b8dc1207ab0 (diff)
Update documentation and fix path to python test resources
Issue-ID: VNFSDK-731 Signed-off-by: Edyta Krukowska <edyta.krukowska@nokia.com> Change-Id: Ie7b045fd55a2192bc90c972e60de58ac5aaa66cc
Diffstat (limited to 'csarvalidation/python/main')
-rw-r--r--csarvalidation/python/main/validation/rules/ActiveRulesTableGenerator.py7
-rw-r--r--csarvalidation/python/main/validation/rules/table/ActiveRuleEntity.py5
-rw-r--r--csarvalidation/python/main/validation/rules/table/ActiveRulesTable.py10
3 files changed, 17 insertions, 5 deletions
diff --git a/csarvalidation/python/main/validation/rules/ActiveRulesTableGenerator.py b/csarvalidation/python/main/validation/rules/ActiveRulesTableGenerator.py
index c8a0f37..56122e7 100644
--- a/csarvalidation/python/main/validation/rules/ActiveRulesTableGenerator.py
+++ b/csarvalidation/python/main/validation/rules/ActiveRulesTableGenerator.py
@@ -1,7 +1,7 @@
# ============LICENSE_START====================================
# vnfsdk-validation
# =========================================================
-# Copyright (C) 2020 Nokia. All rights reserved.
+# Copyright (C) 2021 Nokia. All rights reserved.
# =========================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -47,6 +47,7 @@ class ActiveRulesTableGenerator:
active_rules_table.add_entity(
ActiveRuleEntity(
rule,
+ self._get_release_from_yaml(yaml_description),
self._get_description_from_yaml(yaml_description),
self._get_product_from_yaml(yaml_description)
)
@@ -68,3 +69,7 @@ class ActiveRulesTableGenerator:
@staticmethod
def _get_product_from_yaml(yaml_file: dict) -> str:
return yaml_file['info']['product']
+
+ @staticmethod
+ def _get_release_from_yaml(yaml_file: dict) -> str:
+ return yaml_file['info']['metadata']['release']
diff --git a/csarvalidation/python/main/validation/rules/table/ActiveRuleEntity.py b/csarvalidation/python/main/validation/rules/table/ActiveRuleEntity.py
index ed8c7d5..d3b0088 100644
--- a/csarvalidation/python/main/validation/rules/table/ActiveRuleEntity.py
+++ b/csarvalidation/python/main/validation/rules/table/ActiveRuleEntity.py
@@ -1,7 +1,7 @@
# ============LICENSE_START====================================
# vnfsdk-validation
# =========================================================
-# Copyright (C) 2020 Nokia. All rights reserved.
+# Copyright (C) 2021 Nokia. All rights reserved.
# =========================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -18,7 +18,8 @@
class ActiveRuleEntity:
- def __init__(self, rule, description, product):
+ def __init__(self, rule, release, description, product):
self.rule = rule
+ self.release = release
self.description = description
self.product = product
diff --git a/csarvalidation/python/main/validation/rules/table/ActiveRulesTable.py b/csarvalidation/python/main/validation/rules/table/ActiveRulesTable.py
index 70bb10d..250f0f4 100644
--- a/csarvalidation/python/main/validation/rules/table/ActiveRulesTable.py
+++ b/csarvalidation/python/main/validation/rules/table/ActiveRulesTable.py
@@ -1,7 +1,7 @@
# ============LICENSE_START====================================
# vnfsdk-validation
# =========================================================
-# Copyright (C) 2020 Nokia. All rights reserved.
+# Copyright (C) 2021 Nokia. All rights reserved.
# =========================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -29,9 +29,15 @@ class ActiveRulesTable:
def get_table_in_csv_format(self, values_separator=";", entity_separator="\n") -> str:
csv_table = ""
- for entity in self._active_rules_entities:
+ active_rules_entries_sorted_by_release = ActiveRulesTable._sort_by_release(self._active_rules_entities)
+ for entity in active_rules_entries_sorted_by_release:
csv_table += \
entity.product + values_separator + \
+ entity.release + values_separator + \
entity.rule + values_separator + \
entity.description + entity_separator
return csv_table
+
+ @staticmethod
+ def _sort_by_release(active_rules_entities: list) -> list:
+ return sorted(active_rules_entities, key=lambda it: it.release)