diff --git a/src/main/java/org/onap/clamp/clds/dao/CldsDao.java b/src/main/java/org/onap/clamp/clds/dao/CldsDao.java
index a3771aa..bdb8e4b 100644
--- a/src/main/java/org/onap/clamp/clds/dao/CldsDao.java
+++ b/src/main/java/org/onap/clamp/clds/dao/CldsDao.java
@@ -18,7 +18,7 @@
  * limitations under the License.
  * ============LICENSE_END============================================
  * ===================================================================
- * 
+ *
  */
 
 package org.onap.clamp.clds.dao;
@@ -32,10 +32,13 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 import javax.sql.DataSource;
 
 import org.onap.clamp.clds.model.CldsDbServiceCache;
+import org.onap.clamp.clds.model.CldsDictionary;
+import org.onap.clamp.clds.model.CldsDictionaryItem;
 import org.onap.clamp.clds.model.CldsEvent;
 import org.onap.clamp.clds.model.CldsModel;
 import org.onap.clamp.clds.model.CldsModelInstance;
@@ -43,6 +46,9 @@
 import org.onap.clamp.clds.model.CldsMonitoringDetails;
 import org.onap.clamp.clds.model.CldsServiceData;
 import org.onap.clamp.clds.model.CldsTemplate;
+import org.onap.clamp.clds.model.CldsToscaModel;
+import org.onap.clamp.clds.model.CldsToscaModelDetails;
+import org.onap.clamp.clds.model.CldsToscaModelRevision;
 import org.onap.clamp.clds.model.ValueItem;
 import org.springframework.dao.EmptyResultDataAccessException;
 import org.springframework.jdbc.core.JdbcTemplate;
@@ -72,7 +78,13 @@
     private static final String HEALTHCHECK = "Select 1";
     private static final String V_CONTROL_NAME_PREFIX = "v_control_name_prefix";
     private static final String V_CONTROL_NAME_UUID = "v_control_name_uuid";
-   
+
+    private SimpleJdbcCall procInsertToscaModel;
+    private SimpleJdbcCall procInsertNewToscaModelVersion;
+    private SimpleJdbcCall procInsertDictionary;
+    private SimpleJdbcCall procInsertDictionaryElement;
+
+
     /**
      * Log message when instantiating
      */
@@ -95,6 +107,10 @@
         this.procInsModelInstance = new SimpleJdbcCall(dataSource).withProcedureName("ins_model_instance");
         this.procDelAllModelInstances = new SimpleJdbcCall(dataSource).withProcedureName("del_all_model_instances");
         this.procDeleteModel = new SimpleJdbcCall(dataSource).withProcedureName("del_model");
