/*
* ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
+ * O-RAN-SC : oam/ccsdk feature sdnr wt
* =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
+ * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved.
* =================================================================================================
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class DeviceManagerORanImpl implements AutoCloseable {
+public class DeviceManagerORanImpl implements AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(DeviceManagerORanImpl.class);
private static final String APPLICATION_NAME = "DeviceManagerORan";
+++ /dev/null
-/*
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
- * =================================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- * ============LICENSE_END==========================================================================
- */
-/**
- *
- */
-package org.oransc.oam.features.devicemanager.oran.impl;
-
-import java.util.Optional;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElementService;
-import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.NetworkElementDeviceType;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @author herbert
- *
- */
-public class NtsNetworkElement implements NetworkElement {
-
- private static final Logger LOG = LoggerFactory.getLogger(NtsNetworkElement.class);
-
- private final NetconfAccessor netconfAccessor;
-
- @SuppressWarnings("unused")
- private final DataProvider databaseService;
-
- NtsNetworkElement(NetconfAccessor netconfAccess, DataProvider databaseService) {
- LOG.info("Create {}",NtsNetworkElement.class.getSimpleName());
- this.netconfAccessor = netconfAccess;
- this.databaseService = databaseService;
- }
-
- @Override
- public void deregister() {
- }
-
- @Override
- public NodeId getNodeId() {
- return netconfAccessor.getNodeId();
- }
-
- @Override
- public <L extends NetworkElementService> Optional<L> getService(Class<L> clazz) {
- return Optional.empty();
- }
-
- @Override
- public void warmstart() {
- }
-
- @Override
- public void register() {
- }
-
- @Override
- public NetworkElementDeviceType getDeviceType() {
- return NetworkElementDeviceType.NtsManager;
- }
-
- @Override
- public Optional<NetconfAccessor> getAcessor() {
- return Optional.of(this.netconfAccessor);
- }
-}
/*
* ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
+ * O-RAN-SC : oam/ccsdk feature sdnr wt
* =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
+ * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved.
* =================================================================================================
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
/**
* Listener for change notifications
*/
-public class ORanChangeNotificationListener implements IetfNetconfNotificationsListener {
+public class ORanChangeNotificationListener implements IetfNetconfNotificationsListener {
private static final Logger log = LoggerFactory.getLogger(ORanChangeNotificationListener.class);
/*
* ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
+ * O-RAN-SC : oam/ccsdk feature sdnr wt
* =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
+ * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved.
* =================================================================================================
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
/*
* ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
+ * O-RAN-SC : oam/ccsdk feature sdnr wt
* =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
+ * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved.
* =================================================================================================
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
private @NonNull final ORanFaultNotificationListener oRanFaultListener;
ORanNetworkElement(NetconfAccessor netconfAccess, DataProvider databaseService) {
- log.info("Create {}",ORanNetworkElement.class.getSimpleName());
+ log.info("Create {}", ORanNetworkElement.class.getSimpleName());
this.netconfAccessor = netconfAccess;
this.databaseService = databaseService;
List<Component> componentList = hardware.getComponent();
if (componentList != null) {
for (Component component : componentList) {
- databaseService.writeInventory( oRanMapper.getInternalEquipment(netconfAccessor.getNodeId(), component));
+ databaseService
+ .writeInventory(oRanMapper.getInternalEquipment(netconfAccessor.getNodeId(), component));
}
}
}
log.info("DBRead Get equipment for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(),
accessData.getNodeId().getValue());
- InstanceIdentifier<Hardware> hardwareIID =
- InstanceIdentifier.builder(clazzPac).build();
+ InstanceIdentifier<Hardware> hardwareIID = InstanceIdentifier.builder(clazzPac).build();
- Hardware res = accessData.getTransactionUtils().readData(accessData.getDataBroker(), LogicalDatastoreType.OPERATIONAL,
- hardwareIID);
+ Hardware res = accessData.getTransactionUtils().readData(accessData.getDataBroker(),
+ LogicalDatastoreType.OPERATIONAL, hardwareIID);
return res;
}
}
if (oRanFaultListenerRegistrationResult != null) {
this.oRanFaultListenerRegistrationResult.close();
- };
+ } ;
}
}
@Override
- public void warmstart() {
- }
+ public void warmstart() {}
@Override
public Optional<NetconfAccessor> getAcessor() {
/*
* ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
+ * O-RAN-SC : oam/ccsdk feature sdnr wt
* =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
+ * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved.
* =================================================================================================
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.factory.NetworkElementFactory;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
import org.opendaylight.yang.gen.v1.urn.o.ran.hardware._1._0.rev190328.ORANHWCOMPONENT;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.network.topology.simulator.rev191025.SimulatorStatus;
+import org.opendaylight.yangtools.yang.common.QName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ORanNetworkElementFactory implements NetworkElementFactory {
private static final Logger log = LoggerFactory.getLogger(ORanNetworkElementFactory.class);
+ //Workaround
+ private static final QName OneCell =
+ QName.create("urn:onf:otcc:wireless:yang:radio-access:commscope-onecell", "2020-06-22", "onecell").intern();
+
@Override
public Optional<NetworkElement> create(NetconfAccessor acessor, DeviceManagerServiceProvider serviceProvider) {
- if (acessor.getCapabilites().isSupportingNamespace(ORANHWCOMPONENT.QNAME)) {
- log.info("Create device {} ",ORanNetworkElement.class.getName());
- return Optional.of(new ORanNetworkElement(acessor, serviceProvider.getDataProvider()));
- } else if (acessor.getCapabilites().isSupportingNamespace(SimulatorStatus.QNAME)) {
- log.info("Create device {} ",NtsNetworkElement.class.getName());
- return Optional.of(new NtsNetworkElement(acessor, serviceProvider.getDataProvider()));
- } else {
- return Optional.empty();
+ Capabilities capabilites = acessor.getCapabilites();
+ if (!capabilites.isSupportingNamespace(OneCell)) {
+ if (capabilites.isSupportingNamespace(ORANHWCOMPONENT.QNAME)) {
+ log.info("Create device {} ", ORanNetworkElement.class.getName());
+ return Optional.of(new ORanNetworkElement(acessor, serviceProvider.getDataProvider()));
+ }
}
+ return Optional.empty();
}
}
/**
* ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
+ * O-RAN-SC : oam/ccsdk feature sdnr wt
* =================================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
+ * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved.
* =================================================================================================
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
+/*
+ * ============LICENSE_START========================================================================
+ * O-RAN-SC : oam/ccsdk feature sdnr wt
+ * =================================================================================================
+ * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved.
+ * =================================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ * ============LICENSE_END==========================================================================
+ */
package org.oransc.oam.features.devicemanager.oran.test;
-import java.io.File;
-import java.io.FileNotFoundException;
+import static org.mockito.Mockito.mock;
import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NetconfNetworkElementService;
import org.oransc.oam.features.devicemanager.oran.impl.DeviceManagerORanImpl;
-import org.oransc.oam.features.devicemanager.oran.impl.ORanNetworkElementFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
public class TestDeviceManagerORanImpl {
- private static Path KARAF_ETC = Paths.get("etc");
- private static final Logger LOG = LoggerFactory.getLogger(TestDeviceManagerORanImpl.class);
- DeviceManagerORanImpl devMgrOran;
-
- @Before
- public void init() throws InterruptedException, IOException {
- /*System.out.println("Logger: " + LOG.getClass().getName() + " " + LOG.getName());
- Path etc = KARAF_ETC;
- delete(etc);
-
- System.out.println("Create empty:" + etc.toString());
- Files.createDirectories(etc);*/
- }
-
- @Test
- public void test() throws Exception {
- devMgrOran = new DeviceManagerORanImpl();
- /*DeviceManagerImpl devMgr = new DeviceManagerImpl();
-
- try {
- devMgr.init();
- devMgrOran.setNetconfNetworkElementService(devMgr);
- devMgrOran.init();
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }*/
- /*
- * devMgrOran.setNetconfNetworkElementService(null); devMgrOran.init();
- * NetconfNetworkElementService netConfNetworkElementService =
- * mock(NetconfNetworkElementService.class); devMgrOran =
- * mock(DeviceManagerORanImpl.class);
- * when(netConfNetworkElementService.registerNetworkElementFactory(new
- * ORanNetworkElementFactory())).thenReturn(null);
- */
-
-
- }
-
- @After
- public void cleanUp() throws Exception {
- devMgrOran.close();
- }
-
- private static void delete(Path etc) throws IOException {
- if (Files.exists(etc)) {
- System.out.println("Found, removing:" + etc.toString());
- delete(etc.toFile());
+ DeviceManagerORanImpl devMgrOran;
+
+ @Before
+ public void init() throws InterruptedException, IOException {}
+
+ @Test
+ public void test() throws Exception {
+ devMgrOran = new DeviceManagerORanImpl();
+ NetconfNetworkElementService netconfNetworkElementService = mock(NetconfNetworkElementService.class);
+
+ try {
+ devMgrOran.setNetconfNetworkElementService(netconfNetworkElementService);
+ devMgrOran.init();
+ } catch (Exception e) {
+ throw e;
}
}
- private static void delete(File f) throws IOException {
- if (f.isDirectory()) {
- for (File c : f.listFiles()) {
- delete(c);
- }
- }
- if (!f.delete()) {
- throw new FileNotFoundException("Failed to delete file: " + f);
- }
+ @After
+ public void cleanUp() throws Exception {
+ devMgrOran.close();
}
}
+/*
+ * ============LICENSE_START========================================================================
+ * O-RAN-SC : oam/ccsdk feature sdnr wt
+ * =================================================================================================
+ * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved.
+ * =================================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ * ============LICENSE_END==========================================================================
+ */
package org.oransc.oam.features.devicemanager.oran.test;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana.hardware.rev180313.HardwareClass;
/*
* ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
+ * O-RAN-SC : oam/ccsdk feature sdnr wt
* =================================================================================================
* Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved.
* =================================================================================================
package org.oransc.oam.features.devicemanager.oran.test;
-import static org.mockito.Mockito.*;
-
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import java.util.Arrays;
import java.util.List;
-
import org.eclipse.jdt.annotation.NonNull;
import org.junit.Test;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
public class TestORanChangeNotificationListener {
- private static final String NODEID = "node1";
+ private static final String NODEID = "node1";
+
+ @Test
+ public void test() {
- @Test
- public void test() {
+ NetconfAccessor netconfAccessor = mock(NetconfAccessor.class);
+ DataProvider databaseService = mock(DataProvider.class);
+ ORanChangeNotificationListener notifListener =
+ new ORanChangeNotificationListener(netconfAccessor, databaseService);
+ when(netconfAccessor.getNodeId()).thenReturn(new NodeId(NODEID));
+ Iterable<? extends PathArgument> pathArguments = Arrays.asList(new PathArgument() {
- NetconfAccessor netconfAccessor = mock(NetconfAccessor.class);
- DataProvider databaseService = mock(DataProvider.class);
- ORanChangeNotificationListener notifListener = new ORanChangeNotificationListener(netconfAccessor,
- databaseService);
- when(netconfAccessor.getNodeId()).thenReturn(new NodeId(NODEID));
- Iterable<? extends PathArgument> pathArguments = Arrays.asList(new PathArgument() {
+ @Override
+ public int compareTo(PathArgument arg0) {
+ return 0;
+ }
- @Override
- public int compareTo(PathArgument arg0) {
- return 0;
- }
+ @Override
+ public Class<? extends DataObject> getType() {
+ return DataObject.class;
+ }
+ });
+ InstanceIdentifier<?> target = InstanceIdentifier.create(pathArguments);
- @Override
- public Class<? extends DataObject> getType() {
- return DataObject.class;
- }
- });
- InstanceIdentifier<?> target = InstanceIdentifier.create(pathArguments);
+ notifListener.onNetconfConfigChange(createNotification(EditOperationType.Create, target));
+ EventlogEntity event = new EventlogBuilder().setNodeId(NODEID)
+ .setNewValue(String.valueOf(EditOperationType.Create)).setObjectId(target.toString()).build();
+ verify(databaseService).writeEventLog(event);
- notifListener.onNetconfConfigChange(createNotification(EditOperationType.Create,target));
- EventlogEntity event = new EventlogBuilder().setNodeId(NODEID)
- .setNewValue(String.valueOf(EditOperationType.Create)).setObjectId(target.toString()).build();
- verify(databaseService).writeEventLog(event);
+ }
- }
+ /**
+ * @param type
+ * @return
+ */
+ private static NetconfConfigChange createNotification(EditOperationType type, InstanceIdentifier<?> target) {
+ NetconfConfigChange change = mock(NetconfConfigChange.class);
- /**
- * @param type
- * @return
- */
- private static NetconfConfigChange createNotification(EditOperationType type,InstanceIdentifier<?> target) {
- NetconfConfigChange change = mock(NetconfConfigChange.class);
-
- @SuppressWarnings("null")
- final @NonNull List<Edit> edits = Arrays.asList(new EditBuilder().setOperation(type).setTarget(target).build());
- when(change.nonnullEdit()).thenReturn(edits);
- return change;
- }
+ @SuppressWarnings("null")
+ final @NonNull List<Edit> edits = Arrays.asList(new EditBuilder().setOperation(type).setTarget(target).build());
+ when(change.nonnullEdit()).thenReturn(edits);
+ return change;
+ }
}
/*
* ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
+ * O-RAN-SC : oam/ccsdk feature sdnr wt
* =================================================================================================
* Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved.
* =================================================================================================
public class TestORanFaultNotificationListener {
- @Test
- public void test() {
- ORanFaultNotificationListener faultListener = new ORanFaultNotificationListener();
- faultListener.onAlarmNotif(null);
- }
+ @Test
+ public void test() {
+ ORanFaultNotificationListener faultListener = new ORanFaultNotificationListener();
+ faultListener.onAlarmNotif(null);
+ }
}
/*
* ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
+ * O-RAN-SC : oam/ccsdk feature sdnr wt
* =================================================================================================
* Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved.
* =================================================================================================
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
-import static org.mockito.Mockito.*;
-
-import java.util.Optional;
import java.io.IOException;
+import java.util.Optional;
import org.junit.After;
import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities;
import org.opendaylight.yang.gen.v1.urn.o.ran.hardware._1._0.rev190328.ORANHWCOMPONENT;
import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.network.topology.simulator.rev191025.SimulatorStatus;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
import org.oransc.oam.features.devicemanager.oran.impl.ORanNetworkElementFactory;
import org.oransc.oam.features.devicemanager.oran.test.mock.NetconfAccessorMock;
import org.oransc.oam.features.devicemanager.oran.test.mock.TransactionUtilsMock;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
-import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities;
public class TestORanNetworkElement {
/*
* ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
+ * O-RAN-SC : oam/ccsdk feature sdnr wt
* =================================================================================================
* Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved.
* =================================================================================================
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-
import java.io.IOException;
import org.junit.After;
import org.junit.BeforeClass;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
import org.opendaylight.yang.gen.v1.urn.o.ran.hardware._1._0.rev190328.ORANHWCOMPONENT;
-import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.network.topology.simulator.rev191025.SimulatorStatus;
import org.opendaylight.yangtools.yang.common.QName;
import org.oransc.oam.features.devicemanager.oran.impl.ORanNetworkElementFactory;
import org.oransc.oam.features.devicemanager.oran.test.mock.NetconfAccessorMock;
public class TestORanNetworkElementFactory {
- static NetconfAccessor accessor;
- static DeviceManagerServiceProvider serviceProvider;
- static Capabilities capabilities;
- QName qCapability;
+ static NetconfAccessor accessor;
+ static DeviceManagerServiceProvider serviceProvider;
+ static Capabilities capabilities;
+ QName qCapability;
+
+ @BeforeClass
+ public static void init() throws InterruptedException, IOException {
+ capabilities = mock(Capabilities.class);
+ accessor = mock(NetconfAccessorMock.class);
+ serviceProvider = mock(DeviceManagerServiceProvider.class);
+
+ when(accessor.getCapabilites()).thenReturn(capabilities);
+ when(serviceProvider.getDataProvider()).thenReturn(null);
+
- @BeforeClass
- public static void init() throws InterruptedException, IOException {
- capabilities = mock(Capabilities.class);
- accessor = mock(NetconfAccessorMock.class);
- serviceProvider = mock(DeviceManagerServiceProvider.class);
-
- when(accessor.getCapabilites()).thenReturn(capabilities);
- when(serviceProvider.getDataProvider()).thenReturn(null);
+ }
-
- }
+ @Test
+ public void testCreateORANHWComponent() throws Exception {
+ when(accessor.getCapabilites().isSupportingNamespace(ORANHWCOMPONENT.QNAME)).thenReturn(true);
+ ORanNetworkElementFactory factory = new ORanNetworkElementFactory();
+ assertTrue((factory.create(accessor, serviceProvider)).isPresent());
+ }
- @Test
- public void testCreateORANHWComponent() throws Exception {
- when(accessor.getCapabilites().isSupportingNamespace(ORANHWCOMPONENT.QNAME)).thenReturn(true);
- when(accessor.getCapabilites().isSupportingNamespace(SimulatorStatus.QNAME)).thenReturn(false);
- ORanNetworkElementFactory factory = new ORanNetworkElementFactory();
- assertTrue((factory.create(accessor, serviceProvider)).isPresent());
- }
+ @Test
+ public void testCreateNone() throws Exception {
+ when(accessor.getCapabilites().isSupportingNamespace(ORANHWCOMPONENT.QNAME)).thenReturn(false);
+ ORanNetworkElementFactory factory = new ORanNetworkElementFactory();
+ assertTrue(!(factory.create(accessor, serviceProvider).isPresent()));
+ }
- @Test
- public void testCreateSimulator() throws Exception {
- when(accessor.getCapabilites().isSupportingNamespace(ORANHWCOMPONENT.QNAME)).thenReturn(false);
- when(accessor.getCapabilites().isSupportingNamespace(SimulatorStatus.QNAME)).thenReturn(true);
- ORanNetworkElementFactory factory = new ORanNetworkElementFactory();
- assertTrue(factory.create(accessor, serviceProvider).isPresent());
- }
-
- @Test
- public void testCreateNone() throws Exception {
- when(accessor.getCapabilites().isSupportingNamespace(ORANHWCOMPONENT.QNAME)).thenReturn(false);
- when(accessor.getCapabilites().isSupportingNamespace(SimulatorStatus.QNAME)).thenReturn(false);
- ORanNetworkElementFactory factory = new ORanNetworkElementFactory();
- assertTrue(!(factory.create(accessor, serviceProvider).isPresent()));
- }
-
- @After
- public void cleanUp() throws Exception {
+ @After
+ public void cleanUp() throws Exception {
- }
+ }
}
/*
* ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
+ * O-RAN-SC : oam/ccsdk feature sdnr wt
* =================================================================================================
* Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved.
* =================================================================================================
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-
-import java.util.List;
-import java.util.Optional;
import java.io.IOException;
import java.util.ArrayList;
-
-import org.eclipse.jdt.annotation.Nullable;
+import java.util.List;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
import org.oransc.oam.features.devicemanager.oran.impl.ORanToInternalDataModel;
-import org.oransc.oam.features.devicemanager.oran.test.TestHardwareClass;
public class TestORanToInternalDataModel {
- NodeId nodeId;
- Component component;
+ NodeId nodeId;
+ Component component;
+
+ @SuppressWarnings("unchecked")
+ @Before
+ public void init() throws InterruptedException, IOException {
+ nodeId = mock(NodeId.class);
+ component = mock(Component.class);
+
+ when(nodeId.getValue()).thenReturn("ORan-1000");
+ when(component.getParent()).thenReturn("Shelf");
+ when(component.getParentRelPos()).thenReturn(0);
+ when(component.getUuid()).thenReturn(new Uuid("0Aabcdef-0abc-0cfD-0abC-0123456789AB"));
- @SuppressWarnings("unchecked")
- @Before
- public void init() throws InterruptedException, IOException {
- nodeId = mock(NodeId.class);
- component = mock(Component.class);
+ List<String> list = new ArrayList<String>();
+ list.add("Card-01A");
+ list.add("Card-01B");
- when(nodeId.getValue()).thenReturn("ORan-1000");
- when(component.getParent()).thenReturn("Shelf");
- when(component.getParentRelPos()).thenReturn(0);
- when(component.getUuid()).thenReturn(new Uuid("0Aabcdef-0abc-0cfD-0abC-0123456789AB"));
+ when(component.getContainsChild()).thenReturn(list);
+ when(component.getName()).thenReturn("Nokia");
+ when(component.getDescription()).thenReturn("ORAN Network Element NO-456");
+ Class<? extends HardwareClass> hwClass = TestHardwareClass.class;
+ Mockito.<Class<? extends HardwareClass>>when(component.getXmlClass()).thenReturn(hwClass);
- List<String> list = new ArrayList<String>();
- list.add("Card-01A");
- list.add("Card-01B");
+ DateAndTime dt = new DateAndTime("2020-02-05T12:30:45.283Z");
+ when(component.getMfgDate()).thenReturn(dt);
- when (component.getContainsChild()).thenReturn(list);
- when (component.getName()).thenReturn("Nokia");
- when (component.getDescription()).thenReturn("ORAN Network Element NO-456");
- Class<? extends HardwareClass> hwClass = TestHardwareClass.class;
- Mockito.<Class<? extends HardwareClass>>when(component.getXmlClass()).thenReturn(hwClass);
-
- DateAndTime dt = new DateAndTime("2020-02-05T12:30:45.283Z");
- when (component.getMfgDate()).thenReturn(dt);
-
- }
+ }
- @Test
- public void test() throws Exception {
- ORanToInternalDataModel model = new ORanToInternalDataModel();
- model.getInternalEquipment(nodeId, component);
- assertEquals(component.getUuid().getValue(), "0Aabcdef-0abc-0cfD-0abC-0123456789AB");
- assertEquals(component.getMfgDate().getValue(), "2020-02-05T12:30:45.283Z");
+ @Test
+ public void test() throws Exception {
+ ORanToInternalDataModel model = new ORanToInternalDataModel();
+ model.getInternalEquipment(nodeId, component);
+ assertEquals(component.getUuid().getValue(), "0Aabcdef-0abc-0cfD-0abC-0123456789AB");
+ assertEquals(component.getMfgDate().getValue(), "2020-02-05T12:30:45.283Z");
- }
+ }
- @After
- public void cleanUp() throws Exception {
+ @After
+ public void cleanUp() throws Exception {
- }
+ }
}
/*
* ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
+ * O-RAN-SC : oam/ccsdk feature sdnr wt
* =================================================================================================
* Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved.
* =================================================================================================
/*
* ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
+ * O-RAN-SC : oam/ccsdk feature sdnr wt
* =================================================================================================
* Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved.
* =================================================================================================
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
-
import org.eclipse.jdt.annotation.Nullable;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils;
import org.opendaylight.mdsal.binding.api.DataBroker;
public class TransactionUtilsMock implements TransactionUtils {
- @Override
- public <T extends DataObject> @Nullable T readData(DataBroker dataBroker, LogicalDatastoreType dataStoreType,
- InstanceIdentifier<T> iid) {
- // TODO Auto-generated method stub
- return null;
- }
+ @Override
+ public <T extends DataObject> @Nullable T readData(DataBroker dataBroker, LogicalDatastoreType dataStoreType,
+ InstanceIdentifier<T> iid) {
+ // TODO Auto-generated method stub
+ return null;
+ }
- @Override
- public <T extends DataObject> @Nullable T readDataOptionalWithStatus(DataBroker dataBroker,
- LogicalDatastoreType dataStoreType, InstanceIdentifier<T> iid, AtomicBoolean noErrorIndication,
- AtomicReference<String> statusIndicator) {
- // TODO Auto-generated method stub
- return null;
- }
+ @Override
+ public <T extends DataObject> @Nullable T readDataOptionalWithStatus(DataBroker dataBroker,
+ LogicalDatastoreType dataStoreType, InstanceIdentifier<T> iid, AtomicBoolean noErrorIndication,
+ AtomicReference<String> statusIndicator) {
+ // TODO Auto-generated method stub
+ return null;
+ }
}