Upgrade devicemanager-oran minus NTSim functionality 62/4562/3
authorRavi Pendurty <ravi.pendurty@highstreet-technologies.com>
Thu, 20 Aug 2020 06:12:40 +0000 (08:12 +0200)
committerRavi Pendurty <ravi.pendurty@highstreet-technologies.com>
Thu, 20 Aug 2020 11:51:57 +0000 (13:51 +0200)
Upgrade devicemanager-oran minus NTSim functionality

Issue-ID: OAM-151
Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Change-Id: I41078b0beb23c9cc49679c7f4c6f8598aa437890
Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
16 files changed:
features/devicemanager/o-ran/ru-fh/provider/src/main/java/org/oransc/oam/features/devicemanager/oran/impl/DeviceManagerORanImpl.java
features/devicemanager/o-ran/ru-fh/provider/src/main/java/org/oransc/oam/features/devicemanager/oran/impl/NtsNetworkElement.java [deleted file]
features/devicemanager/o-ran/ru-fh/provider/src/main/java/org/oransc/oam/features/devicemanager/oran/impl/ORanChangeNotificationListener.java
features/devicemanager/o-ran/ru-fh/provider/src/main/java/org/oransc/oam/features/devicemanager/oran/impl/ORanFaultNotificationListener.java
features/devicemanager/o-ran/ru-fh/provider/src/main/java/org/oransc/oam/features/devicemanager/oran/impl/ORanNetworkElement.java
features/devicemanager/o-ran/ru-fh/provider/src/main/java/org/oransc/oam/features/devicemanager/oran/impl/ORanNetworkElementFactory.java
features/devicemanager/o-ran/ru-fh/provider/src/main/java/org/oransc/oam/features/devicemanager/oran/impl/ORanToInternalDataModel.java
features/devicemanager/o-ran/ru-fh/provider/src/test/java/org/oransc/oam/features/devicemanager/oran/test/TestDeviceManagerORanImpl.java
features/devicemanager/o-ran/ru-fh/provider/src/test/java/org/oransc/oam/features/devicemanager/oran/test/TestHardwareClass.java
features/devicemanager/o-ran/ru-fh/provider/src/test/java/org/oransc/oam/features/devicemanager/oran/test/TestORanChangeNotificationListener.java
features/devicemanager/o-ran/ru-fh/provider/src/test/java/org/oransc/oam/features/devicemanager/oran/test/TestORanFaultNotificationListener.java
features/devicemanager/o-ran/ru-fh/provider/src/test/java/org/oransc/oam/features/devicemanager/oran/test/TestORanNetworkElement.java
features/devicemanager/o-ran/ru-fh/provider/src/test/java/org/oransc/oam/features/devicemanager/oran/test/TestORanNetworkElementFactory.java
features/devicemanager/o-ran/ru-fh/provider/src/test/java/org/oransc/oam/features/devicemanager/oran/test/TestORanToInternalDataModel.java
features/devicemanager/o-ran/ru-fh/provider/src/test/java/org/oransc/oam/features/devicemanager/oran/test/mock/NetconfAccessorMock.java
features/devicemanager/o-ran/ru-fh/provider/src/test/java/org/oransc/oam/features/devicemanager/oran/test/mock/TransactionUtilsMock.java

index aeaf312..e580426 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * ============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
@@ -23,7 +23,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NetconfNetworkEleme
 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";
diff --git a/features/devicemanager/o-ran/ru-fh/provider/src/main/java/org/oransc/oam/features/devicemanager/oran/impl/NtsNetworkElement.java b/features/devicemanager/o-ran/ru-fh/provider/src/main/java/org/oransc/oam/features/devicemanager/oran/impl/NtsNetworkElement.java
deleted file mode 100644 (file)
index f718442..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * ============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);
-    }
-}
index 2b413f6..5c35f85 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * ============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
@@ -36,7 +36,7 @@ import org.slf4j.LoggerFactory;
 /**
  * Listener for change notifications
  */
-public class ORanChangeNotificationListener  implements IetfNetconfNotificationsListener {
+public class ORanChangeNotificationListener implements IetfNetconfNotificationsListener {
 
     private static final Logger log = LoggerFactory.getLogger(ORanChangeNotificationListener.class);
 
index 6197cf1..b460f16 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * ============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
index 0c7f6b8..1404c34 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * ============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
@@ -53,7 +53,7 @@ public class ORanNetworkElement implements NetworkElement {
     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;
 
@@ -73,7 +73,8 @@ public class ORanNetworkElement implements NetworkElement {
             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));
                 }
             }
         }
@@ -91,11 +92,10 @@ public class ORanNetworkElement implements NetworkElement {
         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;
     }
@@ -120,7 +120,7 @@ public class ORanNetworkElement implements NetworkElement {
         }
         if (oRanFaultListenerRegistrationResult != null) {
             this.oRanFaultListenerRegistrationResult.close();
-        };
+        } ;
     }
 
 
@@ -135,8 +135,7 @@ public class ORanNetworkElement implements NetworkElement {
     }
 
     @Override
-    public void warmstart() {
-    }
+    public void warmstart() {}
 
     @Override
     public Optional<NetconfAccessor> getAcessor() {
index f0f9815..bc9da71 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * ============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
@@ -22,26 +22,30 @@ import java.util.Optional;
 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();
     }
 }
index e9e8520..0864b8f 100644 (file)
@@ -1,8 +1,8 @@
 /**
  * ============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
index 93459f6..c9476be 100644 (file)
@@ -1,84 +1,51 @@
+/*
+ * ============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();
     }
 }
index 67c91ca..4d259cd 100644 (file)
@@ -1,3 +1,20 @@
+/*
+ * ============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;
index 9bf71bb..435d565 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ============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;
@@ -41,47 +41,47 @@ import org.oransc.oam.features.devicemanager.oran.impl.ORanChangeNotificationLis
 
 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;
+    }
 }
index 247982a..61e5d1b 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ============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.
  * =================================================================================================
@@ -22,9 +22,9 @@ import org.oransc.oam.features.devicemanager.oran.impl.ORanFaultNotificationList
 
 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);
+    }
 }
index 6ae6d75..845e24c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ============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.
  * =================================================================================================
@@ -20,16 +20,17 @@ package org.oransc.oam.features.devicemanager.oran.test;
 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;
@@ -37,8 +38,6 @@ 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;
 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 {
 
index 8f32670..ca61d44 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ============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.
  * =================================================================================================
@@ -20,7 +20,6 @@ package org.oransc.oam.features.devicemanager.oran.test;
 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;
@@ -29,57 +28,46 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServic
 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 {
 
-       }
+    }
 }
 
index 07cff9d..f35bcb4 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ============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.
  * =================================================================================================
@@ -20,13 +20,9 @@ package org.oransc.oam.features.devicemanager.oran.test;
 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;
@@ -37,50 +33,49 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.
 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 {
 
-       }
+    }
 }
index 84cae04..165ad0f 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ============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.
  * =================================================================================================
index cfd01d9..e07fce1 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ============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.
  * =================================================================================================
@@ -19,7 +19,6 @@ package org.oransc.oam.features.devicemanager.oran.test.mock;
 
 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;
@@ -29,19 +28,19 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 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;
+    }
 
 }