+        this.procInsertToscaModel = new SimpleJdbcCall(dataSource).withProcedureName("set_tosca_model");
+        this.procInsertNewToscaModelVersion = new SimpleJdbcCall(dataSource).withProcedureName("set_new_tosca_model_version");
+        this.procInsertDictionary = new SimpleJdbcCall(dataSource).withProcedureName("set_dictionary");
+        this.procInsertDictionaryElement = new SimpleJdbcCall(dataSource).withProcedureName("set_dictionary_elements");
     }
 
     /**
@@ -116,7 +132,7 @@
         CldsModel model = new CldsModel();
         model.setName(modelName);
         SqlParameterSource in = new MapSqlParameterSource().addValue("v_model_name", modelName)
-                .addValue(V_CONTROL_NAME_UUID, controlNameUuid);
+            .addValue(V_CONTROL_NAME_UUID, controlNameUuid);
         Map<String, Object> out = logSqlExecution(procGetModel, in);
         populateModelProperties(model, out);
         return model;
@@ -165,12 +181,12 @@
      */
     public CldsModel setModel(CldsModel model, String userid) {
         SqlParameterSource in = new MapSqlParameterSource().addValue("v_model_name", model.getName())
-                .addValue("v_template_id", model.getTemplateId()).addValue("v_user_id", userid)
-                .addValue("v_model_prop_text", model.getPropText())
-                .addValue("v_model_blueprint_text", model.getBlueprintText())
-                .addValue("v_service_type_id", model.getTypeId()).addValue("v_deployment_id", model.getDeploymentId())
-                .addValue("v_control_name_prefix", model.getControlNamePrefix())
-                .addValue(V_CONTROL_NAME_UUID, model.getControlNameUuid());
+            .addValue("v_template_id", model.getTemplateId()).addValue("v_user_id", userid)
+            .addValue("v_model_prop_text", model.getPropText())
+            .addValue("v_model_blueprint_text", model.getBlueprintText())
+            .addValue("v_service_type_id", model.getTypeId()).addValue("v_deployment_id", model.getDeploymentId())
+            .addValue("v_control_name_prefix", model.getControlNamePrefix())
+            .addValue(V_CONTROL_NAME_UUID, model.getControlNameUuid());
         Map<String, Object> out = logSqlExecution(procSetModel, in);
         model.setControlNamePrefix((String) out.get(V_CONTROL_NAME_PREFIX));
         model.setControlNameUuid((String) out.get(V_CONTROL_NAME_UUID));
@@ -203,9 +219,9 @@
                 logger.debug("v_vm_name={}", currModelInstance.getVmName());
                 logger.debug("v_location={}", currModelInstance.getLocation());
                 SqlParameterSource in = new MapSqlParameterSource()
-                        .addValue(V_CONTROL_NAME_UUID, model.getControlNameUuid())
-                        .addValue("v_vm_name", currModelInstance.getVmName())
-                        .addValue("v_location", currModelInstance.getLocation());
+                    .addValue(V_CONTROL_NAME_UUID, model.getControlNameUuid())
+                    .addValue("v_vm_name", currModelInstance.getVmName())
+                    .addValue("v_location", currModelInstance.getLocation());
                 Map<String, Object> out = logSqlExecution(procInsModelInstance, in);
                 model.setId((String) (out.get("v_model_id")));
                 CldsModelInstance modelInstance = new CldsModelInstance();
@@ -230,10 +246,10 @@
     public CldsEvent insEvent(String modelName, String controlNamePrefix, String controlNameUuid, CldsEvent cldsEvent) {
         CldsEvent event = new CldsEvent();
         SqlParameterSource in = new MapSqlParameterSource().addValue("v_model_name", modelName)
-                .addValue(V_CONTROL_NAME_PREFIX, controlNamePrefix).addValue(V_CONTROL_NAME_UUID, controlNameUuid)
-                .addValue("v_user_id", cldsEvent.getUserid()).addValue("v_action_cd", cldsEvent.getActionCd())
-                .addValue("v_action_state_cd", cldsEvent.getActionStateCd())
-                .addValue("v_process_instance_id", cldsEvent.getProcessInstanceId());
+            .addValue(V_CONTROL_NAME_PREFIX, controlNamePrefix).addValue(V_CONTROL_NAME_UUID, controlNameUuid)
+            .addValue("v_user_id", cldsEvent.getUserid()).addValue("v_action_cd", cldsEvent.getActionCd())
+            .addValue("v_action_state_cd", cldsEvent.getActionStateCd())
+            .addValue("v_process_instance_id", cldsEvent.getProcessInstanceId());
         Map<String, Object> out = logSqlExecution(procInsEvent, in);
         event.setId((String) (out.get("v_event_id")));
         return event;
@@ -253,7 +269,7 @@
      */
     public void updEvent(String eventId, String processInstanceId) {
         SqlParameterSource in = new MapSqlParameterSource().addValue("v_event_id", eventId)
-                .addValue("v_process_instance_id", processInstanceId);
+            .addValue("v_process_instance_id", processInstanceId);
         logSqlExecution(procUpdEvent, in);
     }
 
@@ -276,9 +292,9 @@
      */
     public void setTemplate(CldsTemplate template, String userid) {
         SqlParameterSource in = new MapSqlParameterSource().addValue("v_template_name", template.getName())
-                .addValue("v_user_id", userid).addValue("v_template_bpmn_text", template.getBpmnText())
-                .addValue("v_template_image_text", template.getImageText())
-                .addValue("v_template_doc_text", template.getPropText());
+            .addValue("v_user_id", userid).addValue("v_template_bpmn_text", template.getBpmnText())
+            .addValue("v_template_image_text", template.getImageText())
+            .addValue("v_template_doc_text", template.getPropText());
         Map<String, Object> out = logSqlExecution(procSetTemplate, in);
         template.setId((String) (out.get("v_template_id")));
         template.setBpmnUserid((String) (out.get("v_template_bpmn_user_id")));
@@ -333,10 +349,10 @@
         try {
             String getCldsServiceSQL = "SELECT * , TIMESTAMPDIFF(SECOND, timestamp, CURRENT_TIMESTAMP()) FROM clds_service_cache where invariant_service_id  = ? ";
             cldsServiceData = jdbcTemplateObject.queryForObject(getCldsServiceSQL, new Object[] { invariantUUID },
-                    new CldsServiceDataMapper());
+                new CldsServiceDataMapper());
             if (cldsServiceData != null) {
                 logger.info("CldsServiceData found in cache for Service Invariant ID:"
-                        + cldsServiceData.getServiceInvariantUUID());
+                    + cldsServiceData.getServiceInvariantUUID());
                 return cldsServiceData;
             } else {
                 logger.warn("CldsServiceData not found in cache for Service Invariant ID:" + invariantUUID);
@@ -351,13 +367,13 @@
 
     public void setCldsServiceCache(CldsDbServiceCache cldsDBServiceCache) {
         if (cldsDBServiceCache != null && cldsDBServiceCache.getInvariantId() != null
-                && cldsDBServiceCache.getServiceId() != null) {
+            && cldsDBServiceCache.getServiceId() != null) {
             String invariantUuid = cldsDBServiceCache.getInvariantId();
             String serviceUuid = cldsDBServiceCache.getServiceId();
             InputStream is = cldsDBServiceCache.getCldsDataInstream();
             String insertCldsServiceCacheSql = "INSERT INTO clds_service_cache"
-                    + "(invariant_service_id,service_id,timestamp,object_data) VALUES"
-                    + "(?,?,CURRENT_TIMESTAMP,?) ON DUPLICATE KEY UPDATE invariant_service_id = VALUES(invariant_service_id) , timestamp = CURRENT_TIMESTAMP , object_data = VALUES(object_data) ";
+                + "(invariant_service_id,service_id,timestamp,object_data) VALUES"
+                + "(?,?,CURRENT_TIMESTAMP,?) ON DUPLICATE KEY UPDATE invariant_service_id = VALUES(invariant_service_id) , timestamp = CURRENT_TIMESTAMP , object_data = VALUES(object_data) ";
             jdbcTemplateObject.update(insertCldsServiceCacheSql, invariantUuid, serviceUuid, is);
         }
     }
@@ -377,13 +393,13 @@
 
     /**
      * Method to get deployed/active models with model properties.
-     * 
+     *
      * @return list of CldsModelProp
      */
     public List<CldsModelProp> getDeployedModelProperties() {
         List<CldsModelProp> cldsModelPropList = new ArrayList<>();
         String modelsSql = "select m.model_id, m.model_name, mp.model_prop_id, mp.model_prop_text FROM model m, model_properties mp, event e "
-                + "WHERE m.model_prop_id = mp.model_prop_id and m.event_id = e.event_id and e.action_cd = 'DEPLOY'";
+            + "WHERE m.model_prop_id = mp.model_prop_id and m.event_id = e.event_id and e.action_cd = 'DEPLOY'";
         List<Map<String, Object>> rows = jdbcTemplateObject.queryForList(modelsSql);
         CldsModelProp cldsModelProp = null;
         for (Map<String, Object> row : rows) {
@@ -399,7 +415,7 @@
 
     /**
      * Method to get deployed/active models with model properties.
-     * 
+     *
      * @return list of CLDS-Monitoring-Details: CLOSELOOP_NAME | Close loop name
      *         used in the CLDS application (prefix: ClosedLoop- + unique
      *         ClosedLoop ID) MODEL_NAME | Model Name in CLDS application
@@ -414,8 +430,8 @@
         SimpleDateFormat sdf = new SimpleDateFormat("MM-dd-yyyy HH:mm:ss");
         List<CldsMonitoringDetails> cldsMonitoringDetailsList = new ArrayList<CldsMonitoringDetails>();
         String modelsSql = "SELECT CONCAT(M.CONTROL_NAME_PREFIX, M.CONTROL_NAME_UUID) AS CLOSELOOP_NAME , M.MODEL_NAME, M.SERVICE_TYPE_ID, M.DEPLOYMENT_ID, T.TEMPLATE_NAME, E.ACTION_CD, E.USER_ID, E.TIMESTAMP "
-                + "FROM MODEL M, TEMPLATE T, EVENT E "
-                + "WHERE M.TEMPLATE_ID = T.TEMPLATE_ID AND M.EVENT_ID = E.EVENT_ID " + "ORDER BY ACTION_CD";
+            + "FROM MODEL M, TEMPLATE T, EVENT E "
+            + "WHERE M.TEMPLATE_ID = T.TEMPLATE_ID AND M.EVENT_ID = E.EVENT_ID " + "ORDER BY ACTION_CD";
         List<Map<String, Object>> rows = jdbcTemplateObject.queryForList(modelsSql);
         CldsMonitoringDetails cldsMonitoringDetails = null;
         for (Map<String, Object> row : rows) {
@@ -435,14 +451,14 @@
 
     /**
      * Method to delete model from database.
-     * 
+     *
      * @param modelName
      */
     public void deleteModel(String modelName) {
         SqlParameterSource in = new MapSqlParameterSource().addValue("v_model_name", modelName);
         logSqlExecution(procDeleteModel, in);
     }
-    
+
     private void populateModelProperties(CldsModel model, Map out) {
         // todo : rationalize
         model.setControlNamePrefix((String) out.get(V_CONTROL_NAME_PREFIX));
@@ -461,6 +477,317 @@
         model.getEvent().setProcessInstanceId((String) out.get("v_event_process_instance_id"));
         model.getEvent().setUserid((String) out.get("v_event_user_id"));
         model.setTypeId((String) out.get("v_service_type_id"));
-        model.setDeploymentId((String) out.get("v_deployment_id"));        	
-    }    
+        model.setDeploymentId((String) out.get("v_deployment_id"));
+    }
+
+
+    /**
+     * Method to retrieve a tosca models by Policy Type from database.
+
+     * @param policyType
+     * @return  List of CldsToscaModel
+     */
+    public List<CldsToscaModel> getAllToscaModels() {
+        return getToscaModel(null, null);
+    }
+
+    /**
+     * Method to retrieve a tosca models by Policy Type from database.
+
+     * @param policyType
+     * @return  List of CldsToscaModel
+     */
+    public List<CldsToscaModel> getToscaModelByPolicyType(String policyType) {
+        return getToscaModel(null, policyType);
+    }
+
+    /**
+     * Method to retrieve a tosca models by toscaModelName, version from database.
+     *
+     * @param policyType
+     * @return List of CldsToscaModel
+     */
+    public List<CldsToscaModel> getToscaModelByName(String toscaModelName) {
+        return getToscaModel(toscaModelName, null);
+    }
+
+    // Retrieve the latest tosca model for a policy type or by tosca model name
+
+    private List<CldsToscaModel> getToscaModel(String toscaModelName, String policyType) {
+        SimpleDateFormat sdf = new SimpleDateFormat("MM-dd-yyyy HH:mm:ss");
+        List<CldsToscaModel> cldsToscaModels = new ArrayList<>();
+
+        String toscaModelSql = "SELECT tm.tosca_model_name, tm.tosca_model_id, tm.policy_type, tmr.tosca_model_revision_id, tmr.version, tmr.user_id, tmr.createdTimestamp, tmr.lastUpdatedTimestamp "
+            + ((toscaModelName != null) ? (", tmr.tosca_model_yaml ") : " ")
+            + "FROM tosca_model tm, tosca_model_revision tmr WHERE tm.tosca_model_id = tmr.tosca_model_id "
+            + ((toscaModelName != null) ? (" AND tm.tosca_model_name = '" + toscaModelName + "'") : " ")
+            + ((policyType != null) ? (" AND tm.policy_type = '" + policyType + "'") : " ")
+            + "AND tmr.version = (select max(version) from tosca_model_revision st where tmr.tosca_model_id=st.tosca_model_id)";
+
+        List<Map<String, Object>> rows = jdbcTemplateObject.queryForList(toscaModelSql);
+
+        if (rows != null && rows.size() > 0) {
+
+            rows.stream().forEach(row -> {
+                CldsToscaModel cldsToscaModel = new CldsToscaModel();
+                cldsToscaModel.setId((String) row.get("tosca_model_id"));
+                cldsToscaModel.setPolicyType((String) row.get("policy_type"));
+                cldsToscaModel.setToscaModelName((String) row.get("tosca_model_name"));
+                cldsToscaModel.setUserId((String) row.get("user_id"));
+                cldsToscaModel.setRevisionId((String) row.get("tosca_model_revision_id"));
+                cldsToscaModel.setVersion(((Double) row.get("version")));
+                cldsToscaModel.setCreatedDate(sdf.format(row.get("createdTimestamp")));
+                cldsToscaModel.setLastUpdatedDate(sdf.format(row.get("lastUpdatedTimestamp")));
+                if (toscaModelName != null) {
+                    cldsToscaModel.setToscaModelYaml((String) row.get("tosca_model_yaml"));
+                }
+                cldsToscaModels.add(cldsToscaModel);
+            });
+
+        }
+        return cldsToscaModels;
+    }
+
+    // Retrieve Tosca Models & its revisions by policy Type.
+    private List<CldsToscaModelDetails> getAllToscaModelVersion(String toscaModelName, String policyType,
+        String version) {
+        SimpleDateFormat sdf = new SimpleDateFormat("MM-dd-yyyy HH:mm:ss");
+        List<CldsToscaModelDetails> cldsToscaModelDetailsList = new ArrayList<>();
+        String toscaModelSql = "SELECT tm.tosca_model_name, tm.tosca_model_id, tm.policy_type, tmr.tosca_model_revision_id, tmr.version, tmr.user_id, tmr.createdTimestamp, tmr.lastUpdatedTimestamp "
+            + "FROM tosca_model tm, tosca_model_revision tmr " + "WHERE tmr.tosca_model_id = tm.tosca_model_id "
+            + ((policyType != null) ? (" AND tm.policy_type = '" + policyType + "'") : " ")
+            + ((toscaModelName != null) ? (" AND tm.tosca_model_name = '" + toscaModelName + "'") : " ")
+            + ((version != null) ? (" AND tmr.version = '" + version + "'") : "");
+
+        List<Map<String, Object>> rows = jdbcTemplateObject.queryForList(toscaModelSql);
+
+        if (rows != null && rows.size() > 0) {
+            // Get list of all available modelIds
+            List<String> listofModelIds = new ArrayList<>();
+            for (Map<String, Object> r : rows) {
+                if (r != null) {
+                    listofModelIds.add((String) r.get("tosca_model_id"));
+                }
+            }
+            // Filter Distinct elements using streams
+            listofModelIds = listofModelIds.stream().distinct().collect(Collectors.toList());
+
+            // TODO change logic using java8
+            for (String modelId : listofModelIds) {
+                CldsToscaModelDetails cldsToscaModelDetails = new CldsToscaModelDetails();
+                List<CldsToscaModelRevision> revisions = new ArrayList<>();
+                for (Map<String, Object> row : rows) {
+                    String id = (String) row.get("tosca_model_id");
+                    if (modelId.equalsIgnoreCase(id)) {
+                        cldsToscaModelDetails.setId(id);
+                        cldsToscaModelDetails.setPolicyType((String) row.get("policy_type"));
+                        cldsToscaModelDetails.setToscaModelName((String) row.get("tosca_model_name"));
+                        cldsToscaModelDetails.setUserId((String) row.get("user_id"));
+
+                        CldsToscaModelRevision modelRevision = new CldsToscaModelRevision();
+                        modelRevision.setRevisionId((String) row.get("tosca_model_revision_id"));
+                        modelRevision.setVersion(((Double) row.get("version")));
+                        modelRevision.setUserId((String) row.get("user_id"));
+                        modelRevision.setCreatedDate(sdf.format(row.get("createdTimestamp")));
+                        modelRevision.setLastUpdatedDate(sdf.format(row.get("lastUpdatedTimestamp")));
+                        revisions.add(modelRevision);
+                    }
+                }
+                cldsToscaModelDetails.setToscaModelRevisions(revisions);
+                cldsToscaModelDetailsList.add(cldsToscaModelDetails);
+            }
+        }
+        return cldsToscaModelDetailsList;
+    }
+
+
+    /**
+     *  Method to upload a new version of Tosca Model Yaml in Database
+     *
+     * @param cldsToscaModel
+     * @param userId
+     * @return CldsToscaModel
+     *
+     */
+    public CldsToscaModel updateToscaModelWithNewVersion(CldsToscaModel cldsToscaModel, String userId) {
+        SqlParameterSource in = new MapSqlParameterSource().addValue("v_tosca_model_id", cldsToscaModel.getId())
+            .addValue("v_version", cldsToscaModel.getVersion())
+            .addValue("v_tosca_model_yaml", cldsToscaModel.getToscaModelYaml())
+            .addValue("v_tosca_model_json", cldsToscaModel.getToscaModelJson()).addValue("v_user_id", userId);
+        Map<String, Object> out = logSqlExecution(procInsertNewToscaModelVersion, in);
+        cldsToscaModel.setRevisionId((String) (out.get("v_revision_id")));
+        return cldsToscaModel;
+    }
+
+
+    /**
+     *  Method to upload a new Tosca model Yaml in DB. Default version is 1.0
+     *
+     * @param cldsToscaModel
+     * @param userId
+     * @return CldsToscaModel
+     */
+    public CldsToscaModel insToscaModel(CldsToscaModel cldsToscaModel, String userId) {
+        SqlParameterSource in = new MapSqlParameterSource()
+            .addValue("v_tosca_model_name", cldsToscaModel.getToscaModelName())
+            .addValue("v_policy_type", cldsToscaModel.getPolicyType())
+            .addValue("v_tosca_model_yaml", cldsToscaModel.getToscaModelYaml())
+            .addValue("v_tosca_model_json", cldsToscaModel.getToscaModelJson())
+            .addValue("v_version", cldsToscaModel.getVersion()).addValue("v_user_id", userId);
+        Map<String, Object> out = logSqlExecution(procInsertToscaModel, in);
+        cldsToscaModel.setId((String) (out.get("v_tosca_model_id")));
+        cldsToscaModel.setRevisionId((String) (out.get("v_revision_id")));
+        cldsToscaModel.setUserId((String) out.get("v_user_id"));
+        return cldsToscaModel;
+    }
+
+    /**
+     * Method to insert a new Dictionary in Database
+     *
+     * @param cldsDictionary
+     */
+    public void insDictionary(CldsDictionary cldsDictionary) {
+        SqlParameterSource in = new MapSqlParameterSource()
+            .addValue("v_dictionary_name", cldsDictionary.getDictionaryName())
+            .addValue("v_user_id", cldsDictionary.getCreatedBy());
+        Map<String, Object> out = logSqlExecution(procInsertDictionary, in);
+        cldsDictionary.setDictionaryId((String) (out.get("v_dictionary_id")));
+    }
+
+
+    /**
+     * Method to update Dictionary with new info in Database
+     *
+     * @param dictionaryId
+     * @param cldsDictionary
+     * @param userId
+     */
+    public void updateDictionary(String dictionaryId, CldsDictionary cldsDictionary, String userId) {
+
+        String dictionarySql = "UPDATE dictionary " + "SET dictionary_name = '" + cldsDictionary.getDictionaryName()
+        + "', modified_by = '" + userId + "'" + "WHERE dictionary_id = '" + dictionaryId + "'";
+        jdbcTemplateObject.update(dictionarySql);
+        cldsDictionary.setUpdatedBy(userId);
+    }
+
+
+    /**
+     * Method to get list of Dictionaries from the Database
+     *
+     * @param dictionaryId
+     * @param dictionaryName
+     * @return
+     */
+    public List<CldsDictionary> getDictionary(String dictionaryId, String dictionaryName) {
+        SimpleDateFormat sdf = new SimpleDateFormat("MM-dd-yyyy HH:mm:ss");
+        List<CldsDictionary> dictionaries = new ArrayList<>();
+        String dictionarySql = "SELECT dictionary_id, dictionary_name, created_by, modified_by, timestamp FROM dictionary"
+            + ((dictionaryId != null || dictionaryName != null)
+                ? (" WHERE " + ((dictionaryName != null) ? ("dictionary_name = '" + dictionaryName + "'") : "")
+                    + ((dictionaryId != null && dictionaryName != null) ? (" AND ") : "")
+                    + ((dictionaryId != null) ? ("dictionary_id = '" + dictionaryId + "'") : "")): "");
+
+        List<Map<String, Object>> rows = jdbcTemplateObject.queryForList(dictionarySql);
+
+        if (rows != null && rows.size() > 0) {
+            rows.stream().forEach(row -> {
+                CldsDictionary cldsDictionary = new CldsDictionary();
+                cldsDictionary.setDictionaryId((String) row.get("dictionary_id"));
+                cldsDictionary.setDictionaryName((String) row.get("dictionary_name"));
+                cldsDictionary.setCreatedBy((String) row.get("created_by"));
+                cldsDictionary.setUpdatedBy((String) row.get("modified_by"));
+                cldsDictionary.setLastUpdatedDate(sdf.format(row.get("timestamp")));
+                dictionaries.add(cldsDictionary);
+            });
+        }
+        return dictionaries;
+    }
+
+    /**
+     * Method to insert a new Dictionary Element for given dictionary in Database
+     *
+     * @param cldsDictionaryItem
+     * @param userId
+     */
+    public void insDictionarElements(CldsDictionaryItem cldsDictionaryItem, String userId) {
+        SqlParameterSource in = new MapSqlParameterSource()
+            .addValue("v_dictionary_id", cldsDictionaryItem.getDictionaryId())
+            .addValue("v_dict_element_name", cldsDictionaryItem.getDictElementName())
+            .addValue("v_dict_element_short_name", cldsDictionaryItem.getDictElementShortName())
+            .addValue("v_dict_element_description", cldsDictionaryItem.getDictElementDesc())
+            .addValue("v_dict_element_type", cldsDictionaryItem.getDictElementType())
+            .addValue("v_user_id", userId);
+        Map<String, Object> out = logSqlExecution(procInsertDictionaryElement, in);
+        cldsDictionaryItem.setDictElementId((String) (out.get("v_dict_element_id")));
+    }
+
+
+    /**
+     * Method to update Dictionary Elements with new info for a given dictionary in Database
+     *
+     * @param dictionaryElementId
+     * @param cldsDictionaryItem
+     * @param userId
+     */
+    public void updateDictionaryElements(String dictionaryElementId, CldsDictionaryItem cldsDictionaryItem, String userId) {
+
+        String dictionarySql = "UPDATE dictionary_elements SET dict_element_name = '"
+            + cldsDictionaryItem.getDictElementName() + "', dict_element_short_name = '"
+            + cldsDictionaryItem.getDictElementShortName() + "', dict_element_description= '"
+            + cldsDictionaryItem.getDictElementDesc() + "', dict_element_type = '"
+            + cldsDictionaryItem.getDictElementType() + "', modified_by = '" + userId + "' "
+            + "WHERE dict_element_id = '" + dictionaryElementId + "'";
+        jdbcTemplateObject.update(dictionarySql);
+        cldsDictionaryItem.setUpdatedBy(userId);
+    }
+
+    /**
+     * Method to get list of all dictionary elements for a given dictionary in the Database
+     *
+     * @param dictionaryName
+     * @param dictionaryId
+     * @param dictElementShortName
+     * @return
+     */
+    public List<CldsDictionaryItem> getDictionaryElements(String dictionaryName, String dictionaryId,
+        String dictElementShortName) {
+        SimpleDateFormat sdf = new SimpleDateFormat("MM-dd-yyyy HH:mm:ss");
+        List<CldsDictionaryItem> dictionaryItems = new ArrayList<>();
+        String dictionarySql = "SELECT de.dict_element_id, de.dictionary_id, de.dict_element_name, de.dict_element_short_name, de.dict_element_description, de.dict_element_type, de.created_by, de.modified_by, de.timestamp  "
+            + "FROM dictionary_elements de, dictionary d WHERE de.dictionary_id = d.dictionary_id "
+            + ((dictionaryId != null) ? (" AND d.dictionary_id = '" + dictionaryId + "'") : "")
+            + ((dictElementShortName != null) ? (" AND de.dict_element_short_name = '" + dictElementShortName + "'"): "")
+            + ((dictionaryName != null) ? (" AND dictionary_name = '" + dictionaryName + "'") : "");
+
+        List<Map<String, Object>> rows = jdbcTemplateObject.queryForList(dictionarySql);
+
+        if (rows != null && rows.size() > 0) {
+            rows.stream().forEach(row -> {
+                CldsDictionaryItem dictionaryItem = new CldsDictionaryItem();
+                dictionaryItem.setDictElementId((String) row.get("dict_element_id"));
+                dictionaryItem.setDictionaryId((String) row.get("dictionary_id"));
+                dictionaryItem.setDictElementName((String) row.get("dict_element_name"));
+                dictionaryItem.setDictElementShortName((String) row.get("dict_element_short_name"));
+                dictionaryItem.setDictElementDesc((String) row.get("dict_element_description"));
+                dictionaryItem.setDictElementType((String) row.get("dict_element_type"));
+                dictionaryItem.setCreatedBy((String) row.get("created_by"));
+                dictionaryItem.setUpdatedBy((String) row.get("modified_by"));
+                dictionaryItem.setLastUpdatedDate(sdf.format(row.get("timestamp")));
+                dictionaryItems.add(dictionaryItem);
+            });
+        }
+        return dictionaryItems;
+    }
+
+    /**
+     * Method to delete a tosca model from database.
+     *
+     * @param toscaModelId
+     * @param revisionId
+     */
+    /*public void deleteModel(String toscaModelId, String revisionId) {
+        SqlParameterSource in = new MapSqlParameterSource().addValue("v_tosca_model_id", toscaModelId)
+        		.addValue("v_revision_id", revisionId);
+        logSqlExecution(procDelToscaModel, in);
+    }*/
 }
diff --git a/src/main/java/org/onap/clamp/clds/model/CldsDictionary.java b/src/main/java/org/onap/clamp/clds/model/CldsDictionary.java
new file mode 100644
index 0000000..a9b003d
--- /dev/null
+++ b/src/main/java/org/onap/clamp/clds/model/CldsDictionary.java
@@ -0,0 +1,164 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.clds.model;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.onap.clamp.clds.dao.CldsDao;
+
+/**
+ * Represents a CLDS Dictionary.
+ */
+@JsonInclude(Include.NON_NULL)
+public class CldsDictionary {
+
+    private String dictionaryId;
+    private String dictionaryName;
+    private String createdBy;
+    private String updatedBy;
+    private String lastUpdatedDate;
+    private List<CldsDictionaryItem> cldsDictionaryItems = new ArrayList<>();
+
+    /**
+     * Creates or updates dictionary item for a dictionary in DB
+     *
+     * @param dictionaryName
+     * @param cldsDao
+     * @param userId
+     */
+    public void save(String dictionaryName, CldsDao cldsDao, String userId) {
+        List<CldsDictionary> list = cldsDao.getDictionary(this.getDictionaryId(), dictionaryName);
+        if (list != null && !list.isEmpty()) {
+            CldsDictionary cldsDictionary = list.stream().findFirst().get();
+            if (!cldsDictionary.getDictionaryName().equalsIgnoreCase(this.getDictionaryName())) {
+                cldsDao.updateDictionary(cldsDictionary.getDictionaryId(), this, userId);
+                this.setCreatedBy(cldsDictionary.getCreatedBy());
+            } else {
+                this.setDictionaryId(cldsDictionary.getDictionaryId());
+                this.setCreatedBy(cldsDictionary.getCreatedBy());
+                this.setUpdatedBy(cldsDictionary.getUpdatedBy());
+                this.setLastUpdatedDate(cldsDictionary.getLastUpdatedDate());
+            }
+        } else {
+            this.setCreatedBy(userId);
+            this.setUpdatedBy(userId);
+            cldsDao.insDictionary(this);
+        }
+    }
+
+    /**
+     * @return the dictionaryId
+     */
+    public String getDictionaryId() {
+        return dictionaryId;
+    }
+
+    /**
+     * @param dictionaryId
+     *        the dictionaryId to set
+     */
+    public void setDictionaryId(String dictionaryId) {
+        this.dictionaryId = dictionaryId;
+    }
+
+    /**
+     * @return the dictionaryName
+     */
+    public String getDictionaryName() {
+        return dictionaryName;
+    }
+
+    /**
+     * @param dictionaryName
+     *        the dictionaryName to set
+     */
+    public void setDictionaryName(String dictionaryName) {
+        this.dictionaryName = dictionaryName;
+    }
+
+    /**
+     * @return the createdBy
+     */
+    public String getCreatedBy() {
+        return createdBy;
+    }
+
+    /**
+     * @param createdBy
+     *        the createdBy to set
+     */
+    public void setCreatedBy(String createdBy) {
+        this.createdBy = createdBy;
+    }
+
+    /**
+     * @return the updatedBy
+     */
+    public String getUpdatedBy() {
+        return updatedBy;
+    }
+
+    /**
+     * @param updatedby
+     *        the updatedBy to set
+     */
+    public void setUpdatedBy(String updatedby) {
+        updatedBy = updatedby;
+    }
+
+    /**
+     * @return the lastUpdatedDate
+     */
+    public String getLastUpdatedDate() {
+        return lastUpdatedDate;
+    }
+
+    /**
+     * @param lastUpdatedDate
+     *        the lastUpdatedDate to set
+     */
+    public void setLastUpdatedDate(String lastUpdatedDate) {
+        this.lastUpdatedDate = lastUpdatedDate;
+    }
+
+    /**
+     * @return the cldsDictionaryItems
+     */
+    public List<CldsDictionaryItem> getCldsDictionaryItems() {
+        return cldsDictionaryItems;
+    }
+
+    /**
+     * @param cldsDictionaryItems
+     *        the cldsDictionaryItems to set
+     */
+    public void setCldsDictionaryItems(List<CldsDictionaryItem> cldsDictionaryItems) {
+        this.cldsDictionaryItems = cldsDictionaryItems;
+    }
+
+}
diff --git a/src/main/java/org/onap/clamp/clds/model/CldsDictionaryItem.java b/src/main/java/org/onap/clamp/clds/model/CldsDictionaryItem.java
new file mode 100644
index 0000000..87ba9fe
--- /dev/null
+++ b/src/main/java/org/onap/clamp/clds/model/CldsDictionaryItem.java
@@ -0,0 +1,205 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.clds.model;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+import java.util.List;
+
+import org.onap.clamp.clds.dao.CldsDao;
+
+/**
+ * Represents a CLDS Dictionary Item.
+ */
+@JsonInclude(Include.NON_NULL)
+public class CldsDictionaryItem {
+
+    private String dictElementId;
+    private String dictionaryId;
+    private String dictElementName;
+    private String dictElementShortName;
+    private String dictElementDesc;
+    private String dictElementType;
+    private String createdBy;
+    private String updatedBy;
+    private String lastUpdatedDate;
+
+    public void save(String dictionaryName, CldsDao cldsDao, String userId) {
+        // Check if dictionary exists.
+        List<CldsDictionary> list = cldsDao.getDictionary(this.getDictionaryId(), dictionaryName);
+        if (list != null && !list.isEmpty()) {
+            // Dictionary found. We can add or update the dictionary element
+            CldsDictionary cldsDictionary = list.stream().findFirst().get();
+            List<CldsDictionaryItem> dictionaryItems = cldsDao.getDictionaryElements(dictionaryName,
+                cldsDictionary.getDictionaryId(), this.getDictElementShortName());
+            if (dictionaryItems != null && !dictionaryItems.isEmpty()) {
+                CldsDictionaryItem item = dictionaryItems.stream().findFirst().get();
+                cldsDao.updateDictionaryElements(item.getDictElementId(), this, userId);
+                this.setCreatedBy(item.getCreatedBy());
+
+            } else {
+                this.setCreatedBy(userId);
+                this.setUpdatedBy(userId);
+                cldsDao.insDictionarElements(this, userId);
+            }
+        }
+    }
+
+    /**
+     * @return the dictElementId
+     */
+    public String getDictElementId() {
+        return dictElementId;
+    }
+
+    /**
+     * @param dictElementId
+     *        the dictElementId to set
+     */
+    public void setDictElementId(String dictElementId) {
+        this.dictElementId = dictElementId;
+    }
+
+    /**
+     * @return the dictionaryId
+     */
+    public String getDictionaryId() {
+        return dictionaryId;
+    }
+
+    /**
+     * @param dictionaryId
+     *        the dictionaryId to set
+     */
+    public void setDictionaryId(String dictionaryId) {
+        this.dictionaryId = dictionaryId;
+    }
+
+    /**
+     * @return the dictElementName
+     */
+    public String getDictElementName() {
+        return dictElementName;
+    }
+
+    /**
+     * @param dictElementName
+     *        the dictElementName to set
+     */
+    public void setDictElementName(String dictElementName) {
+        this.dictElementName = dictElementName;
+    }
+
+    /**
+     * @return the dictElementShortName
+     */
+    public String getDictElementShortName() {
+        return dictElementShortName;
+    }
+
+    /**
+     * @param dictElementShortName
+     *        the dictElementShortName to set
+     */
+    public void setDictElementShortName(String dictElementShortName) {
+        this.dictElementShortName = dictElementShortName;
+    }
+
+    /**
+     * @return the dictElementDesc
+     */
+    public String getDictElementDesc() {
+        return dictElementDesc;
+    }
+
+    /**
+     * @param dictElementDesc
+     *        the dictElementDesc to set
+     */
+    public void setDictElementDesc(String dictElementDesc) {
+        this.dictElementDesc = dictElementDesc;
+    }
+
+    /**
+     * @return the dictElementType
+     */
+    public String getDictElementType() {
+        return dictElementType;
+    }
+
+    /**
+     * @param dictElementType
+     *        the dictElementType to set
+     */
+    public void setDictElementType(String dictElementType) {
+        this.dictElementType = dictElementType;
+    }
+
+    /**
+     * @return the createdBy
+     */
+    public String getCreatedBy() {
+        return createdBy;
+    }
+
+    /**
+     * @param createdBy
+     *        the createdBy to set
+     */
+    public void setCreatedBy(String createdBy) {
+        this.createdBy = createdBy;
+    }
+
+    /**
+     * @return the updatedBy
+     */
+    public String getUpdatedBy() {
+        return updatedBy;
+    }
+
+    /**
+     * @param updatedby
+     *        the updatedBy to set
+     */
+    public void setUpdatedBy(String updatedby) {
+        updatedBy = updatedby;
+    }
+
+    /**
+     * @return the lastUpdatedDate
+     */
+    public String getLastUpdatedDate() {
+        return lastUpdatedDate;
+    }
+
+    /**
+     * @param lastUpdatedDate
+     *        the lastUpdatedDate to set
+     */
+    public void setLastUpdatedDate(String lastUpdatedDate) {
+        this.lastUpdatedDate = lastUpdatedDate;
+    }
+
+}
diff --git a/src/main/java/org/onap/clamp/clds/model/CldsEvent.java b/src/main/java/org/onap/clamp/clds/model/CldsEvent.java
index 0867b96..8d3807b 100644
--- a/src/main/java/org/onap/clamp/clds/model/CldsEvent.java
+++ b/src/main/java/org/onap/clamp/clds/model/CldsEvent.java
@@ -29,37 +29,38 @@
  * Represent a CLDS Event.
  */
 public class CldsEvent {
-    public static final String ACTION_TEST            = "TEST";
-    public static final String ACTION_CREATE          = "CREATE";
-    public static final String ACTION_MODIFY          = "MODIFY";
-    public static final String ACTION_SUBMIT          = "SUBMIT";
+    public static final String ACTION_TEST = "TEST";
+    public static final String ACTION_CREATE = "CREATE";
+    public static final String ACTION_MODIFY = "MODIFY";
+    public static final String ACTION_SUBMIT = "SUBMIT";
     // an update before model is active
-    public static final String ACTION_RESUBMIT        = "RESUBMIT";
+    public static final String ACTION_RESUBMIT = "RESUBMIT";
     // For simplified models
-    public static final String ACTION_SUBMITDCAE      = "SUBMITDCAE";
+    public static final String ACTION_SUBMITDCAE = "SUBMITDCAE";
+    public static final String ACTION_SUBMITPOLICY = "SUBMITPOLICY";
     // only from dcae
-    public static final String ACTION_DISTRIBUTE      = "DISTRIBUTE";
+    public static final String ACTION_DISTRIBUTE = "DISTRIBUTE";
     // only from dcae
-    public static final String ACTION_DEPLOY          = "DEPLOY";
+    public static final String ACTION_DEPLOY = "DEPLOY";
     // only from dcae
-    public static final String ACTION_UNDEPLOY        = "UNDEPLOY";
-    public static final String ACTION_UPDATE          = "UPDATE";
-    public static final String ACTION_DELETE          = "DELETE";
-    public static final String ACTION_STOP            = "STOP";
-    public static final String ACTION_RESTART         = "RESTART";
+    public static final String ACTION_UNDEPLOY = "UNDEPLOY";
+    public static final String ACTION_UPDATE = "UPDATE";
+    public static final String ACTION_DELETE = "DELETE";
+    public static final String ACTION_STOP = "STOP";
+    public static final String ACTION_RESTART = "RESTART";
 
     public static final String ACTION_STATE_INITIATED = "INITIATED";
-    public static final String ACTION_STATE_SENT      = "SENT";
+    public static final String ACTION_STATE_SENT = "SENT";
     public static final String ACTION_STATE_COMPLETED = "COMPLETED";
-    public static final String ACTION_STATE_RECEIVED  = "RECEIVED";
-    public static final String ACTION_STATE_ERROR     = "ERROR";
-    public static final String ACTION_STATE_ANY       = null;
+    public static final String ACTION_STATE_RECEIVED = "RECEIVED";
+    public static final String ACTION_STATE_ERROR = "ERROR";
+    public static final String ACTION_STATE_ANY = null;
 
-    private String             id;
-    private String             actionCd;
-    private String             actionStateCd;
-    private String             processInstanceId;
-    private String             userid;
+    private String id;
+    private String actionCd;
+    private String actionStateCd;
+    private String processInstanceId;
+    private String userid;
 
     public String getId() {
         return id;
diff --git a/src/main/java/org/onap/clamp/clds/model/CldsInfo.java b/src/main/java/org/onap/clamp/clds/model/CldsInfo.java
index 382d4e8..a24885f 100644
--- a/src/main/java/org/onap/clamp/clds/model/CldsInfo.java
+++ b/src/main/java/org/onap/clamp/clds/model/CldsInfo.java
@@ -25,12 +25,14 @@
 
 public class CldsInfo {
 
-    private String  userName;
-    private String  cldsVersion;
+    private String userName;
+    private String cldsVersion;
     private boolean permissionReadCl;
     private boolean permissionUpdateCl;
     private boolean permissionReadTemplate;
     private boolean permissionUpdateTemplate;
+    private boolean permissionReadTosca;
+    private boolean permissionUpdateTosca;
 
     public String getUserName() {
         return userName;
@@ -80,4 +82,20 @@
         this.permissionUpdateTemplate = permissionUpdateTemplate;
     }
 
+    public boolean isPermissionReadTosca() {
+        return permissionReadTosca;
+    }
+
+    public void setPermissionReadTosca(boolean permissionReadTosca) {
+        this.permissionReadTosca = permissionReadTosca;
+    }
+
+    public boolean isPermissionUpdateTosca() {
+        return permissionUpdateTosca;
+    }
+
+    public void setPermissionUpdateTosca(boolean permissionUpdateTosca) {
+        this.permissionUpdateTosca = permissionUpdateTosca;
+    }
+
 }
diff --git a/src/main/java/org/onap/clamp/clds/model/CldsModel.java b/src/main/java/org/onap/clamp/clds/model/CldsModel.java
index 8b23995..55f4dfd 100644
--- a/src/main/java/org/onap/clamp/clds/model/CldsModel.java
+++ b/src/main/java/org/onap/clamp/clds/model/CldsModel.java
@@ -139,7 +139,8 @@
         } else if (event.isActionAndStateCd(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_STATE_RECEIVED)
                 || event.isActionAndStateCd(CldsEvent.ACTION_RESTART, CldsEvent.ACTION_STATE_ANY)
                 || event.isActionAndStateCd(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STATE_ANY)
-                || event.isActionAndStateCd(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_STATE_ANY)) {
+                || event.isActionAndStateCd(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_STATE_ANY)
+                || event.isActionAndStateCd(CldsEvent.ACTION_SUBMITPOLICY, CldsEvent.ACTION_STATE_ANY)) {
             status = STATUS_ACTIVE;
         } else if (event.isActionAndStateCd(CldsEvent.ACTION_STOP, CldsEvent.ACTION_STATE_ANY)) {
             status = STATUS_STOPPED;
@@ -185,14 +186,15 @@
                 permittedActionCd = Arrays.asList(CldsEvent.ACTION_SUBMIT, CldsEvent.ACTION_TEST,
                         CldsEvent.ACTION_DELETE);
                 if (isSimplifiedModel()) {
-                    permittedActionCd = Arrays.asList(CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_TEST,
-                            CldsEvent.ACTION_DELETE);
+                    permittedActionCd = Arrays.asList(CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_SUBMITPOLICY,
+                            CldsEvent.ACTION_TEST, CldsEvent.ACTION_DELETE);
                 }
                 break;
             case CldsEvent.ACTION_MODIFY:
                 permittedActionCd = Arrays.asList(CldsEvent.ACTION_RESUBMIT, CldsEvent.ACTION_DELETE);
                 if (isSimplifiedModel()) {
-                    permittedActionCd = Arrays.asList(CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_DELETE);
+                    permittedActionCd = Arrays.asList(CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_SUBMITPOLICY,
+                            CldsEvent.ACTION_DELETE);
                 }
                 break;
             case CldsEvent.ACTION_SUBMIT:
@@ -202,6 +204,9 @@
             case CldsEvent.ACTION_SUBMITDCAE:
                 permittedActionCd = Arrays.asList(CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_DELETE);
                 break;
+            case CldsEvent.ACTION_SUBMITPOLICY:
+                permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP);
+                break;
             case CldsEvent.ACTION_DISTRIBUTE:
                 permittedActionCd = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_RESUBMIT,
                         CldsEvent.ACTION_DELETE);
@@ -226,10 +231,17 @@
             case CldsEvent.ACTION_UPDATE:
                 permittedActionCd = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_UPDATE,
                         CldsEvent.ACTION_STOP, CldsEvent.ACTION_UNDEPLOY);
+                if (isPolicyOnly()) {
+                    permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP);
+                }
                 break;
             case CldsEvent.ACTION_STOP:
                 permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_RESTART,
                         CldsEvent.ACTION_UNDEPLOY);
