Rework the SDC cache 37/31737/1
authorDeterme, Sebastien (sd378r) <sd378r@intl.att.com>
Wed, 14 Feb 2018 14:30:07 +0000 (15:30 +0100)
committerDeterme, Sebastien (sd378r) <sd378r@intl.att.com>
Wed, 14 Feb 2018 14:30:07 +0000 (15:30 +0100)
Rework the SDC cache that was broken and add unit tests to validate it

Issue-ID: CLAMP-85
Change-Id: I43503702733d8f8f0ddbf391f94fb4e5416be98f
Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
src/main/java/org/onap/clamp/clds/dao/CldsDao.java
src/main/java/org/onap/clamp/clds/dao/CldsServiceDataMapper.java
src/main/java/org/onap/clamp/clds/model/CldsDBServiceCache.java
src/main/java/org/onap/clamp/clds/model/CldsServiceData.java
src/test/java/org/onap/clamp/clds/it/CldsDaoItCase.java
src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java
src/test/java/org/onap/clamp/clds/model/CldsDBServiceCacheTest.java [new file with mode: 0644]
src/test/resources/example/sdc/expected-result/sdc-properties-4cc5b45a.json [new file with mode: 0644]

index 088d473..5946416 100644 (file)
@@ -354,19 +354,31 @@ public class CldsDao {
         return template;
     }
 
+    public void clearServiceCache() {
+        String clearCldsServiceCacheSql = "TRUNCATE clds_service_cache";
+        jdbcTemplateObject.execute(clearCldsServiceCacheSql);
+    }
+
     public CldsServiceData getCldsServiceCache(String invariantUUID) {
         CldsServiceData cldsServiceData = null;
-        List<CldsServiceData> cldsServiceDataList = new ArrayList<>();
         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());
-            logger.info("value of cldsServiceDataList: {}", cldsServiceDataList);
+            if (cldsServiceData != null) {
+                logger.info("CldsServiceData found in cache for Service Invariant ID:"
+                        + cldsServiceData.getServiceInvariantUUID());
+                return cldsServiceData;
+            } else {
+                logger.warn("CldsServiceData not found in cache for Service Invariant ID:" + invariantUUID);
+                return null;
+            }
         } catch (EmptyResultDataAccessException e) {
-            logger.warn("cache row not found for invariantUUID: " + invariantUUID, e);
+            logger.info("CldsServiceData not found in cache for Service Invariant ID: " + invariantUUID);
+            logger.debug("CldsServiceData not found in cache for Service Invariant ID: " + invariantUUID, e);
+            return null;
         }
