2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END============================================
20 * ===================================================================
21 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
24 package org.onap.clamp.clds.model.prop;
26 import com.att.eelf.configuration.EELFLogger;
27 import com.att.eelf.configuration.EELFManager;
28 import com.fasterxml.jackson.databind.JsonNode;
30 import java.util.ArrayList;
31 import java.util.Iterator;
32 import java.util.List;
35 * Parse Resource Group json properties.
38 * {"TCA_0aji7go":{"Group1":[{"name":"rgname","value":"1493749598520"},{
39 * "name":"rgfriendlyname","value":"Group1"},{"name":"policyName","value":
40 * "Policy1"},{"name":"policyId","value":"1"},{"serviceConfigurations":[[{"name"
41 * :"aaiMatchingFields","value":["complex.city","vserver.vserver-name"]},{"name"
42 * :"aaiSendFields","value":["complex.city","vserver.vserver-name"]},{"name":
43 * "eventSeverity","value":["OK"]},{"name":"eventSourceType","value":[""]},{
44 * "name":"timeWindow","value":["100"]},{"name":"ageLimit","value":["100"]},{
45 * "name":"createClosedLoopEventId","value":["Initial"]},{"name":
46 * "outputEventName","value":["ONSET"]}]]}],"Group2":[{"name":"rgname","value":
47 * "1493749665149"},{"name":"rgfriendlyname","value":"Group2"},{"name":
48 * "policyName","value":"Policy2"},{"name":"policyId","value":"2"},{
49 * "serviceConfigurations":[[{"name":"aaiMatchingFields","value":[
50 * "cloud-region.identity-url","vserver.vserver-name"]},{"name":"aaiSendFields",
51 * "value":["cloud-region.identity-url","vserver.vserver-name"]},{"name":
52 * "eventSeverity","value":["NORMAL"]},{"name":"eventSourceType","value":[""]},{
53 * "name":"timeWindow","value":["1000"]},{"name":"ageLimit","value":["1000"]},{
54 * "name":"createClosedLoopEventId","value":["Initial"]},{"name":
55 * "outputEventName","value":["ONSET"]}],[{"name":"aaiMatchingFields","value":[
56 * "generic-vnf.vnf-name","vserver.vserver-name"]},{"name":"aaiSendFields",
57 * "value":["generic-vnf.vnf-name","vserver.vserver-name"]},{"name":
58 * "eventSeverity","value":["CRITICAL"]},{"name":"eventSourceType","value":[""]}
59 * ,{"name":"timeWindow","value":["3000"]},{"name":"ageLimit","value":["3000"]},
60 * {"name":"createClosedLoopEventId","value":["Initial"]},{"name":
61 * "outputEventName","value":["ABATED"]}]]}]}}
64 public class ResourceGroup {
66 protected static final EELFLogger logger = EELFManager.getInstance().getLogger(ResourceGroup.class);
67 protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
69 private String groupNumber;
70 private String policyId;
71 private List<ServiceConfiguration> serviceConfigurations;
74 * Parse String Match Resource Group given json node.
79 public ResourceGroup(JsonNode node) {
81 groupNumber = AbstractModelElement.getValueByName(node, "rgname");
82 policyId = AbstractModelElement.getValueByName(node, "policyId");
84 // process Server_Configurations
85 JsonNode serviceConfigurationsNode = node.get(node.size() - 1).get("serviceConfigurations");
86 Iterator<JsonNode> itr = serviceConfigurationsNode.elements();
87 serviceConfigurations = new ArrayList<>();
88 while (itr.hasNext()) {
89 serviceConfigurations.add(new ServiceConfiguration(itr.next()));
94 * @return the groupNumber
96 public String getGroupNumber() {
101 * @return the policyId
103 public String getPolicyId() {
108 * @return the serviceConfigurations
110 public List<ServiceConfiguration> getServiceConfigurations() {
111 return serviceConfigurations;