+                if (isPolicyOnly()) {
+                    permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_RESTART,
+                            CldsEvent.ACTION_DELETE);
+                }
                 break;
             default:
                 logger.warn("Invalid current actionCd: " + actionCd);
@@ -252,6 +264,22 @@
         return result;
     }
 
+    private boolean isPolicyOnly() {
+        boolean result = false;
+        try {
+            if (propText != null) {
+                JsonNode modelJson = JacksonUtils.getObjectMapperInstance().readTree(propText);
+                JsonNode policyOnlyJson = modelJson.get("policyOnly");
+                if (policyOnlyJson != null && policyOnlyJson.asBoolean()) {
+                    result = true;
+                }
+            }
+        } catch (IOException e) {
+            logger.error("Error while parsing propText json", e);
+        }
+        return result;
+    }
+
     /**
      * Validate requestedActionCd - determine permittedActionCd and then check
      * if contained in permittedActionCd Throw IllegalArgumentException if
diff --git a/src/main/java/org/onap/clamp/clds/model/CldsToscaModel.java b/src/main/java/org/onap/clamp/clds/model/CldsToscaModel.java
new file mode 100644
index 0000000..4a23525
--- /dev/null
+++ b/src/main/java/org/onap/clamp/clds/model/CldsToscaModel.java
@@ -0,0 +1,130 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.clds.model;
+
+import java.util.List;
+
+import org.onap.clamp.clds.dao.CldsDao;
+
+public class CldsToscaModel extends CldsToscaModelRevision {
+
+    private String id;
+    private String policyType;
+    private String toscaModelName;
+    private String toscaModelYaml;
+
+    /**
+     * Creates or updates Tosca Model to DB
+     *
+     * @param cldsDao
+     * @param userId
+     */
+    public CldsToscaModel save(CldsDao cldsDao, String userId) {
+        CldsToscaModel cldsToscaModel = null;
+        // TODO tosca parsing logic
+        this.setToscaModelJson("{}");
+        this.setPolicyType("Aging");// TODO update with subString or node_type from the model name
+        List<CldsToscaModel> toscaModels = cldsDao.getToscaModelByName(this.getToscaModelName());
+        if (toscaModels != null && !toscaModels.isEmpty()) {
+            CldsToscaModel toscaModel = toscaModels.stream().findFirst().get();
+            // CldsToscaModelRevision modelRevision =
+            // revisions.stream().max(Comparator.comparingDouble(CldsToscaModelRevision::getVersion)).get();
+            this.setVersion(incrementVersion(toscaModel.getVersion()));
+            this.setId(toscaModel.getId());
+            this.setUserId(userId);
+            cldsToscaModel = cldsDao.updateToscaModelWithNewVersion(this, userId);
+        } else {
+            this.setVersion(1);
+            cldsToscaModel = cldsDao.insToscaModel(this, userId);
+        }
+        return cldsToscaModel;
+    }
+
+    private double incrementVersion(double curVersion) {
+        return curVersion + 1;
+    }
+
+    /**
+     * @return the id
+     */
+    public String getId() {
+        return id;
+    }
+
+    /**
+     * @param id
+     *        the id to set
+     */
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    /**
+     * @return the policyType
+     */
+    public String getPolicyType() {
+        return policyType;
+    }
+
+    /**
+     * @param policyType
+     *        the policyType to set
+     */
+    public void setPolicyType(String policyType) {
+        this.policyType = policyType;
+    }
+
+    /**
+     * @return the toscaModelName
+     */
+    public String getToscaModelName() {
+        return toscaModelName;
+    }
+
+    /**
+     * @param toscaModelName
+     *        the toscaModelName to set
+     */
+    public void setToscaModelName(String toscaModelName) {
+        this.toscaModelName = toscaModelName;
+    }
+
+    /**
+     * @return the toscaModelYaml
+     */
+    @Override
+    public String getToscaModelYaml() {
+        return toscaModelYaml;
+    }
+
+    /**
+     * @param toscaModelYaml
+     *        the toscaModelYaml to set
+     */
+    @Override
+    public void setToscaModelYaml(String toscaModelYaml) {
+        this.toscaModelYaml = toscaModelYaml;
+    }
+
+}
diff --git a/src/main/java/org/onap/clamp/clds/model/CldsToscaModelDetails.java b/src/main/java/org/onap/clamp/clds/model/CldsToscaModelDetails.java
new file mode 100644
index 0000000..5c6f4aa
--- /dev/null
+++ b/src/main/java/org/onap/clamp/clds/model/CldsToscaModelDetails.java
@@ -0,0 +1,132 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.clds.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Represents a CLDS Tosca model
+ *
+ */
+public class CldsToscaModelDetails {
+
+    private String id;
+    private String toscaModelName;
+    private String policyType;
+    private List<CldsToscaModelRevision> toscaModelRevisions = new ArrayList<>();
+    private String userId;
+    private String lastUpdatedDate;
+
+    /**
+     * @return the id
+     */
+    public String getId() {
+        return id;
+    }
+
+    /**
+     * @param id
+     *        the id to set
+     */
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    /**
+     * @return the toscaModelName
+     */
+    public String getToscaModelName() {
+        return toscaModelName;
+    }
+
+    /**
+     * @param toscaModelName
+     *        the toscaModelName to set
+     */
+    public void setToscaModelName(String toscaModelName) {
+        this.toscaModelName = toscaModelName;
+    }
+
+    /**
+     * @return the policyType
+     */
+    public String getPolicyType() {
+        return policyType;
+    }
+
+    /**
+     * @param policyType
+     *        the policyType to set
+     */
+    public void setPolicyType(String policyType) {
+        this.policyType = policyType;
+    }
+
+    /**
+     * @return the toscaModelRevisions
+     */
+    public List<CldsToscaModelRevision> getToscaModelRevisions() {
+        return toscaModelRevisions;
+    }
+
+    /**
+     * @param toscaModelRevisions
+     *        the toscaModelRevisions to set
+     */
+    public void setToscaModelRevisions(List<CldsToscaModelRevision> toscaModelRevisions) {
+        this.toscaModelRevisions = toscaModelRevisions;
+    }
+
+    /**
+     * @return the userId
+     */
+    public String getUserId() {
+        return userId;
+    }
+
+    /**
+     * @param userId
+     *        the userId to set
+     */
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
+    /**
+     * @return the lastUpdatedDate
+     */
+    public String getLastUpdatedDate() {
+        return lastUpdatedDate;
+    }
+
+    /**
+     * @param lastUpdatedDate
+     *        the lastUpdatedDate to set
+     */
+    public void setLastUpdatedDate(String lastUpdatedDate) {
+        this.lastUpdatedDate = lastUpdatedDate;
+    }
+
+}
diff --git a/src/main/java/org/onap/clamp/clds/model/CldsToscaModelRevision.java b/src/main/java/org/onap/clamp/clds/model/CldsToscaModelRevision.java
new file mode 100644
index 0000000..bfb0536
--- /dev/null
+++ b/src/main/java/org/onap/clamp/clds/model/CldsToscaModelRevision.java
@@ -0,0 +1,144 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+/**
+ * Represents a CLDS Tosca model revision
+ *
+ */
+package org.onap.clamp.clds.model;
+
+public class CldsToscaModelRevision {
+
+    private String revisionId;
+    private String toscaModelYaml;
+    private double version;
+    private String toscaModelJson;
+    private String userId;
+    private String createdDate;
+    private String lastUpdatedDate;
+
+    /**
+     * @return the revisionId
+     */
+    public String getRevisionId() {
+        return revisionId;
+    }
+
+    /**
+     * @param revisionId
+     *        the revisionId to set
+     */
+    public void setRevisionId(String revisionId) {
+        this.revisionId = revisionId;
+    }
+
+    /**
+     * @return the toscaModelYaml
+     */
+    public String getToscaModelYaml() {
+        return toscaModelYaml;
+    }
+
+    /**
+     * @param toscaModelYaml
+     *        the toscaModelYaml to set
+     */
+    public void setToscaModelYaml(String toscaModelYaml) {
+        this.toscaModelYaml = toscaModelYaml;
+    }
+
+    /**
+     * @return the version
+     */
+    public double getVersion() {
+        return version;
+    }
+
+    /**
+     * @param version
+     *        the version to set
+     */
+    public void setVersion(double version) {
+        this.version = version;
+    }
+
+    /**
+     * @return the toscaModelJson
+     */
+    public String getToscaModelJson() {
+        return toscaModelJson;
+    }
+
+    /**
+     * @param toscaModelJson
+     *        the toscaModelJson to set
+     */
+    public void setToscaModelJson(String toscaModelJson) {
+        this.toscaModelJson = toscaModelJson;
+    }
+
+    /**
+     * @return the userId
+     */
+    public String getUserId() {
+        return userId;
+    }
+
+    /**
+     * @param userId
+     *        the userId to set
+     */
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
+    /**
+     * @return the createdDate
+     */
+    public String getCreatedDate() {
+        return createdDate;
+    }
+
+    /**
+     * @param createdDate
+     *        the createdDate to set
+     */
+    public void setCreatedDate(String createdDate) {
+        this.createdDate = createdDate;
+    }
+
+    /**
+     * @return the lastUpdatedDate
+     */
+    public String getLastUpdatedDate() {
+        return lastUpdatedDate;
+    }
+
+    /**
+     * @param lastUpdatedDate
+     *        the lastUpdatedDate to set
+     */
+    public void setLastUpdatedDate(String lastUpdatedDate) {
+        this.lastUpdatedDate = lastUpdatedDate;
+    }
+}
diff --git a/src/main/java/org/onap/clamp/clds/service/CldsDictionaryService.java b/src/main/java/org/onap/clamp/clds/service/CldsDictionaryService.java
new file mode 100644
index 0000000..5d5e218
--- /dev/null
+++ b/src/main/java/org/onap/clamp/clds/service/CldsDictionaryService.java
@@ -0,0 +1,149 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.clds.service;
+
+import java.util.Date;
+import java.util.List;
+
+import javax.annotation.PostConstruct;
+
+import org.onap.clamp.clds.dao.CldsDao;
+import org.onap.clamp.clds.model.CldsDictionary;
+import org.onap.clamp.clds.model.CldsDictionaryItem;
+import org.onap.clamp.clds.util.LoggingUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Component;
+
+/**
+ * REST services to manage dictionary and dictionary items for Tosca Model
+ */
+@Component
+public class CldsDictionaryService extends SecureServiceBase {
+
+	@Value("${clamp.config.security.permission.type.tosca:permission-type-tosca}")
+	private String cldsPermissionTypeTosca;
+	@Value("${clamp.config.security.permission.instance:dev}")
+	private String cldsPermissionInstance;
+	private SecureServicePermission permissionReadTosca;
+	private SecureServicePermission permissionUpdateTosca;
+
+	@Autowired
+	private CldsDao cldsDao;
+
+	@PostConstruct
+	private final void initConstruct() {
+		permissionReadTosca = SecureServicePermission.create(cldsPermissionTypeTosca, cldsPermissionInstance, "read");
+        permissionUpdateTosca = SecureServicePermission.create(cldsPermissionTypeTosca, cldsPermissionInstance, "update");
+	}
+
+	/**
+	 *  REST Service that creates or Updates a Dictionary
+	 *  
+	 * @param dictionaryName
+	 * @param cldsDictionary
+	 * @return CldsDictionary that was created in DB.
+	 */
+	public ResponseEntity<CldsDictionary> createOrUpdateDictionary(String dictionaryName,
+			CldsDictionary cldsDictionary) {
+		Date startTime = new Date();
+		LoggingUtils.setRequestContext("CldsDictionaryService: createOrUpdateDictionary", getPrincipalName());
+		// TODO revisit based on new permissions
+		isAuthorized(permissionUpdateTosca);
+		if (cldsDictionary == null) {
+			cldsDictionary = new CldsDictionary();
+			cldsDictionary.setDictionaryName(dictionaryName);
+		}
+		cldsDictionary.save(dictionaryName, cldsDao, getUserId());
+		LoggingUtils.setTimeContext(startTime, new Date());
+		LoggingUtils.setResponseContext("0", "createOrUpdateDictionary success", this.getClass().getName());
+		auditLogger.info("createOrUpdateDictionary completed");
+		return new ResponseEntity<>(cldsDictionary, HttpStatus.OK);
+	}
+
+	/**
+	 * REST Service that creates or Updates a Dictionary Elements for dictionary in DB
+	 * 
+	 * @param dictionaryName
+	 * @param dictionaryItem
+	 * @return CldsDictionaryItem
+	 * 			A dictionary items that was created or updated in DB
+	 */
+	public ResponseEntity<CldsDictionaryItem> createOrUpdateDictionaryElements(String dictionaryName,
+			CldsDictionaryItem dictionaryItem) {
+		Date startTime = new Date();
+		LoggingUtils.setRequestContext("CldsDictionaryService: createOrUpdateDictionaryElements", getPrincipalName());
+		// TODO revisit based on new permissions
+		isAuthorized(permissionUpdateTosca);
+		dictionaryItem.save(dictionaryName, cldsDao, getUserId());
+		LoggingUtils.setTimeContext(startTime, new Date());
+		LoggingUtils.setResponseContext("0", "createOrUpdateDictionaryElements success", this.getClass().getName());
+		auditLogger.info("createOrUpdateDictionaryElements completed");
+		return new ResponseEntity<>(dictionaryItem, HttpStatus.OK);
+	}
+
+	/**
+	 * Rest Service that retrieves all CLDS dictionary in DB
+	 * 
+	 * @return CldsDictionary List
+	 * 			List of CldsDictionary available in DB
+	 */
+	public ResponseEntity<List<CldsDictionary>> getAllDictionaryNames() {
+		Date startTime = new Date();
+		LoggingUtils.setRequestContext("CldsDictionaryService: getAllDictionaryNames", getPrincipalName());
+		// TODO revisit based on new permissions
+		isAuthorized(permissionReadTosca);
+		List<CldsDictionary> dictionaries = cldsDao.getDictionary(null, null);
+		LoggingUtils.setTimeContext(startTime, new Date());
+		LoggingUtils.setResponseContext("0", "getAllDictionaryNames success", this.getClass().getName());
+		auditLogger.info("getAllDictionaryNames completed");
+		return new ResponseEntity<>(dictionaries, HttpStatus.OK);
+	}
+
+	/**
+	 * Rest Service that retrieves all CLDS dictionary items in DB for a give dictionary name
+	 * 
+	 * @param dictionaryName
+	 * @return CldsDictionaryItem list
+	 * 			List of CLDS Dictionary items for a given dictionary name
+	 */
+	public ResponseEntity<List<CldsDictionaryItem>> getDictionaryElementsByName(String dictionaryName) {
+		Date startTime = new Date();
+		LoggingUtils.setRequestContext("CldsDictionaryService: getDictionaryElementsByName", getPrincipalName());
+		// TODO revisit based on new permissions
+		isAuthorized(permissionReadTosca);
+		List<CldsDictionaryItem> dictionaryItems = cldsDao.getDictionaryElements(dictionaryName, null, null);
+		LoggingUtils.setTimeContext(startTime, new Date());
+		LoggingUtils.setResponseContext("0", "getAllDictionaryNames success", this.getClass().getName());
+		auditLogger.info("getAllDictionaryNames completed");
+		return new ResponseEntity<>(dictionaryItems, HttpStatus.OK);
+	}
+
+	public ResponseEntity<?> deleteDictionary() {
+		return null;
+	}
+
+}
diff --git a/src/main/java/org/onap/clamp/clds/service/CldsInfoProvider.java b/src/main/java/org/onap/clamp/clds/service/CldsInfoProvider.java
index 6bebde9..7027cf1 100644
--- a/src/main/java/org/onap/clamp/clds/service/CldsInfoProvider.java
+++ b/src/main/java/org/onap/clamp/clds/service/CldsInfoProvider.java
@@ -45,6 +45,8 @@
         cldsInfo.setPermissionUpdateCl(cldsService.isAuthorizedNoException(cldsService.permissionUpdateCl));
         cldsInfo.setPermissionReadTemplate(cldsService.isAuthorizedNoException(cldsService.permissionReadTemplate));
         cldsInfo.setPermissionUpdateTemplate(cldsService.isAuthorizedNoException(cldsService.permissionUpdateTemplate));
