f55ef4afc5fe5511629e084c4cbc26a38320fe85
[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.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.Equipment;
30 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.EquipmentBuilder;
31 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId;
32 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.equipment.g.ContainedHolder;
33 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.equipment.g.ContainedHolderBuilder;
34 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.equipment.g.ManufacturedThing;
35 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.equipment.g.ManufacturedThingBuilder;
36 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.manufactured.thing.g.EquipmentInstance;
37 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.manufactured.thing.g.EquipmentInstanceBuilder;
38 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.manufactured.thing.g.EquipmentType;
39 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.manufactured.thing.g.EquipmentTypeBuilder;
40 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.manufactured.thing.g.ManufacturerProperties;
41 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.manufactured.thing.g.ManufacturerPropertiesBuilder;
42 import org.slf4j.Logger;
43 import org.slf4j.LoggerFactory;
44
45 public class TestExtendedEquipment {
46
47         UniversalId id = new UniversalId("1234567");
48         private static final String NODEID = "NODE1";
49         private static final Logger LOG = LoggerFactory.getLogger(TestExtendedEquipment.class);
50         
51         @Test
52         public void test() {
53                 final @NonNull List<ContainedHolder> holder = Arrays.asList(new ContainedHolderBuilder().setUuid(id).build());
54                 final @NonNull ManufacturerProperties manufacturerProps = new ManufacturerPropertiesBuilder()
55                                                                                                                                                                 .setManufacturerIdentifier("NOK")
56                                                                                                                                                                 .setManufacturerName("Nokia").build();
57                 
58                 final @NonNull EquipmentType eqptType = new EquipmentTypeBuilder()
59                                                                                                                                         .setDescription("5G RAN Equipment")
60                                                                                                                                         .setModelIdentifier("NOK-987-1T")
61                                                                                                                                         .setPartTypeIdentifier("ABCDEF")
62                                                                                                                                         .setTypeName("12345")
63                                                                                                                                         .setVersion("5T9V4567")
64                                                                                                                                         .build();
65                 
66                 final @NonNull EquipmentInstance eqptInstance = new EquipmentInstanceBuilder()
67                                                                                                                                         .setAssetInstanceIdentifier("NOK1234-ABCD")
68                                                                                                                                         .setManufactureDate("2020-02-11")
69                                                                                                                                         .setSerialNumber("123456ABCD").build();
70                 
71                 final @NonNull ManufacturedThing manufacturedThing = new ManufacturedThingBuilder()
72                                                                                                                                                 .setManufacturerProperties(manufacturerProps)
73                                                                                                                                                 .setEquipmentType(eqptType)
74                                                                                                                                                 .setEquipmentInstance(eqptInstance).build(); 
75                 
76                 Equipment equipment = new EquipmentBuilder().setUuid(id).setContainedHolder(holder).setManufacturedThing(manufacturedThing).build();
77                 
78                 ExtendedEquipment extEqpt = new ExtendedEquipment(NODEID, "1234567890", equipment, "/var/opt", 3);
79                 assertEquals(extEqpt.getNodeId(), NODEID);
80                 assertEquals(extEqpt.getParentUuid(), "1234567890");
81                 assertEquals(extEqpt.getEquipment(), equipment);
82                 LOG.info(extEqpt.toString());
83                 extEqpt.getCreateInventoryInput();
84                 
85         }
86
87 }