Add logic for defautl network resource receipe 25/43725/1
authorsubhash kumar singh <subhash.kumar.singh@huawei.com>
Thu, 19 Apr 2018 11:19:35 +0000 (11:19 +0000)
committersubhash kumar singh <subhash.kumar.singh@huawei.com>
Thu, 19 Apr 2018 11:19:35 +0000 (11:19 +0000)
Add logic for defautl network resource receipe

Change-Id: Ib0f12d9d10fc5956c7448c525fbcc3217da23b96
Issue-ID: SO-422
Signed-off-by: subhash kumar singh <subhash.kumar.singh@huawei.com>
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java

index 27c94f0..4fb5ebc 100644 (file)
@@ -93,8 +93,8 @@ public class CatalogDatabase implements Closeable {
     private static final String MODEL_TYPE = "modelType";
     private static final String MODEL_VERSION_ID = "modelVersionId";
     private static final String MODEL_CUSTOMIZATION_UUID = "modelCustomizationUuid";
-       private static final String VF_MODULE_MODEL_UUID = "vfModuleModelUUId";
-       private static final String NETWORK_SERVICE = "network service";
+    private static final String VF_MODULE_MODEL_UUID = "vfModuleModelUUId";
+    private static final String NETWORK_SERVICE = "network service";
 
     protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
 
@@ -4469,7 +4469,7 @@ public class CatalogDatabase implements Closeable {
     /**
      * Return a Network recipe that matches a given MODEL_UUID and ACTION
      *
-     * @param modelName
+     * @param networkModelUuid
      * @param action
      * @return NetworkRecipe object or null if none found
      */
@@ -4484,7 +4484,17 @@ public class CatalogDatabase implements Closeable {
         }
         
         NetworkRecipe recipe = getNetworkRecipeByNameVersion(networkResource.getModelName(), networkResource.getModelVersion(), action);
-        return recipe;        
+
+        if (recipe == null) {
+            recipe = getDefaultNetworkReceipe(action);
+        }
+
+        return recipe;
+    }
+
+    private NetworkRecipe getDefaultNetworkReceipe(String action) {
+        String modelName = "SDNC_DEFAULT";
+        return getNetworkRecipe(modelName, action);
     }
     
     /**