+        cldsInfo.setPermissionReadTosca(cldsService.isAuthorizedNoException(cldsService.permissionReadTosca));
+        cldsInfo.setPermissionUpdateTosca(cldsService.isAuthorizedNoException(cldsService.permissionUpdateTosca));
         return cldsInfo;
     }
 }
diff --git a/src/main/java/org/onap/clamp/clds/service/CldsService.java b/src/main/java/org/onap/clamp/clds/service/CldsService.java
index bc58ee6..521f3ce 100644
--- a/src/main/java/org/onap/clamp/clds/service/CldsService.java
+++ b/src/main/java/org/onap/clamp/clds/service/CldsService.java
@@ -105,6 +105,8 @@
     final SecureServicePermission permissionUpdateCl;
     final SecureServicePermission permissionReadTemplate;
     final SecureServicePermission permissionUpdateTemplate;
+    final SecureServicePermission permissionReadTosca;
+    final SecureServicePermission permissionUpdateTosca;
 
     private final CldsDao cldsDao;
     private final XslTransformer cldsBpmnTransformer;
@@ -125,6 +127,7 @@
         @Value("${clamp.config.security.permission.type.cl.event:permission-type-cl-event}") String cldsPermissionTypeClEvent,
         @Value("${clamp.config.security.permission.type.filter.vf:permission-type-filter-vf}") String cldsPermissionTypeFilterVf,
         @Value("${clamp.config.security.permission.type.template:permission-type-template}") String cldsPermissionTypeTemplate,
