From 1b4fa5ac22f9d32d3af1615b4b22bd2753d1082b Mon Sep 17 00:00:00 2001
From: Nikolay Stanchev <ns17@it-innovation.soton.ac.uk>
Date: Thu, 1 Nov 2018 09:06:21 +0000
Subject: [PATCH] Updates alerts API to read servicefunctionchain instead of
 sfc from resource specification

---
 src/service/clmcservice/alertsapi/utilities.py                 | 3 ++-
 .../resource-spec/resources_invalid_test_config-1.yaml         | 2 +-
 .../resource-spec/resources_invalid_test_config-2.yaml         | 2 +-
 .../resource-spec/resources_invalid_test_config-3.yaml         | 2 +-
 .../resource-spec/resources_invalid_test_config-4.yaml         | 2 +-
 .../resource-spec/resources_invalid_test_config-5.yaml         | 2 +-
 .../test-data/resource-spec/resources_valid_test_config-1.yaml | 2 +-
 .../test-data/resource-spec/resources_valid_test_config-2.yaml | 2 +-
 .../test-data/resource-spec/resources_valid_test_config-3.yaml | 2 +-
 .../test-data/resource-spec/resources_valid_test_config-4.yaml | 2 +-
 .../test-data/resource-spec/resources_valid_test_config-5.yaml | 2 +-
 src/test/clmctest/alerts/resources_test_config.yaml            | 2 +-
 12 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/src/service/clmcservice/alertsapi/utilities.py b/src/service/clmcservice/alertsapi/utilities.py
index 3ec7a24..d0fb954 100644
--- a/src/service/clmcservice/alertsapi/utilities.py
+++ b/src/service/clmcservice/alertsapi/utilities.py
@@ -72,7 +72,8 @@ def get_resource_spec_policy_triggers(resource_spec_reference):
     policy_trigger_ids = {}
     # TODO next release - uncomment
     # sfc, sfc_i = resource_spec["metadata"]["sfc"], resource_spec["metadata"]["sfci"]
-    sfc, sfc_i = resource_spec["metadata"]["sfc"], "{0}_1".format(resource_spec["metadata"]["sfc"])
+    sfc = resource_spec["metadata"]["servicefunctionchain"]
+    sfc_i = "{0}_1".format(sfc)
 
     policies = resource_spec["topology_template"]["policies"]
     for policy in policies:
diff --git a/src/service/resources/tosca/test-data/resource-spec/resources_invalid_test_config-1.yaml b/src/service/resources/tosca/test-data/resource-spec/resources_invalid_test_config-1.yaml
index 6b86a03..30c6880 100644
--- a/src/service/resources/tosca/test-data/resource-spec/resources_invalid_test_config-1.yaml
+++ b/src/service/resources/tosca/test-data/resource-spec/resources_invalid_test_config-1.yaml
@@ -2,7 +2,7 @@ tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
 
 metadata:
   template_name: Flame Test Tosca resource specification
-  sfc: companyA-VR-ERROR
+  servicefunctionchain: companyA-VR-ERROR
 #  sfci: companyA-VR-premium
 
 # Import own definitions of nodes, capabilities and policy syntax.
diff --git a/src/service/resources/tosca/test-data/resource-spec/resources_invalid_test_config-2.yaml b/src/service/resources/tosca/test-data/resource-spec/resources_invalid_test_config-2.yaml
index 6999666..714cca0 100644
--- a/src/service/resources/tosca/test-data/resource-spec/resources_invalid_test_config-2.yaml
+++ b/src/service/resources/tosca/test-data/resource-spec/resources_invalid_test_config-2.yaml
@@ -4,7 +4,7 @@ metadata:
   template_name: Flame Test Tosca resource specification
 #  sfc: companyA-VR
 #  sfci: companyA-VR-premium-ERROR
-  sfc: companyA-VR-ERROR
+  servicefunctionchain: companyA-VR-ERROR
 
 # Import own definitions of nodes, capabilities and policy syntax.
 imports:
diff --git a/src/service/resources/tosca/test-data/resource-spec/resources_invalid_test_config-3.yaml b/src/service/resources/tosca/test-data/resource-spec/resources_invalid_test_config-3.yaml
index 29b96ed..b594fbf 100644
--- a/src/service/resources/tosca/test-data/resource-spec/resources_invalid_test_config-3.yaml
+++ b/src/service/resources/tosca/test-data/resource-spec/resources_invalid_test_config-3.yaml
@@ -2,7 +2,7 @@ tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
 
 metadata:
   template_name: Flame Test Tosca resource specification
-  sfc: companyA-VR
+  servicefunctionchain: companyA-VR
 #  sfci: companyA-VR-premium
 
 # Import own definitions of nodes, capabilities and policy syntax.
diff --git a/src/service/resources/tosca/test-data/resource-spec/resources_invalid_test_config-4.yaml b/src/service/resources/tosca/test-data/resource-spec/resources_invalid_test_config-4.yaml
index b57c83d..bdf4ab5 100644
--- a/src/service/resources/tosca/test-data/resource-spec/resources_invalid_test_config-4.yaml
+++ b/src/service/resources/tosca/test-data/resource-spec/resources_invalid_test_config-4.yaml
@@ -2,7 +2,7 @@ tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
 
 metadata:
   template_name: Flame Test Tosca resource specification
