portMapping);
DeviceRendererService deviceRendererService = new DeviceRendererServiceImpl(
lightyServices.getBindingDataBroker(), deviceTransactionManager, openRoadmInterfaceFactory,
- openRoadmInterfaces, crossConnect, portMapping, networkModelService);
+ openRoadmInterfaces, crossConnect, portMapping);
OtnDeviceRendererService otnDeviceRendererService = new OtnDeviceRendererServiceImpl(openRoadmInterfaceFactory,
crossConnect, openRoadmInterfaces, deviceTransactionManager, networkModelService);
rendererProvider = initRenderer(lightyServices, olmPowerServiceRpc, deviceRendererService,
this.mapDisgNodeRefNode = gnpyTopo.getMapDisgNodeRefNode();
this.mapLinkFiber = gnpyTopo.getMapLinkFiber();
this.trxList = gnpyTopo.getTrxList();
- try {
- this.pathRequest = extractPathRequest(input, atoz, requestId.toJava(), pceHardConstraints);
- this.synchronization = extractSynchronization(requestId);
- } catch (NullPointerException e) {
- throw new GnpyException("In GnpyServiceImpl: one of the elements is null",e);
- }
+ this.pathRequest = extractPathRequest(input, atoz, requestId.toJava(), pceHardConstraints);
+ this.synchronization = extractSynchronization(requestId);
}
public GnpyServiceImpl(PathComputationRequestInput input, ZToADirection ztoa, Uint32 requestId,
this.mapDisgNodeRefNode = gnpyTopo.getMapDisgNodeRefNode();
this.mapLinkFiber = gnpyTopo.getMapLinkFiber();
this.trxList = gnpyTopo.getTrxList();
- try {
- pathRequest = extractPathRequest(input, ztoa, requestId.toJava(), pceHardConstraints);
- synchronization = extractSynchronization(requestId);
- } catch (NullPointerException e) {
- throw new GnpyException("In GnpyServiceImpl: one of the elements of service is null",e);
- }
+ pathRequest = extractPathRequest(input, ztoa, requestId.toJava(), pceHardConstraints);
+ synchronization = extractSynchronization(requestId);
}
private Map<PathRequestKey, PathRequest> extractPathRequest(
*/
public GnpyTopoImpl(final NetworkTransactionService networkTransactionService) throws GnpyException {
this.networkTransactionService = networkTransactionService;
- try {
- extractTopo();
- } catch (NullPointerException e) {
- throw new GnpyException("In GnpyTopoImpl: one of the elements is null",e);
- }
+ extractTopo();
}
/*
double latency = 0;
for (PceGraphEdge edge : path.getEdgeList()) {
- try {
- latency += edge.link().getLatency();
- LOG.debug("- In checkLatency: latency of {} = {} units", edge.link().getLinkId().getValue(), latency);
- } catch (NullPointerException e) {
+ if (edge.link() == null || edge.link().getLatency() == null) {
LOG.warn("- In checkLatency: the link {} does not contain latency field",
edge.link().getLinkId().getValue());
+ return false;
}
+ latency += edge.link().getLatency();
+ LOG.debug("- In checkLatency: latency of {} = {} units", edge.link().getLinkId().getValue(), latency);
}
return (latency < maxLatency);
}
import org.opendaylight.transportpce.common.mapping.PortMapping;
import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException;
import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaces;
-import org.opendaylight.transportpce.networkmodel.service.NetworkModelService;
import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterfaceFactory;
import org.opendaylight.transportpce.renderer.provisiondevice.servicepath.ServiceListTopology;
import org.opendaylight.transportpce.renderer.provisiondevice.servicepath.ServicePathDirection;
private final OpenRoadmInterfaces openRoadmInterfaces;
private final CrossConnect crossConnect;
private final PortMapping portMapping;
- private final NetworkModelService networkModelService;
public DeviceRendererServiceImpl(DataBroker dataBroker, DeviceTransactionManager deviceTransactionManager,
OpenRoadmInterfaceFactory openRoadmInterfaceFactory, OpenRoadmInterfaces openRoadmInterfaces,
- CrossConnect crossConnect, PortMapping portMapping, NetworkModelService networkModelService) {
+ CrossConnect crossConnect, PortMapping portMapping) {
this.dataBroker = dataBroker;
this.deviceTransactionManager = deviceTransactionManager;
this.openRoadmInterfaceFactory = openRoadmInterfaceFactory;
this.openRoadmInterfaces = openRoadmInterfaces;
this.crossConnect = crossConnect;
this.portMapping = portMapping;
- this.networkModelService = networkModelService;
}
@SuppressWarnings("rawtypes")
ForkJoinPool forkJoinPool = new ForkJoinPool();
ForkJoinTask forkJoinTask = forkJoinPool.submit(() -> nodes.parallelStream().forEach(node -> {
String nodeId = node.getNodeId();
- // take the index of the node
- int nodeIndex = nodes.indexOf(node);
LOG.info("Starting provisioning for node : {}", nodeId);
AEndApiInfo apiInfoA = null;
ZEndApiInfo apiInfoZ = null;
<argument ref="openRoadmInterfaces" />
<argument ref="crossConnect" />
<argument ref="portMapping" />
- <argument ref="networkModelService" />
</bean>
<bean id="otnDeviceRenderer" class="org.opendaylight.transportpce.renderer.provisiondevice.OtnDeviceRendererServiceImpl" >
this.crossConnect = Mockito.spy(this.crossConnect);
this.deviceRendererService = new DeviceRendererServiceImpl(getDataBroker(),
this.deviceTransactionManager, this.openRoadmInterfaceFactory, this.openRoadmInterfaces,
- this.crossConnect, portMapping, null);
+ this.crossConnect, portMapping);
}
@Test
* -request header compliancy are verified.
*/
LOG.debug("checking Service Compliance ...");
- try {
- String serviceNmame = input.getServiceName();
- SdncRequestHeader sdncRequestHeader = input.getSdncRequestHeader();
- ConnectionType conType = input.getConnectionType();
- ComplianceCheckResult serviceHandlerCheckResult = ServicehandlerComplianceCheck.check(
- serviceNmame, sdncRequestHeader, conType, rpcActions, true, true);
- if (serviceHandlerCheckResult.hasPassed()) {
- LOG.debug("Service request compliant !");
- } else {
- return OperationResult.failed(serviceHandlerCheckResult.getMessage());
- }
+ String serviceNmame = input.getServiceName();
+ SdncRequestHeader sdncRequestHeader = input.getSdncRequestHeader();
+ ConnectionType conType = input.getConnectionType();
+ ComplianceCheckResult serviceHandlerCheckResult = ServicehandlerComplianceCheck.check(
+ serviceNmame, sdncRequestHeader, conType, rpcActions, true, true);
+ if (serviceHandlerCheckResult.hasPassed()) {
+ LOG.debug("Service request compliant !");
+ } else {
+ return OperationResult.failed(serviceHandlerCheckResult.getMessage());
+ }
+ /*
+ * If compliant, service-request parameters are verified in order to
+ * check if there is no missing parameter that prevents calculating
+ * a path and implement a service.
+ */
+ LOG.debug("checking Tx/Rx Info for AEnd ...");
+ ComplianceCheckResult txrxCheckAEnd = ServicehandlerTxRxCheck.check(input.getServiceAEnd(),
+ ServiceEndpointType.SERVICEAEND);
+ if (txrxCheckAEnd.hasPassed()) {
+ LOG.debug("Tx/Rx Info for AEnd checked !");
+ } else {
+ return OperationResult.failed(txrxCheckAEnd.getMessage());
+ }
+
+ LOG.debug("checking Tx/Rx Info for ZEnd ...");
+ ComplianceCheckResult txrxCheckZEnd = ServicehandlerTxRxCheck.check(input.getServiceZEnd(),
+ ServiceEndpointType.SERVICEZEND);
+ if (txrxCheckZEnd.hasPassed()) {
+ LOG.debug("Tx/Rx Info for ZEnd checked");
/*
- * If compliant, service-request parameters are verified in order to
- * check if there is no missing parameter that prevents calculating
- * a path and implement a service.
+ * If OK, common-id is verified in order to see if there is
+ * no routing policy provided. If yes, the routing
+ * constraints of the policy are recovered and coherency
+ * with hard/soft constraints provided in the input of the
+ * RPC.
*/
- LOG.debug("checking Tx/Rx Info for AEnd ...");
- ComplianceCheckResult txrxCheckAEnd = ServicehandlerTxRxCheck.check(input.getServiceAEnd(),
- ServiceEndpointType.SERVICEAEND);
- if (txrxCheckAEnd.hasPassed()) {
- LOG.debug("Tx/Rx Info for AEnd checked !");
- } else {
- return OperationResult.failed(txrxCheckAEnd.getMessage());
- }
-
- LOG.debug("checking Tx/Rx Info for ZEnd ...");
- ComplianceCheckResult txrxCheckZEnd = ServicehandlerTxRxCheck.check(input.getServiceZEnd(),
- ServiceEndpointType.SERVICEZEND);
- if (txrxCheckZEnd.hasPassed()) {
- LOG.debug("Tx/Rx Info for ZEnd checked");
- /*
- * If OK, common-id is verified in order to see if there is
- * no routing policy provided. If yes, the routing
- * constraints of the policy are recovered and coherency
- * with hard/soft constraints provided in the input of the
- * RPC.
- */
- } else {
- return OperationResult.failed(txrxCheckZEnd.getMessage());
- }
+ } else {
+ return OperationResult.failed(txrxCheckZEnd.getMessage());
+ }
- if (input.getCommonId() != null) {
- LOG.debug("Common-id specified");
- // Check coherency with hard/soft constraints
- if (CheckCoherencyHardSoft.check(input.getHardConstraints(), input.getSoftConstraints())) {
- LOG.debug("hard/soft constraints coherent !");
- } else {
- return OperationResult.failed("hard/soft constraints are not coherent !");
- }
+ if (input.getCommonId() != null) {
+ LOG.debug("Common-id specified");
+ // Check coherency with hard/soft constraints
+ if (CheckCoherencyHardSoft.check(input.getHardConstraints(), input.getSoftConstraints())) {
+ LOG.debug("hard/soft constraints coherent !");
} else {
- LOG.warn("Common-id not specified !");
+ return OperationResult.failed("hard/soft constraints are not coherent !");
}
- } catch (NullPointerException e) {
- LOG.error("one of input parameter is null ",e);
- return OperationResult.failed("one of input parameter is null.");
+ } else {
+ LOG.warn("Common-id not specified !");
}
return OperationResult.ok("Validation successful.");
}
public static OperationResult validateCreateConnectivityServiceRequest(CreateConnectivityServiceInput input) {
LOG.info("checking rpc create-connectivity-service input parameters...");
- try {
- LOG.info("checking EndPoints...");
- List<EndPoint> endPointList = new ArrayList<>(input.getEndPoint().values());
- ComplianceCheckResult endPointCheckResult = EndPointCheck.check(endPointList);
- if (endPointCheckResult.hasPassed()) {
- LOG.info("create-connectivity-service end-points compliant !");
- } else {
- return OperationResult.failed(endPointCheckResult.getMessage());
- }
-
- LOG.info("checking ConnConstraint...");
- ConnectivityConstraint connectivityConstraint = input.getConnectivityConstraint();
- ComplianceCheckResult conConstraintCheckResult = ConnConstraintCheck.check(connectivityConstraint);
- if (conConstraintCheckResult.hasPassed()) {
- LOG.info("create-connectivity-service connectivity constraints compliant !");
- } else {
- return OperationResult.failed(conConstraintCheckResult.getMessage());
- }
+ LOG.info("checking EndPoints...");
+ if (input.getEndPoint() == null) {
+ return OperationResult.failed("Service End-Point must not be null");
+ }
+ List<EndPoint> endPointList = new ArrayList<>(input.getEndPoint().values());
+ ComplianceCheckResult endPointCheckResult = EndPointCheck.check(endPointList);
+ if (endPointCheckResult.hasPassed()) {
+ LOG.info("create-connectivity-service end-points compliant !");
+ } else {
+ return OperationResult.failed(endPointCheckResult.getMessage());
+ }
- LOG.info("checking ResilienceConstraint...");
- ResilienceConstraint resilienceConstraintList = input.getResilienceConstraint();
- ComplianceCheckResult resilienceConstraintCheckResult = ResilienceConstraintCheck.check(
- resilienceConstraintList);
- if (resilienceConstraintCheckResult.hasPassed()) {
- LOG.info("create-connectivity-service resilience constraints compliant !");
- } else {
- return OperationResult.failed(resilienceConstraintCheckResult.getMessage());
- }
+ LOG.info("checking ConnConstraint...");
+ ConnectivityConstraint connectivityConstraint = input.getConnectivityConstraint();
+ ComplianceCheckResult conConstraintCheckResult = ConnConstraintCheck.check(connectivityConstraint);
+ if (conConstraintCheckResult.hasPassed()) {
+ LOG.info("create-connectivity-service connectivity constraints compliant !");
+ } else {
+ return OperationResult.failed(conConstraintCheckResult.getMessage());
+ }
- LOG.info("checking TopoConstraint...");
- TopologyConstraint topoConstraint = input.getTopologyConstraint();
- ComplianceCheckResult topoConstraintCheckResult = TopoConstraintCheck.check(topoConstraint);
- if (topoConstraintCheckResult.hasPassed()) {
- LOG.info("create-connectivity-service topo constraints compliant !");
- } else {
- return OperationResult.failed(topoConstraintCheckResult.getMessage());
- }
+ LOG.info("checking ResilienceConstraint...");
+ ResilienceConstraint resilienceConstraintList = input.getResilienceConstraint();
+ ComplianceCheckResult resilienceConstraintCheckResult = ResilienceConstraintCheck.check(
+ resilienceConstraintList);
+ if (resilienceConstraintCheckResult.hasPassed()) {
+ LOG.info("create-connectivity-service resilience constraints compliant !");
+ } else {
+ return OperationResult.failed(resilienceConstraintCheckResult.getMessage());
+ }
- } catch (NullPointerException e) {
- LOG.error("one of input parameter is null ", e);
- return OperationResult.failed("one of input parameter is null.");
+ LOG.info("checking TopoConstraint...");
+ TopologyConstraint topoConstraint = input.getTopologyConstraint();
+ ComplianceCheckResult topoConstraintCheckResult = TopoConstraintCheck.check(topoConstraint);
+ if (topoConstraintCheckResult.hasPassed()) {
+ LOG.info("create-connectivity-service topo constraints compliant !");
+ } else {
+ return OperationResult.failed(topoConstraintCheckResult.getMessage());
}
return OperationResult.ok("Validation successful.");
}