2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Modifications Copyright (c) 2019 Samsung
8 * ================================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END=========================================================
23 package org.onap.so.adapters.network;
26 import com.fasterxml.jackson.annotation.JsonProperty;
27 import com.fasterxml.jackson.databind.JsonNode;
28 import com.fasterxml.jackson.databind.ObjectMapper;
29 import org.onap.so.logger.ErrorCode;
30 import org.onap.so.logger.MessageEnum;
31 import org.slf4j.Logger;
32 import org.slf4j.LoggerFactory;
34 public class ContrailPolicyRef {
36 private static final Logger logger = LoggerFactory.getLogger(ContrailPolicyRef.class);
38 @JsonProperty("network_policy_refs_data_sequence")
39 private ContrailPolicyRefSeq seq;
41 public JsonNode toJsonNode()
46 ObjectMapper mapper = new ObjectMapper();
47 node = mapper.convertValue(this, JsonNode.class);
51 logger.error("{} {} Error creating JsonString for Contrail Policy Ref: ", MessageEnum.RA_MARSHING_ERROR,
52 ErrorCode.SchemaError.getValue(), e);
58 public String toJsonString()
60 String jsonString = null;
63 ObjectMapper mapper = new ObjectMapper();
64 jsonString = mapper.writeValueAsString(this);
68 logger.error("{} {} Error creating JsonString for Contrail Policy Ref: ", MessageEnum.RA_MARSHING_ERROR,
69 ErrorCode.SchemaError.getValue(), e);
75 public void populate(String major, String minor)
77 seq = new ContrailPolicyRefSeq(major, minor);