-        return cldsServiceData;
     }
 
     public void setCldsServiceCache(CldsDBServiceCache cldsDBServiceCache) {
@@ -401,7 +413,7 @@ public class CldsDao {
      * @return list of CldsModelProp
      */
     public List<CldsModelProp> getDeployedModelProperties() {
-        List<CldsModelProp> cldsModelPropList = new ArrayList<CldsModelProp>();
+        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'";
         List<Map<String, Object>> rows = jdbcTemplateObject.queryForList(modelsSql);
index 91d8950..470354a 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP CLAMP
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
  *                             reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -27,35 +27,33 @@ import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;
 
 import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import org.apache.commons.io.serialization.ValidatingObjectInputStream;
-import java.sql.Blob;
 import java.sql.ResultSet;
 import java.sql.SQLException;
+import java.util.ArrayList;
 
+import org.apache.commons.io.serialization.ValidatingObjectInputStream;
 import org.onap.clamp.clds.model.CldsServiceData;
+import org.onap.clamp.clds.model.CldsVfData;
+import org.onap.clamp.clds.model.CldsVfcData;
 import org.springframework.jdbc.core.RowMapper;
 
 /**
  * Generic mapper for CldsDBServiceCache
  */
 public final class CldsServiceDataMapper implements RowMapper<CldsServiceData> {
+
     protected static final EELFLogger logger = EELFManager.getInstance().getLogger(CldsDao.class);
 
     @Override
     public CldsServiceData mapRow(ResultSet rs, int rowNum) throws SQLException {
         CldsServiceData cldsServiceData = new CldsServiceData();
-        long age;
-        age = rs.getLong(5);
-        Blob blob = rs.getBlob(4);
-        InputStream is = blob.getBinaryStream();
-        try (ValidatingObjectInputStream oip = new ValidatingObjectInputStream(is)) {
-               oip.accept(CldsServiceData.class);
+        try (ValidatingObjectInputStream oip = new ValidatingObjectInputStream(rs.getBlob(4).getBinaryStream())) {
+            oip.accept(CldsServiceData.class, ArrayList.class, CldsVfData.class, CldsVfcData.class);
             cldsServiceData = (CldsServiceData) oip.readObject();
-            cldsServiceData.setAgeOfRecord(age);
+            cldsServiceData.setAgeOfRecord(rs.getLong(5));
         } catch (IOException | ClassNotFoundException e) {
-            logger.error("Error caught while retrieving cldsServiceData from database", e);
+            logger.error("Error caught while deserializing cldsServiceData from database", e);
+            return null;
         }
         return cldsServiceData;
     }
index f9a760b..80e8d85 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP CLAMP
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
  *                             reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License"); 
@@ -31,10 +31,16 @@ import java.io.ObjectOutputStream;
 
 public class CldsDBServiceCache {
 
-    private String      invariantId;
-    private String      serviceId;
+    private String invariantId;
+    private String serviceId;
     private InputStream cldsDataInstream;
 
+    public CldsDBServiceCache(CldsServiceData cldsServiceData) throws IOException {
+        setCldsDataInstream(cldsServiceData);
+        setInvariantId(cldsServiceData.getServiceInvariantUUID());
+        setServiceId(cldsServiceData.getServiceUUID());
+    }
+
     public String getInvariantId() {
         return invariantId;
     }
@@ -55,6 +61,10 @@ public class CldsDBServiceCache {
         return cldsDataInstream;
     }
 
+    public void setCldsDataInstream(InputStream cldsDataInputstream) {
+        this.cldsDataInstream = cldsDataInputstream;
+    }
+
     public void setCldsDataInstream(CldsServiceData cldsServiceData) throws IOException {
         this.cldsDataInstream = getInstreamFromObject(cldsServiceData);
     }
index 943532f..1a4b4dc 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP CLAMP
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
  *                             reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -32,20 +32,17 @@ import java.util.List;
 
 import javax.ws.rs.NotAuthorizedException;
 
-import org.onap.clamp.clds.dao.CldsDao;
 import org.onap.clamp.clds.service.CldsService;
 
 public class CldsServiceData implements Serializable {
 
-    private static final long         serialVersionUID = -9153372664377279423L;
-
-    protected static final EELFLogger logger           = EELFManager.getInstance().getLogger(CldsServiceData.class);
-    protected static final EELFLogger auditLogger      = EELFManager.getInstance().getAuditLogger();
-
-    private String                    serviceInvariantUUID;
-    private String                    serviceUUID;
-    private Long                      ageOfRecord;
-    private List<CldsVfData>          cldsVfs;
+    private static final long serialVersionUID = -9153372664377279423L;
+    protected static final EELFLogger logger = EELFManager.getInstance().getLogger(CldsServiceData.class);
+    protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
+    private String serviceInvariantUUID;
+    private String serviceUUID;
+    private Long ageOfRecord;
+    private List<CldsVfData> cldsVfs;
 
     public String getServiceInvariantUUID() {
         return serviceInvariantUUID;
@@ -71,14 +68,6 @@ public class CldsServiceData implements Serializable {
         this.serviceUUID = serviceUUID;
     }
 
-    public CldsServiceData getCldsServiceCache(CldsDao cldsDao, String invariantServiceUUID) {
-        return cldsDao.getCldsServiceCache(invariantServiceUUID);
-    }
-
-    public void setCldsServiceCache(CldsDao cldsDao, CldsDBServiceCache cldsDBServiceCache) {
-        cldsDao.setCldsServiceCache(cldsDBServiceCache);
-    }
-
     public Long getAgeOfRecord() {
         return ageOfRecord;
     }
index c684d44..1e9a9ed 100644 (file)
@@ -25,30 +25,35 @@ package org.onap.clamp.clds.it;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
 
 import com.att.aft.dme2.internal.apache.commons.lang.RandomStringUtils;
 import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;
 
 import java.io.IOException;
+import java.security.GeneralSecurityException;
 import java.util.ArrayList;
 import java.util.List;
 
 import javax.ws.rs.NotFoundException;
 
+import org.apache.commons.codec.DecoderException;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.onap.clamp.clds.AbstractItCase;
+import org.onap.clamp.clds.client.req.sdc.SdcCatalogServices;
 import org.onap.clamp.clds.dao.CldsDao;
 import org.onap.clamp.clds.model.CLDSMonitoringDetails;
+import org.onap.clamp.clds.model.CldsDBServiceCache;
 import org.onap.clamp.clds.model.CldsEvent;
 import org.onap.clamp.clds.model.CldsModel;
+import org.onap.clamp.clds.model.CldsServiceData;
 import org.onap.clamp.clds.model.CldsTemplate;
 import org.onap.clamp.clds.util.ResourceFileUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.TestPropertySource;
 import org.springframework.test.context.junit4.SpringRunner;
 
 /**
@@ -57,7 +62,6 @@ import org.springframework.test.context.junit4.SpringRunner;
  */
 @RunWith(SpringRunner.class)
 @SpringBootTest
-@TestPropertySource(locations = "classpath:application-no-camunda.properties")
 public class CldsDaoItCase extends AbstractItCase {
 
     protected static final EELFLogger logger = EELFManager.getInstance().getLogger(CldsDao.class);
@@ -66,6 +70,8 @@ public class CldsDaoItCase extends AbstractItCase {
     private String bpmnText;
     private String imageText;
     private String bpmnPropText;
+    @Autowired
+    private SdcCatalogServices sdcCatalogServices;
 
     /**
      * Setup the variable before the tests execution.
@@ -161,4 +167,31 @@ public class CldsDaoItCase extends AbstractItCase {
             assertNotNull(clName.getCloseloopName());
         });
     }
+
+    @Test
+    public void testCldsServiceCache() throws GeneralSecurityException, DecoderException, IOException {
+        CldsServiceData cldsServiceData = sdcCatalogServices
+                .getCldsServiceDataWithAlarmConditions("4cc5b45a-1f63-4194-8100-cd8e14248c92");
+        // Test not in cache so should be null
+        CldsServiceData cldsServiceDataCache = cldsDao.getCldsServiceCache("4cc5b45a-1f63-4194-8100-cd8e14248c92");
+        assertNull(cldsServiceDataCache);
+        cldsDao.setCldsServiceCache(new CldsDBServiceCache(cldsServiceData));
+        cldsServiceDataCache = cldsDao.getCldsServiceCache("4cc5b45a-1f63-4194-8100-cd8e14248c92");
+        assertNotNull(cldsServiceDataCache);
+        assertEquals("56441b4b-0467-41dc-9a0e-e68613838219", cldsServiceDataCache.getServiceUUID());
+        assertEquals("4cc5b45a-1f63-4194-8100-cd8e14248c92", cldsServiceDataCache.getServiceInvariantUUID());
+        assertEquals(2, cldsServiceDataCache.getCldsVfs().size());
+        assertNotNull(cldsServiceDataCache.getAgeOfRecord());
+        assertEquals(4, cldsServiceDataCache.getCldsVfs().get(0).getCldsVfcs().size());
+        assertEquals("07e266fc-49ab-4cd7-8378-ca4676f1b9ec",
+                cldsServiceDataCache.getCldsVfs().get(0).getVfInvariantResourceUUID());
+        assertEquals(0, cldsServiceDataCache.getCldsVfs().get(0).getCldsKPIList().size());
+        // Second update
+        cldsServiceData.setCldsVfs(null);
+        cldsDao.setCldsServiceCache(new CldsDBServiceCache(cldsServiceData));
+        cldsServiceDataCache = cldsDao.getCldsServiceCache("4cc5b45a-1f63-4194-8100-cd8e14248c92");
+        assertNotNull(cldsServiceDataCache);
+        assertNull(cldsServiceDataCache.getCldsVfs());
+        cldsDao.clearServiceCache();
+    }
 }
index 9dac2dc..932434d 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP CLAMP
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
  *                             reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License"); 
@@ -26,17 +26,21 @@ package org.onap.clamp.clds.it;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
 import com.att.aft.dme2.internal.apache.commons.lang.RandomStringUtils;
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.security.GeneralSecurityException;
 import java.security.Principal;
 import java.util.Properties;
 
 import javax.ws.rs.core.SecurityContext;
 
+import org.apache.commons.codec.DecoderException;
+import org.json.JSONException;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -46,13 +50,14 @@ import org.onap.clamp.clds.dao.CldsDao;
 import org.onap.clamp.clds.model.CldsHealthCheck;
 import org.onap.clamp.clds.model.CldsInfo;
 import org.onap.clamp.clds.model.CldsModel;
+import org.onap.clamp.clds.model.CldsServiceData;
 import org.onap.clamp.clds.model.CldsTemplate;
 import org.onap.clamp.clds.service.CldsService;
 import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.skyscreamer.jsonassert.JSONAssert;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
-import org.springframework.test.context.TestPropertySource;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
 /**
@@ -60,7 +65,6 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
  */
 @RunWith(SpringJUnit4ClassRunner.class)
 @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
-@TestPropertySource(locations = "classpath:application-no-camunda.properties")
 public class CldsServiceItCase extends AbstractItCase {
 
     @Autowired
@@ -170,4 +174,42 @@ public class CldsServiceItCase extends AbstractItCase {
         // Verify whether it has been added properly or not
         assertNotNull(cldsDao.getModel(randomNameModel));
     }
+
+    @Test
+    public void testGetSdcServices() throws GeneralSecurityException, DecoderException, JSONException, IOException {
+        String result = cldsService.getSdcServices();
+        JSONAssert.assertEquals(
+                ResourceFileUtil.getResourceAsString("example/sdc/expected-result/all-sdc-services.json"), result,
+                true);
+    }
+
+    @Test
+    public void testGetSdcPropertiesByServiceUUIDForRefresh()
+            throws GeneralSecurityException, DecoderException, JSONException, IOException {
+        SecurityContext securityContext = Mockito.mock(SecurityContext.class);
+        Principal principal = Mockito.mock(Principal.class);
+        Mockito.when(principal.getName()).thenReturn("admin");
+        Mockito.when(securityContext.getUserPrincipal()).thenReturn(principal);
+        Mockito.when(securityContext.isUserInRole("permission-type-cl|dev|read")).thenReturn(true);
+        Mockito.when(securityContext.isUserInRole("permission-type-cl|dev|update")).thenReturn(true);
+        Mockito.when(securityContext.isUserInRole("permission-type-template|dev|read")).thenReturn(true);
+        Mockito.when(securityContext.isUserInRole("permission-type-template|dev|update")).thenReturn(true);
+        Mockito.when(securityContext.isUserInRole("permission-type-filter-vf|dev|*")).thenReturn(true);
+        cldsService.setSecurityContext(securityContext);
+        // Test basic functionalities
+        String result = cldsService.getSdcPropertiesByServiceUUIDForRefresh("4cc5b45a-1f63-4194-8100-cd8e14248c92",
+                false);
+        JSONAssert.assertEquals(
+                ResourceFileUtil.getResourceAsString("example/sdc/expected-result/sdc-properties-4cc5b45a.json"),
+                result, true);
+        // Now test the Cache effect
+        CldsServiceData cldsServiceDataCache = cldsDao.getCldsServiceCache("c95b0e7c-c1f0-4287-9928-7964c5377a46");
+        // Should not be there, so should be null
+        assertNull(cldsServiceDataCache);
+        cldsService.getSdcPropertiesByServiceUUIDForRefresh("c95b0e7c-c1f0-4287-9928-7964c5377a46", true);
+        // Should be there now, so should NOT be null
+        cldsServiceDataCache = cldsDao.getCldsServiceCache("c95b0e7c-c1f0-4287-9928-7964c5377a46");
+        assertNotNull(cldsServiceDataCache);
+        cldsDao.clearServiceCache();
+    }
 }
diff --git a/src/test/java/org/onap/clamp/clds/model/CldsDBServiceCacheTest.java b/src/test/java/org/onap/clamp/clds/model/CldsDBServiceCacheTest.java
new file mode 100644 (file)
index 0000000..ad16891
--- /dev/null
@@ -0,0 +1,67 @@
+/*-
+ * ============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============================================
+ * ===================================================================
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+package org.onap.clamp.clds.model;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+
+public class CldsDBServiceCacheTest {
+
+    @Test
+    public void testConstructor() throws IOException, ClassNotFoundException {
+        CldsServiceData cldsServiceData = new CldsServiceData();
+        cldsServiceData.setServiceUUID("testUUID");
+        cldsServiceData.setAgeOfRecord(Long.valueOf(100));
+        cldsServiceData.setServiceInvariantUUID("testInvariantUUID");
+        List<CldsVfData> cldsVfs = new ArrayList<>();
+        CldsVfData cldsVfData = new CldsVfData();
+        cldsVfData.setVfName("vf");
+        List<CldsVfKPIData> cldsKPIList = new ArrayList<>();
+        CldsVfKPIData cldsVfKPIData = new CldsVfKPIData();
+        cldsVfKPIData.setFieldPath("fieldPath");
+        cldsVfKPIData.setFieldPathValue("fieldValue");
+        cldsKPIList.add(cldsVfKPIData);
+        cldsVfData.setCldsKPIList(cldsKPIList);
+        cldsVfs.add(cldsVfData);
+        cldsServiceData.setCldsVfs(cldsVfs);
+        CldsDBServiceCache cldsDBServiceCache = new CldsDBServiceCache(cldsServiceData);
+        ObjectInputStream reader = new ObjectInputStream(cldsDBServiceCache.getCldsDataInstream());
+        CldsServiceData cldsServiceDataResult = (CldsServiceData) reader.readObject();
+        assertNotNull(cldsServiceDataResult);
+        assertNotNull(cldsServiceDataResult.getCldsVfs());
+        assertEquals(cldsServiceDataResult.getCldsVfs().size(), 1);
+        assertNotNull(cldsServiceDataResult.getCldsVfs().get(0).getCldsKPIList());
+        assertEquals(cldsServiceDataResult.getCldsVfs().get(0).getCldsKPIList().size(), 1);
+        assertEquals(cldsServiceDataResult.getServiceInvariantUUID(), "testInvariantUUID");
+        assertEquals(cldsServiceDataResult.getServiceUUID(), "testUUID");
+        assertEquals(cldsServiceDataResult.getAgeOfRecord(), Long.valueOf(100L));
+    }
+}
diff --git a/src/test/resources/example/sdc/expected-result/sdc-properties-4cc5b45a.json b/src/test/resources/example/sdc/expected-result/sdc-properties-4cc5b45a.json
new file mode 100644 (file)
index 0000000..8c5f39d
--- /dev/null
@@ -0,0 +1,161 @@
+{
+       "tca": {
+               "tname": "New_Set",
+               "tcaInt": "1",
+               "tcaVio": "1",
+               "eventName": {
+                       "vCPEvGMUXPacketLoss": "vCPEvGMUXPacketLoss",
+                       "vLoadBalancer": "vLoadBalancer",
+                       "vFirewallBroadcastPackets": "vFirewallBroadcastPackets"
+               },
+               "fieldPathM": {
+                       "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated": "receivedBroadcastPacketsAccumulated",
+                       "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta": "receivedDiscardedPacketsDelta"
+               },
+               "operator": {
+                       ">": "GREATER",
+                       ">=": "GREATER_OR_EQUAL",
+                       "=": "EQUAL",
+                       "<=": "LESS_OR_EQUAL",
+                       "<": "LESS"
+               },
+               "opsPolicy": {
+                       "POLICY_test_X": "POLICY_test_X",
+                       "POLICY_test_Y": "POLICY_test_Y"
+               },
+               "controlLoopSchemaType": {
+                       "": "",
+                       "VM": "VM",
+                       "VNF": "VNF"
+               },
+               "closedLoopEventStatus": {
+                       "": "",
+                       "ONSET": "ONSET",
+                       "ABATED": "ABATED"
+               }
+       },
+       "global": {
+               "actionSet": {
+                       "vnfRecipe": "VNF",
+                       "enbRecipe": "eNodeB"
+               },
+               "location": {
+                       "DC1": "Data Center 1",
+                       "DC2": "Data Center 2",
+                       "DC3": "Data Center 3"
+               }
+       },
+       "policy": {
+               "pname": "0",
+               "timeout": 345,
+               "vnfRecipe": {
+                       "": "",
+                       "restart": "Restart",
+                       "rebuild": "Rebuild",
+                       "migrate": "Migrate",
+                       "healthCheck": "Health Check"
+               },
+               "enbRecipe": {
+                       "": "",
+                       "reset": "Reset"
+               },
+               "maxRetries": "3",
+               "retryTimeLimit": 180,
+               "resource": {
+                       "vCTS": "vCTS",
+                       "v3CDB": "v3CDB",
+                       "vUDR": "vUDR",
+                       "vCOM": "vCOM",
+                       "vRAR": "vRAR",
+                       "vLCS": "vLCS",
+                       "vUDR-BE": "vUDR-BE",
+                       "vDBE": "vDBE"
+               },
+               "parentPolicyConditions": {
+                       "Failure_Retries": "Failure: Max Retries Exceeded",
+                       "Failure_Timeout": "Failure: Time Limit Exceeded",
+                       "Failure_Guard": "Failure: Guard",
+                       "Failure_Exception": "Failure: Exception",
+                       "Failure": "Failure: Other",
+                       "Success": "Success"
+               }
+       },
+       "shared": {
+               "byService": {
+                       "4cc5b45a-1f63-4194-8100-cd8e14248c92": {
+                               "vf": {
+                                       "07e266fc-49ab-4cd7-8378-ca4676f1b9ec": "vFirewall 0",
+                                       "023a3f0d-1161-45ff-b4cf-8918a8ccf3ad": "vPacketGen 0"
+                               }
+                       }
+               },
+               "byVf": {
+                       "07e266fc-49ab-4cd7-8378-ca4676f1b9ec": {
+                               "vfc": {
+                               },
+                               "kpi": {
+                                       "": ""
+                               }
+                       },
+                       "023a3f0d-1161-45ff-b4cf-8918a8ccf3ad": {
+                               "vfc": {
+                               },
+                               "kpi": {
+                                       "": ""
+                               }
+                       }
+               },
+               "byKpi": {
+               },
+               "byVfc": {
+                       "53ebeed7-84db-4638-b1f3-8ed44c75985b": {
+                               "alarmCondition": {
+                               },
+                               "alertDescription": {
+                               }
+                       },
+                       "1a12347c-6166-4d21-9861-b2c432722a23": {
+                               "alarmCondition": {
+                               },
+                               "alertDescription": {
+                               }
+                       },
+                       "74805001-19f5-4c2c-9928-03014161c32a": {
+                               "alarmCondition": {
+                               },
+                               "alertDescription": {
+                               }
+                       },
+                       "d66c0bce-d7e1-41ad-bdaf-468d442d0543": {
+                               "alarmCondition": {
+                               },
+                               "alertDescription": {
+                               }
+                       },
+                       "28142b9a-7925-4921-bc81-178c5bae4a9b": {
+                               "alarmCondition": {
+                               },
+                               "alertDescription": {
+                               }
+                       },
+                       "86769df9-139b-489f-949d-05efb7f0ed6a": {
+                               "alarmCondition": {
+                               },
+                               "alertDescription": {
+                               }
+                       }
+               },
+               "byAlarmCondition": {
+                       "": {
+                               "eventSourceType": "",
+                               "eventSeverity": ""
+                       }
+               },
+               "byAlertDescription": {
+                       "": {
+                               "eventSourceType": "",
+                               "eventSeverity": ""
+                       }
+               }
+       }
+}