576267a2ea627b661159d511015bf2b6d2c7e633
[smo/teiv.git] /
1 /*
2  *  ============LICENSE_START=======================================================
3  *  Modifications Copyright (C) 2025 OpenInfra Foundation Europe
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
8  *
9  *        http://www.apache.org/licenses/LICENSE-2.0
10  *
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  *
17  *  SPDX-License-Identifier: Apache-2.0
18  *  ============LICENSE_END=========================================================
19  */
20 package org.oran.smo.ncmp_to_teiv_adapter;
21
22 import com.fasterxml.jackson.databind.ObjectMapper;
23 import com.fasterxml.jackson.databind.node.ArrayNode;
24 import com.fasterxml.jackson.databind.node.ObjectNode;
25
26 public class SmoPayloadBuilder {
27     private static final ObjectMapper objectMapper = new ObjectMapper();
28
29     public static String build() {
30         ArrayNode sourceIds = objectMapper.createArrayNode();
31         sourceIds.add("urn:oran:smo:teiv:SMO");
32         sourceIds.add("http://smo.o-ran-sc.org");
33         sourceIds.add("http://gateway.smo.o-ran-sc.org");
34         sourceIds.add("http://dentity.smo.o-ran-sc.org");
35         sourceIds.add("http://messages.smo.o-ran-sc.org");
36         sourceIds.add("http://kafka-bridge.smo.o-ran-sc.org");
37         sourceIds.add("http://kafka-ui.smo.o-ran-sc.org");
38         sourceIds.add("http://odlux.oam.smo.o-ran-sc.org");
39         sourceIds.add("http://flows.oam.smo.o-ran-sc.org");
40         sourceIds.add("http://tests.oam.smo.o-ran-sc.org");
41         sourceIds.add("http://ves-collector.dcn.smo.o-ran-sc.org");
42         sourceIds.add("http://controller.dcn.smo.o-ran-sc.org");
43         sourceIds.add("http://nginx-loadbalancer:80/ncmp/v1/ch");
44         ObjectNode attributes = objectMapper.createObjectNode();
45         attributes.put("smoName", "SMO");
46         ObjectNode smo = objectMapper.createObjectNode();
47         smo.put("id", "urn:oran:smo:teiv:SMO");
48         smo.set("sourceIds", sourceIds);
49         smo.set("attributes", attributes);
50         ArrayNode smoArray = objectMapper.createArrayNode();
51         smoArray.add(smo);
52         ObjectNode entity = objectMapper.createObjectNode();
53         entity.set("o-ran-smo-teiv-ran:SMO", smoArray);
54         ArrayNode entitiesArray = objectMapper.createArrayNode();
55         entitiesArray.add(entity);
56         ObjectNode root = objectMapper.createObjectNode();
57         root.set("entities", entitiesArray);
58         return root.toString();
59     }
60 }