2 * Copyright © 2017 Orange, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.transportpce.servicehandler.impl;
10 import com.google.common.util.concurrent.ListenableFuture;
11 import java.time.OffsetDateTime;
12 import java.time.ZoneOffset;
13 import java.time.format.DateTimeFormatter;
15 import java.util.Optional;
16 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
17 import org.opendaylight.transportpce.common.OperationResult;
18 import org.opendaylight.transportpce.common.ResponseCodes;
19 import org.opendaylight.transportpce.pce.service.PathComputationService;
20 import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
21 import org.opendaylight.transportpce.servicehandler.CatalogInput;
22 import org.opendaylight.transportpce.servicehandler.DowngradeConstraints;
23 import org.opendaylight.transportpce.servicehandler.ModelMappingUtils;
24 import org.opendaylight.transportpce.servicehandler.ServiceInput;
25 import org.opendaylight.transportpce.servicehandler.catalog.CatalogDataStoreOperations;
26 import org.opendaylight.transportpce.servicehandler.catalog.CatalogMapper;
27 import org.opendaylight.transportpce.servicehandler.listeners.NetworkListener;
28 import org.opendaylight.transportpce.servicehandler.listeners.PceListener;
29 import org.opendaylight.transportpce.servicehandler.listeners.RendererListener;
30 import org.opendaylight.transportpce.servicehandler.service.PCEServiceWrapper;
31 import org.opendaylight.transportpce.servicehandler.service.RendererServiceWrapper;
32 import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperations;
33 import org.opendaylight.transportpce.servicehandler.validation.CatalogValidation;
34 import org.opendaylight.transportpce.servicehandler.validation.ServiceCreateValidation;
35 import org.opendaylight.transportpce.servicehandler.validation.checks.ComplianceCheckResult;
36 import org.opendaylight.transportpce.servicehandler.validation.checks.ServicehandlerComplianceCheck;
37 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.PathComputationRequestOutput;
38 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.PathComputationRerouteRequestOutput;
39 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.path.computation.reroute.request.input.EndpointsBuilder;
40 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.RpcActions;
41 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.ServiceNotificationTypes;
42 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.configuration.response.common.ConfigurationResponseCommon;
43 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.sdnc.request.header.SdncRequestHeaderBuilder;
44 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
45 import org.opendaylight.yang.gen.v1.http.org.openroadm.operational.mode.catalog.rev211210.operational.mode.catalog.OpenroadmOperationalModes;
46 import org.opendaylight.yang.gen.v1.http.org.openroadm.operational.mode.catalog.rev211210.operational.mode.catalog.SpecificOperationalModes;
47 import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.routing.constraints.HardConstraints;
48 import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.routing.constraints.SoftConstraints;
49 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.AddOpenroadmOperationalModesToCatalogInput;
50 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.AddOpenroadmOperationalModesToCatalogOutput;
51 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.AddSpecificOperationalModesToCatalogInput;
52 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.AddSpecificOperationalModesToCatalogOutput;
53 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.EquipmentNotificationInput;
54 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.EquipmentNotificationOutput;
55 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.NetworkReOptimizationInput;
56 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.NetworkReOptimizationOutput;
57 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.OpticalTunnelCreateInput;
58 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.OpticalTunnelCreateOutput;
59 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.OpticalTunnelRequestCancelInput;
60 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.OpticalTunnelRequestCancelOutput;
61 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.OrgOpenroadmServiceService;
62 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateBulkInput;
63 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateBulkOutput;
64 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateComplexResultNotificationRequestInput;
65 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateComplexResultNotificationRequestOutput;
66 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateInput;
67 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateOutput;
68 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateResultNotificationRequestInput;
69 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateResultNotificationRequestOutput;
70 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceDeleteComplexResultNotificationRequestInput;
71 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceDeleteComplexResultNotificationRequestOutput;
72 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceDeleteInput;
73 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceDeleteInputBuilder;
74 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceDeleteOutput;
75 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceDeleteResultNotificationRequestInput;
76 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceDeleteResultNotificationRequestOutput;
77 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceFeasibilityCheckBulkInput;
78 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceFeasibilityCheckBulkOutput;
79 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceFeasibilityCheckInput;
80 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceFeasibilityCheckOutput;
81 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceReconfigureBulkInput;
82 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceReconfigureBulkOutput;
83 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceReconfigureInput;
84 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceReconfigureOutput;
85 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceReconfigureResultNotificationRequestInput;
86 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceReconfigureResultNotificationRequestOutput;
87 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRerouteConfirmInput;
88 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRerouteConfirmOutput;
89 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRerouteConfirmResultNotificationRequestInput;
90 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRerouteConfirmResultNotificationRequestOutput;
91 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRerouteInput;
92 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRerouteOutput;
93 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRestorationInput;
94 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRestorationOutput;
95 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRestorationResultNotificationRequestInput;
96 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRestorationResultNotificationRequestOutput;
97 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceReversionInput;
98 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceReversionOutput;
99 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceReversionResultNotificationRequestInput;
100 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceReversionResultNotificationRequestOutput;
101 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRollInput;
102 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRollOutput;
103 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRollResultNotificationRequestInput;
104 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRollResultNotificationRequestOutput;
105 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceSrlgGetInput;
106 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceSrlgGetOutput;
107 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.TempServiceCreateBulkInput;
108 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.TempServiceCreateBulkOutput;
109 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.TempServiceCreateInput;
110 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.TempServiceCreateOutput;
111 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.TempServiceDeleteInput;
112 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.TempServiceDeleteOutput;
113 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.delete.input.ServiceDeleteReqInfo.TailRetention;
114 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.delete.input.ServiceDeleteReqInfoBuilder;
115 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.list.Services;
116 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.atoz.direction.AToZ;
117 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.atoz.direction.AToZKey;
118 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.pce.resource.resource.resource.TerminationPoint;
119 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.service.path.list.ServicePaths;
120 import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService;
121 import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessServiceBuilder;
122 import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceAEndBuilder;
123 import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceZEndBuilder;
124 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
125 import org.opendaylight.yangtools.yang.common.RpcResult;
126 import org.osgi.service.component.annotations.Activate;
127 import org.osgi.service.component.annotations.Component;
128 import org.osgi.service.component.annotations.Reference;
129 import org.slf4j.Logger;
130 import org.slf4j.LoggerFactory;
134 * Top level service interface providing main OpenROADM controller services.
137 public class ServicehandlerImpl implements OrgOpenroadmServiceService {
138 private static final Logger LOG = LoggerFactory.getLogger(ServicehandlerImpl.class);
139 private static final String PUBLISHER = "ServiceHandler";
140 private static final String TEMP_SERVICE_CREATE_MSG = "tempServiceCreate: {}";
141 private static final String TEMP_SERVICE_DELETE_MSG = "tempServiceDelete: {}";
142 private static final String SERVICE_RESTORATION_MSG = "serviceRestoration: {}";
143 private static final String SERVICE_RECONFIGURE_MSG = "serviceReconfigure: {}";
144 private static final String SERVICE_FEASIBILITY_CHECK_MSG = "serviceFeasibilityCheck: {}";
145 private static final String SERVICE_DELETE_MSG = "serviceDelete: {}";
146 private static final String SERVICE_CREATE_MSG = "serviceCreate: {}";
147 private static final String ADD_OR_TO_CATALOG_MSG = "addORToCatalog: {}";
148 private static final String ADD_SPECIFIC_TO_CATALOG_MSG = "addSpecificToCatalog: {}";
150 private ServiceDataStoreOperations serviceDataStoreOperations;
151 private PCEServiceWrapper pceServiceWrapper;
152 private RendererServiceWrapper rendererServiceWrapper;
153 private PceListener pceListenerImpl;
154 private RendererListener rendererListenerImpl;
155 private NetworkListener networkModelListenerImpl;
156 private NotificationPublishService notificationPublishService;
157 private CatalogDataStoreOperations catalogDataStoreOperations;
160 public ServicehandlerImpl(@Reference PathComputationService pathComputationService,
161 @Reference RendererServiceOperations rendererServiceOperations,
162 @Reference NotificationPublishService notificationPublishService,
163 @Reference PceListener pceListenerImpl,
164 @Reference RendererListener rendererListenerImpl,
165 @Reference NetworkListener networkModelListenerImpl,
166 @Reference ServiceDataStoreOperations serviceDataStoreOperations,
167 @Reference CatalogDataStoreOperations catalogDataStoreOperations) {
168 this.catalogDataStoreOperations = catalogDataStoreOperations;
169 this.serviceDataStoreOperations = serviceDataStoreOperations;
170 this.notificationPublishService = notificationPublishService;
171 this.pceServiceWrapper = new PCEServiceWrapper(pathComputationService, notificationPublishService);
172 this.rendererServiceWrapper = new RendererServiceWrapper(rendererServiceOperations, notificationPublishService);
173 this.pceListenerImpl = pceListenerImpl;
174 this.rendererListenerImpl = rendererListenerImpl;
175 this.networkModelListenerImpl = networkModelListenerImpl;
176 LOG.info("ServicehandlerImpl Initiated");
180 // This is class is public so that these messages can be accessed from Junit (avoid duplications).
181 public static final class LogMessages {
183 public static final String PCE_CALLING;
184 public static final String ABORT_PCE_FAILED;
185 public static final String PCE_FAILED;
186 public static final String ABORT_SERVICE_NON_COMPLIANT;
187 public static final String SERVICE_NON_COMPLIANT;
188 public static final String RENDERER_DELETE_FAILED;
189 public static final String ABORT_VALID_FAILED;
190 public static final String ABORT_OR_TO_CATALOG_FAILED;
191 public static final String ABORT_SPECIFIC_TO_CATALOG_FAILED;
193 // Static blocks are generated once and spare memory.
195 PCE_CALLING = "Calling PCE";
196 ABORT_PCE_FAILED = "Aborting: PCE calculation failed ";
197 PCE_FAILED = "PCE calculation failed";
198 ABORT_SERVICE_NON_COMPLIANT = "Aborting: non-compliant service ";
199 SERVICE_NON_COMPLIANT = "non-compliant service";
200 RENDERER_DELETE_FAILED = "Renderer service delete failed";
201 ABORT_VALID_FAILED = "Aborting: validation of service create request failed";
202 ABORT_OR_TO_CATALOG_FAILED = "Aborting: validation of add OR to catalog request failed";
203 ABORT_SPECIFIC_TO_CATALOG_FAILED = "Aborting: validation of add Specific to catalog request failed";
206 public static String serviceInDS(String serviceName) {
207 return "Service '" + serviceName + "' already exists in datastore";
210 public static String serviceNotInDS(String serviceName) {
211 return "Service '" + serviceName + "' does not exist in datastore";
214 public static String servicePathNotInDS(String serviceName) {
215 return "Service Path from '" + serviceName + "' does not exist in datastore";
218 public static String serviceInService(String serviceName) {
219 return "Service '" + serviceName + "' is in 'inService' state";
222 private LogMessages() {
227 public ListenableFuture<RpcResult<ServiceCreateOutput>> serviceCreate(ServiceCreateInput input) {
228 LOG.info("RPC serviceCreate received");
230 OperationResult validationResult = ServiceCreateValidation.validateServiceCreateRequest(
231 new ServiceInput(input), RpcActions.ServiceCreate);
232 if (!validationResult.isSuccess()) {
233 LOG.warn(SERVICE_CREATE_MSG, LogMessages.ABORT_VALID_FAILED);
234 return ModelMappingUtils.createCreateServiceReply(
235 input, ResponseCodes.FINAL_ACK_YES,
236 validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
238 //Check any presence of services with the same name
239 String serviceName = input.getServiceName();
240 if (this.serviceDataStoreOperations.getService(serviceName).isPresent()) {
241 LOG.warn(SERVICE_CREATE_MSG, LogMessages.serviceInDS(serviceName));
242 return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
243 LogMessages.serviceInDS(serviceName), ResponseCodes.RESPONSE_FAILED);
245 this.pceListenerImpl.setInput(new ServiceInput(input));
246 this.pceListenerImpl.setServiceReconfigure(false);
247 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
248 this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
249 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
250 this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
251 LOG.debug(SERVICE_CREATE_MSG, LogMessages.PCE_CALLING);
252 PathComputationRequestOutput output = this.pceServiceWrapper.performPCE(input, true);
253 if (output == null) {
254 LOG.warn(SERVICE_CREATE_MSG, LogMessages.ABORT_PCE_FAILED);
255 sendNbiNotification(new PublishNotificationProcessServiceBuilder()
256 .setServiceName(serviceName)
257 .setServiceAEnd(new ServiceAEndBuilder(input.getServiceAEnd()).build())
258 .setServiceZEnd(new ServiceZEndBuilder(input.getServiceZEnd()).build())
259 .setCommonId(input.getCommonId())
260 .setConnectionType(input.getConnectionType())
261 .setResponseFailed(LogMessages.ABORT_PCE_FAILED)
262 .setMessage("ServiceCreate request failed ...")
263 .setOperationalState(State.Degraded)
264 .setPublisherName(PUBLISHER)
266 return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
267 LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED);
269 LOG.info("RPC serviceCreate in progress...");
270 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
271 return ModelMappingUtils.createCreateServiceReply(
272 input, common.getAckFinalIndicator(),
273 common.getResponseMessage(), common.getResponseCode());
277 public ListenableFuture<RpcResult<ServiceDeleteOutput>> serviceDelete(ServiceDeleteInput input) {
278 String serviceName = input.getServiceDeleteReqInfo().getServiceName();
279 LOG.info("RPC serviceDelete request received for {}", serviceName);
282 * Upon receipt of service-deleteService RPC, service header and sdnc-request
283 * header compliance are verified.
285 ComplianceCheckResult serviceHandlerCheckResult =
286 ServicehandlerComplianceCheck.check(
287 input.getServiceDeleteReqInfo().getServiceName(),
288 input.getSdncRequestHeader(), null, RpcActions.ServiceDelete, false, true);
289 if (!serviceHandlerCheckResult.hasPassed()) {
290 LOG.warn(SERVICE_DELETE_MSG, LogMessages.ABORT_SERVICE_NON_COMPLIANT);
291 return ModelMappingUtils.createDeleteServiceReply(
292 input, ResponseCodes.FINAL_ACK_YES,
293 LogMessages.SERVICE_NON_COMPLIANT, ResponseCodes.RESPONSE_FAILED);
296 //Check presence of service to be deleted
297 Optional<Services> serviceOpt = this.serviceDataStoreOperations.getService(serviceName);
299 if (serviceOpt.isEmpty()) {
300 LOG.warn(SERVICE_DELETE_MSG, LogMessages.serviceNotInDS(serviceName));
301 return ModelMappingUtils.createDeleteServiceReply(
302 input, ResponseCodes.FINAL_ACK_YES,
303 LogMessages.serviceNotInDS(serviceName), ResponseCodes.RESPONSE_FAILED);
305 service = serviceOpt.orElseThrow();
306 LOG.debug("serviceDelete: Service '{}' found in datastore", serviceName);
307 this.pceListenerImpl.setInput(new ServiceInput(input));
308 this.pceListenerImpl.setServiceReconfigure(false);
309 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
310 this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
311 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
312 this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
313 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteInput
314 serviceDeleteInput = ModelMappingUtils.createServiceDeleteInput(new ServiceInput(input));
315 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteOutput output =
316 this.rendererServiceWrapper.performRenderer(
317 serviceDeleteInput, ServiceNotificationTypes.ServiceDeleteResult, service);
319 if (output == null) {
320 LOG.error(SERVICE_DELETE_MSG, LogMessages.RENDERER_DELETE_FAILED);
321 sendNbiNotification(new PublishNotificationProcessServiceBuilder()
322 .setServiceName(service.getServiceName())
323 .setServiceAEnd(new ServiceAEndBuilder(service.getServiceAEnd()).build())
324 .setServiceZEnd(new ServiceZEndBuilder(service.getServiceZEnd()).build())
325 .setCommonId(service.getCommonId())
326 .setConnectionType(service.getConnectionType())
327 .setMessage("ServiceDelete request failed ...")
328 .setOperationalState(State.InService)
329 .setResponseFailed(LogMessages.RENDERER_DELETE_FAILED)
330 .setPublisherName(PUBLISHER)
332 return ModelMappingUtils.createDeleteServiceReply(
333 input, ResponseCodes.FINAL_ACK_YES,
334 LogMessages.RENDERER_DELETE_FAILED, ResponseCodes.RESPONSE_FAILED);
337 LOG.debug("RPC serviceDelete in progress...");
338 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
339 return ModelMappingUtils.createDeleteServiceReply(
340 input, common.getAckFinalIndicator(),
341 common.getResponseMessage(), common.getResponseCode());
345 public ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> serviceFeasibilityCheck(
346 ServiceFeasibilityCheckInput input) {
347 LOG.info("RPC serviceFeasibilityCheck received");
349 ServiceInput serviceInput = new ServiceInput(input);
350 OperationResult validationResult = ServiceCreateValidation.validateServiceCreateRequest(serviceInput,
351 RpcActions.ServiceFeasibilityCheck);
352 if (! validationResult.isSuccess()) {
353 LOG.warn(SERVICE_FEASIBILITY_CHECK_MSG, LogMessages.ABORT_VALID_FAILED);
354 return ModelMappingUtils.createCreateServiceReply(
355 input, ResponseCodes.FINAL_ACK_YES,
356 validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
358 this.pceListenerImpl.setInput(new ServiceInput(input));
359 this.pceListenerImpl.setServiceReconfigure(false);
360 this.pceListenerImpl.setServiceFeasiblity(true);
361 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
362 this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
363 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
364 this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
365 LOG.debug(SERVICE_FEASIBILITY_CHECK_MSG, LogMessages.PCE_CALLING);
366 PathComputationRequestOutput output = this.pceServiceWrapper.performPCE(input, true);
367 if (output == null) {
368 LOG.warn(SERVICE_FEASIBILITY_CHECK_MSG, LogMessages.ABORT_PCE_FAILED);
369 return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
370 LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED);
372 LOG.info("RPC serviceFeasibilityCheck in progress...");
373 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
374 return ModelMappingUtils.createCreateServiceReply(
375 input, common.getAckFinalIndicator(),
376 common.getResponseMessage(), common.getResponseCode());
380 public ListenableFuture<RpcResult<ServiceReconfigureOutput>> serviceReconfigure(ServiceReconfigureInput input) {
381 String serviceName = input.getServiceName();
382 LOG.info("RPC serviceReconfigure received for {}", serviceName);
383 Optional<Services> servicesObject = this.serviceDataStoreOperations.getService(serviceName);
384 if (servicesObject.isEmpty()) {
385 LOG.warn(SERVICE_RECONFIGURE_MSG, LogMessages.serviceNotInDS(serviceName));
386 return ModelMappingUtils.createCreateServiceReply(
388 LogMessages.serviceNotInDS(serviceName));
390 LOG.debug("Service '{}' found in datastore", serviceName);
391 OperationResult validationResult = ServiceCreateValidation
392 .validateServiceCreateRequest(new ServiceInput(input), RpcActions.ServiceReconfigure);
393 if (!validationResult.isSuccess()) {
394 LOG.warn(SERVICE_RECONFIGURE_MSG, LogMessages.ABORT_VALID_FAILED);
395 return ModelMappingUtils.createCreateServiceReply(
397 validationResult.getResultMessage());
399 this.pceListenerImpl.setInput(new ServiceInput(input));
400 this.pceListenerImpl.setServiceReconfigure(true);
401 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
402 this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
403 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
404 this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
405 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
406 .ServiceDeleteInput serviceDeleteInput =
407 ModelMappingUtils.createServiceDeleteInput(new ServiceInput(input));
408 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
409 .ServiceDeleteOutput output = this.rendererServiceWrapper.performRenderer(serviceDeleteInput,
410 ServiceNotificationTypes.ServiceDeleteResult, null);
411 if (output == null) {
412 LOG.error(SERVICE_RECONFIGURE_MSG, LogMessages.RENDERER_DELETE_FAILED);
413 return ModelMappingUtils.createCreateServiceReply(
415 LogMessages.RENDERER_DELETE_FAILED);
416 //TODO check if RpcStatus.Successful is really expected here
418 LOG.info("RPC serviceReconfigure in progress...");
419 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
420 return ModelMappingUtils.createCreateServiceReply(
422 common.getResponseMessage());
426 public ListenableFuture<RpcResult<ServiceRestorationOutput>> serviceRestoration(ServiceRestorationInput input) {
427 String serviceName = input.getServiceName();
428 LOG.info("RPC serviceRestoration received for {}", serviceName);
429 Optional<Services> servicesObject = this.serviceDataStoreOperations.getService(serviceName);
431 if (!servicesObject.isPresent()) {
432 LOG.warn(SERVICE_RESTORATION_MSG, LogMessages.serviceNotInDS(serviceName));
433 return ModelMappingUtils.createRestoreServiceReply(
434 LogMessages.serviceNotInDS(serviceName));
437 Services service = servicesObject.orElseThrow();
438 State state = service.getOperationalState();
440 if (state == State.InService) {
441 LOG.error(SERVICE_RESTORATION_MSG, LogMessages.serviceInService(serviceName));
442 return ModelMappingUtils.createRestoreServiceReply(
443 LogMessages.serviceInService(serviceName));
446 DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx");
447 OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);
448 DateAndTime datetime = new DateAndTime(dtf.format(offsetDateTime));
449 SdncRequestHeaderBuilder sdncBuilder = new SdncRequestHeaderBuilder()
450 .setNotificationUrl(service.getSdncRequestHeader().getNotificationUrl())
451 .setRequestId(service.getSdncRequestHeader().getRequestId())
452 .setRequestSystemId(service.getSdncRequestHeader().getRequestSystemId())
453 .setRpcAction(RpcActions.ServiceDelete);
454 ServiceDeleteInputBuilder deleteInputBldr = new ServiceDeleteInputBuilder()
455 .setServiceDeleteReqInfo(new ServiceDeleteReqInfoBuilder()
456 .setServiceName(serviceName)
457 .setDueDate(datetime)
458 .setTailRetention(TailRetention.No).build())
459 .setSdncRequestHeader(sdncBuilder.build());
460 ServiceInput serviceInput = new ServiceInput(deleteInputBldr.build());
461 serviceInput.setServiceAEnd(service.getServiceAEnd());
462 serviceInput.setServiceZEnd(service.getServiceZEnd());
463 serviceInput.setConnectionType(service.getConnectionType());
464 HardConstraints hardConstraints = service.getHardConstraints();
465 if (hardConstraints == null) {
466 LOG.warn("service '{}' HardConstraints is not set !", serviceName);
468 SoftConstraints softConstraints = service.getSoftConstraints();
469 if (softConstraints == null) {
470 LOG.warn("service '{}' SoftConstraints is not set !", serviceName);
471 serviceInput.setSoftConstraints(DowngradeConstraints.convertToSoftConstraints(hardConstraints));
473 LOG.info("converting hard constraints to soft constraints ...");
474 serviceInput.setSoftConstraints(
475 DowngradeConstraints.updateSoftConstraints(hardConstraints, softConstraints));
477 serviceInput.setHardConstraints(DowngradeConstraints.downgradeHardConstraints(hardConstraints));
479 this.pceListenerImpl.setInput(serviceInput);
480 this.pceListenerImpl.setServiceReconfigure(true);
481 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
482 this.rendererListenerImpl.setServiceInput(serviceInput);
483 this.rendererListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
484 this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
485 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
486 .ServiceDeleteInput serviceDeleteInput = ModelMappingUtils.createServiceDeleteInput(
487 new ServiceInput(deleteInputBldr.build()));
488 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
489 .ServiceDeleteOutput output = this.rendererServiceWrapper.performRenderer(serviceDeleteInput,
490 ServiceNotificationTypes.ServiceDeleteResult, null);
491 if (output == null) {
492 LOG.error(SERVICE_RESTORATION_MSG, LogMessages.RENDERER_DELETE_FAILED);
493 return ModelMappingUtils.createRestoreServiceReply(LogMessages.RENDERER_DELETE_FAILED);
495 LOG.info("RPC serviceRestore in progress...");
496 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
497 return ModelMappingUtils.createRestoreServiceReply(common.getResponseMessage());
502 public ListenableFuture<RpcResult<EquipmentNotificationOutput>>
503 equipmentNotification(EquipmentNotificationInput input) {
504 // TODO Auto-generated method stub
509 public ListenableFuture<RpcResult<ServiceRerouteConfirmOutput>>
510 serviceRerouteConfirm(ServiceRerouteConfirmInput input) {
511 // TODO Auto-generated method stub
516 public ListenableFuture<RpcResult<ServiceRerouteOutput>> serviceReroute(ServiceRerouteInput input) {
517 String serviceName = input.getServiceName();
518 LOG.info("RPC serviceReroute received for {}", serviceName);
519 Optional<Services> servicesObject = this.serviceDataStoreOperations.getService(serviceName);
520 if (servicesObject.isEmpty()) {
521 LOG.warn("serviceReroute: {}", LogMessages.serviceNotInDS(serviceName));
522 return ModelMappingUtils.createRerouteServiceReply(
523 input, ResponseCodes.FINAL_ACK_YES,
524 LogMessages.serviceNotInDS(serviceName),
525 ResponseCodes.RESPONSE_FAILED);
527 Services service = servicesObject.orElseThrow();
528 Optional<ServicePaths> servicePathsObject = this.serviceDataStoreOperations.getServicePath(serviceName);
529 if (servicePathsObject.isEmpty()) {
530 LOG.warn("serviceReroute: {}", LogMessages.servicePathNotInDS(serviceName));
531 return ModelMappingUtils.createRerouteServiceReply(
532 input, ResponseCodes.FINAL_ACK_YES,
533 LogMessages.servicePathNotInDS(serviceName),
534 ResponseCodes.RESPONSE_FAILED);
536 ServicePaths servicePaths = servicePathsObject.orElseThrow();
537 // serviceInput for later use maybe...
538 ServiceInput serviceInput = new ServiceInput(input);
539 serviceInput.setServiceAEnd(service.getServiceAEnd());
540 serviceInput.setServiceZEnd(service.getServiceZEnd());
541 serviceInput.setConnectionType(service.getConnectionType());
542 serviceInput.setCommonId(service.getCommonId());
543 serviceInput.setHardConstraints(service.getHardConstraints());
544 serviceInput.setSoftConstraints(service.getSoftConstraints());
545 serviceInput.setCustomer(service.getCustomer());
546 serviceInput.setCustomerContact(service.getCustomerContact());
548 // Get the network xpdr termination points
549 Map<AToZKey, AToZ> mapaToz = servicePaths.getPathDescription().getAToZDirection().getAToZ();
550 String aendtp = ((TerminationPoint) mapaToz.get(new AToZKey(String.valueOf(mapaToz.size() - 3)))
554 String zendtp = ((TerminationPoint) mapaToz.get(new AToZKey("2"))
559 PathComputationRerouteRequestOutput output = this.pceServiceWrapper.performPCEReroute(
560 service.getHardConstraints(), service.getSoftConstraints(), input.getSdncRequestHeader(),
561 service.getServiceAEnd(), service.getServiceZEnd(),
562 new EndpointsBuilder().setAEndTp(aendtp).setZEndTp(zendtp).build());
564 if (output == null) {
565 LOG.error("serviceReroute: {}", LogMessages.PCE_FAILED);
566 return ModelMappingUtils.createRerouteServiceReply(
567 input, ResponseCodes.FINAL_ACK_YES,
568 LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED);
570 LOG.info("RPC ServiceReroute is done");
571 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
572 return ModelMappingUtils.createRerouteServiceReply(input, common.getAckFinalIndicator(),
573 common.getResponseMessage(), common.getResponseCode());
577 public ListenableFuture<RpcResult<ServiceReversionOutput>> serviceReversion(ServiceReversionInput input) {
578 // TODO Auto-generated method stub
583 public ListenableFuture<RpcResult<ServiceRollOutput>> serviceRoll(ServiceRollInput input) {
584 // TODO Auto-generated method stub
589 public ListenableFuture<RpcResult<NetworkReOptimizationOutput>>
590 networkReOptimization(NetworkReOptimizationInput input) {
591 // TODO Auto-generated method stub
596 public ListenableFuture<RpcResult<TempServiceDeleteOutput>> tempServiceDelete(TempServiceDeleteInput input) {
597 String commonId = input.getCommonId();
598 LOG.info("RPC temp serviceDelete request received for {}", commonId);
601 * Upon receipt of service-deleteService RPC, service header and sdnc-request
602 * header compliance are verified.
604 LOG.debug("checking Service Compliance ...");
605 ComplianceCheckResult serviceHandlerCheckResult = ServicehandlerComplianceCheck.check(
606 commonId, null, null, RpcActions.ServiceDelete, false, false
608 if (!serviceHandlerCheckResult.hasPassed()) {
609 LOG.warn(TEMP_SERVICE_DELETE_MSG, LogMessages.ABORT_SERVICE_NON_COMPLIANT);
610 return ModelMappingUtils.createDeleteServiceReply(
611 input, ResponseCodes.FINAL_ACK_YES,
612 LogMessages.SERVICE_NON_COMPLIANT, ResponseCodes.RESPONSE_FAILED);
615 //Check presence of service to be deleted
616 LOG.debug("service common-id '{}' is compliant", commonId);
617 Optional<org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.temp.service.list.Services>
619 this.serviceDataStoreOperations.getTempService(commonId);
620 if (service.isEmpty()) {
621 LOG.error(TEMP_SERVICE_DELETE_MSG, LogMessages.serviceNotInDS(commonId));
622 return ModelMappingUtils.createDeleteServiceReply(
623 input, ResponseCodes.FINAL_ACK_YES,
624 LogMessages.serviceNotInDS(commonId), ResponseCodes.RESPONSE_FAILED);
627 LOG.info("Service '{}' present in datastore !", commonId);
628 this.pceListenerImpl.setInput(new ServiceInput(input));
629 this.pceListenerImpl.setServiceReconfigure(false);
630 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
631 this.rendererListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
632 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
633 this.rendererListenerImpl.setTempService(true);
634 this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
635 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteOutput output =
636 this.rendererServiceWrapper.performRenderer(input, ServiceNotificationTypes.ServiceDeleteResult);
637 if (output == null) {
638 LOG.error(TEMP_SERVICE_DELETE_MSG, LogMessages.RENDERER_DELETE_FAILED);
639 return ModelMappingUtils.createDeleteServiceReply(
640 input, ResponseCodes.FINAL_ACK_YES,
641 LogMessages.RENDERER_DELETE_FAILED, ResponseCodes.RESPONSE_FAILED);
643 LOG.info("RPC tempServiceDelete in progress...");
644 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
645 return ModelMappingUtils.createDeleteServiceReply(
646 input, common.getAckFinalIndicator(),
647 common.getResponseMessage(), common.getResponseCode());
651 public ListenableFuture<RpcResult<TempServiceCreateOutput>> tempServiceCreate(TempServiceCreateInput input) {
652 LOG.info("RPC tempServiceCreate received");
654 OperationResult validationResult = ServiceCreateValidation.validateServiceCreateRequest(
655 new ServiceInput(input), RpcActions.TempServiceCreate);
656 if (! validationResult.isSuccess()) {
657 LOG.warn(TEMP_SERVICE_CREATE_MSG, LogMessages.ABORT_VALID_FAILED);
658 return ModelMappingUtils.createCreateServiceReply(
659 input, ResponseCodes.FINAL_ACK_YES,
660 validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
663 // Starting service create operation
664 LOG.debug(TEMP_SERVICE_CREATE_MSG, LogMessages.PCE_CALLING);
665 this.pceListenerImpl.setInput(new ServiceInput(input));
666 this.pceListenerImpl.setServiceReconfigure(false);
667 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
668 this.pceListenerImpl.setTempService(true);
669 this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
670 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
671 this.rendererListenerImpl.setTempService(true);
672 this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
673 PathComputationRequestOutput output = this.pceServiceWrapper.performPCE(input, true);
674 if (output == null) {
675 LOG.warn(TEMP_SERVICE_CREATE_MSG, LogMessages.ABORT_PCE_FAILED);
676 return ModelMappingUtils.createCreateServiceReply(
677 input, ResponseCodes.FINAL_ACK_YES,
678 LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED);
680 LOG.info("RPC tempServiceCreate in progress...");
681 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
682 return ModelMappingUtils.createCreateServiceReply(
683 input, common.getAckFinalIndicator(),
684 common.getResponseMessage(), common.getResponseCode());
688 public ListenableFuture<RpcResult<
689 ServiceDeleteComplexResultNotificationRequestOutput>> serviceDeleteComplexResultNotificationRequest(
690 ServiceDeleteComplexResultNotificationRequestInput input) {
691 // TODO Auto-generated method stub
696 public ListenableFuture<RpcResult<
697 ServiceCreateResultNotificationRequestOutput>> serviceCreateResultNotificationRequest(
698 ServiceCreateResultNotificationRequestInput input) {
699 // TODO Auto-generated method stub
704 public ListenableFuture<RpcResult<
705 ServiceDeleteResultNotificationRequestOutput>> serviceDeleteResultNotificationRequest(
706 ServiceDeleteResultNotificationRequestInput input) {
707 // TODO Auto-generated method stub
712 public ListenableFuture<RpcResult<
713 ServiceCreateComplexResultNotificationRequestOutput>> serviceCreateComplexResultNotificationRequest(
714 ServiceCreateComplexResultNotificationRequestInput input) {
715 // TODO Auto-generated method stub
720 public ListenableFuture<RpcResult<ServiceFeasibilityCheckBulkOutput>> serviceFeasibilityCheckBulk(
721 ServiceFeasibilityCheckBulkInput input) {
722 // TODO Auto-generated method stub
727 * Send notification to NBI notification in order to publish message.
728 * @param service PublishNotificationService
730 private void sendNbiNotification(PublishNotificationProcessService service) {
732 notificationPublishService.putNotification(service);
733 } catch (InterruptedException e) {
734 LOG.warn("Cannot send notification to nbi", e);
735 Thread.currentThread().interrupt();
741 public ListenableFuture<RpcResult<ServiceCreateBulkOutput>> serviceCreateBulk(ServiceCreateBulkInput input) {
742 // TODO Auto-generated method stub
747 public ListenableFuture<RpcResult<TempServiceCreateBulkOutput>> tempServiceCreateBulk(
748 TempServiceCreateBulkInput input) {
749 // TODO Auto-generated method stub
754 public ListenableFuture<RpcResult<ServiceRollResultNotificationRequestOutput>> serviceRollResultNotificationRequest(
755 ServiceRollResultNotificationRequestInput input) {
756 // TODO Auto-generated method stub
761 public ListenableFuture<RpcResult<ServiceReconfigureBulkOutput>> serviceReconfigureBulk(
762 ServiceReconfigureBulkInput input) {
763 // TODO Auto-generated method stub
768 public ListenableFuture<RpcResult<ServiceReconfigureResultNotificationRequestOutput>>
769 serviceReconfigureResultNotificationRequest(ServiceReconfigureResultNotificationRequestInput input) {
770 // TODO Auto-generated method stub
775 public ListenableFuture<RpcResult<ServiceRestorationResultNotificationRequestOutput>>
776 serviceRestorationResultNotificationRequest(ServiceRestorationResultNotificationRequestInput input) {
777 // TODO Auto-generated method stub
782 public ListenableFuture<RpcResult<ServiceReversionResultNotificationRequestOutput>>
783 serviceReversionResultNotificationRequest(ServiceReversionResultNotificationRequestInput input) {
784 // TODO Auto-generated method stub
789 public ListenableFuture<RpcResult<ServiceRerouteConfirmResultNotificationRequestOutput>>
790 serviceRerouteConfirmResultNotificationRequest(ServiceRerouteConfirmResultNotificationRequestInput input) {
791 // TODO Auto-generated method stub
796 public ListenableFuture<RpcResult<OpticalTunnelCreateOutput>> opticalTunnelCreate(OpticalTunnelCreateInput input) {
797 // TODO Auto-generated method stub
802 public ListenableFuture<RpcResult<OpticalTunnelRequestCancelOutput>> opticalTunnelRequestCancel(
803 OpticalTunnelRequestCancelInput input) {
804 // TODO Auto-generated method stub
810 * Implementation of the RPC to set OR operational modes in the catalog of the controller.
811 * Semantics of the RPC is such that the information in the input replaces the full content
812 * of the OR operational modes catalog in the config data store. Incremental changes to the
813 * catalog, if required, must be done via individual PUT/POST/DELETE RESTconf APIs.
815 * @param input AddOpenroadmOperationalModesToCatalogInput to be added to Catalog
816 * @return Result of the request
818 public ListenableFuture<RpcResult<AddOpenroadmOperationalModesToCatalogOutput>>
819 addOpenroadmOperationalModesToCatalog(AddOpenroadmOperationalModesToCatalogInput input) {
821 LOG.info("RPC addOpenroadmOperationalModesToCatalog in progress");
822 LOG.debug(" Input openRoadm {}", input);
824 OperationResult validationResult = CatalogValidation.validateORCatalogRequest(
825 new CatalogInput(input), RpcActions.FillCatalogWithOrOperationalModes);
826 if (! validationResult.isSuccess()) {
827 LOG.warn(ADD_OR_TO_CATALOG_MSG, LogMessages.ABORT_OR_TO_CATALOG_FAILED);
828 return ModelMappingUtils.addOpenroadmServiceReply(
829 input, ResponseCodes.FINAL_ACK_YES,
830 validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
832 LOG.info(" Request System Id {} " ,input.getSdncRequestHeader().getRequestSystemId());
833 LOG.info(" Rpc Action {} " ,input.getSdncRequestHeader().getRpcAction());
835 OpenroadmOperationalModes objToSave = CatalogMapper.createORModesToSave(input);
836 catalogDataStoreOperations.addOpenroadmOperationalModesToCatalog(objToSave);
837 LOG.info("RPC addOpenroadmOperationalModesToCatalog Completed");
838 return ModelMappingUtils.addOpenroadmServiceReply(input, ResponseCodes.FINAL_ACK_YES,
839 validationResult.getResultMessage(), ResponseCodes.RESPONSE_OK);
844 * Implementation of the RPC to set specific operational modes in the catalog of the controller.
845 * Semantics of the RPC is such that the information in the input replaces the full content
846 * of the specific operational modes catalog in the config data store. Incremental changes to the
847 * catalog, if required, must be done via individual PUT/POST/DELETE RESTconf APIs.
849 * @param input AddSpecificOperationalModesToCatalogInput to be added to Catalog
850 * @return Result of the request
852 public ListenableFuture<RpcResult<AddSpecificOperationalModesToCatalogOutput>> addSpecificOperationalModesToCatalog(
853 AddSpecificOperationalModesToCatalogInput input) {
855 LOG.info("RPC addSpecificOperationalModesToCatalog in progress");
856 LOG.debug(" Input openSpecificRoadm {}", input);
858 OperationResult validationResult = CatalogValidation.validateSpecificCatalogRequest(
859 new CatalogInput(input), RpcActions.FillCatalogWithSpecificOperationalModes);
860 if (! validationResult.isSuccess()) {
861 LOG.warn(ADD_SPECIFIC_TO_CATALOG_MSG, LogMessages.ABORT_SPECIFIC_TO_CATALOG_FAILED);
862 return ModelMappingUtils.addSpecificOpenroadmServiceReply(
863 input, ResponseCodes.FINAL_ACK_YES,
864 validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
866 LOG.info(" Request System Id {} " ,input.getSdncRequestHeader().getRequestSystemId());
867 LOG.info(" Rpc Action {} " ,input.getSdncRequestHeader().getRpcAction());
869 SpecificOperationalModes objToSave = CatalogMapper.createSpecificModesToSave(input);
870 catalogDataStoreOperations.addSpecificOperationalModesToCatalog(objToSave);
871 LOG.info("RPC addSpecificOperationalModesToCatalog Completed");
872 return ModelMappingUtils.addSpecificOpenroadmServiceReply(input, ResponseCodes.FINAL_ACK_YES,
873 validationResult.getResultMessage(), ResponseCodes.RESPONSE_OK);
877 public ListenableFuture<RpcResult<ServiceSrlgGetOutput>> serviceSrlgGet(ServiceSrlgGetInput input) {
878 // TODO Auto-generated method stub