2 * ============LICENSE_START=======================================================
3 * ONAP : ccsdk features
4 * ================================================================================
5 * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl;
24 import static org.mockito.Mockito.mock;
25 import static org.mockito.Mockito.when;
26 import org.junit.Test;
27 import org.junit.runner.RunWith;
28 import org.mockito.Mock;
29 import org.mockito.junit.MockitoJUnitRunner;
30 import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.ORanRegistrationToVESpnfRegistrationMapper;
31 import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorCfgService;
32 import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorService;
33 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
34 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.hardware.rev180313.hardware.Component;
35 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Host;
36 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
37 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode;
39 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
41 @RunWith(MockitoJUnitRunner.class)
42 public class TestORanRegistrationToVESpnfRegistration {
45 NetconfAccessor netconfAccessor;
47 VESCollectorService vesCollectorService;
49 VESCollectorCfgService vesCfgService;
51 private final int SEQUENCE_NO = 10;
55 String dateTimeString = "2020-02-05T12:30:45.283Z";
56 String name = "Slot-0";
58 NetconfNode testNetconfNode = mock(NetconfNode.class);
59 when(testNetconfNode.getHost()).thenReturn(new Host(new IpAddress(new Ipv4Address("10.10.10.10"))));
61 when(netconfAccessor.getNodeId()).thenReturn(new NodeId("nSky"));
62 when(netconfAccessor.getNetconfNode()).thenReturn(testNetconfNode);
63 when(vesCollectorService.getConfig()).thenReturn(vesCfgService);
64 when(vesCfgService.getReportingEntityName()).thenReturn("SDN-R");
65 Component testComponent = ComponentHelper.get(name, dateTimeString);
67 ORanRegistrationToVESpnfRegistrationMapper mapper = new ORanRegistrationToVESpnfRegistrationMapper(netconfAccessor, vesCollectorService);
68 mapper.mapCommonEventHeader(testComponent);
69 mapper.mapPNFRegistrationFields(testComponent);