+            @Value("${clamp.config.security.permission.type.tosca:permission-type-tosca}") String cldsPermissionTypeTosca,
         @Value("${clamp.config.security.permission.instance:dev}") String cldsPermissionInstance) {
         this.cldsDao = cldsDao;
         this.cldsBpmnTransformer = cldsBpmnTransformer;
@@ -144,6 +147,9 @@
             "read");
         permissionUpdateTemplate = SecureServicePermission.create(cldsPermissionTypeTemplate, cldsPermissionInstance,
             "update");
+        permissionReadTosca = SecureServicePermission.create(cldsPermissionTypeTosca, cldsPermissionInstance, "read");
+        permissionUpdateTosca = SecureServicePermission.create(cldsPermissionTypeTosca, cldsPermissionInstance,
+                "update");
     }
 
     /*
@@ -401,7 +407,7 @@
                 retrievedModel = CldsModel.retrieve(cldsDao, modelName, false);
             }
             if (retrievedModel != null) {
-                if (!isTest && (actionCd.equalsIgnoreCase(CldsEvent.ACTION_SUBMIT)
+                if (!isTest && !errorCase && (actionCd.equalsIgnoreCase(CldsEvent.ACTION_SUBMIT)
                     || actionCd.equalsIgnoreCase(CldsEvent.ACTION_RESUBMIT)
                     || actionCd.equalsIgnoreCase(CldsEvent.ACTION_SUBMITDCAE))) {
                     if (retrievedModel.getTemplateName().startsWith(CsarInstallerImpl.TEMPLATE_NAME_PREFIX)) {
diff --git a/src/main/java/org/onap/clamp/clds/service/CldsToscaService.java b/src/main/java/org/onap/clamp/clds/service/CldsToscaService.java
new file mode 100644
index 0000000..f33039f
--- /dev/null
+++ b/src/main/java/org/onap/clamp/clds/service/CldsToscaService.java
@@ -0,0 +1,149 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.clds.service;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Optional;
+
+import javax.annotation.PostConstruct;
+
+import org.onap.clamp.clds.dao.CldsDao;
+import org.onap.clamp.clds.model.CldsToscaModel;
+import org.onap.clamp.clds.util.LoggingUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Component;
+
+/**
+ * REST services to manage Tosca Model
+ */
+@Component
+public class CldsToscaService extends SecureServiceBase {
+
+	@Value("${clamp.config.security.permission.type.tosca:permission-type-tosca}")
+	private String cldsPermissionTypeTosca;
+	@Value("${clamp.config.security.permission.instance:dev}")
+	private String cldsPermissionInstance;
+	private SecureServicePermission permissionReadTosca;
+	private SecureServicePermission permissionUpdateTosca;
+
+	@Autowired
+	private CldsDao cldsDao;
+
+	@PostConstruct
+	private final void initConstruct() {
+		permissionReadTosca = SecureServicePermission.create(cldsPermissionTypeTosca, cldsPermissionInstance, "read");
+        permissionUpdateTosca = SecureServicePermission.create(cldsPermissionTypeTosca, cldsPermissionInstance, "update");
+	}
+	
+	/**
+	 * REST service to upload a new Tosca Model or update an existing Tosca model with new version.
+	 * This API will parse the Tosca model yaml and generates a JSON schema out of it.
+	 * 
+	 * @param toscaModelName
+	 * 			Tosca model name to be used as a key
+	 * @param cldsToscaModel
+	 *          Object containing the tosca model yaml
+	 * 
+	 * @return clds tosca models - list of CLDS tosca models for a given policy type 
+	 */
+	public ResponseEntity<?> parseToscaModelAndSave(String toscaModelName, CldsToscaModel cldsToscaModel ) {
+        Date startTime = new Date();
+        LoggingUtils.setRequestContext("CldsToscaService: Parse Tosca model and save", getPrincipalName());
+        //TODO revisit based on new permissions
+        isAuthorized(permissionUpdateTosca);
+        cldsToscaModel.setToscaModelName(toscaModelName);
+        cldsToscaModel = cldsToscaModel.save(cldsDao, getUserId());
+        LoggingUtils.setTimeContext(startTime, new Date());
+        LoggingUtils.setResponseContext("0", "Parse Tosca model and save success", this.getClass().getName());
+        auditLogger.info("Parse Tosca model and save completed");
+        return new ResponseEntity<>(cldsToscaModel, HttpStatus.CREATED);
+	}
+	
+	/**
+	 * REST service to retrieve all Tosca models from the CLDS database.
+	 * 
+	 * @return clds tosca models - list of CLDS tosca models 
+	 */
+	public ResponseEntity<List<CldsToscaModel>> getAllToscaModels() {
+		
+		Date startTime = new Date();
+        LoggingUtils.setRequestContext("CldsToscaService: Get All tosca models", getPrincipalName());
+        //TODO revisit based on new permissions
+        isAuthorized(permissionReadTosca);
+        List<CldsToscaModel> cldsToscaModels = Optional.ofNullable(cldsDao.getAllToscaModels()).get();
+        LoggingUtils.setTimeContext(startTime, new Date());
+        LoggingUtils.setResponseContext("0", "Get All tosca models success", this.getClass().getName());
+        auditLogger.info("Get All tosca models");
+        return new ResponseEntity<>(cldsToscaModels, HttpStatus.OK);
+	}
+	
+	/**
+	 * REST service that retrieves a CLDS Tosca model by model name from the database.
+	 * 
+	 * @param toscaModelName
+	 * 			Path param with tosca model name
+	 * 
+	 * @return clds tosca model -  CLDS tosca model for a given tosca model name 
+	 */
+	public ResponseEntity<CldsToscaModel> getToscaModel(String toscaModelName) {
+		Date startTime = new Date();
+        LoggingUtils.setRequestContext("CldsToscaService: Get tosca models by model name", getPrincipalName());
+        //TODO revisit based on new permissions
+        isAuthorized(permissionReadTosca);
+        List<CldsToscaModel> cldsToscaModels = Optional.ofNullable(cldsDao.getToscaModelByName(toscaModelName)).get();
+        LoggingUtils.setTimeContext(startTime, new Date());
+        LoggingUtils.setResponseContext("0", "Get tosca models by model name success", this.getClass().getName());
+        auditLogger.info("GET tosca models by model name completed");
+        return new ResponseEntity<>(Optional.ofNullable(cldsToscaModels).get().stream().findFirst().get(), HttpStatus.OK);
+	}
+
+	
+	/**
+	 * REST service that retrieves a CLDS Tosca model lists for a policy type from the database.
+	 * 
+	 * @param policyType
+	 * @return clds tosca model -  CLDS tosca model for a given policy type 
+	 */
+	public ResponseEntity<CldsToscaModel> getToscaModelsByPolicyType(String policyType) {
+		Date startTime = new Date();
+        LoggingUtils.setRequestContext("CldsToscaService: Get tosca models by policyType", getPrincipalName());
+        //TODO revisit based on new permissions
+        isAuthorized(permissionReadTosca);
+        List<CldsToscaModel> cldsToscaModels = Optional.ofNullable(cldsDao.getToscaModelByPolicyType(policyType)).get();
+        LoggingUtils.setTimeContext(startTime, new Date());
+        LoggingUtils.setResponseContext("0", "Get tosca models by policyType success", this.getClass().getName());
+        auditLogger.info("GET tosca models by policyType completed");
+        return new ResponseEntity<>(Optional.ofNullable(cldsToscaModels).get().stream().findFirst().get(), HttpStatus.OK);
+	}
+	
+	public ResponseEntity<?> deleteToscaModelById(String toscaModeId) {
+		//TODO
+		return null;
+	}
+	
+}
diff --git a/src/main/resources/clds/camel/rest/clds-services.xml b/src/main/resources/clds/camel/rest/clds-services.xml
index 1ea8213..b63591f 100644
--- a/src/main/resources/clds/camel/rest/clds-services.xml
+++ b/src/main/resources/clds/camel/rest/clds-services.xml
@@ -64,7 +64,7 @@
 				
 				
 				
