import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
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.CrossConnectImpl22;
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.openroadminterfaces.OpenRoadmInterfacesImpl22;
import org.opendaylight.transportpce.renderer.NetworkModelWavelengthService;
import org.opendaylight.transportpce.renderer.NetworkModelWavelengthServiceImpl;
+import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterface121;
+import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterface22;
import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterfaceFactory;
import org.opendaylight.transportpce.renderer.stub.MountPointServiceStub;
import org.opendaylight.transportpce.renderer.stub.MountPointStub;
this.openRoadmInterfacesImpl22 = new OpenRoadmInterfacesImpl22(deviceTransactionManager);
this.mappingUtils = new MappingUtilsImpl(getDataBroker());
this.openRoadmInterfaces = new OpenRoadmInterfacesImpl(deviceTransactionManager, mappingUtils,
- openRoadmInterfacesImpl121, openRoadmInterfacesImpl22);
+ openRoadmInterfacesImpl121, openRoadmInterfacesImpl22);
this.openRoadmInterfaces = Mockito.spy(this.openRoadmInterfaces);
this.portMappingVersion22 =
- new PortMappingVersion22(getDataBroker(), deviceTransactionManager, this.openRoadmInterfaces);
+ new PortMappingVersion22(getDataBroker(), deviceTransactionManager, this.openRoadmInterfaces);
this.portMappingVersion121 =
- new PortMappingVersion121(getDataBroker(), deviceTransactionManager, this.openRoadmInterfaces);
+ new PortMappingVersion121(getDataBroker(), deviceTransactionManager, this.openRoadmInterfaces);
this.portMapping = new PortMappingImpl(getDataBroker(), this.portMappingVersion22, this.mappingUtils,
- this.portMappingVersion121);
+ this.portMappingVersion121);
this.crossConnectImpl121 = new CrossConnectImpl121(deviceTransactionManager);
this.crossConnectImpl22 = new CrossConnectImpl22(deviceTransactionManager);
this.crossConnect = new CrossConnectImpl(deviceTransactionManager, this.mappingUtils, this.crossConnectImpl121,
- this.crossConnectImpl22);
+ this.crossConnectImpl22);
this.crossConnect = Mockito.spy(crossConnect);
- OpenRoadmInterfaceFactory openRoadmInterfaceFactory =
- new OpenRoadmInterfaceFactory(portMapping, openRoadmInterfaces);
+ FixedFlexInterface fixedFlexInterface = new FixedFlexImpl();
+ OpenRoadmInterface121 openRoadmInterface121 = new OpenRoadmInterface121(portMapping,openRoadmInterfaces);
+ OpenRoadmInterface22 openRoadmInterface22 = new OpenRoadmInterface22(portMapping,openRoadmInterfaces,
+ fixedFlexInterface);
+ OpenRoadmInterfaceFactory openRoadmInterfaceFactory = new OpenRoadmInterfaceFactory(this.mappingUtils,
+ openRoadmInterface121,openRoadmInterface22);
+
this.deviceRenderer = new DeviceRendererServiceImpl(this.getDataBroker(),
- this.deviceTransactionManager, openRoadmInterfaceFactory, openRoadmInterfaces, crossConnect,
+ this.deviceTransactionManager, openRoadmInterfaceFactory, openRoadmInterfaces, crossConnect,
this.portMapping);
}
this.olmService = new OlmServiceStub();
this.olmService = Mockito.spy(this.olmService);
ListeningExecutorService executor =
- MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(NUMBER_OF_THREADS));
+ MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(NUMBER_OF_THREADS));
this.networkModelWavelengthService = new NetworkModelWavelengthServiceImpl(getDataBroker());
NotificationPublishService notificationPublishService = new NotificationPublishServiceMock();
this.rendererServiceOperations = new RendererServiceOperationsImpl(this.deviceRenderer, olmService,
ServiceDeleteInputBuilder serviceDeleteInputBuilder = new ServiceDeleteInputBuilder();
serviceDeleteInputBuilder.setServiceName("service 1");
serviceDeleteInputBuilder.setServiceHandlerHeader((new ServiceHandlerHeaderBuilder())
- .setRequestId("request1").build());
+ .setRequestId("request1").build());
Mockito.doReturn(true).when(this.crossConnect).deleteCrossConnect(Mockito.anyString(), Mockito.anyString());
ServiceDeleteOutput serviceDeleteOutput
= this.rendererServiceOperations.serviceDelete(serviceDeleteInputBuilder.build()).get();
Assert.assertEquals(ResponseCodes.RESPONSE_OK,
- serviceDeleteOutput.getConfigurationResponseCommon().getResponseCode());
+ serviceDeleteOutput.getConfigurationResponseCommon().getResponseCode());
Mockito.verify(this.crossConnect, Mockito.times(2)).deleteCrossConnect(Mockito.any(), Mockito.any());
}
ServiceDeleteOutput serviceDeleteOutput
= this.rendererServiceOperations.serviceDelete(serviceDeleteInputBuilder.build()).get();
Assert.assertEquals(ResponseCodes.RESPONSE_FAILED,
- serviceDeleteOutput.getConfigurationResponseCommon().getResponseCode());
+ serviceDeleteOutput.getConfigurationResponseCommon().getResponseCode());
Mockito.verify(this.crossConnect, Mockito.times(0)).deleteCrossConnect(Mockito.any(), Mockito.any());
}
public void serviceDeleteOperationTearDownFailedAtoZ() throws ExecutionException, InterruptedException {
Mockito.doReturn(true).when(this.crossConnect).deleteCrossConnect(Mockito.anyString(), Mockito.anyString());
Mockito.doReturn(RpcResultBuilder.success((new ServicePowerTurndownOutputBuilder())
- .setResult("Failed").build()).buildFuture()).when(this.olmService).servicePowerTurndown(Mockito.any());
+ .setResult("Failed").build()).buildFuture()).when(this.olmService).servicePowerTurndown(Mockito.any());
writePathDescription();
ServiceDeleteInputBuilder serviceDeleteInputBuilder = new ServiceDeleteInputBuilder();
public void serviceDeleteOperationTearDownFailedZtoA() throws ExecutionException, InterruptedException {
Mockito.doReturn(true).when(this.crossConnect).deleteCrossConnect(Mockito.anyString(), Mockito.anyString());
Mockito.when(this.olmService.servicePowerTurndown(Mockito.any()))
- .thenReturn(RpcResultBuilder.success((new ServicePowerTurndownOutputBuilder())
- .setResult("Success").build()).buildFuture())
- .thenReturn(RpcResultBuilder.success((new ServicePowerTurndownOutputBuilder())
- .setResult("Failed").build()).buildFuture());
+ .thenReturn(RpcResultBuilder.success((new ServicePowerTurndownOutputBuilder())
+ .setResult("Success").build()).buildFuture())
+ .thenReturn(RpcResultBuilder.success((new ServicePowerTurndownOutputBuilder())
+ .setResult("Failed").build()).buildFuture());
writePathDescription();
ServiceDeleteInputBuilder serviceDeleteInputBuilder = new ServiceDeleteInputBuilder();
serviceDeleteInputBuilder.setServiceName("service 1");
serviceDeleteInputBuilder.setServiceHandlerHeader((new ServiceHandlerHeaderBuilder())
- .setRequestId("request1").build());
+ .setRequestId("request1").build());
ServiceDeleteOutput serviceDeleteOutput =
this.rendererServiceOperations.serviceDelete(serviceDeleteInputBuilder.build()).get();
Assert.assertEquals(ResponseCodes.RESPONSE_FAILED,
- serviceDeleteOutput.getConfigurationResponseCommon().getResponseCode());
+ serviceDeleteOutput.getConfigurationResponseCommon().getResponseCode());
Mockito.verify(this.olmService, Mockito.times(2)).servicePowerTurndown(Mockito.any());
Mockito.verify(this.crossConnect, Mockito.times(0)).deleteCrossConnect(Mockito.eq("node1"), Mockito.any());
Mockito.verify(this.crossConnect, Mockito.times(0)).deleteCrossConnect(Mockito.eq("node2"), Mockito.any());
private void writePathDescription() throws ExecutionException, InterruptedException {
ServicePathsBuilder servicePathsBuilder = new ServicePathsBuilder();
servicePathsBuilder.setPathDescription(ServiceDeleteDataUtils
- .createTransactionPathDescription(OpenRoadmInterfacesImpl.PP_TOKEN));
+ .createTransactionPathDescription(StringConstants.PP_TOKEN));
servicePathsBuilder.setServiceAEnd(ServiceDeleteDataUtils.getServiceAEndBuild().build())
.setServiceZEnd(ServiceDeleteDataUtils.getServiceZEndBuild().build());
servicePathsBuilder.withKey(new ServicePathsKey("service 1"));
InstanceIdentifier<ServicePaths> servicePathsInstanceIdentifier = InstanceIdentifier.create(
ServicePathList.class).child(ServicePaths.class, new ServicePathsKey("service 1"));
TransactionUtils.writeTransaction(
- this.deviceTransactionManager,
- "node1" + OpenRoadmInterfacesImpl.PP_TOKEN,
- LogicalDatastoreType.OPERATIONAL,
- servicePathsInstanceIdentifier,
- servicePathsBuilder.build());
+ this.deviceTransactionManager,
+ "node1" + StringConstants.PP_TOKEN,
+ LogicalDatastoreType.OPERATIONAL,
+ servicePathsInstanceIdentifier,
+ servicePathsBuilder.build());
}
}