-  sfc: companyA-VR
+  servicefunctionchain: companyA-VR
 #  sfci: companyA-VR-premium
 
 # Import own definitions of nodes, capabilities and policy syntax.
diff --git a/src/service/resources/tosca/test-data/resource-spec/resources_invalid_test_config-5.yaml b/src/service/resources/tosca/test-data/resource-spec/resources_invalid_test_config-5.yaml
index 7584f49..74f1c4d 100644
--- a/src/service/resources/tosca/test-data/resource-spec/resources_invalid_test_config-5.yaml
+++ b/src/service/resources/tosca/test-data/resource-spec/resources_invalid_test_config-5.yaml
@@ -2,7 +2,7 @@ tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
 
 metadata:
   template_name: Flame Test Tosca resource specification
-  sfc: companyA-VR
+  servicefunctionchain: companyA-VR
 #  sfci: companyA-VR-premium
 
 # Import own definitions of nodes, capabilities and policy syntax.
diff --git a/src/service/resources/tosca/test-data/resource-spec/resources_valid_test_config-1.yaml b/src/service/resources/tosca/test-data/resource-spec/resources_valid_test_config-1.yaml
index cbaa52c..57ee024 100644
--- a/src/service/resources/tosca/test-data/resource-spec/resources_valid_test_config-1.yaml
+++ b/src/service/resources/tosca/test-data/resource-spec/resources_valid_test_config-1.yaml
@@ -2,7 +2,7 @@ tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
 
 metadata:
   template_name: Flame Test Tosca resource specification
-  sfc: companyA-VR
+  servicefunctionchain: companyA-VR
 #  sfci: companyA-VR-premium
 
 # Import own definitions of nodes, capabilities and policy syntax.
diff --git a/src/service/resources/tosca/test-data/resource-spec/resources_valid_test_config-2.yaml b/src/service/resources/tosca/test-data/resource-spec/resources_valid_test_config-2.yaml
index 6ad505f..7f021eb 100644
--- a/src/service/resources/tosca/test-data/resource-spec/resources_valid_test_config-2.yaml
+++ b/src/service/resources/tosca/test-data/resource-spec/resources_valid_test_config-2.yaml
@@ -2,7 +2,7 @@ tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
 
 metadata:
   template_name: Flame Test Tosca resource specification
-  sfc: companyA-VR
+  servicefunctionchain: companyA-VR
 #  sfci: companyA-VR-premium
 
 # Import own definitions of nodes, capabilities and policy syntax.
diff --git a/src/service/resources/tosca/test-data/resource-spec/resources_valid_test_config-3.yaml b/src/service/resources/tosca/test-data/resource-spec/resources_valid_test_config-3.yaml
index 99fb147..0dbe565 100644
--- a/src/service/resources/tosca/test-data/resource-spec/resources_valid_test_config-3.yaml
+++ b/src/service/resources/tosca/test-data/resource-spec/resources_valid_test_config-3.yaml
@@ -2,7 +2,7 @@ tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
 
 metadata:
   template_name: Flame Test Tosca resource specification
-  sfc: companyA-VR
+  servicefunctionchain: companyA-VR
 #  sfci: companyA-VR-premium
 
 # Import own definitions of nodes, capabilities and policy syntax.
diff --git a/src/service/resources/tosca/test-data/resource-spec/resources_valid_test_config-4.yaml b/src/service/resources/tosca/test-data/resource-spec/resources_valid_test_config-4.yaml
index dbcc8cb..6c44aff 100644
--- a/src/service/resources/tosca/test-data/resource-spec/resources_valid_test_config-4.yaml
+++ b/src/service/resources/tosca/test-data/resource-spec/resources_valid_test_config-4.yaml
@@ -2,7 +2,7 @@ tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
 
 metadata:
   template_name: Flame Test Tosca resource specification
-  sfc: companyA-VR
+  servicefunctionchain: companyA-VR
 #  sfci: companyA-VR-premium
 
 # Import own definitions of nodes, capabilities and policy syntax.
diff --git a/src/service/resources/tosca/test-data/resource-spec/resources_valid_test_config-5.yaml b/src/service/resources/tosca/test-data/resource-spec/resources_valid_test_config-5.yaml
index e1ab90e..73c6592 100644
--- a/src/service/resources/tosca/test-data/resource-spec/resources_valid_test_config-5.yaml
+++ b/src/service/resources/tosca/test-data/resource-spec/resources_valid_test_config-5.yaml
@@ -2,7 +2,7 @@ tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
 
 metadata:
   template_name: Flame Test Tosca resource specification
-  sfc: companyA-VR
+  servicefunctionchain: companyA-VR
 #  sfci: companyA-VR-premium
 
 # Import own definitions of nodes, capabilities and policy syntax.
diff --git a/src/test/clmctest/alerts/resources_test_config.yaml b/src/test/clmctest/alerts/resources_test_config.yaml
index 161ab8b..9bd17df 100644
--- a/src/test/clmctest/alerts/resources_test_config.yaml
+++ b/src/test/clmctest/alerts/resources_test_config.yaml
@@ -2,7 +2,7 @@ tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
 
 metadata:
   template_name: Flame CLMC Alerts Integration Test
-  sfc: MS_Template_1
+  servicefunctionchain: MS_Template_1
   sfci: MS_I1
 
 
-- 
GitLab