remove Junit tests using service-path 1.5 models 75/85175/2
authorguillaume.lambert <guillaume.lambert@orange.com>
Thu, 17 Oct 2019 09:03:15 +0000 (11:03 +0200)
committerguillaume.lambert <guillaume.lambert@orange.com>
Tue, 22 Oct 2019 12:00:32 +0000 (14:00 +0200)
JIRA: TRNSPRTPCE-160
Signed-off-by: guillaume.lambert <guillaume.lambert@orange.com>
Change-Id: I8aacee9742bdfcc2bbacef281094cc789570c62d

renderer/src/test/java/org/opendaylight/transportpce/renderer/provisiondevice/DeviceRendererServiceImplDeleteTest.java [deleted file]
renderer/src/test/java/org/opendaylight/transportpce/renderer/provisiondevice/DeviceRendererServiceImplRollbackTest.java [deleted file]
renderer/src/test/java/org/opendaylight/transportpce/renderer/provisiondevice/DeviceRendererServiceImplSetupTest.java [deleted file]
renderer/src/test/java/org/opendaylight/transportpce/renderer/utils/ServiceImplementationDataUtils.java [deleted file]

diff --git a/renderer/src/test/java/org/opendaylight/transportpce/renderer/provisiondevice/DeviceRendererServiceImplDeleteTest.java b/renderer/src/test/java/org/opendaylight/transportpce/renderer/provisiondevice/DeviceRendererServiceImplDeleteTest.java
deleted file mode 100644 (file)
index d0e6aa0..0000000
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * Copyright © 2018 Orange Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.transportpce.renderer.provisiondevice;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-//import java.util.concurrent.ExecutionException;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.opendaylight.mdsal.binding.api.MountPoint;
-import org.opendaylight.mdsal.binding.api.MountPointService;
-import org.opendaylight.transportpce.common.StringConstants;
-import org.opendaylight.transportpce.common.crossconnect.CrossConnect;
-import org.opendaylight.transportpce.common.crossconnect.CrossConnectImpl;
-import org.opendaylight.transportpce.common.crossconnect.CrossConnectImpl121;
-import org.opendaylight.transportpce.common.crossconnect.CrossConnectImpl221;
-import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
-import org.opendaylight.transportpce.common.device.DeviceTransactionManagerImpl;
-import org.opendaylight.transportpce.common.fixedflex.FixedFlexImpl;
-import org.opendaylight.transportpce.common.fixedflex.FixedFlexInterface;
-import org.opendaylight.transportpce.common.mapping.MappingUtils;
-import org.opendaylight.transportpce.common.mapping.MappingUtilsImpl;
-import org.opendaylight.transportpce.common.mapping.PortMapping;
-import org.opendaylight.transportpce.common.mapping.PortMappingImpl;
-import org.opendaylight.transportpce.common.mapping.PortMappingVersion121;
-import org.opendaylight.transportpce.common.mapping.PortMappingVersion221;
-import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException;
-import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaces;
-import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfacesImpl;
-import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfacesImpl121;
-import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfacesImpl221;
-import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterface121;
-import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterface221;
-import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterfaceFactory;
-import org.opendaylight.transportpce.renderer.stub.MountPointServiceStub;
-import org.opendaylight.transportpce.renderer.utils.MountPointUtils;
-import org.opendaylight.transportpce.renderer.utils.ServiceImplementationDataUtils;
-//import org.opendaylight.transportpce.renderer.utils.TransactionUtils
-import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev170228.ServicePathInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev170228.ServicePathOutput;
-/*
-import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.connection.DestinationBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.connection.SourceBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.OrgOpenroadmDevice;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.org.openroadm.device.RoadmConnections;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.org.openroadm.device.RoadmConnectionsBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.org.openroadm.device.RoadmConnectionsKey;
-*/
-import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev170907.olm.renderer.input.Nodes;
-//import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class DeviceRendererServiceImplDeleteTest extends AbstractTest {
-
-    private DeviceRendererService deviceRendererService;
-    private CrossConnect crossConnect;
-    private OpenRoadmInterfaces openRoadmInterfaces;
-    private OpenRoadmInterfaceFactory openRoadmInterfaceFactory;
-    private DeviceTransactionManager deviceTransactionManager;
-    private MappingUtils mappingUtils;
-    private OpenRoadmInterfacesImpl121 openRoadmInterfacesImpl121;
-    private OpenRoadmInterfacesImpl221 openRoadmInterfacesImpl221;
-    private PortMappingVersion221 portMappingVersion22;
-    private PortMappingVersion121 portMappingVersion121;
-    private CrossConnectImpl121 crossConnectImpl121;
-    private CrossConnectImpl221 crossConnectImpl221;
-
-    private void setMountPoint(MountPoint mountPoint) {
-        MountPointService mountPointService = new MountPointServiceStub(mountPoint);
-        this.deviceTransactionManager = new DeviceTransactionManagerImpl(mountPointService, 3000);
-        this.openRoadmInterfacesImpl121 = new OpenRoadmInterfacesImpl121(this.deviceTransactionManager);
-        this.openRoadmInterfacesImpl221 = new OpenRoadmInterfacesImpl221(this.deviceTransactionManager);
-        this.mappingUtils = new MappingUtilsImpl(getDataBroker());
-        this.openRoadmInterfaces = new OpenRoadmInterfacesImpl(deviceTransactionManager, mappingUtils,
-            openRoadmInterfacesImpl121, openRoadmInterfacesImpl221);
-        this.openRoadmInterfaces = Mockito.spy(this.openRoadmInterfaces);
-        this.portMappingVersion22 = new PortMappingVersion221(getDataBroker(), this.deviceTransactionManager,
-            this.openRoadmInterfaces);
-        this.portMappingVersion121 = new PortMappingVersion121(getDataBroker(), this.deviceTransactionManager,
-            this.openRoadmInterfaces);
-        PortMapping portMapping = new PortMappingImpl(getDataBroker(), this.portMappingVersion22,
-            this.portMappingVersion121);
-        FixedFlexInterface fixedFlexInterface = new FixedFlexImpl();
-        OpenRoadmInterface121 openRoadmInterface121 = new OpenRoadmInterface121(portMapping,openRoadmInterfaces);
-        OpenRoadmInterface221 openRoadmInterface221 = new OpenRoadmInterface221(portMapping,openRoadmInterfaces,
-            fixedFlexInterface);
-        this.openRoadmInterfaceFactory = new OpenRoadmInterfaceFactory(this.mappingUtils,openRoadmInterface121,
-            openRoadmInterface221);
-
-        this.crossConnectImpl121 = new CrossConnectImpl121(this.deviceTransactionManager);
-        this.crossConnectImpl221 = new CrossConnectImpl221(this.deviceTransactionManager);
-        this.crossConnect = new CrossConnectImpl(this.deviceTransactionManager, this.mappingUtils,
-            this.crossConnectImpl121, this.crossConnectImpl221);
-        this.crossConnect = Mockito.spy(this.crossConnect);
-        this.deviceRendererService = new DeviceRendererServiceImpl(this.getDataBroker(),
-            this.deviceTransactionManager, this.openRoadmInterfaceFactory, this.openRoadmInterfaces,
-            this.crossConnect, portMapping);
-    }
-
-    @Test
-    public void testSetupServiceWhenDeviceIsNotMounted() {
-        setMountPoint(null);
-        ServicePathInput servicePathInput = ServiceImplementationDataUtils.buildServicePathInputs();
-        ServicePathOutput servicePathOutput = deviceRendererService.deleteServicePath(servicePathInput);
-        Assert.assertFalse(servicePathOutput.isSuccess());
-        Assert.assertEquals("node1 is not mounted on the controller",
-            servicePathOutput.getResult());
-    }
-
-    @Test
-    public void testDeleteServiceSuccess() throws OpenRoadmInterfaceException {
-        setMountPoint(MountPointUtils.getMountPoint(new ArrayList<>(), getDataBroker()));
-        String [] interfaceTokens = {
-            StringConstants.NETWORK_TOKEN,
-            StringConstants.CLIENT_TOKEN,
-            StringConstants.TTP_TOKEN,
-            StringConstants.PP_TOKEN
-        };
-
-        String nodeId = "node1";
-        Mockito.doReturn(Collections.emptyList()).when(this.crossConnect)
-            .deleteCrossConnect(Mockito.eq(nodeId), Mockito.anyString());
-        Mockito.doNothing().when(this.openRoadmInterfaces).deleteInterface(Mockito.eq(nodeId), Mockito.anyString());
-
-        for (String srcToken : interfaceTokens) {
-            String srcTP = "src-" + srcToken;
-            for (String dstToken : interfaceTokens) {
-                String dstTp = "dst-" + dstToken;
-
-                List<Nodes> nodes = new ArrayList<>();
-                nodes.add(ServiceImplementationDataUtils.createNode(nodeId, srcTP, dstTp));
-                ServicePathInput servicePathInput = ServiceImplementationDataUtils.buildServicePathInputs(nodes);
-
-                ServicePathOutput servicePathOutput = deviceRendererService.deleteServicePath(servicePathInput);
-                Assert.assertTrue(servicePathOutput.isSuccess());
-                Assert.assertEquals("Request processed", servicePathOutput.getResult());
-            }
-        }
-    }
-
-//    @Test
-//    public void testDeleteServiceFailure() throws OpenRoadmInterfaceException {
-//        setMountPoint(MountPointUtils.getMountPoint(new ArrayList<>(), getDataBroker()));
-//        String [] interfaceTokens = {
-//            StringConstants.NETWORK_TOKEN,
-//            StringConstants.CLIENT_TOKEN,
-//            StringConstants.TTP_TOKEN,
-//            StringConstants.PP_TOKEN };
-//        String nodeId = "node1";
-//        Mockito.doReturn(Collections.emptyList()).when(this.crossConnect).deleteCrossConnect(Mockito.eq(nodeId),
-//            Mockito.anyString());
-//        Mockito.doThrow(OpenRoadmInterfaceException.class).when(this.openRoadmInterfaces)
-//            .deleteInterface(Mockito.eq(nodeId), Mockito.anyString());
-//
-//        for (String srcToken : interfaceTokens) {
-//            String srcTP = "src-" + srcToken;
-//            for (String dstToken : interfaceTokens) {
-//                String dstTp = "dst-" + dstToken;
-//
-//                List<Nodes> nodes = new ArrayList<>();
-//                nodes.add(ServiceImplementationDataUtils.createNode(nodeId, srcTP, dstTp));
-//                ServicePathInput servicePathInput = ServiceImplementationDataUtils.buildServicePathInputs(nodes);
-//
-//                ServicePathOutput servicePathOutput = deviceRendererService.deleteServicePath(servicePathInput);
-//                Assert.assertFalse(servicePathOutput.isSuccess());
-//                Assert.assertNotEquals("Request processed", servicePathOutput.getResult());
-//            }
-//        }
-//    }
-
-    @Test
-    public void testDeleteServiceNulls() throws OpenRoadmInterfaceException {
-        setMountPoint(MountPointUtils.getMountPoint(new ArrayList<>(), getDataBroker()));
-
-        String nodeId = "node1";
-        Mockito.doReturn(Collections.emptyList()).when(this.crossConnect)
-            .deleteCrossConnect(Mockito.eq(nodeId), Mockito.anyString());
-        Mockito.doThrow(OpenRoadmInterfaceException.class).when(this.openRoadmInterfaces)
-            .deleteInterface(Mockito.eq(nodeId), Mockito.anyString());
-
-        List<Nodes> nodes = new ArrayList<>();
-        nodes.add(ServiceImplementationDataUtils.createNode(nodeId, null, null));
-        nodes.add(ServiceImplementationDataUtils.createNode(nodeId, "src-" + StringConstants.PP_TOKEN, null));
-        ServicePathInput servicePathInput = ServiceImplementationDataUtils.buildServicePathInputs(nodes);
-
-        ServicePathOutput servicePathOutput = deviceRendererService.deleteServicePath(servicePathInput);
-        Assert.assertTrue(servicePathOutput.isSuccess());
-        Assert.assertEquals("Request processed", servicePathOutput.getResult());
-    }
-
-    @Test
-    public void testDeleteServiceFailedCrossConnect() throws OpenRoadmInterfaceException {
-        setMountPoint(MountPointUtils.getMountPoint(new ArrayList<>(), getDataBroker()));
-
-        String nodeId = "node1";
-
-        Mockito.doReturn(Collections.emptyList()).when(this.crossConnect)
-            .deleteCrossConnect(Mockito.eq(nodeId), Mockito.anyString());
-        Mockito.doNothing().when(this.openRoadmInterfaces).deleteInterface(Mockito.eq(nodeId), Mockito.anyString());
-
-        String srcTP = "src-" + StringConstants.TTP_TOKEN;
-        String dstTp = "dst-" + StringConstants.PP_TOKEN;
-
-        List<Nodes> nodes = new ArrayList<>();
-        nodes.add(ServiceImplementationDataUtils.createNode(nodeId, srcTP, dstTp));
-        ServicePathInput servicePathInput = ServiceImplementationDataUtils.buildServicePathInputs(nodes);
-
-        ServicePathOutput servicePathOutput = deviceRendererService.deleteServicePath(servicePathInput);
-        Assert.assertTrue(servicePathOutput.isSuccess());
-        Assert.assertEquals("Request processed", servicePathOutput.getResult());
-    }
-
-//    @Test
-//    public void testDeleteServiceInterfacesUsedByXc() throws OpenRoadmInterfaceException, ExecutionException,
-//        InterruptedException {
-//        setMountPoint(MountPointUtils.getMountPoint(new ArrayList<>(), getDataBroker()));
-//
-//        String nodeId = "node1";
-//
-//        Mockito.doReturn(true).when(this.crossConnect).deleteCrossConnect(Mockito.eq(nodeId), Mockito.anyString());
-//        Mockito.doThrow(OpenRoadmInterfaceException.class).when(this.openRoadmInterfaces)
-//            .deleteInterface(Mockito.eq(nodeId), Mockito.anyString());
-//
-//        String srcTp = "src-" + StringConstants.PP_TOKEN;
-//        String dstTp = "dst-" + StringConstants.TTP_TOKEN;
-//        Long waveNumber = 20L;
-//
-//        String connectionNumber = dstTp + "-" + srcTp + "-" + waveNumber;
-//        RoadmConnectionsBuilder roadmConnectionsBuilder = new RoadmConnectionsBuilder();
-//        roadmConnectionsBuilder.setConnectionNumber(connectionNumber)
-//            .withKey(new RoadmConnectionsKey(connectionNumber));
-//        String interfaceName = this.openRoadmInterfaceFactory.createOpenRoadmOchInterfaceName(srcTp, waveNumber);
-//        roadmConnectionsBuilder.setSource((new SourceBuilder()).setSrcIf(interfaceName).build());
-//        interfaceName = this.openRoadmInterfaceFactory.createOpenRoadmOchInterfaceName(dstTp, waveNumber);
-//        roadmConnectionsBuilder.setWavelengthNumber(20L);
-//        roadmConnectionsBuilder.setDestination((new DestinationBuilder()).setDstIf(interfaceName).build());
-//        InstanceIdentifier<RoadmConnections> xciid = InstanceIdentifier.create(OrgOpenroadmDevice.class)
-//            .child(RoadmConnections.class, new RoadmConnectionsKey(connectionNumber));
-//        TransactionUtils.writeTransaction(this.deviceTransactionManager, nodeId, LogicalDatastoreType.CONFIGURATION,
-//            xciid, roadmConnectionsBuilder.build());
-//
-//        List<Nodes> nodes = new ArrayList<>();
-//        nodes.add(ServiceImplementationDataUtils.createNode(nodeId, srcTp, dstTp));
-//        ServicePathInput servicePathInput = ServiceImplementationDataUtils.buildServicePathInputs(nodes);
-//
-//        ServicePathOutput servicePathOutput = deviceRendererService.deleteServicePath(servicePathInput);
-//        Assert.assertTrue(servicePathOutput.isSuccess());
-//        Assert.assertEquals("Request processed", servicePathOutput.getResult());
-//    }
-}
diff --git a/renderer/src/test/java/org/opendaylight/transportpce/renderer/provisiondevice/DeviceRendererServiceImplRollbackTest.java b/renderer/src/test/java/org/opendaylight/transportpce/renderer/provisiondevice/DeviceRendererServiceImplRollbackTest.java
deleted file mode 100644 (file)
index 3c94cc8..0000000
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * Copyright © 2018 Orange Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.transportpce.renderer.provisiondevice;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.opendaylight.mdsal.binding.api.MountPoint;
-import org.opendaylight.mdsal.binding.api.MountPointService;
-import org.opendaylight.transportpce.common.StringConstants;
-import org.opendaylight.transportpce.common.crossconnect.CrossConnect;
-import org.opendaylight.transportpce.common.crossconnect.CrossConnectImpl;
-import org.opendaylight.transportpce.common.crossconnect.CrossConnectImpl121;
-import org.opendaylight.transportpce.common.crossconnect.CrossConnectImpl221;
-import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
-import org.opendaylight.transportpce.common.device.DeviceTransactionManagerImpl;
-import org.opendaylight.transportpce.common.fixedflex.FixedFlexImpl;
-import org.opendaylight.transportpce.common.fixedflex.FixedFlexInterface;
-import org.opendaylight.transportpce.common.mapping.MappingUtils;
-import org.opendaylight.transportpce.common.mapping.MappingUtilsImpl;
-import org.opendaylight.transportpce.common.mapping.PortMapping;
-import org.opendaylight.transportpce.common.mapping.PortMappingImpl;
-import org.opendaylight.transportpce.common.mapping.PortMappingVersion121;
-import org.opendaylight.transportpce.common.mapping.PortMappingVersion221;
-import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException;
-import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaces;
-import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfacesImpl;
-import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfacesImpl121;
-import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfacesImpl221;
-import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterface121;
-import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterface221;
-import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterfaceFactory;
-import org.opendaylight.transportpce.renderer.stub.MountPointServiceStub;
-import org.opendaylight.transportpce.renderer.stub.MountPointStub;
-import org.opendaylight.transportpce.renderer.utils.ServiceImplementationDataUtils;
-import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev170228.RendererRollbackInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev170228.RendererRollbackInputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev170228.RendererRollbackOutput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev170907.node.interfaces.NodeInterface;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev170907.node.interfaces.NodeInterfaceBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev170907.node.interfaces.NodeInterfaceKey;
-
-public class DeviceRendererServiceImplRollbackTest extends AbstractTest {
-
-    private DeviceRendererService deviceRendererService;
-    private CrossConnect crossConnect;
-    private OpenRoadmInterfaces openRoadmInterfaces;
-    private MappingUtils mappingUtils;
-    private OpenRoadmInterfacesImpl121 openRoadmInterfacesImpl121;
-    private OpenRoadmInterfacesImpl221 openRoadmInterfacesImpl221;
-    private PortMappingVersion221 portMappingVersion22;
-    private PortMappingVersion121 portMappingVersion121;
-    private CrossConnectImpl121 crossConnectImpl121;
-    private CrossConnectImpl221 crossConnectImpl221;
-
-    private void setMountPoint(MountPoint mountPoint) {
-        MountPointService mountPointService = new MountPointServiceStub(mountPoint);
-        DeviceTransactionManager deviceTransactionManager = new DeviceTransactionManagerImpl(mountPointService, 3000);
-        this.openRoadmInterfacesImpl121 = new OpenRoadmInterfacesImpl121(deviceTransactionManager);
-        this.openRoadmInterfacesImpl221 = new OpenRoadmInterfacesImpl221(deviceTransactionManager);
-        this.mappingUtils = new MappingUtilsImpl(getDataBroker());
-        this.mappingUtils = Mockito.spy(this.mappingUtils);
-        this.openRoadmInterfaces = new OpenRoadmInterfacesImpl(deviceTransactionManager, mappingUtils,
-            openRoadmInterfacesImpl121, openRoadmInterfacesImpl221);
-        this.openRoadmInterfaces = Mockito.spy(this.openRoadmInterfaces);
-        this.portMappingVersion22 =
-            new PortMappingVersion221(getDataBroker(), deviceTransactionManager, this.openRoadmInterfaces);
-        this.portMappingVersion121 = new PortMappingVersion121(getDataBroker(), deviceTransactionManager,
-            this.openRoadmInterfaces);
-        this.crossConnectImpl121 = new CrossConnectImpl121(deviceTransactionManager);
-        this.crossConnectImpl221 = new CrossConnectImpl221(deviceTransactionManager);
-        this.crossConnect = new CrossConnectImpl(deviceTransactionManager, this.mappingUtils, this.crossConnectImpl121,
-            this.crossConnectImpl221);
-        this.crossConnect = Mockito.spy(this.crossConnect);
-        PortMapping portMapping = new PortMappingImpl(getDataBroker(), this.portMappingVersion22,
-            this.portMappingVersion121);
-        FixedFlexInterface fixedFlexInterface = new FixedFlexImpl();
-        OpenRoadmInterface121 openRoadmInterface121 = new OpenRoadmInterface121(portMapping,openRoadmInterfaces);
-        OpenRoadmInterface221 openRoadmInterface221 = new OpenRoadmInterface221(portMapping,openRoadmInterfaces,
-            fixedFlexInterface);
-        OpenRoadmInterfaceFactory openRoadmInterfaceFactory = new OpenRoadmInterfaceFactory(this.mappingUtils,
-            openRoadmInterface121,openRoadmInterface221);
-
-
-        this.deviceRendererService = new DeviceRendererServiceImpl(this.getDataBroker(),
-            deviceTransactionManager, openRoadmInterfaceFactory, this.openRoadmInterfaces, this.crossConnect,
-            portMapping);
-    }
-
-
-
-    @Test
-    public void testRollbackEmptyInterface() {
-        setMountPoint(new MountPointStub(getDataBroker()));
-        RendererRollbackInput rendererRollbackInput = ServiceImplementationDataUtils.buildRendererRollbackInput();
-        RendererRollbackOutput rendererRollbackOutput =
-            this.deviceRendererService.rendererRollback(rendererRollbackInput);
-        Assert.assertTrue(rendererRollbackOutput.isSuccess());
-        Assert.assertTrue(rendererRollbackOutput.getFailedToRollback().isEmpty());
-    }
-
-    @Test
-    public void testRollbackConnectionIdNotExist() {
-        setMountPoint(new MountPointStub(getDataBroker()));
-
-        NodeInterfaceBuilder nodeInterfaceBuilder = new NodeInterfaceBuilder();
-        nodeInterfaceBuilder.setNodeId("node1");
-        nodeInterfaceBuilder.withKey(new NodeInterfaceKey("node1"));
-        List<String> connectionID = new ArrayList<>();
-        connectionID.add("node1-PP");
-        nodeInterfaceBuilder.setConnectionId(connectionID);
-        List<NodeInterface> nodeInterfaces = new ArrayList<>();
-        nodeInterfaces.add(nodeInterfaceBuilder.build());
-        RendererRollbackInputBuilder rendererRollbackInputBuilder = new RendererRollbackInputBuilder();
-        rendererRollbackInputBuilder.setNodeInterface(nodeInterfaces);
-        Mockito.doReturn(StringConstants.OPENROADM_DEVICE_VERSION_1_2_1).when(this.mappingUtils)
-            .getOpenRoadmVersion("node1");
-        RendererRollbackOutput rendererRollbackOutput =
-            this.deviceRendererService.rendererRollback(rendererRollbackInputBuilder.build());
-        Assert.assertFalse(rendererRollbackOutput.isSuccess());
-        Assert.assertEquals(1, rendererRollbackOutput.getFailedToRollback().size());
-        Assert.assertEquals("node1", rendererRollbackOutput.getFailedToRollback().get(0).getNodeId());
-    }
-
-    @Test
-    public void testRollbackConnectionId() {
-        setMountPoint(new MountPointStub(getDataBroker()));
-
-        NodeInterfaceBuilder nodeInterfaceBuilder = new NodeInterfaceBuilder();
-        nodeInterfaceBuilder.setNodeId("node1");
-        nodeInterfaceBuilder.withKey(new NodeInterfaceKey("node1"));
-        List<String> connectionID = new ArrayList<>();
-        connectionID.add("src-PP-dest-PP-20");
-        nodeInterfaceBuilder.setConnectionId(connectionID);
-        List<NodeInterface> nodeInterfaces = new ArrayList<>();
-        nodeInterfaces.add(nodeInterfaceBuilder.build());
-        RendererRollbackInputBuilder rendererRollbackInputBuilder = new RendererRollbackInputBuilder();
-        rendererRollbackInputBuilder.setNodeInterface(nodeInterfaces);
-
-        Mockito.doReturn(Collections.emptyList()).when(this.crossConnect)
-            .deleteCrossConnect("node1", connectionID.get(0));
-        RendererRollbackOutput rendererRollbackOutput =
-            this.deviceRendererService.rendererRollback(rendererRollbackInputBuilder.build());
-        Assert.assertTrue("Rollback must success when cross connect returns true", rendererRollbackOutput.isSuccess());
-        Assert.assertEquals(1, rendererRollbackOutput.getFailedToRollback().size());
-        Assert.assertTrue("There must not be any failed interfaces when cross connect returns true",
-            rendererRollbackOutput.getFailedToRollback().get(0).getInterface().isEmpty());
-
-        Mockito.doReturn(null).when(this.crossConnect).deleteCrossConnect("node1", connectionID.get(0));
-        rendererRollbackOutput =
-            this.deviceRendererService.rendererRollback(rendererRollbackInputBuilder.build());
-        Assert.assertFalse("Rollback must fail when cross connect returns false",rendererRollbackOutput.isSuccess());
-        Assert.assertEquals(1, rendererRollbackOutput.getFailedToRollback().size());
-        Assert.assertFalse(rendererRollbackOutput.getFailedToRollback().get(0).getInterface().isEmpty());
-        Assert.assertEquals("node1", rendererRollbackOutput.getFailedToRollback().get(0).getNodeId());
-
-        Mockito.verify(this.crossConnect, Mockito.times(2)).deleteCrossConnect("node1", connectionID.get(0));
-    }
-
-    @Test
-    public void testRollbackInterfaces() throws OpenRoadmInterfaceException {
-        setMountPoint(new MountPointStub(getDataBroker()));
-
-        NodeInterfaceBuilder nodeInterfaceBuilder = new NodeInterfaceBuilder();
-        nodeInterfaceBuilder.setNodeId("node1");
-        nodeInterfaceBuilder.withKey(new NodeInterfaceKey("node1"));
-        nodeInterfaceBuilder.setConnectionId(new ArrayList<>());
-        List<String> oduInterfacesId = new ArrayList<>();
-        oduInterfacesId.add("node1-" + StringConstants.NETWORK_TOKEN + "-ODU");
-        nodeInterfaceBuilder.setOduInterfaceId(oduInterfacesId);
-        List<String> otuInterfacesId = new ArrayList<>();
-        otuInterfacesId.add("node1-" + StringConstants.NETWORK_TOKEN + "-OTU");
-        nodeInterfaceBuilder.setOtuInterfaceId(otuInterfacesId);
-        List<String> ochInterfacesId = new ArrayList<>();
-        ochInterfacesId.add("node1-" + StringConstants.NETWORK_TOKEN + "-20");
-        nodeInterfaceBuilder.setOchInterfaceId(ochInterfacesId);
-        List<NodeInterface> nodeInterfaces = new ArrayList<>();
-        nodeInterfaces.add(nodeInterfaceBuilder.build());
-        RendererRollbackInputBuilder rendererRollbackInputBuilder = new RendererRollbackInputBuilder();
-        rendererRollbackInputBuilder.setNodeInterface(nodeInterfaces);
-
-        Mockito.doNothing().when(this.openRoadmInterfaces).deleteInterface(Mockito.eq("node1"), Mockito.anyString());
-        RendererRollbackOutput rendererRollbackOutput =
-            this.deviceRendererService.rendererRollback(rendererRollbackInputBuilder.build());
-        Assert.assertTrue(rendererRollbackOutput.isSuccess());
-        Assert.assertFalse(rendererRollbackOutput.getFailedToRollback().isEmpty());
-        Assert.assertTrue(rendererRollbackOutput.getFailedToRollback().get(0).getInterface().isEmpty());
-        Mockito.verify(this.crossConnect, Mockito.times(0)).deleteCrossConnect(Mockito.anyString(),
-            Mockito.anyString());
-        Mockito.verify(this.openRoadmInterfaces, Mockito.times(3)).deleteInterface(Mockito.eq("node1"),
-            Mockito.anyString());
-    }
-
-    @Test
-    public void testRollbackInterfacesException() throws OpenRoadmInterfaceException {
-        setMountPoint(new MountPointStub(getDataBroker()));
-
-        NodeInterfaceBuilder nodeInterfaceBuilder = new NodeInterfaceBuilder();
-        nodeInterfaceBuilder.setNodeId("node1");
-        nodeInterfaceBuilder.withKey(new NodeInterfaceKey("node1"));
-        nodeInterfaceBuilder.setConnectionId(new ArrayList<>());
-        List<String> ethInterfacesId = new ArrayList<>();
-        ethInterfacesId.add("node1-" + StringConstants.CLIENT_TOKEN + "-ETHERNET");
-        nodeInterfaceBuilder.setEthInterfaceId(ethInterfacesId);
-        List<NodeInterface> nodeInterfaces = new ArrayList<>();
-        nodeInterfaces.add(nodeInterfaceBuilder.build());
-        RendererRollbackInputBuilder rendererRollbackInputBuilder = new RendererRollbackInputBuilder();
-        rendererRollbackInputBuilder.setNodeInterface(nodeInterfaces);
-
-        Mockito.doThrow(OpenRoadmInterfaceException.class).when(this.openRoadmInterfaces)
-            .deleteInterface(Mockito.eq("node1"), Mockito.anyString());
-        RendererRollbackOutput rendererRollbackOutput =
-            this.deviceRendererService.rendererRollback(rendererRollbackInputBuilder.build());
-        Assert.assertFalse(rendererRollbackOutput.isSuccess());
-        Assert.assertEquals(1,rendererRollbackOutput.getFailedToRollback().size());
-        Assert.assertEquals(1, rendererRollbackOutput.getFailedToRollback().get(0).getInterface().size());
-        Assert.assertEquals(ethInterfacesId.get(0), rendererRollbackOutput.getFailedToRollback().get(0)
-            .getInterface().get(0));
-        Mockito.verify(this.crossConnect, Mockito.times(0))
-            .deleteCrossConnect(Mockito.anyString(), Mockito.anyString());
-        Mockito.verify(this.openRoadmInterfaces, Mockito.times(1))
-            .deleteInterface("node1",ethInterfacesId.get(0));
-    }
-}
diff --git a/renderer/src/test/java/org/opendaylight/transportpce/renderer/provisiondevice/DeviceRendererServiceImplSetupTest.java b/renderer/src/test/java/org/opendaylight/transportpce/renderer/provisiondevice/DeviceRendererServiceImplSetupTest.java
deleted file mode 100644 (file)
index c2c5860..0000000
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * Copyright © 2018 Orange Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.transportpce.renderer.provisiondevice;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.opendaylight.mdsal.binding.api.MountPoint;
-import org.opendaylight.mdsal.binding.api.MountPointService;
-import org.opendaylight.transportpce.common.StringConstants;
-import org.opendaylight.transportpce.common.crossconnect.CrossConnect;
-import org.opendaylight.transportpce.common.crossconnect.CrossConnectImpl;
-import org.opendaylight.transportpce.common.crossconnect.CrossConnectImpl121;
-import org.opendaylight.transportpce.common.crossconnect.CrossConnectImpl221;
-import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
-import org.opendaylight.transportpce.common.device.DeviceTransactionManagerImpl;
-import org.opendaylight.transportpce.common.fixedflex.FixedFlexImpl;
-import org.opendaylight.transportpce.common.fixedflex.FixedFlexInterface;
-import org.opendaylight.transportpce.common.mapping.MappingUtils;
-import org.opendaylight.transportpce.common.mapping.PortMapping;
-import org.opendaylight.transportpce.common.mapping.PortMappingImpl;
-import org.opendaylight.transportpce.common.mapping.PortMappingVersion121;
-import org.opendaylight.transportpce.common.mapping.PortMappingVersion221;
-import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException;
-import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaces;
-import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfacesImpl;
-import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfacesImpl121;
-import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfacesImpl221;
-import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterface121;
-import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterface221;
-import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterfaceFactory;
-import org.opendaylight.transportpce.renderer.provisiondevice.servicepath.ServicePathDirection;
-import org.opendaylight.transportpce.renderer.stub.MountPointServiceStub;
-import org.opendaylight.transportpce.renderer.utils.MountPointUtils;
-import org.opendaylight.transportpce.renderer.utils.ServiceImplementationDataUtils;
-import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev170228.ServicePathInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev170228.ServicePathOutput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev170907.olm.renderer.input.Nodes;
-
-public class DeviceRendererServiceImplSetupTest extends AbstractTest {
-
-    private DeviceTransactionManager deviceTransactionManager;
-
-    private DeviceRendererService deviceRendererService;
-    private CrossConnect crossConnect;
-    private PortMapping portMapping;
-    private OpenRoadmInterfaces openRoadmInterfaces;
-    private MappingUtils mappingUtils;
-    private OpenRoadmInterfacesImpl121 openRoadmInterfacesImpl121;
-    private OpenRoadmInterfacesImpl221 openRoadmInterfacesImpl221;
-    private PortMappingVersion221 portMappingVersion22;
-    private PortMappingVersion121 portMappingVersion121;
-    private CrossConnectImpl121 crossConnectImpl121;
-    private CrossConnectImpl221 crossConnectImpl221;
-
-
-    private void setMountPoint(MountPoint mountPoint) {
-        MountPointService mountPointService = new MountPointServiceStub(mountPoint);
-        this.deviceTransactionManager = new DeviceTransactionManagerImpl(mountPointService, 3000);
-        this.openRoadmInterfacesImpl121 = new OpenRoadmInterfacesImpl121(deviceTransactionManager);
-        this.openRoadmInterfacesImpl221 = new OpenRoadmInterfacesImpl221(deviceTransactionManager);
-        this.mappingUtils = Mockito.spy(MappingUtils.class);
-
-        Mockito.doReturn(StringConstants.OPENROADM_DEVICE_VERSION_1_2_1).when(mappingUtils)
-            .getOpenRoadmVersion(Mockito.anyString());
-
-        this.openRoadmInterfaces = new OpenRoadmInterfacesImpl(deviceTransactionManager, mappingUtils,
-            openRoadmInterfacesImpl121, openRoadmInterfacesImpl221);
-        this.openRoadmInterfaces = Mockito.spy(this.openRoadmInterfaces);
-        this.portMappingVersion22 =
-            new PortMappingVersion221(getDataBroker(), deviceTransactionManager, this.openRoadmInterfaces);
-        this.portMappingVersion121 =
-            new PortMappingVersion121(getDataBroker(), deviceTransactionManager, this.openRoadmInterfaces);
-        this.portMapping = new PortMappingImpl(getDataBroker(), this.portMappingVersion22,
-            this.portMappingVersion121);
-        this.portMapping = Mockito.spy(this.portMapping);
-        this.crossConnectImpl121 = new CrossConnectImpl121(deviceTransactionManager);
-        this.crossConnectImpl221 = new CrossConnectImpl221(deviceTransactionManager);
-        this.crossConnect = new CrossConnectImpl(deviceTransactionManager, this.mappingUtils, this.crossConnectImpl121,
-            this.crossConnectImpl221);
-        this.crossConnect = Mockito.spy(this.crossConnect);
-
-
-        FixedFlexInterface fixedFlexInterface = new FixedFlexImpl();
-        OpenRoadmInterface121 openRoadmInterface121 = new OpenRoadmInterface121(portMapping,openRoadmInterfaces);
-        OpenRoadmInterface221 openRoadmInterface221 = new OpenRoadmInterface221(portMapping,openRoadmInterfaces,
-            fixedFlexInterface);
-        OpenRoadmInterfaceFactory openRoadmInterfaceFactory = new OpenRoadmInterfaceFactory(this.mappingUtils,
-            openRoadmInterface121,openRoadmInterface221);
-
-        this.deviceRendererService = new DeviceRendererServiceImpl(this.getDataBroker(),
-            this.deviceTransactionManager, openRoadmInterfaceFactory, openRoadmInterfaces, crossConnect,
-            portMapping);
-    }
-
-    @Test
-    public void testSetupServiceWhenDeviceIsNotMounted() {
-        setMountPoint(null);
-        ServicePathInput servicePathInput = ServiceImplementationDataUtils.buildServicePathInputs();
-        for (ServicePathDirection servicePathDirection : ServicePathDirection.values()) {
-            ServicePathOutput servicePathOutput = deviceRendererService.setupServicePath(servicePathInput,
-                servicePathDirection);
-            Assert.assertFalse(servicePathOutput.isSuccess());
-            Assert.assertEquals("node1 is not mounted on the controller",
-                servicePathOutput.getResult());
-        }
-    }
-
-    @Test
-    public void testSetupServicemptyPorts() {
-        setMountPoint(MountPointUtils.getMountPoint(new ArrayList<>(), getDataBroker()));
-        String nodeId = "node1";
-        String srcTP = StringConstants.TTP_TOKEN;
-        String dstTp = StringConstants.PP_TOKEN;
-        List<Nodes> nodes = new ArrayList<>();
-        nodes.add(ServiceImplementationDataUtils.createNode(nodeId, srcTP, dstTp));
-        ServicePathInput servicePathInput = ServiceImplementationDataUtils.buildServicePathInputs(nodes);
-        for (ServicePathDirection servicePathDirection : ServicePathDirection.values()) {
-            ServicePathOutput servicePathOutput = deviceRendererService.setupServicePath(servicePathInput,
-                servicePathDirection);
-            Assert.assertFalse(servicePathOutput.isSuccess());
-        }
-    }
-
-    @Test
-    public void testSetupServiceCannotCrossConnect() {
-        setMountPoint(MountPointUtils.getMountPoint(new ArrayList<>(), getDataBroker()));
-        String nodeId = "node1";
-        String srcTP = StringConstants.TTP_TOKEN;
-        String dstTp = StringConstants.PP_TOKEN;
-        MountPointUtils.writeMapping(nodeId, srcTP, this.deviceTransactionManager);
-        MountPointUtils.writeMapping(nodeId, dstTp, this.deviceTransactionManager);
-        List<Nodes> nodes = new ArrayList<>();
-        nodes.add(ServiceImplementationDataUtils.createNode(nodeId, srcTP, dstTp));
-        ServicePathInput servicePathInput = ServiceImplementationDataUtils.buildServicePathInputs(nodes);
-        Mockito.doReturn(StringConstants.OPENROADM_DEVICE_VERSION_1_2_1).when(this.mappingUtils)
-            .getOpenRoadmVersion("node1");
-        Mockito.doReturn(java.util.Optional.empty()).when(this.crossConnect).postCrossConnect(nodeId, 20L, srcTP,
-            dstTp);
-        ServicePathOutput servicePathOutput = deviceRendererService.setupServicePath(servicePathInput,
-            ServicePathDirection.A_TO_Z);
-        Assert.assertFalse(servicePathOutput.isSuccess());
-    }
-
-    @Test
-    public void testSetupService() throws OpenRoadmInterfaceException {
-        setMountPoint(MountPointUtils.getMountPoint(new ArrayList<>(), getDataBroker()));
-        Mockito.doNothing().when(this.openRoadmInterfaces).postEquipmentState(Mockito.anyString(),
-            Mockito.anyString(), Mockito.anyBoolean());
-        String [] interfaceTokens = {
-            StringConstants.NETWORK_TOKEN,
-            StringConstants.CLIENT_TOKEN,
-            StringConstants.TTP_TOKEN,
-            StringConstants.PP_TOKEN
-        };
-
-        String nodeId = "node1";
-
-        for (String srcToken : interfaceTokens) {
-            String srcTP = "src-" + srcToken;
-            MountPointUtils.writeMapping(nodeId, srcTP, this.deviceTransactionManager);
-            for (String dstToken : interfaceTokens) {
-                String dstTp = "dst-" + dstToken;
-                MountPointUtils.writeMapping(nodeId, dstTp, this.deviceTransactionManager);
-
-                boolean connectingUsingCrossConnect = true;
-                if (StringConstants.NETWORK_TOKEN.equals(srcToken)
-                    || StringConstants.CLIENT_TOKEN.equals(srcToken)) {
-                    connectingUsingCrossConnect = false;
-                }
-                if (StringConstants.NETWORK_TOKEN.equals(dstToken)
-                    || StringConstants.CLIENT_TOKEN.equals(dstToken)) {
-                    connectingUsingCrossConnect = false;
-                }
-
-                List<Nodes> nodes = new ArrayList<>();
-                nodes.add(ServiceImplementationDataUtils.createNode(nodeId, srcTP, dstTp));
-                ServicePathInput servicePathInput = ServiceImplementationDataUtils.buildServicePathInputs(nodes);
-                Mockito.doReturn(StringConstants.OPENROADM_DEVICE_VERSION_1_2_1).when(this.mappingUtils)
-                    .getOpenRoadmVersion("node1");
-                for (ServicePathDirection servicePathDirection : ServicePathDirection.values()) {
-                    ServicePathOutput servicePathOutput = deviceRendererService.setupServicePath(servicePathInput,
-                        servicePathDirection);
-                    Assert.assertTrue(servicePathOutput.isSuccess());
-                    String expectedResult = "Roadm-connection successfully created for nodes: ";
-                    if (connectingUsingCrossConnect) {
-                        expectedResult = expectedResult + nodeId;
-                    }
-                    Assert.assertEquals(expectedResult, servicePathOutput.getResult());
-                    Assert.assertEquals(1, servicePathOutput.getNodeInterface().size());
-                    Assert.assertEquals(nodeId, servicePathOutput.getNodeInterface().get(0).getNodeId());
-                    if (!connectingUsingCrossConnect) { // No need to try both directions if not cross connect
-                        break;
-                    }
-                }
-            }
-        }
-    }
-
-    @Test
-    public void testSetupServiceNulls() throws OpenRoadmInterfaceException {
-        setMountPoint(MountPointUtils.getMountPoint(new ArrayList<>(), getDataBroker()));
-        String nodeId = "node1";
-        String srcTP = null;
-        String dstTp = null;
-        boolean connectingUsingCrossConnect = true;
-
-        List<Nodes> nodes = new ArrayList<>();
-        nodes.add(ServiceImplementationDataUtils.createNode(nodeId, srcTP, dstTp));
-        ServicePathInput servicePathInput = ServiceImplementationDataUtils.buildServicePathInputs(nodes);
-        Mockito.doReturn(StringConstants.OPENROADM_DEVICE_VERSION_1_2_1).when(this.mappingUtils)
-            .getOpenRoadmVersion("node1");
-        for (ServicePathDirection servicePathDirection : ServicePathDirection.values()) {
-            ServicePathOutput servicePathOutput = deviceRendererService.setupServicePath(servicePathInput,
-                servicePathDirection);
-            Assert.assertTrue(servicePathOutput.isSuccess());
-            String expectedResult = "Roadm-connection successfully created for nodes: ";
-            expectedResult = expectedResult + nodeId;
-            Assert.assertEquals(expectedResult, servicePathOutput.getResult());
-            Assert.assertEquals(1, servicePathOutput.getNodeInterface().size());
-            Assert.assertEquals(nodeId, servicePathOutput.getNodeInterface().get(0).getNodeId());
-        }
-    }
-}
diff --git a/renderer/src/test/java/org/opendaylight/transportpce/renderer/utils/ServiceImplementationDataUtils.java b/renderer/src/test/java/org/opendaylight/transportpce/renderer/utils/ServiceImplementationDataUtils.java
deleted file mode 100644 (file)
index cd52cca..0000000
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * Copyright © 2018 Orange Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.transportpce.renderer.utils;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev170228.RendererRollbackInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev170228.RendererRollbackInputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev170228.ServicePathInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev170228.ServicePathInputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.ServiceFormat;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.port.PortBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.path.description.AToZDirection;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.path.description.AToZDirectionBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.path.description.ZToADirection;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.path.description.ZToADirectionBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.path.description.atoz.direction.AToZ;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.path.description.atoz.direction.AToZBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.path.description.atoz.direction.AToZKey;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.path.description.ztoa.direction.ZToA;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.path.description.ztoa.direction.ZToABuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.path.description.ztoa.direction.ZToAKey;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.pce.resource.ResourceBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.pce.resource.resource.resource.Link;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.pce.resource.resource.resource.LinkBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.pce.resource.resource.resource.NodeBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.pce.resource.resource.resource.TerminationPoint;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.pce.resource.resource.resource.TerminationPointBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.pce.resource.resource.resource.link.LinkIdentifierBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.pce.resource.resource.resource.node.NodeIdentifierBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.pce.resource.resource.resource.termination.point.TerminationPointIdentifierBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.service.endpoint.sp.RxDirectionBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.service.endpoint.sp.TxDirectionBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.service.handler.header.ServiceHandlerHeaderBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceImplementationRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceImplementationRequestInputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.service.implementation.request.input.PathDescription;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.service.implementation.request.input.PathDescriptionBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.service.implementation.request.input.ServiceAEndBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.service.implementation.request.input.ServiceZEndBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev170907.olm.renderer.input.Nodes;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev170907.olm.renderer.input.NodesBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev170907.olm.renderer.input.NodesKey;
-
-
-public final class ServiceImplementationDataUtils {
-
-    private ServiceImplementationDataUtils() {
-
-    }
-
-    public static Nodes createNode(String nodeId, String srcTp, String dstTp) {
-        return new NodesBuilder().setNodeId(nodeId).withKey(new NodesKey(nodeId)).setSrcTp(srcTp)
-                .setDestTp(dstTp).build();
-    }
-
-    public static ServicePathInput buildServicePathInputs(List<Nodes> nodes) {
-        ServicePathInputBuilder servicePathInputBuilder = new ServicePathInputBuilder();
-        servicePathInputBuilder.setNodes(nodes);
-        servicePathInputBuilder.setServiceName("Service 1").setWaveNumber(20L);
-        return servicePathInputBuilder.build();
-    }
-
-    public static ServicePathInput buildServicePathInputs() {
-        ServicePathInputBuilder servicePathInputBuilder = new ServicePathInputBuilder();
-        List<Nodes> nodes = new ArrayList<>();
-        nodes.add(ServiceImplementationDataUtils.createNode("node1", "src", "dst"));
-        servicePathInputBuilder.setNodes(nodes);
-        servicePathInputBuilder.setServiceName("Service 1").setWaveNumber(20L);
-        return servicePathInputBuilder.build();
-    }
-
-    public static RendererRollbackInput buildRendererRollbackInput() {
-        RendererRollbackInputBuilder rendererRollbackInputBuilder = new RendererRollbackInputBuilder();
-        rendererRollbackInputBuilder.setNodeInterface(new ArrayList<>());
-        return rendererRollbackInputBuilder.build();
-    }
-
-    public static ServiceImplementationRequestInput buildServiceImplementationRequestInputTerminationPointResource(
-        String tpId) {
-        ServiceImplementationRequestInputBuilder builder = new ServiceImplementationRequestInputBuilder()
-            .setServiceName("service 1").setPathDescription(createPathDescriptionTerminationPointResource(tpId))
-            .setServiceHandlerHeader(new ServiceHandlerHeaderBuilder().setRequestId("Request 1").build())
-            .setServiceAEnd(getServiceAEndBuild().build())
-            .setServiceZEnd(getServiceZEndBuild().build());
-        return builder.build();
-    }
-
-    public static ServiceImplementationRequestInput buildServiceImplementationRequestInputInvalidResource() {
-        ServiceImplementationRequestInputBuilder builder = new ServiceImplementationRequestInputBuilder()
-            .setServiceName("service 1").setPathDescription(createPathDescriptionInvalidResource())
-            .setServiceHandlerHeader(new ServiceHandlerHeaderBuilder().setRequestId("Request 1").build())
-            .setServiceAEnd(getServiceAEndBuild().build())
-            .setServiceZEnd(getServiceZEndBuild().build());
-        return builder.build();
-    }
-
-    public static ServiceImplementationRequestInput buildServiceImplementationRequestInputLinkResource() {
-        ServiceImplementationRequestInputBuilder builder = new ServiceImplementationRequestInputBuilder()
-            .setServiceName("service 1").setPathDescription(createPathDescriptionLinkResource())
-            .setServiceHandlerHeader(new ServiceHandlerHeaderBuilder().setRequestId("Request 1").build())
-            .setServiceAEnd(getServiceAEndBuild().build())
-            .setServiceZEnd(getServiceZEndBuild().build());
-        return builder.build();
-    }
-
-    private static PathDescription createPathDescriptionInvalidResource() {
-        List<AToZ> atoZList = new ArrayList<AToZ>();
-        org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.pce.resource
-            .resource.resource.NodeBuilder nodesBuilder = new NodeBuilder();
-        org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.pce.resource
-            .resource.resource.Node node1 = nodesBuilder.setNodeIdentifier(new NodeIdentifierBuilder()
-            .setNodeId("XPONDER-1-2").build()).build();
-        org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.pce.resource
-            .resource.resource.Node node2 = nodesBuilder.setNodeIdentifier(new NodeIdentifierBuilder()
-            .setNodeId("XPONDER-1-2").build()).build();
-        AToZ atoZ = new AToZBuilder().setId("1").withKey(new AToZKey("1")).setResource(new ResourceBuilder()
-            .setResource(node1).build()).build();
-        AToZ atoZ2 = new AToZBuilder().setId("1").withKey(new AToZKey("1")).setResource(new ResourceBuilder()
-            .setResource(node2).build()).build();
-        atoZList.add(atoZ);
-        atoZList.add(atoZ2);
-        AToZDirection atozDirection = new AToZDirectionBuilder()
-            .setRate(20L)
-            .setAToZWavelengthNumber(20L)
-            .setAToZ(atoZList)
-            .build();
-        List<ZToA> ztoAList = new ArrayList<ZToA>();
-        ZToA ztoA = new ZToABuilder().setId("1").withKey(new ZToAKey("1")).setResource(new ResourceBuilder()
-            .setResource(node1).build()).build();
-        ZToA ztoA2 = new ZToABuilder().setId("1").withKey(new ZToAKey("1")).setResource(new ResourceBuilder()
-            .setResource(node2).build()).build();
-        ztoAList.add(ztoA);
-        ztoAList.add(ztoA2);
-        ZToADirection ztoaDirection = new ZToADirectionBuilder()
-            .setRate(20L)
-            .setZToAWavelengthNumber(20L)
-            .setZToA(ztoAList)
-            .build();
-        PathDescriptionBuilder builder = new PathDescriptionBuilder()
-            .setAToZDirection(atozDirection)
-            .setZToADirection(ztoaDirection);
-        return builder.build();
-    }
-
-    public static PathDescription createPathDescriptionTerminationPointResource(String tpId) {
-        List<AToZ> atoZList = new ArrayList<AToZ>();
-        TerminationPointBuilder terminationPointBuilder = new TerminationPointBuilder();
-        TerminationPoint terminationPoint = terminationPointBuilder
-            .setTerminationPointIdentifier(new TerminationPointIdentifierBuilder().setNodeId("XPONDER-1-2")
-                .setTpId("XPONDER-1-2-" + tpId).build()).build();
-        TerminationPoint terminationPoint2 = terminationPointBuilder
-            .setTerminationPointIdentifier(new TerminationPointIdentifierBuilder().setNodeId("XPONDER-1-2")
-                .setTpId("XPONDER-1-2-" + tpId).build()).build();
-        AToZ atoZ = new AToZBuilder().setId("1").withKey(new AToZKey("1")).setResource(new ResourceBuilder()
-            .setResource(terminationPoint).build()).build();
-        AToZ atoZ2 = new AToZBuilder().setId("2").withKey(new AToZKey("2")).setResource(new ResourceBuilder()
-            .setResource(terminationPoint2).build()).build();
-        atoZList.add(atoZ);
-        atoZList.add(atoZ2);
-        AToZDirection atozDirection = new AToZDirectionBuilder()
-            .setRate(20L)
-            .setAToZWavelengthNumber(20L)
-            .setAToZ(atoZList)
-            .build();
-        List<ZToA> ztoAList = new ArrayList<ZToA>();
-        ZToA ztoA = new ZToABuilder().setId("1").withKey(new ZToAKey("1")).setResource(new ResourceBuilder()
-            .setResource(terminationPoint).build()).build();
-        ZToA ztoA2 = new ZToABuilder().setId("2").withKey(new ZToAKey("2")).setResource(new ResourceBuilder()
-            .setResource(terminationPoint).build()).build();
-        ztoAList.add(ztoA);
-        ztoAList.add(ztoA2);
-        ZToADirection ztoaDirection = new ZToADirectionBuilder()
-            .setRate(20L)
-            .setZToAWavelengthNumber(20L)
-            .setZToA(ztoAList)
-            .build();
-        PathDescriptionBuilder builder = new PathDescriptionBuilder()
-            .setAToZDirection(atozDirection)
-            .setZToADirection(ztoaDirection);
-        return builder.build();
-    }
-
-    private static PathDescription createPathDescriptionLinkResource() {
-        List<AToZ> atoZList = new ArrayList<AToZ>();
-        org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.pce.resource
-            .resource.resource.NodeBuilder nodesBuilder = new NodeBuilder();
-        Link link1 = new LinkBuilder().setLinkIdentifier(new LinkIdentifierBuilder().setLinkId("link 1").build())
-            .build();
-        Link link2 = new LinkBuilder().setLinkIdentifier(new LinkIdentifierBuilder().setLinkId("link 2").build())
-            .build();
-        AToZ atoZ = new AToZBuilder().setId("1").withKey(new AToZKey("1")).setResource(new ResourceBuilder()
-            .setResource(link1).build()).build();
-        AToZ atoZ2 = new AToZBuilder().setId("1").withKey(new AToZKey("1")).setResource(new ResourceBuilder()
-            .setResource(link2).build()).build();
-        atoZList.add(atoZ);
-        atoZList.add(atoZ2);
-        AToZDirection atozDirection = new AToZDirectionBuilder()
-            .setRate(20L)
-            .setAToZWavelengthNumber(20L)
-            .setAToZ(atoZList)
-            .build();
-        List<ZToA> ztoAList = new ArrayList<ZToA>();
-        ZToA ztoA = new ZToABuilder().setId("1").withKey(new ZToAKey("1")).setResource(new ResourceBuilder()
-            .setResource(link1).build()).build();
-        ZToA ztoA2 = new ZToABuilder().setId("1").withKey(new ZToAKey("1")).setResource(new ResourceBuilder()
-            .setResource(link2).build()).build();
-        ztoAList.add(ztoA);
-        ztoAList.add(ztoA2);
-        ZToADirection ztoaDirection = new ZToADirectionBuilder()
-            .setRate(20L)
-            .setZToAWavelengthNumber(20L)
-            .setZToA(ztoAList)
-            .build();
-        PathDescriptionBuilder builder = new PathDescriptionBuilder()
-            .setAToZDirection(atozDirection)
-            .setZToADirection(ztoaDirection);
-        return builder.build();
-    }
-
-    public static ServiceAEndBuilder getServiceAEndBuild() {
-        return new ServiceAEndBuilder()
-            .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate((long) 1).setNodeId("XPONDER-1-2")
-            .setTxDirection(
-                new TxDirectionBuilder()
-                    .setPort(new PortBuilder().setPortDeviceName("device name").setPortName("port name")
-                        .setPortRack("port rack").setPortShelf("port shelf").setPortSlot("port slot")
-                        .setPortSubSlot("port subslot").setPortType("port type").build())
-                    .build())
-            .setRxDirection(
-                new RxDirectionBuilder()
-                    .setPort(new PortBuilder().setPortDeviceName("device name").setPortName("port name")
-                        .setPortRack("port rack").setPortShelf("port shelf").setPortSlot("port slot")
-                        .setPortSubSlot("port subslot").setPortType("port type").build())
-                    .build());
-    }
-
-    public static ServiceZEndBuilder getServiceZEndBuild() {
-        return new ServiceZEndBuilder()
-            .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate((long) 1).setNodeId("XPONDER-1-2")
-            .setTxDirection(
-                new TxDirectionBuilder()
-                    .setPort(new PortBuilder().setPortDeviceName("device name").setPortName("port name")
-                        .setPortRack("port rack").setPortShelf("port shelf").setPortSlot("port slot")
-                        .setPortSubSlot("port subslot").setPortType("port type").build())
-                    .build())
-            .setRxDirection(
-                new RxDirectionBuilder()
-                    .setPort(new PortBuilder().setPortDeviceName("device name").setPortName("port name")
-                        .setPortRack("port rack").setPortShelf("port shelf").setPortSlot("port slot")
-                        .setPortSubSlot("port subslot").setPortType("port type").build())
-                    .build());
-    }
-
-}