Fix the Sdc Controller 55/44655/1
authorDeterme, Sebastien (sd378r) <sd378r@intl.att.com>
Wed, 25 Apr 2018 12:22:52 +0000 (14:22 +0200)
committerDeterme, Sebastien (sd378r) <sd378r@intl.att.com>
Wed, 25 Apr 2018 12:22:52 +0000 (14:22 +0200)
Fix the controller bugs, it was not able to decode properly the Yaml
received and there was a bug with Csar content

Issue-ID: CLAMP-151
Change-Id: If42577b221c31b48a2b955e35bb3c1a957240611
Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
src/main/java/org/onap/clamp/clds/model/CldsModel.java
src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java
src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java

index b92ff5f..af4d6c6 100644 (file)
@@ -108,10 +108,11 @@ public class CldsModel {
     /**
      * Save model to DB.
      */
-    public void save(CldsDao cldsDao, String userid) {
-        cldsDao.setModel(this, userid);
+    public CldsModel save(CldsDao cldsDao, String userid) {
+        CldsModel cldsModel = cldsDao.setModel(this, userid);
         determineStatus();
         determinePermittedActionCd();
+        return cldsModel;
     }
 
     /**
index 87c9c15..8835438 100644 (file)
@@ -113,7 +113,7 @@ public class CsarHandler {
         for (IResourceInstance resource : this.sdcNotification.getResources()) {
             String filteredString = resource.getResourceInstanceName().replaceAll("-", "");
             filteredString = filteredString.replaceAll(" ", "");
-            if (filteredString.equals(blueprintResourceInstanceName)) {
+            if (filteredString.equalsIgnoreCase(blueprintResourceInstanceName)) {
                 return resource;
             }
         }
index 0498ca7..e28e8ab 100644 (file)
@@ -154,7 +154,7 @@ public class CsarInstallerImpl implements CsarInstaller {
         List<String> policyNameList = new ArrayList<>();
         Map<String, Object> templateNodes = ((Map<String, Object>) ((Map<String, Object>) yaml
                 .load(blueprintArtifact.getDcaeBlueprint())).get("node_templates"));
-        templateNodes.entrySet().stream().filter(e -> e.getKey().contains("policy_")).forEach(ef -> {
+        templateNodes.entrySet().stream().filter(e -> e.getKey().contains("policy")).forEach(ef -> {
             String filteredPolicyName = (String) ((Map<String, Object>) ((Map<String, Object>) ef.getValue())
                     .get("properties")).get("policy_filter");
             if (policyName != null) {
@@ -230,7 +230,7 @@ public class CsarInstallerImpl implements CsarInstaller {
                     + blueprintArtifact.getResourceAttached().getResourceInvariantUUID()
                     + "\"]},{\"name\":\"actionSet\",\"value\":[\"vnfRecipe\"]},{\"name\":\"location\",\"value\":[\"DC1\"]},"
                     + inputParams + "]}");
-            cldsModel.save(cldsDao, null);
+            cldsModel = cldsModel.save(cldsDao, null);
             logger.info("Fake Clds Model created for blueprint " + blueprintArtifact.getBlueprintArtifactName()
                     + " with name " + cldsModel.getName());
             return cldsModel;