2 * ============LICENSE_START========================================================================
3 * O-RAN-SC : oam/ccsdk feature sdnr wt
4 * =================================================================================================
5 * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved.
6 * =================================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software distributed under the License
13 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14 * or implied. See the License for the specific language governing permissions and limitations under
16 * ============LICENSE_END==========================================================================
18 package org.oransc.oam.features.devicemanager.oran.impl;
20 import java.util.ArrayList;
21 import java.util.List;
22 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.hardware.rev180313.hardware.Component;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.Inventory;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.InventoryBuilder;
25 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
31 public class ORanToInternalDataModel {
34 public Inventory getInternalEquipment(NodeId nodeId, Component component) {
36 InventoryBuilder inventoryBuilder = new InventoryBuilder();
39 inventoryBuilder.setNodeId(nodeId.getValue());
40 inventoryBuilder.setParentUuid(component.getParent());
41 inventoryBuilder.setTreeLevel(new Long(component.getParentRelPos()));
43 inventoryBuilder.setUuid(component.getUuid().getValue());
44 // -- String list with ids of holders
45 List<String> containerHolderKeyList = new ArrayList<>();
46 List<String> containerHolderList = component.getContainsChild();
47 if (containerHolderList != null) {
48 for (String containerHolder : containerHolderList) {
49 containerHolderKeyList.add(containerHolder);
52 inventoryBuilder.setContainedHolder(containerHolderKeyList);
53 // -- Manufacturer related things
54 inventoryBuilder.setManufacturerName(component.getName());
57 inventoryBuilder.setDescription(component.getDescription());
58 inventoryBuilder.setModelIdentifier(component.getModelName());
59 inventoryBuilder.setPartTypeId(component.getXmlClass().getName());
60 inventoryBuilder.setTypeName(component.getName());
61 inventoryBuilder.setVersion(component.getHardwareRev());
64 inventoryBuilder.setDate(component.getMfgDate().getValue());
65 inventoryBuilder.setSerial(component.getSerialNum());
67 return inventoryBuilder.build();