-				<get uri="/cldsTempate/template/bpmn/{templateName}" produces="text/xml">
+				<get uri="/cldsTempate/template/bpmn/{templateName}" produces="text/xml" >
 						<to
 								uri="bean:org.onap.clamp.clds.service.CldsTemplateService?method=getBpmnTemplate(${header.templateName})" />
 				</get>
@@ -86,6 +86,43 @@
 				</get>
 				
 				
+				<put uri="/tosca/models/{toscaModelName}" type="org.onap.clamp.clds.model.CldsToscaModel" consumes="application/json" produces="application/json">
+						<to
+								uri="bean:org.onap.clamp.clds.service.CldsToscaService?method=parseToscaModelAndSave(${header.toscaModelName},${body})" />
+				</put>
+				<get uri="/tosca/models/policyType/{policyType}" produces="application/json">
+						<to
+								uri="bean:org.onap.clamp.clds.service.CldsToscaService?method=getToscaModelsByPolicyType(${header.policyType})" />
+				</get>
+				<get uri="/tosca/models" outType="org.onap.clamp.clds.model.CldsToscaModel" produces="application/json">
+						<to
+								uri="bean:org.onap.clamp.clds.service.CldsToscaService?method=getAllToscaModels()" />
+				</get>	
+				<get uri="/tosca/models/{toscaModelName}" outType="org.onap.clamp.clds.model.CldsToscaModel" produces="application/json">
+						<to
+								uri="bean:org.onap.clamp.clds.service.CldsToscaService?method=getToscaModel(${header.toscaModelName})" />
+				</get>
+				
+				
+				<put uri="/dictionary/{dictionaryName}" type="org.onap.clamp.clds.model.CldsDictionary" outType="org.onap.clamp.clds.model.CldsDictionary" consumes="application/json" produces="application/json">
+						<to
+								uri="bean:org.onap.clamp.clds.service.CldsDictionaryService?method=createOrUpdateDictionary(${header.dictionaryName},${body})" />
+				</put>
+				
+				<get uri="/dictionary" outType="org.onap.clamp.clds.model.CldsDictionary" produces="application/json">
+						<to
+								uri="bean:org.onap.clamp.clds.service.CldsDictionaryService?method=getAllDictionaryNames()" />
+				</get>
+				
+				<put uri="/dictionary/{dictionaryName}/items" type="org.onap.clamp.clds.model.CldsDictionaryItem" outType="org.onap.clamp.clds.model.CldsDictionaryItem" consumes="application/json" produces="application/json">
+						<to
+								uri="bean:org.onap.clamp.clds.service.CldsDictionaryService?method=createOrUpdateDictionaryElements(${header.dictionaryName},${body})" />
+				</put>
+				
+				<get uri="/dictionary/{dictionaryName}/items" outType="org.onap.clamp.clds.model.CldsDictionary" produces="application/json">
+						<to
+								uri="bean:org.onap.clamp.clds.service.CldsDictionaryService?method=getDictionaryElementsByName(${header.dictionaryName})" />
+				</get>
 				
 				<get uri="/user/getUser" produces="text/plain">
 						<to
