2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2022 AT&T Intellectual Property. All rights reserved.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 * ============LICENSE_END=========================================================
19 package org.onap.policy.controlloop.actor.cds.properties;
21 import java.util.LinkedHashMap;
22 import java.util.List;
25 import lombok.EqualsAndHashCode;
26 import org.onap.policy.controlloop.actor.cds.GrpcOperation;
27 import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
28 import org.onap.policy.controlloop.actorserviceprovider.Util;
31 * GRPC Operation with PNF properties.
35 @EqualsAndHashCode(callSuper = true)
36 public class GrpcOperationPnfProperties extends GrpcOperationProperties {
39 protected static final List<String> PNF_PROPERTY_NAMES = List.of(
40 OperationProperties.AAI_PNF,
41 OperationProperties.EVENT_ADDITIONAL_PARAMS,
42 OperationProperties.OPT_CDS_GRPC_AAI_PROPERTIES);
46 public List<String> getPropertyNames() {
47 return PNF_PROPERTY_NAMES;
51 public Map<String, String> convertToAaiProperties(GrpcOperation operation) {
52 Map<String, String> result = operation.getProperty(OperationProperties.OPT_CDS_GRPC_AAI_PROPERTIES);
57 Object pnfData = operation.getRequiredProperty(OperationProperties.AAI_PNF, "PNF");
58 Map<String, Object> source = Util.translateToMap(operation.getFullName(), pnfData);
60 result = new LinkedHashMap<>();
62 for (Map.Entry<String, Object> ent : source.entrySet()) {
63 result.put(AAI_PNF_PREFIX + ent.getKey(), ent.getValue().toString());