"Version 1.2";
}
+ rpc service-state-modify {
+ input {
+ leaf service-name {
+ type string;
+ mandatory true;
+ }
+ leaf operational-state {
+ type org-openroadm-common-types:state;
+ }
+ }
+ output {
+ uses org-openroadm-common-service-types:configuration-response-common;
+ }
+ description
+ "Just to test rpc restoration from org-openroadm-service";
+ }
+
notification service-rpc-result-sh{
description
"This Notification indicates result of service RPC";
<module>impl</module>
<module>renderer</module>
<module>olm</module>
- <module>servicehandler</module>
<module>tests</module>
+ <module>servicehandler</module>
<module>cli</module>
<module>features</module>
<module>karaf</module>
<artifactId>transportpce-ordmodels</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>transportpce-stubmodels</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<!-- Testing Dependencies -->
<dependency>
RpcResult<PathComputationRequestOutput> pceOutputResult = null;
Boolean output = false;
if (pathComputationRequestInput != null) {
- LOG.info("pathComputationRequestInput : " + pathComputationRequestInput.toString());
+ LOG.info("pathComputationRequestInput : {}", pathComputationRequestInput.toString());
Future<RpcResult<PathComputationRequestOutput>> pceOutputFuture = service
.pathComputationRequest(pathComputationRequestInput);
try {
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.service.implementation.request.input.ServiceZEnd;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.service.implementation.request.input.ServiceZEndBuilder;
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.sdnc.request.header.SdncRequestHeader;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceCreateInput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceReconfigureInput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.list.Services;
try {
tmp = pathComputationOutput.getResponseParameters().getPathDescription();
} catch (NullPointerException e) {
- LOG.error("PathDescription is null : " + e.toString());
+ LOG.error("PathDescription is null : {}", e.toString());
}
PathDescriptionBuilder pathDescription = new PathDescriptionBuilder();
if (tmp != null) {
try {
tmp = pathComputationOutput.getResponseParameters().getPathDescription();
} catch (NullPointerException e) {
- LOG.error("PathDescription is null : " + e.toString());
+ LOG.error("PathDescription is null : {}", e.toString());
}
PathDescriptionBuilder pathDescription = new PathDescriptionBuilder();
if (tmp != null) {
.setServiceAEnd(serviceAEnd)
.setServiceZEnd(serviceZEnd)
.build();
- LOG.info("ServiceImplementationRequestInput : " + serviceImplementationRequestInput.toString());*/
+ LOG.info("ServiceImplementationRequestInput : {}", serviceImplementationRequestInput.toString());*/
}
/** Building ServiceImplementationRequestInput / ServiceDeleteInput serviceDeleteInput .*/
ServiceHandlerHeaderBuilder serviceHandlerHeader = new ServiceHandlerHeaderBuilder();
+ SdncRequestHeader sdnc = services.getSdncRequestHeader();
+ if (sdnc != null) {
+ String requestId = services.getSdncRequestHeader().getRequestId();
+ if (requestId != null) {
+ serviceHandlerHeader.setRequestId(requestId);
+ }
+ }
mappingSIRequest(pathComputationOutput, serviceHandlerHeader, services.getServiceAEnd(),
services.getServiceZEnd(), services.getServiceName());
/*org.opendaylight.yang.gen.v1.http.org.openroadm.common.service
try {
tmp = pathComputationOutput.getResponseParameters().getPathDescription();
} catch (NullPointerException e) {
- LOG.error("PathDescription is null : " + e.toString());
+ LOG.error("PathDescription is null : {}", e);
}
PathDescriptionBuilder pathDescription = new PathDescriptionBuilder();
if (tmp != null) {
.setServiceAEnd(serviceAEnd)
.setServiceZEnd(serviceZEnd)
.build();
- LOG.info("ServiceImplementationRequestInput : " + serviceImplementationRequestInput.toString());*/
+ LOG.info("ServiceImplementationRequestInput : {}", serviceImplementationRequestInput.toString());*/
}
/**
try {
tmp = pathComputationOutput.getResponseParameters().getPathDescription();
} catch (NullPointerException e) {
- LOG.error("PathDescription is null : " + e.toString());
+ LOG.error("PathDescription is null : {}", e.toString());
}
PathDescriptionBuilder pathDescription = new PathDescriptionBuilder();
if (tmp != null) {
import org.opendaylight.transportpce.servicehandler.ServicehandlerTxRxCheck;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev170930.ServiceRpcResultSh;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev170930.ServiceRpcResultShBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev170930.ServiceStateModifyInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev170930.ServiceStateModifyOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev170930.ServiceStateModifyOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev170930.ServicehandlerService;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.PathComputationRequestOutput;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.PathComputationRequestOutputBuilder;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.ServicePathRpcResult;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.configuration.response.common.ConfigurationResponseCommon;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.configuration.response.common.ConfigurationResponseCommonBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.sdnc.request.header.SdncRequestHeader;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.sdnc.request.header.SdncRequestHeaderBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.ServiceAEnd;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.ServiceAEndBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.ServiceZEnd;
*
* @author <a href="mailto:martial.coulibaly@gfi.com">Martial Coulibaly</a> on behalf of Orange
*/
-public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceListener,
+public class ServicehandlerImpl implements OrgOpenroadmServiceService, ServicehandlerService, StubpceListener,
StubrendererListener,AutoCloseable {
/** Logging. */
private static final Logger LOG = LoggerFactory.getLogger(ServicehandlerImpl.class);
private ServicePathRpcResult servicePathRpcResult = null;
private ServiceRpcResultSp serviceRpcResultSp = null;
- private String notificationUrl = "";
private RpcActions action;
private PathDescription pathDescription;
serviceName = service.getServiceName();
}
if (serviceName != null) {
- LOG.info("deleting service '" + serviceName + "'from datastore ...");
+ LOG.info("deleting service '{}' from datastore ...", serviceName);
ServiceRpcResultSh notification = null;
String message = "";
/**
try {
notificationPublishService.putNotification(notification);
} catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.info("notification offer rejected : {}", e);
}
} else {
LOG.error("Parameter 'ServiceName' fro deleteServiceFromDatastore is null !");
}
notification = new ServiceRpcResultShBuilder()
.setNotificationType(notif)
- .setServiceName(serviceCreateInput.getServiceName())
+ .setServiceName(serviceName)
.setStatus(RpcStatusEx.Successful).setStatusMessage(message)
.build();
try {
notificationPublishService.putNotification(notification);
} catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.info("notification offer rejected : {}", e);
}
} else {
message = "pathTopology not in stubrenderer notification, cancelling pce resource reserve ...";
try {
notificationPublishService.putNotification(notification);
} catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.info("notification offer rejected : {}", e);
}
pceCancelResResource();
}
try {
notificationPublishService.putNotification(notification);
} catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.info("notification offer rejected : {}", e);
}
FutureCallback<Boolean> pceCallback = new FutureCallback<Boolean>() {
String message = "";
try {
notificationPublishService.putNotification(notification);
} catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.info("notification offer rejected : {}", e);
}
} else {
message = mappingAndSendingPCRequest.getError();
try {
notificationPublishService.putNotification(notification);
} catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.info("notification offer rejected : {}", e);
}
}
}
try {
notificationPublishService.putNotification(notification);
} catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.info("notification offer rejected : {}", e);
}
}
try {
notificationPublishService.putNotification(notification);
} catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.info("notification offer rejected : {}", e);
}
} else {
message = mappingAndSendingPCRequest.getError();
try {
notificationPublishService.putNotification(notification);
} catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.info("notification offer rejected : {}", e);
}
}
}
try {
notificationPublishService.putNotification(notification);
} catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.info("notification offer rejected : {}", e);
}
}
if (tmp != null && id != null) {
final String serviceName = tmp;
- LOG.info("stubrendererDelete service '" + serviceName + "'");
+ LOG.info("stubrendererDelete service '{}'", serviceName);
mappingAndSendingSIRequest = new MappingAndSendingSIRequest(rpcRegistry, id, serviceName);
ListenableFuture<Boolean> renderer = mappingAndSendingSIRequest.serviceDelete();
FutureCallback<Boolean> rendererCallback = new FutureCallback<Boolean>() {
try {
notificationPublishService.putNotification(notification);
} catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.info("notification offer rejected : {}", e);
}
}
try {
notificationPublishService.putNotification(notification);
} catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.info("notification offer rejected : {}", e);
}
} else {
message = "deleting service failed !";
try {
notificationPublishService.putNotification(notification);
} catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.info("notification offer rejected : {}", e);
}
}
}
final ServiceNotificationTypes notifType = type;
if (!create) { /** ServiceReconfigure. */
if ((result = writeOrModifyOrDeleteServiceList(serviceName, pathComputationResponse,null, 1)) == null) {
- LOG.info("Service '" + serviceName + "' deleted from datastore");
+ LOG.info("Service '{}' deleted from datastore", serviceName);
serviceName = newServiceName;
delete = true;
} else {
- LOG.info("deleting Service '" + serviceName + "' failed !");
+ LOG.info("deleting Service '{}' failed !", serviceName);
}
}
if (delete) {
try {
notificationPublishService.putNotification(notification);
} catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.info("notification offer rejected : {}", e);
}
FutureCallback<Boolean> rendererCallback = new FutureCallback<Boolean>() {
try {
notificationPublishService.putNotification(notification);
} catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.info("notification offer rejected : {}", e);
}
} else {
message = mappingAndSendingSIRequest.getError();
try {
notificationPublishService.putNotification(notification);
} catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.info("notification offer rejected : {}", e);
}
}
}
try {
notificationPublishService.putNotification(notification);
} catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.info("notification offer rejected : {}", e);
}
}
};
Boolean commonId = true;
Boolean coherencyHardSoft = false;
- if (sdncRequestHeader != null) {
+ if (rpcActions.equals(RpcActions.ServiceCreate) || rpcActions.equals(RpcActions.ServiceFeasibilityCheck)
+ || rpcActions.equals(RpcActions.ServiceDelete)) {
sdncRequest = true;
- }
- if (connectionType != null) {
+ } else if (rpcActions.equals(RpcActions.ServiceCreate)
+ || rpcActions.equals(RpcActions.ServiceFeasibilityCheck)
+ || rpcActions.equals(RpcActions.ServiceReconfigure)) {
contype = true;
}
compliancyCheck = new ServicehandlerCompliancyCheck(sdncRequestHeader, serviceName,
pathDescription = null;
pathTopology = null;
action = RpcActions.ServiceCreate;
- notificationUrl = null;
- LOG.info("notificationUrl : " + notificationUrl);
setPathDescription(null);
serviceCreateInput = input;
setServiceDeleteInput(null);
input.getConnectionType(), RpcActions.ServiceCreate, input.getServiceAEnd(), input.getServiceZEnd(),
input.getCommonId(), input.getHardConstraints(), input.getSoftConstraints())) != null) {
message = "Service not compliant : " + serviceCompliancy;
+ responseCode = "500";
LOG.info(message);
} else {
LOG.info("Service compliant !");
- pcePathComputation(input);
- LOG.info("PCR Request in progress ");
- configurationResponseCommon = new ConfigurationResponseCommonBuilder()
- .setAckFinalIndicator("No").setRequestId(input.getSdncRequestHeader().getRequestId())
- .setResponseMessage("Service compliant, serviceCreate in progress...")
- .setResponseCode("200").build();
+ String name = input.getServiceName();
+ if (readServiceList(name) == null) {
+ pcePathComputation(input);
+ LOG.info("PCR Request in progress ");
+ configurationResponseCommon = new ConfigurationResponseCommonBuilder()
+ .setAckFinalIndicator("No").setRequestId(input.getSdncRequestHeader().getRequestId())
+ .setResponseMessage("Service compliant, serviceCreate in progress...")
+ .setResponseCode("200").build();
- ServiceCreateOutputBuilder output = new ServiceCreateOutputBuilder()
- .setConfigurationResponseCommon(configurationResponseCommon);
+ ServiceCreateOutputBuilder output = new ServiceCreateOutputBuilder()
+ .setConfigurationResponseCommon(configurationResponseCommon);
- return RpcResultBuilder.success(output.build()).buildFuture();
+ return RpcResultBuilder.success(output.build()).buildFuture();
+ } else {
+ LOG.info("Service '{}' already created !", name);
+ configurationResponseCommon = new ConfigurationResponseCommonBuilder()
+ .setAckFinalIndicator("Yes").setRequestId(input.getSdncRequestHeader().getRequestId())
+ .setResponseMessage("Service already created !")
+ .setResponseCode("500").build();
+ ServiceCreateOutputBuilder output = new ServiceCreateOutputBuilder()
+ .setConfigurationResponseCommon(configurationResponseCommon);
+
+ return RpcResultBuilder.success(output.build()).buildFuture();
+ }
}
/*compliancyCheck = new ServicehandlerCompliancyCheck(input.getSdncRequestHeader(), input.getServiceName(),
input.getConnectionType(), RpcActions.ServiceCreate);
responseCode = "500";
}*/
- configurationResponseCommon = new ConfigurationResponseCommonBuilder()
+ ConfigurationResponseCommonBuilder builder = new ConfigurationResponseCommonBuilder()
.setAckFinalIndicator("Yes")
- .setRequestId(input.getSdncRequestHeader().getRequestId()).setResponseMessage(message)
- .setResponseCode(responseCode).build();
+ .setResponseMessage(message)
+ .setResponseCode(responseCode);
+ SdncRequestHeader sdnc = input.getSdncRequestHeader();
+ if (sdnc != null) {
+ String requestId = sdnc.getRequestId();
+ if (requestId != null) {
+ builder.setRequestId(requestId);
+ }
+ }
+ configurationResponseCommon = builder.build();
ServiceCreateOutputBuilder output = new ServiceCreateOutputBuilder()
.setConfigurationResponseCommon(configurationResponseCommon);
return RpcResultBuilder.success(output.build()).buildFuture();
-
}
@Override
public Future<RpcResult<ServiceDeleteOutput>> serviceDelete(ServiceDeleteInput input) {
- LOG.info("RPC serviceDelete request received for Service '" + input.getServiceDeleteReqInfo().getServiceName()
- + "'");
+ LOG.info("RPC serviceDelete request received for Service '{}'", input.getServiceDeleteReqInfo()
+ .getServiceName());
setServiceDeleteInput(input);
setServiceReconfigureInput(null);
serviceCreateInput = null;
String serviceName = input.getServiceDeleteReqInfo().getServiceName();
Services service = readServiceList(serviceName);
if (service != null) {
- LOG.debug("Service '" + serviceName + "' present in datastore !");
+ LOG.debug("Service '{}' present in datastore !", serviceName);
stubrendererDelete();
LOG.info("ServiceDelete Request in progress ... ");
ConfigurationResponseCommon configurationResponseCommon = new ConfigurationResponseCommonBuilder()
String serviceName = input.getServiceName();
Services service = readServiceList(serviceName);
if (service != null) {
- LOG.debug("Service '" + serviceName + "' present in datastore !");
+ LOG.debug("Service '{}' present in datastore !", serviceName);
/**
* Sending cancel resource reserve request to PCE.
*/
String serviceName = input.getServiceName();
Services service = readServiceList(serviceName);
if (service != null) {
- LOG.debug("Service '" + serviceName + "' present in datastore !");
+ LOG.debug("Service '{}' present in datastore !", serviceName);
pceCancelResResource();
ServiceReconfigureOutput output = new ServiceReconfigureOutputBuilder()
.setStatus(RpcStatusEx.Pending)
return RpcResultBuilder.success(output).buildFuture();
} else {
message = "Service '" + serviceName + "' not exists in datastore";
- LOG.error(message);
+ LOG.error("Service '{}' not exists in datastore", serviceName);
}
}
} else {
message = compliancyCheck.getMessage();
}*/
- ServiceReconfigureOutput output = new ServiceReconfigureOutputBuilder().setStatus(RpcStatus.Successful)
+ ServiceReconfigureOutput output = new ServiceReconfigureOutputBuilder().setStatus(RpcStatus.Failed)
.setStatusMessage(message).build();
return RpcResultBuilder.success(output).buildFuture();
}
ServiceRpcResultSh notification = null;
setServiceDeleteInput(null);
setServiceReconfigureInput(null);
- notificationUrl = null;
String message = "";
LOG.info("checking Service Compliancy ...");
compliancyCheck = new ServicehandlerCompliancyCheck(input.getServiceName(), RpcActions.ServiceRestoration);
Services service = readServiceList(serviceName);
if (service != null) {
this.service = service;
- LOG.debug("Service '" + serviceName + "' present in datastore !");
- notification = new ServiceRpcResultShBuilder()
- .setNotificationType(ServiceNotificationTypes.ServiceRestorationResult)
- .setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Pending)
- .setStatusMessage("Service '" + serviceName + "' present in datastore, deleting service ...")
- .build();
- try {
- notificationPublishService.putNotification(notification);
- } catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.debug("Service '{}' present in datastore !", serviceName);
+ /** verify if service state is down. */
+ State state = service.getOperationalState();
+ if (state != null && !state.equals(State.InService)) {
+ notification = new ServiceRpcResultShBuilder()
+ .setNotificationType(ServiceNotificationTypes.ServiceRestorationResult)
+ .setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Pending)
+ .setStatusMessage("Service '" + serviceName + "' present in datastore, deleting service ..")
+ .build();
+ try {
+ notificationPublishService.putNotification(notification);
+ } catch (InterruptedException e) {
+ LOG.info("notification offer rejected : {}", e);
+ }
+ stubrendererDelete();
+ LOG.info("PCR Request in progress ");
+ ServiceRestorationOutput output = new ServiceRestorationOutputBuilder()
+ .setStatus(RpcStatus.Successful)
+ .setStatusMessage("ServiceRestoration in progress...").build();
+ return RpcResultBuilder.success(output).buildFuture();
+ } else {
+ LOG.info("Service '{}' still in '{}' state", serviceName, state);
+ ServiceRestorationOutput output = new ServiceRestorationOutputBuilder()
+ .setStatus(RpcStatus.Failed)
+ .setStatusMessage("ServiceRestoration failed : Service still in service !")
+ .build();
+ return RpcResultBuilder.success(output).buildFuture();
}
- stubrendererDelete();
- LOG.info("PCR Request in progress ");
- ServiceRestorationOutput output = new ServiceRestorationOutputBuilder()
- .setStatus(RpcStatus.Successful)
- .setStatusMessage("ServiceRestoration in progress...").build();
- return RpcResultBuilder.success(output).buildFuture();
} else {
message = "Service '" + serviceName + "' not exists in datastore";
LOG.error(message);
LOG.error(message);
}
- ServiceRestorationOutput output = new ServiceRestorationOutputBuilder().setStatus(RpcStatus.Successful)
+ ServiceRestorationOutput output = new ServiceRestorationOutputBuilder().setStatus(RpcStatus.Failed)
.setStatusMessage(message).build();
return RpcResultBuilder.success(output).buildFuture();
if (serviceCreateInput != null) {
aend = new ServiceAEndBuilder(serviceCreateInput.getServiceAEnd()).build();
zend = new ServiceZEndBuilder(serviceCreateInput.getServiceZEnd()).build();
- service.setServiceName(serviceCreateInput.getServiceName()).setAdministrativeState(State.OutOfService)
- .setOperationalState(State.OutOfService).setCommonId(serviceCreateInput.getCommonId())
- .setConnectionType(serviceCreateInput.getConnectionType())
- .setCustomer(serviceCreateInput.getCustomer())
- .setCustomerContact(serviceCreateInput.getCustomerContact())
- .setHardConstraints(serviceCreateInput.getHardConstraints())
- .setSoftConstraints(serviceCreateInput.getSoftConstraints())
- .setLifecycleState(LifecycleState.Planned).setServiceAEnd(aend).setServiceZEnd(zend)
- .setSdncRequestHeader(serviceCreateInput.getSdncRequestHeader());
+ service.setServiceName(serviceCreateInput.getServiceName())
+ .setAdministrativeState(State.OutOfService)
+ .setOperationalState(State.OutOfService).setCommonId(serviceCreateInput.getCommonId())
+ .setConnectionType(serviceCreateInput.getConnectionType())
+ .setCustomer(serviceCreateInput.getCustomer())
+ .setCustomerContact(serviceCreateInput.getCustomerContact())
+ .setHardConstraints(serviceCreateInput.getHardConstraints())
+ .setSoftConstraints(serviceCreateInput.getSoftConstraints())
+ .setLifecycleState(LifecycleState.Planned).setServiceAEnd(aend).setServiceZEnd(zend)
+ .setSdncRequestHeader(new SdncRequestHeaderBuilder()
+ .setRequestId(serviceCreateInput.getSdncRequestHeader().getRequestId())
+ .setRpcAction(serviceCreateInput.getSdncRequestHeader().getRpcAction())
+ .build());
} else if (serviceReconfigureInput != null) {
aend = new ServiceAEndBuilder(serviceReconfigureInput.getServiceAEnd()).build();
.setCustomerContact(serviceReconfigureInput.getCustomerContact())
.setHardConstraints(serviceReconfigureInput.getHardConstraints())
.setSoftConstraints(serviceReconfigureInput.getSoftConstraints())
- .setLifecycleState(LifecycleState.Planned).setServiceAEnd(aend).setServiceZEnd(zend);
+ .setLifecycleState(LifecycleState.Planned).setServiceAEnd(aend).setServiceZEnd(zend)
+ .setSdncRequestHeader(new SdncRequestHeaderBuilder()
+ .setRequestId("reconfigure_" + serviceReconfigureInput.getNewServiceName())
+ .setRpcAction(RpcActions.ServiceReconfigure)
+ .build());
}
org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.response
LOG.error("Reading service failed:", e);
}
if (optional.isPresent()) {
- LOG.debug("Service '" + serviceName + "' present !");
+ LOG.debug("Service '{}' present !", serviceName);
result = new ServicesBuilder(optional.get()).build();
}
return result;
*/
private String writeOrModifyOrDeleteServiceList(String serviceName, PathComputationRequestOutput output,
Topology topo, int choice) {
- LOG.info("WriteOrModifyOrDeleting '" + serviceName + "' Service");
+ LOG.info("WriteOrModifyOrDeleting '{}' Service", serviceName);
WriteTransaction writeTx = db.newWriteOnlyTransaction();
String result = null;
Services readService = readServiceList(serviceName);
String action = null;
switch (choice) {
case 0: /** Modify. */
- LOG.info("Modifying '" + serviceName + "' Service");
+ LOG.info("Modifying '{}' Service", serviceName);
service.setOperationalState(State.InService).setAdministrativeState(State.InService);
service.setTopology(topo);
writeTx.merge(LogicalDatastoreType.OPERATIONAL, iid, service.build());
break;
case 1: /** Delete. */
- LOG.info("Deleting '" + serviceName + "' Service");
+ LOG.info("Deleting '{}' Service", serviceName);
writeTx.delete(LogicalDatastoreType.OPERATIONAL, iid);
action = "delete";
break;
try {
Futures.getChecked(future, ExecutionException.class);
} catch (ExecutionException e) {
- LOG.info("Failed to " + action + " service from Service List");
+ LOG.info("Failed to {} service from Service List", action);
result = "Failed to " + action + " service from Service List";
}
} else if (choice == 2) { /** Write Service. */
- LOG.info("Writing '" + serviceName + "' Service");
+ LOG.info("Writing '{}' Service", serviceName);
InstanceIdentifier<Services> iid = InstanceIdentifier.create(ServiceList.class).child(Services.class,
new ServicesKey(serviceName));
Services writeService = null;
public void setServiceFeasibilityCheckInput(ServiceFeasibilityCheckInput serviceFeasibilityCheckInput) {
this.serviceFeasibilityCheckInput = serviceFeasibilityCheckInput;
}
+
+ @Override
+ public Future<RpcResult<ServiceStateModifyOutput>> serviceStateModify(ServiceStateModifyInput input) {
+ LOG.info("RPC service state modify received");
+ String servicename = input.getServiceName();
+ String message = "";
+ String responseCode = "500";
+ if (servicename != null) {
+ Services service = readServiceList(servicename);
+ if (service != null) {
+ LOG.info("Modify '{}' Service state", servicename);
+ WriteTransaction writeTx = db.newWriteOnlyTransaction();
+ String result = null;
+ Future<Void> future = null;
+ InstanceIdentifier<Services> iid = InstanceIdentifier.create(ServiceList.class).child(Services.class,
+ new ServicesKey(servicename));
+ ServicesBuilder modifyService = new ServicesBuilder(service);
+ modifyService.setOperationalState(State.OutOfService);
+ writeTx.merge(LogicalDatastoreType.OPERATIONAL, iid, modifyService.build());
+ future = writeTx.submit();
+ try {
+ Futures.getChecked(future, ExecutionException.class);
+ } catch (ExecutionException e) {
+ LOG.info("Failed to {} service from Service List", action);
+ result = "Failed to " + action + " service from Service List";
+ }
+ if (result == null) {
+ responseCode = "200";
+ message = "Service state modified !";
+ }
+ } else {
+ message = "Service not present in datastore ! ";
+ }
+ } else {
+ message = "servicename not set in ServiceStateModifyInput";
+ }
+ ConfigurationResponseCommon configurationResponseCommon = new ConfigurationResponseCommonBuilder()
+ .setAckFinalIndicator("Yes")
+ .setResponseCode(responseCode)
+ .setResponseMessage(message)
+ .build();
+ ServiceStateModifyOutput output = new ServiceStateModifyOutputBuilder()
+ .setConfigurationResponseCommon(configurationResponseCommon)
+ .build();
+ return RpcResultBuilder.success(output).buildFuture();
+ }
}
import org.opendaylight.controller.md.sal.binding.api.NotificationService;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev170930.ServicehandlerService;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.StubpceListener;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.StubrendererListener;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.OrgOpenroadmServiceService;
private ListenerRegistration<StubpceListener> stubpcelistenerRegistration;
private ListenerRegistration<StubrendererListener> stubrendererlistenerRegistration;
private RpcRegistration<OrgOpenroadmServiceService> rpcRegistration;
+ private RpcRegistration<ServicehandlerService> rpcRegistrationServiceHandler;
public ServicehandlerProvider(final DataBroker dataBroker, RpcProviderRegistry rpcProviderRegistry,
stubpcelistenerRegistration = notificationService.registerNotificationListener(consumer);
stubrendererlistenerRegistration = notificationService.registerNotificationListener(consumer);
rpcRegistration = rpcRegistry.addRpcImplementation(OrgOpenroadmServiceService.class, consumer);
+ rpcRegistrationServiceHandler = rpcRegistry.addRpcImplementation(ServicehandlerService.class, consumer);
}
/**
stubpcelistenerRegistration.close();
stubrendererlistenerRegistration.close();
rpcRegistration.close();
+ rpcRegistrationServiceHandler.close();
}
}
<packaging>pom</packaging>
<modules>
+ <module>stubmodels</module>
<module>stubpce</module>
<module>stubrenderer</module>
</modules>
[files]
packages = transportpce_tests
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright © 2016 Orange 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
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>binding-parent</artifactId>
+ <version>0.12.3-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.opendaylight.transportpce</groupId>
+ <artifactId>transportpce-stubmodels</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>transportpce-ordmodels</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>transportpce-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <!--
+ Private references
+ -->
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>3.0.1</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Include-Resource>{maven-resources},target/classes/LICENSE,META-INF/git.properties=-target/classes/META-INF/git.properties</Include-Resource>
+ <_exportcontents>
+ org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.transportpce.stubrenderer.rev170403.service.implementation.request.input,*
+ </_exportcontents>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <sourcepath>*/target/generated-sources/mdsal-binding/*</sourcepath>
+ <excludePackageNames>*</excludePackageNames>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <sourcepath>*/target/generated-sources/mdsal-binding/*</sourcepath>
+ <excludePackageNames>*</excludePackageNames>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+
+</project>
}
}
+ container service-path-list {
+ description
+ "List of service paths. Can only be created, deleted, modified, etc. using special RPCs.";
+ list service-paths {
+ key "service-path-name";
+ uses transportpce-common-service-path-types:service-path;
+ }
+ }
+
+ grouping stubpce-path-description {
+ leaf path-name {
+ type string;
+ description
+ "Identifier for the pathDescription to be created in
+ the ROADM network, e.g., CLFI, CLCI, etc.";
+ mandatory true;
+ }
+ uses transportpce-pathDescription:path-description;
+ }
+
+ container path-description-list {
+ description
+ "List of pathDescription. Can only be created, deleted, modified, etc. using special RPCs.";
+ list pathDescriptions {
+ key "path-name";
+ uses stubpce-path-description;
+ }
+ }
+
notification service-path-rpc-result {
description
"This Notification indicates result of service RPC";
<artifactId>transportpce-ordmodels</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>transportpce-stubmodels</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<!-- Testing Dependencies -->
<dependency>
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.transportpce.stubpce.topology.PathDescriptionsOrdered;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.CancelResourceReserveInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.PathComputationRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.PathDescriptionList;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.ServicePathList;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.path.description.list.PathDescriptions;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.service.path.list.ServicePaths;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.service.path.list.ServicePathsBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.service.path.list.ServicePathsKey;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.service.path.rpc.result.PathDescriptionBuilder;
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.ZToADirection;
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.routing.constraints.rev170426.constraints.sp.co.routing.or.general.general.Exclude;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev170426.routing.constraints.sp.HardConstraints;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev170426.routing.constraints.sp.SoftConstraints;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.response.parameters.sp.response.parameters.PathDescriptionBuilder;
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.service.types.rev170426.service.path.ServiceAEnd;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.service.path.ServiceZEnd;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.CancelResourceReserveInput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.PathComputationRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.PathDescriptionList;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServicePathList;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.path.description.list.PathDescriptions;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.service.path.list.ServicePaths;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.service.path.list.ServicePathsBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.service.path.list.ServicePathsKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private Boolean egalResource(Resource res1, Resource res2) {
LOG.info("comparing resource ...");
Boolean result = false;
- LOG.info(res1.getClass().getName() + " - " + res2.getClass().getName());
+ LOG.info("{} - {}", res1.getClass().getName(), res2.getClass().getName());
if (res1.getClass().getName().compareToIgnoreCase(res2.getClass().getName()) == 0) {
if (res1 instanceof Node && res2 instanceof Node) {
Node node1 = (Node)res1;
if (atoz1.getAToZ().size() == atoz2.getAToZ().size()) {
int index = 0;
int size = atoz1.getAToZ().size();
- LOG.info("size : " + size);
+ LOG.info("size : {}", size);
String id1 = null;
String id2 = null;
while (index < size) {
id1 = atoz1.getAToZ().get(index).getId();
- LOG.info("id : " + id1);
+ LOG.info("id : {}", id1);
Resource res1 = atoz1.getAToZ().get(index).getResource().getResource();
- LOG.info("res1 : " + res1.toString());
+ LOG.info("res1 : {}", res1.toString());
Resource res2 = null;
if (id1 != null) {
Boolean trouve = false;
id2 = atoz2.getAToZ().get(loop).getId();
if (id2 != null && id2.compareTo(id1) == 0) {
res2 = atoz2.getAToZ().get(loop).getResource().getResource();
- LOG.info("res2 : " + res2.toString());
+ LOG.info("res2 : {}", res2.toString());
trouve = true;
break;
}
if (ztoa1.getZToA().size() == ztoa2.getZToA().size()) {
int index = 0;
int size = ztoa1.getZToA().size();
- LOG.info("size : " + size);
+ LOG.info("size : {}", size);
String id1 = null;
String id2 = null;
while (index < size) {
id1 = ztoa1.getZToA().get(index).getId();
- LOG.info("id : " + id1);
+ LOG.info("id : {}", id1);
Resource res1 = ztoa1.getZToA().get(index).getResource().getResource();
- LOG.info("res1 : " + res1.toString());
+ LOG.info("res1 : {}", res1.toString());
Resource res2 = null;
if (id1 != null) {
Boolean trouve = false;
id2 = ztoa2.getZToA().get(loop).getId();
if (id2 != null && id2.compareTo(id1) == 0) {
res2 = ztoa2.getZToA().get(loop).getResource().getResource();
- LOG.info("res2 : " + res2.toString());
+ LOG.info("res2 : {}", res2.toString());
trouve = true;
break;
}
if (servicePathList != null && !servicePathList.isEmpty()) {
for (ServicePaths service : servicePathList) {
if (service.getServicePathName().compareTo(tmp) == 0) {
- LOG.info("Existing Service '" + tmp + "' found in ServicePathList ...");
+ LOG.info("Existing Service '{}' found in ServicePathList ...", tmp);
pathDesc = service.getPathDescription();
}
}
break;
}
} else {
- LOG.info("Existing Service '" + tmp + "' not found in ServicePathList !");
+ LOG.info("Existing Service '{}' not found in ServicePathList !", tmp);
result = true;
}
if (!result) {
LOG.info("retrieving path from servicePath List ...");
try {
if (!servicePathList.isEmpty()) {
- LOG.info("ServicePathList not empty, contains " + servicePathList.size() + " paths.");
+ LOG.info("ServicePathList not empty, contains {} paths.", servicePathList.size());
for (ServicePaths service : servicePathList) {
org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service
.types.rev170426.service.path.PathDescription tmp = service.getPathDescription();
LOG.info("PathDescriptions is null !");
result = true;
}
- LOG.info("testPathDescription result : " + result);
+ LOG.info("testPathDescription result : {}", result);
return result;
}
List<PathDescriptions> result = new ArrayList<PathDescriptions>();
List<PathDescriptions> paths = readPathDescriptionList();
if (!paths.isEmpty() && aendNodeId != null && zendNodeId != null) {
- LOG.info("retrieving paths from pathDescription List for " + aendNodeId + " / " + zendNodeId);
+ LOG.info("retrieving paths from pathDescription List for {} / {}", aendNodeId, zendNodeId);
for (PathDescriptions tmp : paths) {
Resource pathAend = null;
Resource pathZend = null;
String id = null;
if (tmp != null) {
- LOG.info("Getting Aend & ZEnd from path '" + tmp.getPathName() + "'...");
+ LOG.info("Getting Aend & ZEnd from path '{}'...",tmp.getPathName());
int index = 0;
int size = tmp.getAToZDirection().getAToZ().size();
while (index < size) {
if (id.compareToIgnoreCase("1") == 0) {
Resource resource = tmp.getAToZDirection().getAToZ().get(index).getResource()
.getResource();
- LOG.info(resource.getClass().toString() + " : " + resource.toString());
+ LOG.info("{} : {}", resource.getClass().toString(), resource.toString());
pathAend = resource;
break;
}
index++;
}
if (pathAend != null && pathZend != null) {
- LOG.info("pathAend : " + pathAend + " - pathZend: " + pathZend);
- LOG.info("aendNodeId : " + aendNodeId + " - zendNodeId : " + zendNodeId);
+ LOG.info("pathAend : {} - pathZend: {}",pathAend, pathZend);
+ LOG.info("aendNodeId : {} - zendNodeId : {}", aendNodeId, zendNodeId);
if (comp(pathAend, pathZend, aendNodeId, zendNodeId)) {
LOG.info("PathDescription found !");
result.add(tmp);
while (it.hasNext()) {
PathDescriptions path = it.next();
String name = path.getPathName();
- LOG.info("path : " + name);
+ LOG.info("path : {}", name);
if (name != null && name.contains(contain)) {
- LOG.info(" path gets : " + name);
+ LOG.info(" path gets : {}", name);
String [] split = name.split("_");
if (split.length == 3) {
odr = Integer.parseInt(split[2]);
/** get pathList ordered. */
pathsList = orderPathdescriptionsList(pathsList);
if (!pathsList.isEmpty()) {
- LOG.info(pathsList.size() + " Paths get from Pathdescription List");
+ LOG.info("{} Paths get from Pathdescription List", pathsList.size());
index = 0;
output = false;
while (index < pathsList.size()) {
path = pathsList.get(index);
- LOG.info("path n°" + index + " gets : '" + path.getPathName() + "'!");
+ LOG.info("path n°{} gets : '{}'!", index, path.getPathName());
if (constraints) {
LOG.info("Calculating path with constraints ...");
if (inputHard.getCoRoutingOrGeneral() instanceof General) {
private Boolean writeOrDeleteServicePathList(String serviceName, int choice) {
Boolean result = null;
if (serviceName != null && serviceName.compareTo(" ") != 0 && choice >= 0 && choice < 2) {
- LOG.info("WriteOrDeleting '" + serviceName + "' ServicePaths");
+ LOG.info("WriteOrDeleting '{}' ServicePaths", serviceName);
WriteTransaction writeTx = db.newWriteOnlyTransaction();
result = true;
String action = null;
Future<Void> future = null;
switch (choice) {
case 0: /** Write. */
- LOG.info("Writing '" + serviceName + "' Service");
+ LOG.info("Writing '{}' Service", serviceName);
org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.service
.path.PathDescriptionBuilder path = new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c
._interface.service.types.rev170426.service.path.PathDescriptionBuilder();
//CheckedFuture<Void, OperationFailedException> future = transaction.submit();
future = writeTx.submit();
try {
- LOG.info("Sending '" + action + "' command to datastore !");
+ LOG.info("Sending '{}' command to datastore !", action);
Futures.getChecked(future, ExecutionException.class);
} catch (ExecutionException e) {
- LOG.error("Failed to " + action + " service from Service List");
+ LOG.error("Failed to {} service from Service List", action);
result = false;
}
break;
case 1: /** Delete */
- LOG.info("Deleting '" + serviceName + "' Service");
+ LOG.info("Deleting '{}' Service", serviceName);
writeTx.delete(LogicalDatastoreType.OPERATIONAL, iid);
action = "delete";
future = writeTx.submit();
try {
- LOG.info("Sending '" + action + "' command to datastore !");
+ LOG.info("Sending '{}' command to datastore !", serviceName);
Futures.getChecked(future, ExecutionException.class);
} catch (ExecutionException e) {
- LOG.error("Failed to " + action + " service from Service List");
+ LOG.error("Failed to {} service from Service List", serviceName);
result = false;
}
break;
import org.opendaylight.transportpce.stubpce.topology.PathDescriptionsOrdered;
import org.opendaylight.transportpce.stubpce.topology.SuperNodePath;
import org.opendaylight.transportpce.stubpce.topology.Topology;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.CancelResourceReserveInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.CancelResourceReserveOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.CancelResourceReserveOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.PathComputationRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.PathComputationRequestOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.PathComputationRequestOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.PathDescriptionList;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.PathDescriptionListBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.ServicePathList;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.ServicePathListBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.ServicePathRpcResult;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.ServicePathRpcResultBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.StubpceService;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.path.description.list.PathDescriptions;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.path.description.list.PathDescriptionsBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.path.description.list.PathDescriptionsKey;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.service.path.list.ServicePaths;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.service.path.list.ServicePathsBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.service.path.list.ServicePathsKey;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.service.path.rpc.result.PathDescriptionBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.configuration.response.common.ConfigurationResponseCommonBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceList;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.list.Services;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.list.ServicesKey;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.RpcStatusEx;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.ServicePathNotificationTypes;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.response.parameters.sp.response.parameters.PathDescriptionBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.CancelResourceReserveInput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.CancelResourceReserveOutput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.CancelResourceReserveOutputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.PathComputationRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.PathComputationRequestOutput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.PathComputationRequestOutputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.PathDescriptionList;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.PathDescriptionListBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceDeleteInput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceDeleteOutput;
-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.ServiceImplementationRequestOutput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServicePathList;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServicePathListBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServicePathRpcResult;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServicePathRpcResultBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.TransportpceServicepathService;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.path.description.list.PathDescriptions;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.path.description.list.PathDescriptionsBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.path.description.list.PathDescriptionsKey;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.service.path.list.ServicePaths;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.service.path.list.ServicePathsBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.service.path.list.ServicePathsKey;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.service.path.rpc.result.PathDescription;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.RpcResult;
* behalf of Orange
*/
-public class StubpceImpl implements TransportpceServicepathService {
+public class StubpceImpl implements StubpceService {
/** Logging. */
private static final Logger LOG = LoggerFactory.getLogger(StubpceImpl.class);
/** Permit to access database. */
String responseCode = "";
ConfigurationResponseCommonBuilder configurationResponseCommon = null;
String serviceName = input.getServiceName();
- LOG.info("serviceName : " + serviceName);
+ LOG.info("serviceName : {}", serviceName);
if (serviceName != null) {
sendingPCE = new SendingPceRPCs(input,db,executor);
FutureCallback<Boolean> pceCallback = new FutureCallback<Boolean>() {
@Override
public void onFailure(Throwable arg0) {
- LOG.error(arg0.toString());
- LOG.error("Cancel resource failed !");
+ LOG.error("Cancel resource failed : {}", arg0);
notification = new ServicePathRpcResultBuilder()
.setNotificationType(ServicePathNotificationTypes.CancelResourceReserve)
.setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Failed)
try {
notificationPublishService.putNotification(notification);
} catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.info("notification offer rejected : {}", e);
}
}
@Override
public void onSuccess(Boolean response) {
- LOG.info("response : " + response);
+ LOG.info("response : {}", response);
if (response) {
message = "Resource cancelled !";
notification = new ServicePathRpcResultBuilder()
try {
notificationPublishService.putNotification(notification);
} catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.info("notification offer rejected : {}", e);
}
LOG.info(message);
}
CancelResourceReserveOutputBuilder output = new CancelResourceReserveOutputBuilder()
.setConfigurationResponseCommon(configurationResponseCommon.build());
-
return RpcResultBuilder.success(output.build()).buildFuture();
} else {
message = "serviceName / requestId is not correct !";
try {
notificationPublishService.putNotification(notification);
} catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.info("notification offer rejected : {}", e);
}
}
configurationResponseCommon = new ConfigurationResponseCommonBuilder();
try {
notificationPublishService.putNotification(notification);
} catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.info("notification offer rejected : {}", e);
}
sendingPCE = new SendingPceRPCs(input,db,executor);
FutureCallback<Boolean> pceCallback = new FutureCallback<Boolean>() {
@Override
public void onFailure(Throwable arg0) {
- LOG.error("Failure message : " + arg0.toString());
+ LOG.error("Failure message : {}", arg0.toString());
LOG.error("Path calculation failed !");
notification = new ServicePathRpcResultBuilder()
.setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Failed)
try {
notificationPublishService.putNotification(notification);
} catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.info("notification offer rejected : {}", e);
}
}
@Override
public void onSuccess(Boolean response) {
- LOG.info("response : " + response);
+ LOG.info("response : {}", response);
if (response) {
message = "Path Computated !";
ServicePathRpcResultBuilder tmp = new ServicePathRpcResultBuilder()
.setAToZDirection(pathDescriptionBuilder.getAToZDirection())
.setZToADirection(pathDescriptionBuilder.getZToADirection())
.build();
- tmp.setPathDescription(pathDescription);
+ tmp.setPathDescription(new PathDescriptionBuilder()
+ .setAToZDirection(pathDescription.getAToZDirection())
+ .setZToADirection(pathDescription.getZToADirection())
+ .build());
}
notification = tmp.build();
} else {
try {
notificationPublishService.putNotification(notification);
} catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.info("notification offer rejected : {}", e);
}
LOG.info(message);
}
try {
notificationPublishService.putNotification(notification);
} catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.info("notification offer rejected : {}", e);
}
}
configurationResponseCommon = new ConfigurationResponseCommonBuilder();
try {
Futures.getChecked(future, ExecutionException.class);
} catch (ExecutionException e) {
- LOG.error("Failed to create ServicePathList List : " + e.toString());
+ LOG.error("Failed to create ServicePathList List : {}", e.toString());
result = false;
}
return result;
LOG.info("filling PathDescription List...");
Topology topo = new Topology();
topo.start();
- LOG.info("Network : " + topo.getNetwork());
+ LOG.info("Network : {}", topo.getNetwork());
SuperNodePath superNodePath = new SuperNodePath(topo.getNetwork());
String aend = "NodeA";
String zend = "NodeZ";
try {
Futures.getChecked(future, ExecutionException.class);
} catch (ExecutionException e) {
- LOG.error("Failed to write PathDescriptions to PathDescriptionsList : " + e.toString());
+ LOG.error("Failed to write PathDescriptions to PathDescriptionsList : {}", e.toString());
}
} else {
LOG.error("PathDescriptions gets is null !");
LOG.error("Reading service failed:", e);
}
if (optional.isPresent()) {
- LOG.debug("Service '" + serviceName + "' present !");
+ LOG.debug("Service '{}' present !", serviceName);
result = new ServicesBuilder(optional.get()).build();
}
return result;
LOG.error("Reading service failed:", e);
}
if (optional.isPresent()) {
- LOG.debug("Service '" + serviceName + "' present !");
+ LOG.debug("Service '{}' present !", serviceName);
result = new ServicePathsBuilder(optional.get()).build();
}
return result;
LOG.error("Reading service failed:", e);
}
if (optional.isPresent()) {
- LOG.debug("PathDescritions '" + pathName + "' present !");
+ LOG.debug("PathDescritions '{}' present !", pathName);
result = new PathDescriptionsBuilder(optional.get()).build();
}
return result;
@SuppressWarnings("unused")
private String writeServicePathList(PathComputationRequestInput input) {
String serviceName = input.getServiceName();
- LOG.debug("Write ServicePath '" + serviceName + "' Service");
+ LOG.debug("Write ServicePath '{}' Service", serviceName);
String result = null;
- LOG.debug("Writing '" + serviceName + "' ServicePath");
+ LOG.debug("Writing '{}' ServicePath", serviceName);
InstanceIdentifier<ServicePaths> iid = InstanceIdentifier.create(ServicePathList.class)
.child(ServicePaths.class, new ServicePathsKey(serviceName));
public void setPathDescriptionBuilder(PathDescriptionBuilder pathDescriptionBuilder) {
this.pathDescriptionBuilder = pathDescriptionBuilder;
}
-
- @Override
- public Future<RpcResult<ServiceImplementationRequestOutput>> serviceImplementationRequest(
- ServiceImplementationRequestInput input) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Future<RpcResult<ServiceDeleteOutput>> serviceDelete(ServiceDeleteInput input) {
- // TODO Auto-generated method stub
- return null;
- }
}
import org.opendaylight.controller.md.sal.binding.api.NotificationService;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.TransportpceServicepathListener;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.TransportpceServicepathService;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.StubpceListener;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.StubpceService;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private final DataBroker dataBroker;
- private BindingAwareBroker.RpcRegistration<TransportpceServicepathService> rpcRegistration;
- private ListenerRegistration<TransportpceServicepathListener> stubPcelistenerRegistration;
+ private BindingAwareBroker.RpcRegistration<StubpceService> rpcRegistration;
+ private ListenerRegistration<StubpceListener> stubPcelistenerRegistration;
public StubpceProvider(RpcProviderRegistry rpcProviderRegistry,final DataBroker dataBroker,
NotificationService notificationService, NotificationPublishService notificationPublishService) {
public void init() {
LOG.info("StubpceProvider Session Initiated");
final StubpceImpl consumer = new StubpceImpl(notificationPublishService,dataBroker);
- rpcRegistration = rpcRegistry.addRpcImplementation(TransportpceServicepathService.class, consumer);
+ rpcRegistration = rpcRegistry.addRpcImplementation(StubpceService.class, consumer);
}
/**
LOG.info("firstnodeTpId is null !");
}
}
- LOG.info("getAToZDirectionEndBy result size : " + result.size() + "\n " + result.toString());
+ LOG.info("getAToZDirectionEndBy result size : {}\n{}", result.size(),result.toString());
return result;
}
}
}
} else {
- LOG.info("getAToZDirectionEndBy size " + tmp.size());
+ LOG.info("getAToZDirectionEndBy size : {}", tmp.size());
}
return result;
}
if (res != null && res instanceof TerminationPoint) {
TerminationPoint tp = (TerminationPoint) res;
if (tp != null && tp.getTpId().contains(beginBy)) {
- LOG.info("tmp : " + tmp.toString());
+ LOG.info("tmp : {}", tmp.toString());
result.add(tmp);
}
}
}
}
}
- LOG.info("result size : " + result.size());
+ LOG.info("result size : {}", result.size());
return result;
}
path.fill();
nodepaths.add(path);
}
- LOG.info("nodepaths size : " + nodepaths.size());
+ LOG.info("nodepaths size : {}", nodepaths.size());
build(superNode.isXpdrSrgAbsent(),superNode.getSuperNodeId(), zend);
}
}
List<TpNodeTp> direction = new ArrayList<TpNodeTp>();
for (Link link : links) {
String linkId = link.getLinkId();
- LOG.info("LinkId : " + linkId);
+ LOG.info("LinkId : {}", linkId);
if (!isXpdrSrgAbsent) {
if (StringUtils.countMatches(link.getLinkId(), "ROADM") < 2) {
if ((linkId.contains("XPDR") && linkId.startsWith("ROADM"))
|| ((linkId.startsWith("DEG") && linkId.contains("SRG")))
|| (nodeId.contains("XPDR") && linkId.contains("TAIL-LINKS"))) {
- LOG.info("reversing TpNodetp list for link '" + linkId + "'");
+ LOG.info("reversing TpNodetp list for link '{}'", linkId);
direction = reverseTpNodetpList();
} else {
direction = tpNodeTps;
Network net = topo.getNetwork();
if (net != null) {
SuperNode superNode = net.getSuperNodes().get(0);
- LOG.info("SuperNode : " + superNode.getSuperNodeId());
+ LOG.info("SuperNode : {}", superNode.getSuperNodeId());
for (org.opendaylight.transportpce.stubpce.topology.Resource res :
superNode.getResources()) {
LOG.info(res.toString());
package org.opendaylight.transportpce.stubpce.topology;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.path.description.list.PathDescriptions;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.path.description.list.PathDescriptions;
/**
* class to create structure
import java.util.SortedSet;
import java.util.TreeSet;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.path.description.list.PathDescriptionsBuilder;
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.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.servicepath.rev170426.path.description.list.PathDescriptionsBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
for (String tmp : links) {
if (tmp.contains(aend)
&& tmp.contains(zend)) {
- LOG.info("direct path found for : " + aend + " / " + zend);
+ LOG.info("direct path found for : {} / {}", aend, zend);
if (tmp.startsWith(aend)) {
atozlink = tmp;
}
tmp = tmp.replace("Node", "ROADM");
if (tmp.compareTo(aend) != 0) {
if (link.contains(aend) && link.contains(tmp)) {
- LOG.info("hop : " + tmp);
+ LOG.info("hop : {}", tmp);
result = tmp;
}
}
}
} else {
- LOG.info(term + " links not found !");
+ LOG.info("{} links not found !", term);
}
}
hop = findHop(tmp, aend, supernodes);
if (hop != null) {
if (hop.compareTo(zend.replace("Node", "ROADM")) != 0) {
- LOG.info("next hop found : " + hop);
+ LOG.info("next hop found : {}", hop);
links.addAll(findLinks(aend,hop,roadmLinks,false));
links.addAll(findLinks(hop,zend,roadmLinks,false));
} else {
PathDescriptionsBuilder pathDescr = new PathDescriptionsBuilder();
int size = atozDirection.size();
if (!atozDirection.isEmpty()) {
- LOG.info("result list AToZDirection size : " + atozDirection.size());
+ LOG.info("result list AToZDirection size : {}", atozDirection.size());
List<ZToADirection> ztoadirList = new ArrayList<ZToADirection>();
for (AToZDirection atozdir : atozDirection) {
ZToADirection ztodir = convertToZtoaDirection(atozdir);
String pathName = null;
for (int indexPath = 0 ; indexPath < size ; indexPath++) {
pathName = term.concat(Integer.toString(index));
- LOG.info("pathName : " + pathName);
+ LOG.info("pathName : {}", pathName);
pathDescr.setAToZDirection(atozDirection.get(indexPath))
.setZToADirection(ztoadirList.get(indexPath)).setPathName(pathName);
- LOG.info(pathDescr.build().toString());
+ LOG.info("pathdesciption : {}", pathDescr.build().toString());
result.add(new PathDescriptionsOrdered(pathDescr.build(),index));
index++;
}
String aend = split[0].replaceAll("ROADM", "Node");
String zend = split[2].replaceAll("ROADM", "Node");
if (aend != null && zend != null) {
- LOG.info("getting super node for : " + aend + " and " + zend);
+ LOG.info("getting super node for : {} and {}", aend, zend);
SuperNode aendSp = getSuperNode(aend);
SuperNode zendSp = getSuperNode(zend);
if (aendSp != null && zendSp != null) {
if (!paths.isEmpty()) {
for (NodeLinkNode tmp : paths) {
if (tmp.getDirect()) {
- LOG.info("Direct NodeLinkNode : " + tmp.toString());
+ LOG.info("Direct NodeLinkNode : {}", tmp.toString());
String atozLink = null;
String ztoaLink = null;
atozLink = tmp.getAtozLink().get(0);
ztoaLink = tmp.getZtoaLink().get(0);
if (atozLink != null && ztoaLink != null) {
- LOG.info("atozlink : " + atozLink);
- LOG.info("ztoalink : " + ztoaLink);
+ LOG.info("atozlink : {}", atozLink);
+ LOG.info("ztoalink : {}", ztoaLink);
InterNodePath interAend = new InterNodePath(aendSp);
interAend.buildPath(zend);
InterNodePath interZend = new InterNodePath(zendSp);
interZend.buildPath(zend);
List<String> deg = getDeg(atozLink,ztoaLink);
- LOG.info("deg : " + deg.toString());
+ LOG.info("deg : {}", deg.toString());
if (deg.size() == 2) {
List<AToZDirection> cleanInterA =
interAend.replaceOrRemoveAToZDirectionEndLink(deg.get(0),"",atozLink,
LOG.info("List of direct path is empty !");
}
if (!atozdirectionPaths.isEmpty()) {
- LOG.info("result size : " + result.size());
+ LOG.info("result size : {}", result.size());
result = buildPathDescription(atozdirectionPaths,aend.concat("To").concat(zend).concat("_direct_"));
} else {
LOG.info("result is empty");
if (!paths.isEmpty()) {
for (NodeLinkNode tmp : paths) {
if (!tmp.getDirect()) {
- LOG.info("Indirect NodeLinkNode : " + tmp.toString());
+ LOG.info("Indirect NodeLinkNode : {}", tmp.toString());
int size = tmp.getAtozLink().size();
/** must be two for now just one hop. */
- LOG.info("number of links : " + size);
+ LOG.info("number of links : {}", size);
boolean first = true;
if (size == 2) {
List<String> atozLinks = tmp.getAtozLink();
List<String> ztoaLinks = tmp.getZtoaLink();
if (!atozLinks.isEmpty() && !ztoaLinks.isEmpty()) {
- LOG.info("atozlink : " + atozLinks.toString());
- LOG.info("ztoalink : " + ztoaLinks.toString());
+ LOG.info("atozlink : {}", atozLinks.toString());
+ LOG.info("ztoalink : {}", ztoaLinks.toString());
int loop = 0;
while (loop < 2) {
List<SuperNode> hop = getSuperNodeEndLink(atozLinks.get(loop));
zendSp = hop.get(1);
InterNodePath interAend = new InterNodePath(aendSp);
interAend.buildPath(zend);
- LOG.info("interAend : " + interAend.getAtoz().toString());
+ LOG.info("interAend : {}", interAend.getAtoz().toString());
InterNodePath interZend = new InterNodePath(zendSp);
interZend.buildPath(zend);
- LOG.info("interZend : " + interZend.getAtoz().toString());
+ LOG.info("interZend : {}", interZend.getAtoz().toString());
List<String> deg1 = getDeg(atozLinks.get(loop),ztoaLinks.get(loop));
- LOG.info("deg1 : " + deg1.toString());
+ LOG.info("deg1 : {}", deg1.toString());
if (!deg1.isEmpty() && deg1.size() == 2) {
List<AToZDirection> cleanInterA = null;
List<AToZDirection> cleanInterZ = null;
LOG.info("List of indirect path is empty !");
}
if (!atozdirectionPaths.isEmpty()) {
- LOG.info("result size : " + result.size());
+ LOG.info("result size : {}", result.size());
result = buildPathDescription(atozdirectionPaths,aend.concat("To").concat(zend).concat("_indirect_"));
} else {
LOG.info("result is empty");
xml = inputStreamToString(is);
if (xml != null) {
setNetwork(xmlMapper.readValue(xml, Network.class));
- LOG.info("Network : " + network.toString());
+ LOG.info("Network : {}", network.toString());
} else {
LOG.info("String xml is null");
}
<artifactId>transportpce-ordmodels</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>transportpce-stubmodels</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<!-- Testing Dependencies -->
<dependency>
Thread.sleep(10000); //sleep for 10s
} catch (InterruptedException e) {
output = false;
- LOG.error(e.toString());
+ LOG.error("Thread.sleep failed : {}", e.toString());
}
buildAtoZ();
buildZtoA();
Thread.sleep(10000); //sleep for 10s
} catch (InterruptedException e) {
output = false;
- LOG.error(e.toString());
+ LOG.error("Thread.sleep failed : {}", e.toString());
}
buildAtoZ();
buildZtoA();
import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
import org.opendaylight.transportpce.stubrenderer.SendingRendererRPCs;
import org.opendaylight.transportpce.stubrenderer.StubrendererCompliancyCheck;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceDeleteInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceDeleteOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceDeleteOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceImplementationRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceImplementationRequestOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceImplementationRequestOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceRpcResultSp;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceRpcResultSpBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.StubrendererService;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.service.rpc.result.sp.PathTopology;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.service.rpc.result.sp.PathTopologyBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.configuration.response.common.ConfigurationResponseCommonBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.TopologyBuilder;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.RpcStatusEx;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.ServicePathNotificationTypes;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.CancelResourceReserveInput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.CancelResourceReserveOutput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.PathComputationRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.PathComputationRequestOutput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceDeleteInput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceDeleteOutput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceDeleteOutputBuilder;
-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.ServiceImplementationRequestOutput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceImplementationRequestOutputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceRpcResultSp;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceRpcResultSpBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.TransportpceServicepathService;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.service.rpc.result.sp.PathTopology;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.service.rpc.result.sp.PathTopologyBuilder;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.slf4j.Logger;
* @author Martial Coulibaly ( martial.coulibaly@gfi.com ) on behalf of Orange
*
*/
-public class StubrendererImpl implements TransportpceServicepathService {
+public class StubrendererImpl implements StubrendererService {
/** Logging. */
private static final Logger LOG = LoggerFactory.getLogger(StubrendererImpl.class);
/** send notification. */
try {
notificationPublishService.putNotification(notification);
} catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.info("notification offer rejected : {}", e);
}
SendingRendererRPCs sendingRenderer = new SendingRendererRPCs(executor);
@Override
public void onFailure(Throwable arg0) {
- LOG.error("Failure message : " + arg0.toString());
+ LOG.error("Failure message : {}", arg0.toString());
LOG.error("Service implementation failed !");
notification = new ServiceRpcResultSpBuilder()
.setNotificationType(ServicePathNotificationTypes.ServiceImplementationRequest)
.setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Failed)
- .setStatusMessage("PCR Request failed : " + arg0.getMessage()).build();
+ .setStatusMessage("PCR Request failed : {}" + arg0.getMessage()).build();
try {
notificationPublishService.putNotification(notification);
} catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.info("notification offer rejected : {}", e);
}
}
@Override
public void onSuccess(Boolean response) {
- LOG.info("response : " + response);
+ LOG.info("response : {}", response);
if (response) {
message = "Service implemented !";
TopologyBuilder topo = sendingRenderer.getTopology();
try {
notificationPublishService.putNotification(notification);
} catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.info("notification offer rejected : {}", e);
}
LOG.info(message);
}
} else {
message = compliancyCheck.getMessage();
responseCode = "500";
- LOG.info("Service not compliant caused by : " + message);
+ LOG.info("Service not compliant caused by : {}", message);
notification = new ServiceRpcResultSpBuilder()
.setNotificationType(ServicePathNotificationTypes.ServiceDelete)
.setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Failed)
try {
notificationPublishService.putNotification(notification);
} catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.info("notification offer rejected : {}", e);
}
}
configurationResponseCommon = new ConfigurationResponseCommonBuilder()
try {
notificationPublishService.putNotification(notification);
} catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.info("notification offer rejected : {}", e);
}
SendingRendererRPCs sendingRenderer = new SendingRendererRPCs(executor);
FutureCallback<Boolean> rendererCallback = new FutureCallback<Boolean>() {
@Override
public void onFailure(Throwable arg0) {
- LOG.error("Failure message : " + arg0.toString());
+ LOG.error("Failure message : {}", arg0.toString());
LOG.error("Service delete failed !");
notification = new ServiceRpcResultSpBuilder()
.setNotificationType(ServicePathNotificationTypes.ServiceDelete)
try {
notificationPublishService.putNotification(notification);
} catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.info("notification offer rejected : {}", e);
}
}
@Override
public void onSuccess(Boolean response) {
- LOG.info("response : " + response);
+ LOG.info("response : {}", response);
if (response) {
message = "Service deleted !";
notification = new ServiceRpcResultSpBuilder()
try {
notificationPublishService.putNotification(notification);
} catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.info("notification offer rejected : {}", e);
}
LOG.info(message);
}
return RpcResultBuilder.success(output).buildFuture();
} else {
message = compliancyCheck.getMessage();
- LOG.info("Service not compliant caused by : " + message);
+ LOG.info("Service not compliant caused by : {}", message);
responseCode = "500";
notification = new ServiceRpcResultSpBuilder()
.setNotificationType(ServicePathNotificationTypes.ServiceDelete)
try {
notificationPublishService.putNotification(notification);
} catch (InterruptedException e) {
- LOG.info("notification offer rejected : " + e);
+ LOG.info("notification offer rejected : {}", e);
}
}
configurationResponseCommon = new ConfigurationResponseCommonBuilder()
.build();
return RpcResultBuilder.success(output).buildFuture();
}
-
- @Override
- public Future<RpcResult<CancelResourceReserveOutput>> cancelResourceReserve(CancelResourceReserveInput input) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Future<RpcResult<PathComputationRequestOutput>> pathComputationRequest(PathComputationRequestInput input) {
- // TODO Auto-generated method stub
- return null;
- }
}
import org.opendaylight.controller.md.sal.binding.api.NotificationService;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.TransportpceServicepathListener;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.TransportpceServicepathService;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.StubrendererListener;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.StubrendererService;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private final NotificationPublishService notificationPublishService;
- private BindingAwareBroker.RpcRegistration<TransportpceServicepathService> rpcRegistration;
- private ListenerRegistration<TransportpceServicepathListener> stubRendererlistenerRegistration;
+ private BindingAwareBroker.RpcRegistration<StubrendererService> rpcRegistration;
+ private ListenerRegistration<StubrendererListener> stubRendererlistenerRegistration;
public StubrendererProvider(RpcProviderRegistry rpcProviderRegistry,
NotificationService notificationService,
public void init() {
LOG.info("StubrendererProvider Session Initiated");
final StubrendererImpl consumer = new StubrendererImpl(notificationPublishService);
- rpcRegistration = rpcRegistry.addRpcImplementation(TransportpceServicepathService.class, consumer);
+ rpcRegistration = rpcRegistry.addRpcImplementation(StubrendererService.class, consumer);
}
/**
bash -c "(cd .. && mvn clean install -DskipTests -Dmaven.javadoc.skip=true)"
./build.sh
nosetests --with-xunit transportpce_tests
+
+[testenv:servicehandler]
+usedevelop = True
+deps =
+ -r{toxinidir}/requirements.txt
+ -r{toxinidir}/test-requirements.txt
+whitelist_externals = bash
+commands =
+ bash -c "(cd .. && mvn clean install -DskipTests -Dmaven.javadoc.skip=true)"
+ nosetests --with-xunit transportpce_tests/test_servicehandler.py
--- /dev/null
+#!/usr/bin/env python
+##############################################################################
+#Copyright (c) 2017 Orange, Inc. and others. All rights reserved.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+import json
+import os
+import psutil
+import requests
+import signal
+import shutil
+import subprocess
+import time
+import unittest
+
+
+class TransportPCEtesting(unittest.TestCase):
+
+ odl_process = None
+ restconf_baseurl = "http://127.0.0.1:8181/restconf"
+
+ @classmethod
+ def __start_odl(cls):
+ executable = "../karaf/target/assembly/bin/karaf"
+ with open('odl.log', 'w') as outfile:
+ cls.odl_process = subprocess.Popen(
+ ["bash", executable], stdout=outfile,
+ stdin=open(os.devnull))
+
+ @classmethod
+ def setUpClass(cls): #a class method called before tests in an individual class run.
+ cls.__start_odl()
+ time.sleep(90)
+
+ @classmethod
+ def tearDownClass(cls):
+ for child in psutil.Process(cls.odl_process.pid).children():
+ child.send_signal(signal.SIGINT)
+ child.wait()
+ cls.odl_process.send_signal(signal.SIGINT)
+ cls.odl_process.wait()
+
+ def setUp(self): #instruction executed before each test method
+ time.sleep(1)
+
+ #Get existing PathDesciption
+ def test_01_get_pathdescriptions(self):
+ url = ("{}/operational/stubpce:path-description-list/pathDescriptions/NodeAToNodeZ_direct_1"
+ .format(self.restconf_baseurl))
+ headers = {'content-type': 'application/json',
+ "Accept": "application/json"}
+ response = requests.request(
+ "GET", url, headers=headers, auth=('admin', 'admin'))
+ self.assertEqual(response.status_code, requests.codes.ok)
+ res = response.json()
+ self.assertEqual(
+ res['pathDescriptions'][0]['path-name'],
+ 'NodeAToNodeZ_direct_1')
+ time.sleep(1)
+
+ #Get non existing PathDesciption
+ def test_02_get_pathdescriptions(self):
+ url = ("{}/operational/stubpce:path-description-list/pathDescriptions/Node"
+ .format(self.restconf_baseurl))
+ headers = {'content-type': 'application/json',
+ "Accept": "application/json"}
+ response = requests.request(
+ "GET", url, headers=headers, auth=('admin', 'admin'))
+ self.assertEqual(response.status_code, 404)
+ time.sleep(1)
+
+ #Create Service 'test' with correct parameters
+ def test_03_create_service(self):
+ url = ("{}/operations/org-openroadm-service:service-create"
+ .format(self.restconf_baseurl))
+ data = {"input": {
+ "sdnc-request-header": {
+ "request-id": "e3028bae-a90f-4ddd-a83f-cf224eba0e58",
+ "rpc-action": "service-create",
+ "request-system-id": "appname",
+ "notification-url": "http://localhost:8585/NotificationServer/notify"
+ },
+ "service-name": "test",
+ "common-id": "ASATT1234567",
+ "connection-type": "infrastructure",
+ "service-a-end": {
+ "service-rate": "100",
+ "node-id": "XPDRA",
+ "service-format": "Ethernet",
+ "clli": "SNJSCAMCJP8",
+ "tx-direction": {
+ "port": {
+ "port-device-name": "ROUTER_SNJSCAMCJP8_000000.00_00",
+ "port-type": "router",
+ "port-name": "Gigabit Ethernet_Tx.ge-5/0/0.0",
+ "port-rack": "000000.00",
+ "port-shelf": "00"
+ },
+ "lgx": {
+ "lgx-device-name": "LGX Panel_SNJSCAMCJP8_000000.00_00",
+ "lgx-port-name": "LGX Back.3",
+ "lgx-port-rack": "000000.00",
+ "lgx-port-shelf": "00"
+ }
+ },
+ "rx-direction": {
+ "port": {
+ "port-device-name": "ROUTER_SNJSCAMCJP8_000000.00_00",
+ "port-type": "router",
+ "port-name": "Gigabit Ethernet_Rx.ge-5/0/0.0",
+ "port-rack": "000000.00",
+ "port-shelf": "00"
+ },
+ "lgx": {
+ "lgx-device-name": "LGX Panel_SNJSCAMCJP8_000000.00_00",
+ "lgx-port-name": "LGX Back.4",
+ "lgx-port-rack": "000000.00",
+ "lgx-port-shelf": "00"
+ }
+ },
+ "optic-type": "gray"
+ },
+ "service-z-end": {
+ "service-rate": "100",
+ "node-id": "XPDRC",
+ "service-format": "Ethernet",
+ "clli": "SNJSCAMCJT4",
+ "tx-direction": {
+ "port": {
+ "port-device-name": "ROUTER_SNJSCAMCJT4_000000.00_00",
+ "port-type": "router",
+ "port-name": "Gigabit Ethernet_Tx.ge-1/0/0.0",
+ "port-rack": "000000.00",
+ "port-shelf": "00"
+ },
+ "lgx": {
+ "lgx-device-name": "LGX Panel_SNJSCAMCJT4_000000.00_00",
+ "lgx-port-name": "LGX Back.29",
+ "lgx-port-rack": "000000.00",
+ "lgx-port-shelf": "00"
+ }
+ },
+ "rx-direction": {
+ "port": {
+ "port-device-name": "ROUTER_SNJSCAMCJT4_000000.00_00",
+ "port-type": "router",
+ "port-name": "Gigabit Ethernet_Rx.ge-1/0/0.0",
+ "port-rack": "000000.00",
+ "port-shelf": "00"
+ },
+ "lgx": {
+ "lgx-device-name": "LGX Panel_SNJSCAMCJT4_000000.00_00",
+ "lgx-port-name": "LGX Back.30",
+ "lgx-port-rack": "000000.00",
+ "lgx-port-shelf": "00"
+ }
+ },
+ "optic-type": "gray"
+ },
+ "due-date": "2016-11-28T00:00:01Z",
+ "operator-contact": "pw1234"
+ }
+ }
+ headers = {'content-type': 'application/json',
+ "Accept": "application/json"}
+ response = requests.request(
+ "POST", url, data=json.dumps(data), headers=headers,
+ auth=('admin', 'admin'))
+ self.assertEqual(response.status_code, requests.codes.ok)
+ res = response.json()
+ self.assertIn('in progress',
+ res['output']['configuration-response-common']['response-message'])
+ time.sleep(30)
+
+ #Create Service 'test' with not compliant parameter : no 'sdnc-request-header' parameter
+ def test_04_create_service(self):
+ url = ("{}/operations/org-openroadm-service:service-create"
+ .format(self.restconf_baseurl))
+ data = {"input": {
+ "service-name": "test",
+ "common-id": "ASATT1234567",
+ "connection-type": "infrastructure",
+ "service-a-end": {
+ "service-rate": "100",
+ "node-id": "XPDRA",
+ "service-format": "Ethernet",
+ "clli": "SNJSCAMCJP8",
+ "tx-direction": {
+ "port": {
+ "port-device-name": "ROUTER_SNJSCAMCJP8_000000.00_00",
+ "port-type": "router",
+ "port-name": "Gigabit Ethernet_Tx.ge-5/0/0.0",
+ "port-rack": "000000.00",
+ "port-shelf": "00"
+ },
+ "lgx": {
+ "lgx-device-name": "LGX Panel_SNJSCAMCJP8_000000.00_00",
+ "lgx-port-name": "LGX Back.3",
+ "lgx-port-rack": "000000.00",
+ "lgx-port-shelf": "00"
+ }
+ },
+ "rx-direction": {
+ "port": {
+ "port-device-name": "ROUTER_SNJSCAMCJP8_000000.00_00",
+ "port-type": "router",
+ "port-name": "Gigabit Ethernet_Rx.ge-5/0/0.0",
+ "port-rack": "000000.00",
+ "port-shelf": "00"
+ },
+ "lgx": {
+ "lgx-device-name": "LGX Panel_SNJSCAMCJP8_000000.00_00",
+ "lgx-port-name": "LGX Back.4",
+ "lgx-port-rack": "000000.00",
+ "lgx-port-shelf": "00"
+ }
+ },
+ "optic-type": "gray"
+ },
+ "service-z-end": {
+ "service-rate": "100",
+ "node-id": "XPDRC",
+ "service-format": "Ethernet",
+ "clli": "SNJSCAMCJT4",
+ "tx-direction": {
+ "port": {
+ "port-device-name": "ROUTER_SNJSCAMCJT4_000000.00_00",
+ "port-type": "router",
+ "port-name": "Gigabit Ethernet_Tx.ge-1/0/0.0",
+ "port-rack": "000000.00",
+ "port-shelf": "00"
+ },
+ "lgx": {
+ "lgx-device-name": "LGX Panel_SNJSCAMCJT4_000000.00_00",
+ "lgx-port-name": "LGX Back.29",
+ "lgx-port-rack": "000000.00",
+ "lgx-port-shelf": "00"
+ }
+ },
+ "rx-direction": {
+ "port": {
+ "port-device-name": "ROUTER_SNJSCAMCJT4_000000.00_00",
+ "port-type": "router",
+ "port-name": "Gigabit Ethernet_Rx.ge-1/0/0.0",
+ "port-rack": "000000.00",
+ "port-shelf": "00"
+ },
+ "lgx": {
+ "lgx-device-name": "LGX Panel_SNJSCAMCJT4_000000.00_00",
+ "lgx-port-name": "LGX Back.30",
+ "lgx-port-rack": "000000.00",
+ "lgx-port-shelf": "00"
+ }
+ },
+ "optic-type": "gray"
+ },
+ "due-date": "2016-11-28T00:00:01Z",
+ "operator-contact": "pw1234"
+ }
+ }
+ headers = {'content-type': 'application/json',
+ "Accept": "application/json"}
+ response = requests.request(
+ "POST", url, data=json.dumps(data), headers=headers,
+ auth=('admin', 'admin'))
+ self.assertEqual(response.status_code, requests.codes.ok)
+ res = response.json()
+ self.assertIn('Service not compliant',
+ res['output']['configuration-response-common']['response-message'])
+ time.sleep(5)
+
+ #Create Service 'test' with not compliant parameter : no 'tx-direction' for serviceAEnd
+ def test_05_create_service(self):
+ url = ("{}/operations/org-openroadm-service:service-create"
+ .format(self.restconf_baseurl))
+ data = {"input": {
+ "sdnc-request-header": {
+ "request-id": "e3028bae-a90f-4ddd-a83f-cf224eba0e58",
+ "rpc-action": "service-create",
+ "request-system-id": "appname",
+ "notification-url": "http://localhost:8585/NotificationServer/notify"
+ },
+ "service-name": "test",
+ "common-id": "ASATT1234567",
+ "connection-type": "infrastructure",
+ "service-a-end": {
+ "service-rate": "100",
+ "node-id": "XPDRA",
+ "service-format": "Ethernet",
+ "clli": "SNJSCAMCJP8",
+ "rx-direction": {
+ "port": {
+ "port-device-name": "ROUTER_SNJSCAMCJP8_000000.00_00",
+ "port-type": "router",
+ "port-name": "Gigabit Ethernet_Rx.ge-5/0/0.0",
+ "port-rack": "000000.00",
+ "port-shelf": "00"
+ },
+ "lgx": {
+ "lgx-device-name": "LGX Panel_SNJSCAMCJP8_000000.00_00",
+ "lgx-port-name": "LGX Back.4",
+ "lgx-port-rack": "000000.00",
+ "lgx-port-shelf": "00"
+ }
+ },
+ "optic-type": "gray"
+ },
+ "service-z-end": {
+ "service-rate": "100",
+ "node-id": "XPDRC",
+ "service-format": "Ethernet",
+ "clli": "SNJSCAMCJT4",
+ "tx-direction": {
+ "port": {
+ "port-device-name": "ROUTER_SNJSCAMCJT4_000000.00_00",
+ "port-type": "router",
+ "port-name": "Gigabit Ethernet_Tx.ge-1/0/0.0",
+ "port-rack": "000000.00",
+ "port-shelf": "00"
+ },
+ "lgx": {
+ "lgx-device-name": "LGX Panel_SNJSCAMCJT4_000000.00_00",
+ "lgx-port-name": "LGX Back.29",
+ "lgx-port-rack": "000000.00",
+ "lgx-port-shelf": "00"
+ }
+ },
+ "rx-direction": {
+ "port": {
+ "port-device-name": "ROUTER_SNJSCAMCJT4_000000.00_00",
+ "port-type": "router",
+ "port-name": "Gigabit Ethernet_Rx.ge-1/0/0.0",
+ "port-rack": "000000.00",
+ "port-shelf": "00"
+ },
+ "lgx": {
+ "lgx-device-name": "LGX Panel_SNJSCAMCJT4_000000.00_00",
+ "lgx-port-name": "LGX Back.30",
+ "lgx-port-rack": "000000.00",
+ "lgx-port-shelf": "00"
+ }
+ },
+ "optic-type": "gray"
+ },
+ "due-date": "2016-11-28T00:00:01Z",
+ "operator-contact": "pw1234"
+ }
+ }
+ headers = {'content-type': 'application/json',
+ "Accept": "application/json"}
+ response = requests.request(
+ "POST", url, data=json.dumps(data), headers=headers,
+ auth=('admin', 'admin'))
+ self.assertEqual(response.status_code, requests.codes.ok)
+ res = response.json()
+ self.assertIn('Service not compliant',
+ res['output']['configuration-response-common']['response-message'])
+ time.sleep(5)
+
+ #Get 'test' service created
+ def test_06_get_service(self):
+ url = ("{}/operational/org-openroadm-service:service-list/services/test"
+ .format(self.restconf_baseurl))
+ headers = {'content-type': 'application/json',
+ "Accept": "application/json"}
+ response = requests.request(
+ "GET", url, headers=headers, auth=('admin', 'admin'))
+ self.assertEqual(response.status_code, requests.codes.ok)
+ res = response.json()
+ self.assertEqual(
+ res['services'][0]['administrative-state'],
+ 'inService')
+ time.sleep(1)
+
+ #get non existing service
+ def test_07_get_service(self):
+ url = ("{}/operational/org-openroadm-service:service-list/services/test1"
+ .format(self.restconf_baseurl))
+ headers = {'content-type': 'application/json',
+ "Accept": "application/json"}
+ response = requests.request(
+ "GET", url, headers=headers, auth=('admin', 'admin'))
+ self.assertEqual(response.status_code, 404)
+ time.sleep(1)
+
+ #reconfigure 'test' to be 'test-new'
+ def test_08_reconfigure_service(self):
+ url = ("{}/operations/org-openroadm-service:service-reconfigure"
+ .format(self.restconf_baseurl))
+ data = {"input": {
+ "service-name": "test",
+ "new-service-name": "test-new",
+ "common-id": "ASATT1234567",
+ "connection-type": "infrastructure",
+ "service-a-end": {
+ "service-rate": "100",
+ "node-id": "XPDRA",
+ "service-format": "Ethernet",
+ "clli": "SNJSCAMCJP8",
+ "tx-direction": {
+ "port": {
+ "port-device-name": "ROUTER_SNJSCAMCJP8_000000.00_00",
+ "port-type": "router",
+ "port-name": "Gigabit Ethernet_Tx.ge-5/0/0.0",
+ "port-rack": "000000.00",
+ "port-shelf": "00"
+ },
+ "lgx": {
+ "lgx-device-name": "LGX Panel_SNJSCAMCJP8_000000.00_00",
+ "lgx-port-name": "LGX Back.3",
+ "lgx-port-rack": "000000.00",
+ "lgx-port-shelf": "00"
+ }
+ },
+ "rx-direction": {
+ "port": {
+ "port-device-name": "ROUTER_SNJSCAMCJP8_000000.00_00",
+ "port-type": "router",
+ "port-name": "Gigabit Ethernet_Rx.ge-5/0/0.0",
+ "port-rack": "000000.00",
+ "port-shelf": "00"
+ },
+ "lgx": {
+ "lgx-device-name": "LGX Panel_SNJSCAMCJP8_000000.00_00",
+ "lgx-port-name": "LGX Back.4",
+ "lgx-port-rack": "000000.00",
+ "lgx-port-shelf": "00"
+ }
+ },
+ "optic-type": "gray"
+ },
+ "service-z-end": {
+ "service-rate": "100",
+ "node-id": "XPDRC",
+ "service-format": "Ethernet",
+ "clli": "SNJSCAMCJT4",
+ "tx-direction": {
+ "port": {
+ "port-device-name": "ROUTER_SNJSCAMCJT4_000000.00_00",
+ "port-type": "router",
+ "port-name": "Gigabit Ethernet_Tx.ge-1/0/0.0",
+ "port-rack": "000000.00",
+ "port-shelf": "00"
+ },
+ "lgx": {
+ "lgx-device-name": "LGX Panel_SNJSCAMCJT4_000000.00_00",
+ "lgx-port-name": "LGX Back.29",
+ "lgx-port-rack": "000000.00",
+ "lgx-port-shelf": "00"
+ }
+ },
+ "rx-direction": {
+ "port": {
+ "port-device-name": "ROUTER_SNJSCAMCJT4_000000.00_00",
+ "port-type": "router",
+ "port-name": "Gigabit Ethernet_Rx.ge-1/0/0.0",
+ "port-rack": "000000.00",
+ "port-shelf": "00"
+ },
+ "lgx": {
+ "lgx-device-name": "LGX Panel_SNJSCAMCJT4_000000.00_00",
+ "lgx-port-name": "LGX Back.30",
+ "lgx-port-rack": "000000.00",
+ "lgx-port-shelf": "00"
+ }
+ },
+ "optic-type": "gray"
+ },
+ "hard-constraints": {
+ "diversity": {
+ "existing-service": [
+ "104/GE100/SNJSCAMCJP8/SNJSCAMCJT4"
+ ],
+ "existing-service-applicability": {
+ "node": "true"
+ }
+ },
+ "exclude": {
+ "fiber-bundle": [
+ "l(string)"
+ ],
+ "node-id": [
+ "SNJSCAMCJP8_000000.00"
+ ]
+ },
+ "latency": {
+ "max-latency": "30"
+ }
+ }
+ }
+ }
+ headers = {'content-type': 'application/json',
+ "Accept": "application/json"}
+ response = requests.request(
+ "POST", url, data=json.dumps(data), headers=headers,
+ auth=('admin', 'admin'))
+ self.assertEqual(response.status_code, requests.codes.ok)
+ res = response.json()
+ self.assertIn('in progress',
+ res['output']['status-message'])
+ time.sleep(30)
+
+
+ #get new service 'test-new'
+ def test_09_get_service(self):
+ url = ("{}/operational/org-openroadm-service:service-list/services/test-new"
+ .format(self.restconf_baseurl))
+ headers = {'content-type': 'application/json',
+ "Accept": "application/json"}
+ response = requests.request(
+ "GET", url, headers=headers, auth=('admin', 'admin'))
+ res = response.json()
+ self.assertEqual(
+ res['services'][0]['operational-state'],
+ 'inService')
+ time.sleep(1)
+
+
+ #Modify 'test-new' state
+ def test_10_modify_service_state(self):
+ url = ("{}/operations/servicehandler:service-state-modify"
+ .format(self.restconf_baseurl))
+ data = {"input": {
+ "service-name": "test-new",
+ "operational-state": "outOfService"
+ }
+ }
+ headers = {'content-type': 'application/json'}
+ response = requests.request(
+ "POST", url, data=json.dumps(data), headers=headers,
+ auth=('admin', 'admin'))
+ res = response.json()
+ self.assertIn('Service state modified',
+ res['output']['configuration-response-common']['response-message'])
+ time.sleep(5)
+
+
+ #get new service 'test-new' state
+ def test_11_get_service(self):
+ url = ("{}/operational/org-openroadm-service:service-list/services/test-new"
+ .format(self.restconf_baseurl))
+ headers = {'content-type': 'application/json',
+ "Accept": "application/json"}
+ response = requests.request(
+ "GET", url, headers=headers, auth=('admin', 'admin'))
+ res = response.json()
+ self.assertEqual(
+ res['services'][0]['operational-state'],
+ 'outOfService')
+ time.sleep(1)
+
+
+ #restore service 'test-new'
+ def test_12_restore_service(self):
+ url = ("{}/operations/org-openroadm-service:service-restoration"
+ .format(self.restconf_baseurl))
+ data = {"input": {
+ "service-name": "test-new",
+ "option": "permanent"
+ }
+ }
+ headers = {'content-type': 'application/json'}
+ response = requests.request(
+ "POST", url, data=json.dumps(data), headers=headers,
+ auth=('admin', 'admin'))
+ res = response.json()
+ self.assertIn('in progress',
+ res['output']['status-message'])
+ time.sleep(60)
+
+
+ #get new service 'test-new' state
+ def test_13_get_service(self):
+ url = ("{}/operational/org-openroadm-service:service-list/services/test-new"
+ .format(self.restconf_baseurl))
+ headers = {'content-type': 'application/json',
+ "Accept": "application/json"}
+ response = requests.request(
+ "GET", url, headers=headers, auth=('admin', 'admin'))
+ res = response.json()
+ self.assertEqual(
+ res['services'][0]['operational-state'],
+ 'inService')
+ time.sleep(1)
+
+
+ #Delete 'test-new' service
+ def test_14_delete_service(self):
+ url = ("{}/operations/org-openroadm-service:service-delete"
+ .format(self.restconf_baseurl))
+ data = {"input": {
+ "sdnc-request-header": {
+ "request-id": "e3028bae-a90f-4ddd-a83f-cf224eba0e58",
+ "rpc-action": "service-delete",
+ "request-system-id": "appname",
+ "notification-url": "http://localhost:8585/NotificationServer/notify"
+ },
+ "service-delete-req-info": {
+ "service-name": "test-new",
+ "due-date": "2016-11-28T00:00:01Z",
+ "tail-retention": "no"
+ }
+ }
+ }
+ headers = {'content-type': 'application/json'}
+ response = requests.request(
+ "POST", url, data=json.dumps(data), headers=headers,
+ auth=('admin', 'admin'))
+ res = response.json()
+ self.assertIn('in progress',
+ res['output']['configuration-response-common']['response-message'])
+ time.sleep(30)
+
+
+ #Delete non existing service
+ def test_15_delete_service(self):
+ url = ("{}/operations/org-openroadm-service:service-delete"
+ .format(self.restconf_baseurl))
+ data = {"input": {
+ "sdnc-request-header": {
+ "request-id": "e3028bae-a90f-4ddd-a83f-cf224eba0e58",
+ "rpc-action": "service-delete",
+ "request-system-id": "appname",
+ "notification-url": "http://localhost:8585/NotificationServer/notify"
+ },
+ "service-delete-req-info": {
+ "service-name": "test",
+ "due-date": "2016-11-28T00:00:01Z",
+ "tail-retention": "no"
+ }
+ }
+ }
+ headers = {'content-type': 'application/json'}
+ response = requests.request(
+ "POST", url, data=json.dumps(data), headers=headers,
+ auth=('admin', 'admin'))
+ self.assertEqual(response.status_code, requests.codes.ok)
+ res = response.json()
+ self.assertIn('not exists in datastore',
+ res['output']['configuration-response-common']['response-message'])
+ time.sleep(1)
+
+
+ #Verify 'test' service deleted
+ def test_16_get_service(self):
+ url = ("{}/operational/org-openroadm-service:service-list/services/test-new"
+ .format(self.restconf_baseurl))
+ headers = {'content-type': 'application/json',
+ "Accept": "application/json"}
+ response = requests.request(
+ "GET", url, headers=headers, auth=('admin', 'admin'))
+ self.assertEqual(response.status_code, 404)
+ time.sleep(1)
+
+if __name__ == "__main__":
+ unittest.main(verbosity=2)