3ded68537db75f50ba67e323f89b22d1d2c4eee9
[ccsdk/features.git] /
1 /*
2  * ============LICENSE_START========================================================================
3  * ONAP : 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
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
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
15  * the License.
16  * ============LICENSE_END==========================================================================
17  */
18 package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.equipment.test;
19
20 import static org.junit.Assert.*;
21
22 import java.util.Arrays;
23 import java.util.List;
24
25 import org.eclipse.jdt.annotation.NonNull;
26 import org.junit.Test;
27 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.WrapperPTPModelRev170208;
28 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.equipment.ExtendedEquipment;
29 import org.onap.ccsdk.features.sdnr.wt.yang.mapper.YangToolsMapperHelper;
30 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.Equipment;
31 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.EquipmentBuilder;
32 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId;
33 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.equipment.g.ContainedHolder;
34 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.equipment.g.ContainedHolderBuilder;
35 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.equipment.g.ManufacturedThing;
36 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.equipment.g.ManufacturedThingBuilder;
37 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.manufactured.thing.g.EquipmentInstance;
38 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.manufactured.thing.g.EquipmentInstanceBuilder;
39 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.manufactured.thing.g.EquipmentType;
40 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.manufactured.thing.g.EquipmentTypeBuilder;
41 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.manufactured.thing.g.ManufacturerProperties;
42 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.manufactured.thing.g.ManufacturerPropertiesBuilder;
43 import org.slf4j.Logger;
44 import org.slf4j.LoggerFactory;
45
46 public class TestExtendedEquipment {
47
48     UniversalId id = new UniversalId("1234567");
49     private static final String NODEID = "NODE1";
50     private static final Logger LOG = LoggerFactory.getLogger(TestExtendedEquipment.class);
51
52     @Test
53     public void test() {
54         final @NonNull List<ContainedHolder> holder = Arrays.asList(new ContainedHolderBuilder().setUuid(id).build());
55         final @NonNull ManufacturerProperties manufacturerProps = new ManufacturerPropertiesBuilder()
56                 .setManufacturerIdentifier("NOK").setManufacturerName("Nokia").build();
57
58         final @NonNull EquipmentType eqptType =
59                 new EquipmentTypeBuilder().setDescription("5G RAN Equipment").setModelIdentifier("NOK-987-1T")
60                         .setPartTypeIdentifier("ABCDEF").setTypeName("12345").setVersion("5T9V4567").build();
61
62         final @NonNull EquipmentInstance eqptInstance =
63                 new EquipmentInstanceBuilder().setAssetInstanceIdentifier("NOK1234-ABCD")
64                         .setManufactureDate("2020-02-11").setSerialNumber("123456ABCD").build();
65
66         final @NonNull ManufacturedThing manufacturedThing =
67                 new ManufacturedThingBuilder().setManufacturerProperties(manufacturerProps).setEquipmentType(eqptType)
68                         .setEquipmentInstance(eqptInstance).build();
69
70         Equipment equipment = new EquipmentBuilder().setUuid(id).setContainedHolder(YangToolsMapperHelper.toMap(holder))
71                 .setManufacturedThing(manufacturedThing).build();
72
73         ExtendedEquipment extEqpt = new ExtendedEquipment(NODEID, "1234567890", equipment, "/var/opt", 3);
74         assertEquals(extEqpt.getNodeId(), NODEID);
75         assertEquals(extEqpt.getParentUuid(), "1234567890");
76         assertEquals(extEqpt.getEquipment(), equipment);
77         LOG.info(extEqpt.toString());
78         extEqpt.getCreateInventoryInput();
79
80     }
81
82 }