<version>${project.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>mdsal-binding-generator</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
return Map.of("nodeId", nodeId, "tpid", lcp);
}
}
- return null;
+ return Map.of();
}
private static Map<String, String> extractZendFromPathDescriptionForOtn(PathDescription pathDescription) {
return Map.of("nodeId", nodeId, "tpid", lcp);
}
}
- return null;
+ return Map.of();
}
private static Map<String, String> extractAendFromPathDescriptionForOptical(PathDescription pathDescription) {
return Map.of("nodeId", tp.getTpNodeId(), "tpid", tp.getTpId());
}
}
- return null;
+ return Map.of();
}
private static Map<String, String> extractZendFromPathDescriptionForOptical(PathDescription pathDescription) {
return Map.of("nodeId", tp.getTpNodeId(), "tpid", tp.getTpId());
}
}
- return null;
+ return Map.of();
}
}
sendNotifications(ServicePathNotificationTypes.ServiceImplementationRequest, input.getServiceName(),
RpcStatusEx.Pending, "Service compliant, submitting service implementation Request ...");
Uint32 serviceRate = getServiceRate(input);
+ org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210927.network.Nodes
+ mappingNode = portMapping.isNodeExist(input.getServiceAEnd().getNodeId())
+ ? portMapping.getNode(input.getServiceAEnd().getNodeId())
+ : null;
String serviceType = ServiceTypes.getServiceType(
input.getServiceAEnd().getServiceFormat().getName(),
serviceRate,
- (NodeTypes.Xpdr.equals(portMapping.getNode(input.getServiceAEnd().getNodeId())
- .getNodeInfo().getNodeType())
+ (mappingNode != null
+ && NodeTypes.Xpdr.equals(mappingNode.getNodeInfo().getNodeType())
&& input.getServiceAEnd().getTxDirection() != null
&& input.getServiceAEnd().getTxDirection().getPort() != null
&& input.getServiceAEnd().getTxDirection().getPort().getPortName() != null)
RollbackProcessor rollbackProcessor = new RollbackProcessor();
List<DeviceRenderingResult> renderingResults =
deviceRendering(rollbackProcessor, servicePathInputDataAtoZ, servicePathInputDataZtoA);
- if (rollbackProcessor.rollbackAllIfNecessary() > 0) {
+ if (rollbackProcessor.rollbackAllIfNecessary() > 0 || renderingResults.isEmpty()) {
sendNotifications(ServicePathNotificationTypes.ServiceImplementationRequest,
input.getServiceName(), RpcStatusEx.Failed, DEVICE_RENDERING_ROLL_BACK_MSG);
return false;
import org.junit.After;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
import org.opendaylight.mdsal.binding.api.RpcProviderService;
import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
import org.opendaylight.transportpce.renderer.rpcs.DeviceRendererRPCImpl;
import org.opendaylight.transportpce.renderer.rpcs.TransportPCEServicePathRPCImpl;
import org.opendaylight.transportpce.test.AbstractTest;
-@Ignore
+@RunWith(MockitoJUnitRunner.StrictStubs.class)
public class RendererProviderTest extends AbstractTest {
-
@Mock
RpcProviderService rpcProviderService;
-
@Mock
private RendererServiceOperations rendererServiceOperations;
-
@Mock
DeviceRendererRPCImpl deviceRendererRPC;
-
private AutoCloseable closeable;
@Before
verify(rpcProviderService, times(1))
.registerRpcImplementation(any(), any(TransportPCEServicePathRPCImpl.class));
-
verify(rpcProviderService, times(1))
.registerRpcImplementation(any(), any(DeviceRendererRPCImpl.class));
}
- @After public void releaseMocks() throws Exception {
+ @After
+ public void releaseMocks() throws Exception {
closeable.close();
}
-
}
*/
package org.opendaylight.transportpce.renderer.openroadminterface;
+import java.math.BigDecimal;
import java.util.Arrays;
import org.junit.Assert;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.mockito.Mockito;
import org.opendaylight.transportpce.common.fixedflex.SpectrumInformation;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210927.mapping.MappingBuilder;
import org.opendaylight.yangtools.yang.common.Uint32;
-@Ignore
public class OpenRoadMInterface221Test extends AbstractTest {
private final PortMapping portMapping = Mockito.mock(PortMapping.class);
@Before
public void setup() {
-
OpenRoadmInterfaces openRoadmInterfaces = Mockito.spy(OpenRoadmInterfaces.class);
this.openRoadMInterface221 = new OpenRoadmInterface221(portMapping, openRoadmInterfaces);
}
public void testCreateOpenRoadmEthInterface() throws OpenRoadmInterfaceException {
String logicalConnPoint = "logicalConnPoint";
- Mockito.when(portMapping.getMapping(nodeId, logicalConnPoint)).thenReturn(new MappingBuilder().build());
+ Mockito.when(portMapping.getMapping(nodeId, logicalConnPoint))
+ .thenReturn(new MappingBuilder().setSupportingCircuitPackName("circit-pack").setSupportingPort("port")
+ .setLogicalConnectionPoint(logicalConnPoint).build());
Assert.assertEquals(openRoadMInterface221.createOpenRoadmEthInterface(nodeId, logicalConnPoint),
logicalConnPoint + "-ETHERNET");
}
public void testCreateFlexOCH() throws OpenRoadmInterfaceException {
String logicalConnPoint = "logicalConnPoint";
- Mockito.when(portMapping.getMapping(nodeId, logicalConnPoint)).thenReturn(new MappingBuilder().build());
+ Mockito.when(portMapping.getMapping(nodeId, logicalConnPoint))
+ .thenReturn(new MappingBuilder().setSupportingCircuitPackName("circit-pack").setSupportingPort("port")
+ .setLogicalConnectionPoint(logicalConnPoint).build());
SpectrumInformation spectrumInformation = new SpectrumInformation();
spectrumInformation.setWaveLength(Uint32.valueOf(1));
spectrumInformation.setLowerSpectralSlotNumber(761);
spectrumInformation.setHigherSpectralSlotNumber(768);
+ spectrumInformation.setCenterFrequency(BigDecimal.valueOf(195.8));
Assert.assertNotNull(openRoadMInterface221.createFlexOCH(nodeId, logicalConnPoint, spectrumInformation));
Assert.assertEquals(openRoadMInterface221.createFlexOCH(nodeId, logicalConnPoint, spectrumInformation),
Arrays.asList(logicalConnPoint + "-nmc-761:768"));
public void testCreateFlexOCHReturnsMoreThanOneElement() throws OpenRoadmInterfaceException {
String logicalConnPoint = "logicalConnPointDEG";
- Mockito.when(portMapping.getMapping(nodeId, logicalConnPoint)).thenReturn(new MappingBuilder().build());
+ Mockito.when(portMapping.getMapping(nodeId, logicalConnPoint))
+ .thenReturn(new MappingBuilder().setSupportingCircuitPackName("circit-pack").setSupportingPort("port")
+ .setLogicalConnectionPoint(logicalConnPoint).build());
SpectrumInformation spectrumInformation = new SpectrumInformation();
spectrumInformation.setWaveLength(Uint32.valueOf(1));
spectrumInformation.setLowerSpectralSlotNumber(761);
spectrumInformation.setHigherSpectralSlotNumber(768);
+ spectrumInformation.setCenterFrequency(BigDecimal.valueOf(195.8));
+ spectrumInformation.setMinFrequency(BigDecimal.valueOf(195.775));
+ spectrumInformation.setMaxFrequency(BigDecimal.valueOf(195.825));
Assert.assertNotNull(openRoadMInterface221.createFlexOCH(nodeId, logicalConnPoint,spectrumInformation));
Assert.assertEquals(openRoadMInterface221.createFlexOCH(nodeId, logicalConnPoint, spectrumInformation),
Arrays.asList(logicalConnPoint + "-mc-761:768", logicalConnPoint + "-nmc-761:768"));
String logicalConnPoint = "logicalConnPoint";
Mockito.when(portMapping.getMapping(nodeId, logicalConnPoint))
- .thenReturn(new MappingBuilder().setLogicalConnectionPoint(logicalConnPoint).build());
+ .thenReturn(new MappingBuilder().setSupportingCircuitPackName("circit-pack").setSupportingPort("port")
+ .setLogicalConnectionPoint(logicalConnPoint).build());
SpectrumInformation spectrumInformation = new SpectrumInformation();
spectrumInformation.setWaveLength(Uint32.valueOf(1));
spectrumInformation.setLowerSpectralSlotNumber(761);
spectrumInformation.setHigherSpectralSlotNumber(768);
+ spectrumInformation.setCenterFrequency(BigDecimal.valueOf(195.8));
Assert.assertEquals(openRoadMInterface221.createOpenRoadmOchInterface(nodeId, logicalConnPoint,
spectrumInformation), logicalConnPoint + "-761:768");
}
String logicalConnPoint = "logicalConnPoint";
String supportOchInterface = "supportOchInterface";
Mockito.when(portMapping.getMapping(nodeId, logicalConnPoint))
- .thenReturn(new MappingBuilder().setLogicalConnectionPoint(logicalConnPoint).build());
- Assert.assertEquals(openRoadMInterface221.createOpenRoadmOtu4Interface(
- nodeId, logicalConnPoint, supportOchInterface, null, null),
- logicalConnPoint + "-OTU");
+ .thenReturn(new MappingBuilder().setSupportingCircuitPackName("circit-pack").setSupportingPort("port")
+ .setLogicalConnectionPoint(logicalConnPoint).build());
+ Assert.assertEquals(openRoadMInterface221
+ .createOpenRoadmOtu4Interface(nodeId, logicalConnPoint, supportOchInterface, null, null),
+ logicalConnPoint + "-OTU");
}
}
@Test
- public void testCreateOpenRoadmOmsInterfaceSupportingOmsNotNull() throws OpenRoadmInterfaceException {
-
- String supportingOms = "supportingOms";
+ public void testCreateOpenRoadmOmsInterfaceSupportingOtsNotNull() throws OpenRoadmInterfaceException {
+ String logicalConnPoint = "logicalConnPoint";
+ String supportingOts = "supportingOts";
Assert.assertEquals(openRoadMInterface221.createOpenRoadmOmsInterface(nodeId,
- new MappingBuilder().setSupportingOms(supportingOms).build()), supportingOms);
+ new MappingBuilder().setSupportingCircuitPackName("circit-pack").setSupportingPort("port")
+ .setLogicalConnectionPoint(logicalConnPoint).setSupportingOts(supportingOts).build()),
+ "OMS-" + logicalConnPoint);
}
@Test
public void testCreateOpenRoadmOmsInterfaceSupportingOmsNotNullException() throws OpenRoadmInterfaceException {
- Assert.assertNull(openRoadMInterface221.createOpenRoadmOmsInterface(nodeId, new MappingBuilder().build()));
+ Assert.assertNull(openRoadMInterface221.createOpenRoadmOmsInterface(nodeId, new MappingBuilder()
+ .setLogicalConnectionPoint("logicalConnPoint").build()));
}
@Test
import java.util.ArrayList;
import java.util.concurrent.ExecutionException;
import org.junit.Assert;
-import org.junit.Ignore;
import org.junit.Test;
import org.mockito.Mockito;
import org.opendaylight.mdsal.binding.api.MountPoint;
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.mapping.PortMappingVersion710;
import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException;
import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaces;
import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfacesImpl;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.CreateOtsOmsOutput;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210927.Network;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210927.OpenroadmNodeVersion;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210927.mapping.Mapping;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210927.network.Nodes;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210927.network.NodesBuilder;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210927.network.NodesKey;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210927.network.nodes.NodeInfoBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-@Ignore
public class DeviceRendererServiceImplCreateOtsOmsTest extends AbstractTest {
private DeviceRendererService deviceRendererService;
private OpenRoadmInterfacesImpl121 openRoadmInterfacesImpl121;
private OpenRoadmInterfacesImpl221 openRoadmInterfacesImpl221;
private OpenRoadmInterfacesImpl710 openRoadmInterfacesImpl710;
- private PortMappingVersion710 portMappingVersion710;
- private PortMappingVersion221 portMappingVersion22;
- private PortMappingVersion121 portMappingVersion121;
private CrossConnectImpl121 crossConnectImpl121;
private CrossConnectImpl221 crossConnectImpl221;
private CrossConnectImpl710 crossConnectImpl710;
+ private final PortMapping portMapping = Mockito.mock(PortMapping.class);
private void setMountPoint(MountPoint mountPoint) {
MountPointService mountPointService = new MountPointServiceStub(mountPoint);
this.openRoadmInterfaces = new OpenRoadmInterfacesImpl(deviceTransactionManager, mappingUtils,
openRoadmInterfacesImpl121, openRoadmInterfacesImpl221, openRoadmInterfacesImpl710);
this.openRoadmInterfaces = Mockito.spy(this.openRoadmInterfaces);
- this.portMappingVersion22 = new PortMappingVersion221(getDataBroker(), this.deviceTransactionManager);
- this.portMappingVersion121 = new PortMappingVersion121(getDataBroker(), this.deviceTransactionManager);
- this.portMappingVersion710 = new PortMappingVersion710(getDataBroker(), deviceTransactionManager);
- this.openRoadmInterfacesImpl121 = new OpenRoadmInterfacesImpl121(this.deviceTransactionManager);
- this.openRoadmInterfacesImpl710 = new OpenRoadmInterfacesImpl710(this.deviceTransactionManager);
- PortMapping portMapping =
- new PortMappingImpl(getDataBroker(), this.portMappingVersion710, this.portMappingVersion22,
- this.portMappingVersion121);
- this.openRoadmInterfacesImpl221 = new OpenRoadmInterfacesImpl221(this.deviceTransactionManager, portMapping,
- this.portMappingVersion22);
OpenRoadmInterface121 openRoadmInterface121 = new OpenRoadmInterface121(portMapping,openRoadmInterfaces);
OpenRoadmInterface221 openRoadmInterface221 = new OpenRoadmInterface221(portMapping,openRoadmInterfaces);
OpenRoadmInterface710 openRoadmInterface710 = new OpenRoadmInterface710(portMapping, openRoadmInterfaces);
wr.commit().get();
setMountPoint(MountPointUtils.getMountPoint(new ArrayList<>(), getDataBroker()));
CreateOtsOmsInput input = CreateOtsOmsDataUtils.buildCreateOtsOms();
- writePortMapping(input);
+ Mapping mapping = MountPointUtils.createMapping(input.getNodeId(), input.getLogicalConnectionPoint());
+ Mockito.when(portMapping.getMapping(Mockito.anyString(), Mockito.anyString())).thenReturn(mapping);
CreateOtsOmsOutput result = this.deviceRendererService.createOtsOms(input);
Assert.assertTrue(result.getSuccess());
}
- private void writePortMapping(CreateOtsOmsInput input) {
- MountPointUtils.writeMapping(
- input.getNodeId(),
- input.getLogicalConnectionPoint(),
- this.deviceTransactionManager
- );
- }
-
}
package org.opendaylight.transportpce.renderer.provisiondevice;
import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.common.util.concurrent.MoreExecutors;
import java.util.Collections;
import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Executors;
import org.junit.Assert;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.mockito.Mockito;
import org.opendaylight.mdsal.binding.api.MountPoint;
import org.opendaylight.transportpce.common.ResponseCodes;
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.crossconnect.CrossConnectImpl710;
import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
import org.opendaylight.transportpce.common.device.DeviceTransactionManagerImpl;
-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.mapping.PortMappingVersion710;
-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.common.openroadminterfaces.OpenRoadmInterfacesImpl710;
-import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterface121;
-import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterface221;
-import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterface710;
-import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterfaceFactory;
-import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmOtnInterface221;
-import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmOtnInterface710;
import org.opendaylight.transportpce.renderer.stub.OlmServiceStub;
import org.opendaylight.transportpce.renderer.utils.NotificationPublishServiceMock;
import org.opendaylight.transportpce.renderer.utils.ServiceDeleteDataUtils;
import org.opendaylight.transportpce.test.AbstractTest;
import org.opendaylight.transportpce.test.stub.MountPointServiceStub;
import org.opendaylight.transportpce.test.stub.MountPointStub;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.ServicePathOutputBuilder;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.ServicePowerTurndownOutputBuilder;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.TransportpceOlmService;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteInputBuilder;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteOutput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.node.types.rev181130.NodeIdType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.ConnectionType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.ServiceAEnd;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.ServiceAEndBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.endpoint.TxDirectionBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.port.PortBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.format.rev190531.ServiceFormat;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.Services;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.ServicesBuilder;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.common.Uint32;
-@Ignore
public class RendererServiceOperationsImplDeleteTest extends AbstractTest {
- private static final int NUMBER_OF_THREADS = 4;
private DeviceTransactionManager deviceTransactionManager;
private RendererServiceOperationsImpl rendererServiceOperations;
- private OpenRoadmInterfaces openRoadmInterfaces;
- private DeviceRendererService deviceRenderer;
- private PortMapping portMapping;
- private CrossConnect crossConnect;
+ private final DeviceRendererService deviceRenderer = Mockito.mock(DeviceRendererService.class);
+ private final OtnDeviceRendererService otnDeviceRendererService = Mockito.mock(OtnDeviceRendererService.class);
+ private final PortMapping portMapping = Mockito.mock(PortMapping.class);
+ private final CrossConnect crossConnect = Mockito.mock(CrossConnect.class);
private TransportpceOlmService olmService;
- private MappingUtils mappingUtils;
- private OpenRoadmInterfacesImpl121 openRoadmInterfacesImpl121;
- private OpenRoadmInterfacesImpl221 openRoadmInterfacesImpl221;
- private OpenRoadmInterfacesImpl710 openRoadmInterfacesImpl710;
- private PortMappingVersion710 portMappingVersion710;
- private PortMappingVersion221 portMappingVersion22;
- private PortMappingVersion121 portMappingVersion121;
- private CrossConnectImpl121 crossConnectImpl121;
- private CrossConnectImpl221 crossConnectImpl221;
- private CrossConnectImpl710 crossConnectImpl710;
- private OtnDeviceRendererService otnDeviceRendererService;
private void setMountPoint(MountPoint mountPoint) {
MountPointService mountPointService = new MountPointServiceStub(mountPoint);
this.deviceTransactionManager = new DeviceTransactionManagerImpl(mountPointService, 3000);
- this.mappingUtils = new MappingUtilsImpl(getDataBroker());
- this.openRoadmInterfaces = new OpenRoadmInterfacesImpl(deviceTransactionManager, mappingUtils,
- openRoadmInterfacesImpl121, openRoadmInterfacesImpl221, openRoadmInterfacesImpl710);
- this.openRoadmInterfaces = Mockito.spy(this.openRoadmInterfaces);
- this.portMappingVersion710 = new PortMappingVersion710(getDataBroker(), deviceTransactionManager);
- this.portMappingVersion22 = new PortMappingVersion221(getDataBroker(), deviceTransactionManager);
- this.portMappingVersion121 = new PortMappingVersion121(getDataBroker(), deviceTransactionManager);
- this.portMapping = new PortMappingImpl(getDataBroker(), this.portMappingVersion710, this.portMappingVersion22,
- this.portMappingVersion121);
- this.openRoadmInterfacesImpl121 = new OpenRoadmInterfacesImpl121(deviceTransactionManager);
- this.openRoadmInterfacesImpl221 = new OpenRoadmInterfacesImpl221(deviceTransactionManager, this.portMapping,
- this.portMappingVersion22);
- this.openRoadmInterfacesImpl710 = new OpenRoadmInterfacesImpl710(deviceTransactionManager);
- this.crossConnectImpl121 = new CrossConnectImpl121(deviceTransactionManager);
- this.crossConnectImpl221 = new CrossConnectImpl221(deviceTransactionManager);
- this.crossConnect = new CrossConnectImpl(deviceTransactionManager, this.mappingUtils, this.crossConnectImpl121,
- this.crossConnectImpl221, this.crossConnectImpl710);
- this.crossConnect = Mockito.spy(crossConnect);
- OpenRoadmInterface121 openRoadmInterface121 = new OpenRoadmInterface121(portMapping,openRoadmInterfaces);
- OpenRoadmInterface221 openRoadmInterface221 = new OpenRoadmInterface221(portMapping,openRoadmInterfaces);
- OpenRoadmInterface710 openRoadmInterface710 = new OpenRoadmInterface710(portMapping,openRoadmInterfaces);
- OpenRoadmOtnInterface221 openRoadmOTNInterface221 = new OpenRoadmOtnInterface221(portMapping,
- openRoadmInterfaces);
- OpenRoadmOtnInterface710 openRoadmOtnInterface710 = new OpenRoadmOtnInterface710(portMapping,
- openRoadmInterfaces);
- OpenRoadmInterfaceFactory openRoadmInterfaceFactory = new OpenRoadmInterfaceFactory(this.mappingUtils,
- openRoadmInterface121, openRoadmInterface221, openRoadmInterface710, openRoadmOTNInterface221,
- openRoadmOtnInterface710);
-
- this.deviceRenderer = new DeviceRendererServiceImpl(getDataBroker(),
- this.deviceTransactionManager, openRoadmInterfaceFactory, openRoadmInterfaces, crossConnect,
- this.portMapping, null);
-
- this.otnDeviceRendererService = new OtnDeviceRendererServiceImpl(openRoadmInterfaceFactory, crossConnect,
- openRoadmInterfaces, this.deviceTransactionManager, null);
-
}
@Before
setMountPoint(new MountPointStub(getDataBroker()));
this.olmService = new OlmServiceStub();
this.olmService = Mockito.spy(this.olmService);
- ListeningExecutorService executor =
- MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(NUMBER_OF_THREADS));
NotificationPublishService notificationPublishService = new NotificationPublishServiceMock();
- this.rendererServiceOperations = new RendererServiceOperationsImpl(this.deviceRenderer,
- this.otnDeviceRendererService, olmService, getDataBroker(), notificationPublishService, null);
-
+ this.rendererServiceOperations = new RendererServiceOperationsImpl(deviceRenderer,
+ otnDeviceRendererService, olmService, getDataBroker(), notificationPublishService, portMapping);
}
ServiceAEnd serviceAEnd = new ServiceAEndBuilder()
.setServiceFormat(ServiceFormat.Ethernet)
.setServiceRate(Uint32.valueOf("100"))
+ .setTxDirection(new TxDirectionBuilder().setPort(new PortBuilder().setPortName("port-name").build())
+ .build())
+ .setNodeId(new NodeIdType("optical-node1"))
.build();
Services service = new ServicesBuilder()
+ .setServiceName("service 1")
.setConnectionType(ConnectionType.Service)
.setServiceAEnd(serviceAEnd)
.build();
+ Mockito.when(portMapping.getMapping(Mockito.anyString(), Mockito.anyString()))
+ .thenReturn(null);
+ Mockito.when(deviceRenderer.deleteServicePath(Mockito.any()))
+ .thenReturn(new ServicePathOutputBuilder().setSuccess(true).build());
ServiceDeleteOutput serviceDeleteOutput
= this.rendererServiceOperations.serviceDelete(serviceDeleteInputBuilder.build(), service).get();
Assert.assertEquals(ResponseCodes.RESPONSE_OK,
serviceDeleteOutput.getConfigurationResponseCommon().getResponseCode());
- Mockito.verify(this.crossConnect, Mockito.times(2))
- .deleteCrossConnect(Mockito.any(), Mockito.any(), Mockito.eq(false));
}
@Test
public void serviceDeleteOperationNoDescription() throws InterruptedException, ExecutionException {
ServiceDeleteInputBuilder serviceDeleteInputBuilder = new ServiceDeleteInputBuilder();
serviceDeleteInputBuilder.setServiceName("service 1");
+ Services service = new ServicesBuilder()
+ .setServiceName("service 1")
+ .setServiceAEnd(new ServiceAEndBuilder()
+ .setServiceFormat(ServiceFormat.Ethernet)
+ .setServiceRate(Uint32.valueOf(100))
+ .setTxDirection(new TxDirectionBuilder().setPort(new PortBuilder().setPortName("port-name").build())
+ .build())
+ .setNodeId(new NodeIdType("optical-node1"))
+ .build())
+ .build();
+ Mockito.when(portMapping.getMapping(Mockito.anyString(), Mockito.anyString()))
+ .thenReturn(null);
+ Mockito.doReturn(RpcResultBuilder.success((new ServicePowerTurndownOutputBuilder())
+ .setResult("Failed").build()).buildFuture()).when(this.olmService).servicePowerTurndown(Mockito.any());
ServiceDeleteOutput serviceDeleteOutput
- = this.rendererServiceOperations.serviceDelete(serviceDeleteInputBuilder.build(), null).get();
+ = this.rendererServiceOperations.serviceDelete(serviceDeleteInputBuilder.build(), service).get();
Assert.assertEquals(ResponseCodes.RESPONSE_FAILED,
serviceDeleteOutput.getConfigurationResponseCommon().getResponseCode());
Mockito.verify(this.crossConnect, Mockito.times(0))
ServiceAEnd serviceAEnd = new ServiceAEndBuilder()
.setServiceFormat(ServiceFormat.Ethernet)
.setServiceRate(Uint32.valueOf("100"))
+ .setTxDirection(new TxDirectionBuilder().setPort(new PortBuilder().setPortName("port-name").build())
+ .build())
+ .setNodeId(new NodeIdType("optical-node1"))
.build();
Services service = new ServicesBuilder()
+ .setServiceName("service 1")
.setConnectionType(ConnectionType.Service)
.setServiceAEnd(serviceAEnd)
.build();
+ Mockito.when(portMapping.getMapping(Mockito.anyString(), Mockito.anyString()))
+ .thenReturn(null);
ListenableFuture<ServiceDeleteOutput> serviceDeleteOutput
= this.rendererServiceOperations.serviceDelete(serviceDeleteInputBuilder.build(), service);
ServiceDeleteOutput output = serviceDeleteOutput.get();
ServiceAEnd serviceAEnd = new ServiceAEndBuilder()
.setServiceFormat(ServiceFormat.Ethernet)
.setServiceRate(Uint32.valueOf("100"))
+ .setTxDirection(new TxDirectionBuilder().setPort(new PortBuilder().setPortName("port-name").build())
+ .build())
+ .setNodeId(new NodeIdType("optical-node1"))
.build();
Services service = new ServicesBuilder()
+ .setServiceName("service 1")
.setConnectionType(ConnectionType.Service)
.setServiceAEnd(serviceAEnd)
.build();
+ Mockito.when(portMapping.getMapping(Mockito.anyString(), Mockito.anyString()))
+ .thenReturn(null);
ServiceDeleteOutput serviceDeleteOutput =
this.rendererServiceOperations.serviceDelete(serviceDeleteInputBuilder.build(), service).get();
Assert.assertEquals(ResponseCodes.RESPONSE_FAILED,
import java.util.concurrent.ExecutionException;
import org.junit.Assert;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.mockito.Mockito;
import org.opendaylight.mdsal.binding.api.MountPoint;
import org.opendaylight.mdsal.binding.api.NotificationPublishService;
import org.opendaylight.transportpce.common.ResponseCodes;
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.crossconnect.CrossConnectImpl710;
import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
import org.opendaylight.transportpce.common.device.DeviceTransactionManagerImpl;
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.mapping.PortMappingVersion710;
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.common.openroadminterfaces.OpenRoadmInterfacesImpl710;
-import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterface121;
-import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterface221;
-import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterface710;
-import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterfaceFactory;
-import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmOtnInterface221;
-import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmOtnInterface710;
import org.opendaylight.transportpce.renderer.stub.OlmServiceStub;
-import org.opendaylight.transportpce.renderer.utils.MountPointUtils;
import org.opendaylight.transportpce.renderer.utils.NotificationPublishServiceMock;
import org.opendaylight.transportpce.renderer.utils.ServiceDataUtils;
import org.opendaylight.transportpce.test.AbstractTest;
import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210618.olm.get.pm.input.ResourceIdentifierBuilder;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
-@Ignore
public class RendererServiceOperationsImplTest extends AbstractTest {
private MountPointService mountPointService;
private DeviceTransactionManager deviceTransactionManager;
+ private final DeviceRendererService deviceRenderer = Mockito.mock(DeviceRendererService.class);
+ private final OtnDeviceRendererService otnDeviceRendererService = Mockito.mock(OtnDeviceRendererService.class);
+ private final PortMapping portMapping = Mockito.mock(PortMapping.class);
private RendererServiceOperationsImpl rendererServiceOperations;
private OpenRoadmInterfaces openRoadmInterfaces;
- private DeviceRendererService deviceRenderer;
- private OtnDeviceRendererService otnDeviceRendererService;
- private PortMapping portMapping;
- private OpenRoadmInterfaceFactory openRoadmInterfaceFactory;
- private CrossConnect crossConnect;
private TransportpceOlmService olmService;
private MappingUtils mappingUtils;
private OpenRoadmInterfacesImpl121 openRoadmInterfacesImpl121;
private OpenRoadmInterfacesImpl221 openRoadmInterfacesImpl221;
private OpenRoadmInterfacesImpl710 openRoadmInterfacesImpl710;
- private PortMappingVersion710 portMappingVersion710;
- private PortMappingVersion221 portMappingVersion22;
- private PortMappingVersion121 portMappingVersion121;
- private CrossConnectImpl121 crossConnectImpl121;
- private CrossConnectImpl221 crossConnectImpl221;
- private CrossConnectImpl710 crossConnectImpl710;
private void setMountPoint(MountPoint mountPoint) {
this.mountPointService = new MountPointServiceStub(mountPoint);
this.openRoadmInterfaces = new OpenRoadmInterfacesImpl(deviceTransactionManager, mappingUtils,
openRoadmInterfacesImpl121, openRoadmInterfacesImpl221, openRoadmInterfacesImpl710);
this.openRoadmInterfaces = Mockito.spy(this.openRoadmInterfaces);
- this.portMappingVersion22 =
- new PortMappingVersion221(getDataBroker(), deviceTransactionManager);
- this.portMappingVersion121 =
- new PortMappingVersion121(getDataBroker(), deviceTransactionManager);
- this.portMappingVersion710 =
- new PortMappingVersion710(getDataBroker(), deviceTransactionManager);
- this.portMapping = new PortMappingImpl(getDataBroker(), this.portMappingVersion710, this.portMappingVersion22,
- this.portMappingVersion121);
- OpenRoadmInterface121 openRoadmInterface121 = new OpenRoadmInterface121(portMapping,openRoadmInterfaces);
- OpenRoadmInterface221 openRoadmInterface221 = new OpenRoadmInterface221(portMapping,openRoadmInterfaces);
- OpenRoadmInterface710 openRoadmInterface710 = new OpenRoadmInterface710(portMapping,openRoadmInterfaces);
- OpenRoadmOtnInterface221 openRoadmOTNInterface221 = new OpenRoadmOtnInterface221(portMapping,
- openRoadmInterfaces);
- OpenRoadmOtnInterface710 openRoadmOtnInterface710 = new OpenRoadmOtnInterface710(portMapping,
- openRoadmInterfaces);
- this.openRoadmInterfaceFactory = new OpenRoadmInterfaceFactory(this.mappingUtils,openRoadmInterface121,
- openRoadmInterface221, openRoadmInterface710, openRoadmOTNInterface221, openRoadmOtnInterface710);
- this.crossConnectImpl121 = new CrossConnectImpl121(deviceTransactionManager);
- this.crossConnectImpl221 = new CrossConnectImpl221(deviceTransactionManager);
- this.crossConnect = new CrossConnectImpl(deviceTransactionManager, this.mappingUtils, this.crossConnectImpl121,
- this.crossConnectImpl221, this.crossConnectImpl710);
}
@Before
public void setUp() throws OpenRoadmInterfaceException {
setMountPoint(new MountPointStub(getDataBroker()));
this.olmService = new OlmServiceStub();
- this.deviceRenderer = new DeviceRendererServiceImpl(getDataBroker(), this.deviceTransactionManager,
- openRoadmInterfaceFactory, openRoadmInterfaces, crossConnect, portMapping, null);
- this.otnDeviceRendererService = new OtnDeviceRendererServiceImpl(openRoadmInterfaceFactory, this.crossConnect,
- openRoadmInterfaces, this.deviceTransactionManager, null);
Mockito.doNothing().when(this.openRoadmInterfaces).postEquipmentState(Mockito.anyString(),
Mockito.anyString(), Mockito.anyBoolean());
NotificationPublishService notificationPublishService = new NotificationPublishServiceMock();
this.olmService = Mockito.spy(this.olmService);
- this.deviceRenderer = Mockito.spy(this.deviceRenderer);
- this.rendererServiceOperations = new RendererServiceOperationsImpl(this.deviceRenderer,
- this.otnDeviceRendererService, this.olmService, getDataBroker(), notificationPublishService, null);
-
- ServicePathOutputBuilder mockOutputBuilder = new ServicePathOutputBuilder().setResult("success")
- .setSuccess(true);
- Mockito.doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(Mockito.any(),
- Mockito.any());
+ this.rendererServiceOperations = new RendererServiceOperationsImpl(deviceRenderer,
+ otnDeviceRendererService, this.olmService, getDataBroker(), notificationPublishService, portMapping);
}
@Test
ServiceImplementationRequestInput input = ServiceDataUtils
.buildServiceImplementationRequestInputTerminationPointResource(StringConstants.TTP_TOKEN);
- writePortMapping(input, StringConstants.TTP_TOKEN);
ServicePathOutputBuilder mockOutputBuilder = new ServicePathOutputBuilder().setResult("success")
.setSuccess(true);
Mockito.doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(Mockito.any(),
ServiceImplementationRequestInput input = ServiceDataUtils
.buildServiceImplementationRequestInputTerminationPointResource(StringConstants.TTP_TOKEN);
- writePortMapping(input, StringConstants.TTP_TOKEN);
ServicePathOutputBuilder mockOutputBuilder = new ServicePathOutputBuilder().setResult("success")
.setSuccess(true);
Mockito.doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(Mockito.any(),
ServiceImplementationRequestInput input = ServiceDataUtils
.buildServiceImplementationRequestInputTerminationPointResource(StringConstants.PP_TOKEN);
- writePortMapping(input, StringConstants.PP_TOKEN);
ServicePathOutputBuilder mockOutputBuilder = new ServicePathOutputBuilder().setResult("success")
.setSuccess(true);
Mockito.doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(Mockito.any(),
@Test
public void serviceImplementationTerminationPointAsResourceNetwork()
- throws InterruptedException, ExecutionException {
+ throws InterruptedException, ExecutionException {
ServiceImplementationRequestInput input = ServiceDataUtils
.buildServiceImplementationRequestInputTerminationPointResource(StringConstants.NETWORK_TOKEN);
- writePortMapping(input, StringConstants.NETWORK_TOKEN);
ServicePathOutputBuilder mockOutputBuilder = new ServicePathOutputBuilder().setResult("success")
.setSuccess(true);
Mockito.doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(Mockito.any(),
@Test
public void serviceImplementationTerminationPointAsResourceClient()
- throws InterruptedException, ExecutionException {
+ throws InterruptedException, ExecutionException {
ServiceImplementationRequestInput input = ServiceDataUtils
- // .buildServiceImplementationRequestInputTerminationPointResource(OpenRoadmInterfacesImpl.CLIENT_TOKEN);
.buildServiceImplementationRequestInputTerminationPointResource(StringConstants.CLIENT_TOKEN);
- // writePortMapping(input, OpenRoadmInterfacesImpl.CLIENT_TOKEN);
- writePortMapping(input, StringConstants.CLIENT_TOKEN);
+ ServicePathOutputBuilder mockOutputBuilder = new ServicePathOutputBuilder().setResult("success")
+ .setSuccess(true);
+ Mockito.doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(Mockito.any(),
+ Mockito.any());
ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input).get();
Assert.assertEquals(ResponseCodes.RESPONSE_OK, result.getConfigurationResponseCommon().getResponseCode());
}
@Test
public void serviceImplementationTerminationPointAsResourceNoMapping()
- throws InterruptedException, ExecutionException {
+ throws InterruptedException, ExecutionException {
String[] interfaceTokens = {
StringConstants.NETWORK_TOKEN,
}
}
- private void writePortMapping(ServiceImplementationRequestInput input, String tpToken) {
- MountPointUtils.writeMapping(
- input.getServiceAEnd().getNodeId(),
- input.getServiceAEnd().getNodeId() + "-" + tpToken,
- this.deviceTransactionManager
- );
- MountPointUtils.writeMapping(
- input.getServiceZEnd().getNodeId(),
- input.getServiceZEnd().getNodeId() + "-"
- + input.getServiceAEnd().getNodeId() + "-" + tpToken,
- this.deviceTransactionManager
- );
- MountPointUtils.writeMapping(
- input.getServiceAEnd().getNodeId(),
- input.getServiceAEnd().getNodeId() + "-"
- + input.getServiceZEnd().getNodeId() + "-" + tpToken,
- this.deviceTransactionManager
- );
- MountPointUtils.writeMapping(
- input.getServiceZEnd().getNodeId(),
- input.getServiceZEnd().getNodeId() + "-" + tpToken,
- this.deviceTransactionManager
- );
- }
-
@Test
public void serviceImplementationRollbackAllNecessary() throws InterruptedException, ExecutionException {
ServiceImplementationRequestInput input = ServiceDataUtils
.buildServiceImplementationRequestInputTerminationPointResource(StringConstants.NETWORK_TOKEN);
- writePortMapping(input, StringConstants.NETWORK_TOKEN);
+// writePortMapping(input, StringConstants.NETWORK_TOKEN);
Mockito.doReturn(RpcResultBuilder.failed().buildFuture()).when(this.olmService)
.servicePowerSetup(Mockito.any());
ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input).get();
ServiceImplementationRequestInput input = ServiceDataUtils
.buildServiceImplementationRequestInputTerminationPointResource(StringConstants.NETWORK_TOKEN);
- writePortMapping(input, StringConstants.NETWORK_TOKEN);
Measurements measurements = new MeasurementsBuilder().setPmparameterName("FECUncorrectableBlocks")
.setPmparameterValue("1").build();
List<Measurements> measurementsList = new ArrayList<Measurements>();
ServiceImplementationRequestInput input = ServiceDataUtils
.buildServiceImplementationRequestInputTerminationPointResource(StringConstants.NETWORK_TOKEN);
- writePortMapping(input, StringConstants.NETWORK_TOKEN);
Measurements measurements = new MeasurementsBuilder().setPmparameterName("FECUncorrectableBlocks")
.setPmparameterValue("1").build();
List<Measurements> measurementsList = new ArrayList<Measurements>();
measurementsList.add(measurements);
GetPmOutput getPmOutput = new GetPmOutputBuilder()
.setNodeId("node1").setMeasurements(measurementsList).build();
- GetPmOutput getPmOutput2 = new GetPmOutputBuilder()
- .setNodeId("node1").setMeasurements(new ArrayList<>()).build();
Mockito.when(this.olmService.getPm(Mockito.any()))
.thenReturn(RpcResultBuilder.success(getPmOutput).buildFuture());
@Test
public void serviceImplementationServiceInActive3() throws InterruptedException, ExecutionException {
- ServiceImplementationRequestInput input = ServiceDataUtils
- .buildServiceImplementationRequestInputTerminationPointResource(StringConstants.NETWORK_TOKEN);
- writePortMapping(input, StringConstants.NETWORK_TOKEN);
Measurements measurements = new MeasurementsBuilder().setPmparameterName("FECUncorrectableBlocks")
.setPmparameterValue("1").build();
List<Measurements> measurementsList = new ArrayList<Measurements>();
.thenReturn(RpcResultBuilder.success(getPmOutput2).buildFuture());
Mockito.when(this.olmService.getPm(Mockito.eq(getPmInputA)))
.thenReturn(RpcResultBuilder.success(getPmOutput).buildFuture());
+ ServicePathOutputBuilder mockOutputBuilder = new ServicePathOutputBuilder().setResult("success")
+ .setSuccess(true);
+ Mockito.doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(Mockito.any(),
+ Mockito.any());
+ ServiceImplementationRequestInput input = ServiceDataUtils
+ .buildServiceImplementationRequestInputTerminationPointResource(StringConstants.NETWORK_TOKEN);
ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input).get();
Assert.assertEquals(ResponseCodes.RESPONSE_OK, result.getConfigurationResponseCommon().getResponseCode());
ServiceImplementationRequestInput input = ServiceDataUtils
.buildServiceImplementationRequestInputTerminationPointResource(StringConstants.NETWORK_TOKEN);
- writePortMapping(input, StringConstants.NETWORK_TOKEN);
- GetPmOutput getPmOutput = new GetPmOutputBuilder()
- .setNodeId("node1").setMeasurements(new ArrayList<>()).build();
GetPmOutput getPmOutput1 = null;
Mockito.when(this.olmService.getPm(Mockito.any())).thenReturn(RpcResultBuilder.success(getPmOutput1)
.buildFuture());
ServiceImplementationRequestInput input = ServiceDataUtils
.buildServiceImplementationRequestInputTerminationPointResource(StringConstants.NETWORK_TOKEN);
- writePortMapping(input, StringConstants.NETWORK_TOKEN);
GetPmOutput getPmOutput = new GetPmOutputBuilder().setMeasurements(new ArrayList<>()).build();
Mockito.when(this.olmService.getPm(Mockito.any())).thenReturn(RpcResultBuilder.success(getPmOutput)
.buildFuture());
@Test
public void serviceImplementationServiceInActive4() throws InterruptedException, ExecutionException {
- ServiceImplementationRequestInput input = ServiceDataUtils
- .buildServiceImplementationRequestInputTerminationPointResource(StringConstants.NETWORK_TOKEN);
- writePortMapping(input, StringConstants.NETWORK_TOKEN);
Measurements measurements = new MeasurementsBuilder().setPmparameterName("preFECCorrectedErrors")
.setPmparameterValue("1").build();
List<Measurements> measurementsList = new ArrayList<Measurements>();
.setSuccess(true);
Mockito.doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(Mockito.any(),
Mockito.any());
+ ServiceImplementationRequestInput input = ServiceDataUtils
+ .buildServiceImplementationRequestInputTerminationPointResource(StringConstants.NETWORK_TOKEN);
ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input).get();
Assert.assertEquals(ResponseCodes.RESPONSE_OK, result.getConfigurationResponseCommon().getResponseCode());
ServiceImplementationRequestInput input = ServiceDataUtils
.buildServiceImplementationRequestInputTerminationPointResource(StringConstants.NETWORK_TOKEN);
- writePortMapping(input, StringConstants.NETWORK_TOKEN);
Measurements measurements = new MeasurementsBuilder().setPmparameterName("preFECCorrectedErrors")
.setPmparameterValue("112000000000d").build();
List<Measurements> measurementsList = new ArrayList<Measurements>();
import org.junit.Assert;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.mockito.Mockito;
import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.RendererRollbackOutputBuilder;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.ServicePathInput;
-@Ignore
public class DeviceRendererRPCImplTest extends AbstractTest {
private final DeviceRendererService deviceRenderer = Mockito.mock(DeviceRendererService.class);
private final OtnDeviceRendererService otnDeviceRenderer = Mockito.mock(OtnDeviceRendererService.class);
import com.google.common.util.concurrent.ListenableFuture;
import java.util.List;
-import java.util.concurrent.ExecutionException;
import org.mockito.Mockito;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry;
-import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
import org.opendaylight.transportpce.test.stub.MountPointStub;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210927.Network;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210927.mapping.Mapping;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210927.mapping.MappingBuilder;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210927.mapping.MappingKey;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210927.network.Nodes;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210927.network.NodesKey;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.GetConnectionPortTrailOutput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.GetConnectionPortTrailOutputBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.OrgOpenroadmDeviceService;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.get.connection.port.trail.output.Ports;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
return mountPoint;
}
- public static boolean writeMapping(String nodeId, String logicalConnPoint,
- DeviceTransactionManager deviceTransactionManager) {
- MappingBuilder mappingBuilder = new MappingBuilder();
- mappingBuilder.withKey(new MappingKey(logicalConnPoint));
- mappingBuilder.setLogicalConnectionPoint(logicalConnPoint);
- mappingBuilder.setSupportingOts("OTS");
- mappingBuilder.setSupportingCircuitPackName("2/0");
- mappingBuilder.setSupportingOms("OMS");
- mappingBuilder.setSupportingPort("8080");
- mappingBuilder.setSupportingCircuitPackName("circuit1");
- InstanceIdentifier<Mapping> portMappingIID =
- InstanceIdentifier.builder(Network.class).child(Nodes.class, new NodesKey(nodeId))
- .child(Mapping.class, new MappingKey(logicalConnPoint)).build();
- try {
- return TransactionUtils.writeTransaction(deviceTransactionManager,
- nodeId, LogicalDatastoreType.CONFIGURATION, portMappingIID, mappingBuilder.build());
- } catch (ExecutionException | InterruptedException e) {
- return false;
- }
+ public static Mapping createMapping(String nodeId, String logicalConnPoint) {
+ return new MappingBuilder()
+ .withKey(new MappingKey(logicalConnPoint))
+ .setLogicalConnectionPoint(logicalConnPoint)
+ .setSupportingOts("supporting-OTS")
+ .setSupportingCircuitPackName("2/0")
+ .setSupportingOms("supporting-OMS")
+ .setSupportingPort("port")
+ .setSupportingCircuitPackName("circuit-pack")
+ .build();
}
private MountPointUtils() {
import java.util.HashMap;
import java.util.Map;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.port.PortBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.format.rev190531.ServiceFormat;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.AToZDirection;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.AToZDirectionBuilder;
TerminationPoint terminationPoint2 = terminationPointBuilder.setTpNodeId("node1" + tpId)
.setTpId(tpId).build();
AToZ atoZ = new AToZBuilder().setId("1").withKey(new AToZKey("1")).setResource(new ResourceBuilder()
- .setResource(terminationPoint).build()).build();
+ .setResource(terminationPoint).setState(State.InService).build()).build();
AToZ atoZ2 = new AToZBuilder().setId("2").withKey(new AToZKey("2")).setResource(new ResourceBuilder()
- .setResource(terminationPoint2).build()).build();
+ .setResource(terminationPoint2).setState(State.InService).build()).build();
atoZMap.put(atoZ.key(),atoZ);
atoZMap.put(atoZ2.key(),atoZ2);
AToZDirection atozDirection = new AToZDirectionBuilder()
.build();
Map<ZToAKey,ZToA> ztoAMap = new HashMap<>();
ZToA ztoA = new ZToABuilder().setId("1").withKey(new ZToAKey("1")).setResource(new ResourceBuilder()
- .setResource(terminationPoint).build()).build();
+ .setResource(terminationPoint).setState(State.InService).build()).build();
ZToA ztoA2 = new ZToABuilder().setId("2").withKey(new ZToAKey("2")).setResource(new ResourceBuilder()
- .setResource(terminationPoint).build()).build();
+ .setResource(terminationPoint).setState(State.InService).build()).build();
ztoAMap.put(ztoA.key(),ztoA);
ztoAMap.put(ztoA2.key(),ztoA2);
ZToADirection ztoaDirection = new ZToADirectionBuilder()