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.rev230501.path.description.atoz.direction.AToZ;
117 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev230501.path.description.atoz.direction.AToZKey;
118 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev230501.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 // TODO: Here we also have to check if there is an associated temp-service.
246 // TODO: If there is one, delete it from the temp-service-list??
247 this.pceListenerImpl.setInput(new ServiceInput(input));
248 this.pceListenerImpl.setServiceReconfigure(false);
249 this.pceListenerImpl.setTempService(false);
250 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
251 this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
252 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
253 // This ensures that the temp-service boolean is false, especially, when
254 // service-create is initiated after the temp-service-create
255 this.rendererListenerImpl.setTempService(false);
256 this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
257 LOG.debug(SERVICE_CREATE_MSG, LogMessages.PCE_CALLING);
258 PathComputationRequestOutput output = this.pceServiceWrapper.performPCE(input, true);
259 if (output == null) {
260 LOG.warn(SERVICE_CREATE_MSG, LogMessages.ABORT_PCE_FAILED);
261 sendNbiNotification(new PublishNotificationProcessServiceBuilder()
262 .setServiceName(serviceName)
263 .setServiceAEnd(new ServiceAEndBuilder(input.getServiceAEnd()).build())
264 .setServiceZEnd(new ServiceZEndBuilder(input.getServiceZEnd()).build())
265 .setCommonId(input.getCommonId())
266 .setConnectionType(input.getConnectionType())
267 .setResponseFailed(LogMessages.ABORT_PCE_FAILED)
268 .setMessage("ServiceCreate request failed ...")
269 .setOperationalState(State.Degraded)
270 .setPublisherName(PUBLISHER)
272 return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
273 LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED);
275 LOG.info("RPC serviceCreate in progress...");
276 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
277 return ModelMappingUtils.createCreateServiceReply(
278 input, common.getAckFinalIndicator(),
279 common.getResponseMessage(), common.getResponseCode());
283 public ListenableFuture<RpcResult<ServiceDeleteOutput>> serviceDelete(ServiceDeleteInput input) {
284 String serviceName = input.getServiceDeleteReqInfo().getServiceName();
285 LOG.info("RPC serviceDelete request received for {}", serviceName);
288 * Upon receipt of service-deleteService RPC, service header and sdnc-request
289 * header compliance are verified.
291 ComplianceCheckResult serviceHandlerCheckResult =
292 ServicehandlerComplianceCheck.check(
293 input.getServiceDeleteReqInfo().getServiceName(),
294 input.getSdncRequestHeader(), null, RpcActions.ServiceDelete, false, true);
295 if (!serviceHandlerCheckResult.hasPassed()) {
296 LOG.warn(SERVICE_DELETE_MSG, LogMessages.ABORT_SERVICE_NON_COMPLIANT);
297 return ModelMappingUtils.createDeleteServiceReply(
298 input, ResponseCodes.FINAL_ACK_YES,
299 LogMessages.SERVICE_NON_COMPLIANT, ResponseCodes.RESPONSE_FAILED);
302 //Check presence of service to be deleted
303 Optional<Services> serviceOpt = this.serviceDataStoreOperations.getService(serviceName);
305 if (serviceOpt.isEmpty()) {
306 LOG.warn(SERVICE_DELETE_MSG, LogMessages.serviceNotInDS(serviceName));
307 return ModelMappingUtils.createDeleteServiceReply(
308 input, ResponseCodes.FINAL_ACK_YES,
309 LogMessages.serviceNotInDS(serviceName), ResponseCodes.RESPONSE_FAILED);
311 service = serviceOpt.orElseThrow();
312 LOG.debug("serviceDelete: Service '{}' found in datastore", serviceName);
313 this.pceListenerImpl.setInput(new ServiceInput(input));
314 this.pceListenerImpl.setServiceReconfigure(false);
315 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
316 this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
317 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
318 this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
319 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteInput
320 serviceDeleteInput = ModelMappingUtils.createServiceDeleteInput(new ServiceInput(input));
321 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteOutput output =
322 this.rendererServiceWrapper.performRenderer(
323 serviceDeleteInput, ServiceNotificationTypes.ServiceDeleteResult, service);
325 if (output == null) {
326 LOG.error(SERVICE_DELETE_MSG, LogMessages.RENDERER_DELETE_FAILED);
327 sendNbiNotification(new PublishNotificationProcessServiceBuilder()
328 .setServiceName(service.getServiceName())
329 .setServiceAEnd(new ServiceAEndBuilder(service.getServiceAEnd()).build())
330 .setServiceZEnd(new ServiceZEndBuilder(service.getServiceZEnd()).build())
331 .setCommonId(service.getCommonId())
332 .setConnectionType(service.getConnectionType())
333 .setMessage("ServiceDelete request failed ...")
334 .setOperationalState(State.InService)
335 .setResponseFailed(LogMessages.RENDERER_DELETE_FAILED)
336 .setPublisherName(PUBLISHER)
338 return ModelMappingUtils.createDeleteServiceReply(
339 input, ResponseCodes.FINAL_ACK_YES,
340 LogMessages.RENDERER_DELETE_FAILED, ResponseCodes.RESPONSE_FAILED);
343 LOG.debug("RPC serviceDelete in progress...");
344 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
345 return ModelMappingUtils.createDeleteServiceReply(
346 input, common.getAckFinalIndicator(),
347 common.getResponseMessage(), common.getResponseCode());
351 public ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> serviceFeasibilityCheck(
352 ServiceFeasibilityCheckInput input) {
353 LOG.info("RPC serviceFeasibilityCheck received");
355 ServiceInput serviceInput = new ServiceInput(input);
356 OperationResult validationResult = ServiceCreateValidation.validateServiceCreateRequest(serviceInput,
357 RpcActions.ServiceFeasibilityCheck);
358 if (! validationResult.isSuccess()) {
359 LOG.warn(SERVICE_FEASIBILITY_CHECK_MSG, LogMessages.ABORT_VALID_FAILED);
360 return ModelMappingUtils.createCreateServiceReply(
361 input, ResponseCodes.FINAL_ACK_YES,
362 validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
364 this.pceListenerImpl.setInput(new ServiceInput(input));
365 this.pceListenerImpl.setServiceReconfigure(false);
366 this.pceListenerImpl.setServiceFeasiblity(true);
367 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
368 this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
369 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
370 this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
371 LOG.debug(SERVICE_FEASIBILITY_CHECK_MSG, LogMessages.PCE_CALLING);
372 PathComputationRequestOutput output = this.pceServiceWrapper.performPCE(input, true);
373 if (output == null) {
374 LOG.warn(SERVICE_FEASIBILITY_CHECK_MSG, LogMessages.ABORT_PCE_FAILED);
375 return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
376 LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED);
378 LOG.info("RPC serviceFeasibilityCheck in progress...");
379 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
380 return ModelMappingUtils.createCreateServiceReply(
381 input, common.getAckFinalIndicator(),
382 common.getResponseMessage(), common.getResponseCode());
386 public ListenableFuture<RpcResult<ServiceReconfigureOutput>> serviceReconfigure(ServiceReconfigureInput input) {
387 String serviceName = input.getServiceName();
388 LOG.info("RPC serviceReconfigure received for {}", serviceName);
389 Optional<Services> servicesObject = this.serviceDataStoreOperations.getService(serviceName);
390 if (servicesObject.isEmpty()) {
391 LOG.warn(SERVICE_RECONFIGURE_MSG, LogMessages.serviceNotInDS(serviceName));
392 return ModelMappingUtils.createCreateServiceReply(
394 LogMessages.serviceNotInDS(serviceName));
396 LOG.debug("Service '{}' found in datastore", serviceName);
397 OperationResult validationResult = ServiceCreateValidation
398 .validateServiceCreateRequest(new ServiceInput(input), RpcActions.ServiceReconfigure);
399 if (!validationResult.isSuccess()) {
400 LOG.warn(SERVICE_RECONFIGURE_MSG, LogMessages.ABORT_VALID_FAILED);
401 return ModelMappingUtils.createCreateServiceReply(
403 validationResult.getResultMessage());
405 this.pceListenerImpl.setInput(new ServiceInput(input));
406 this.pceListenerImpl.setServiceReconfigure(true);
407 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
408 this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
409 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
410 this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
411 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
412 .ServiceDeleteInput serviceDeleteInput =
413 ModelMappingUtils.createServiceDeleteInput(new ServiceInput(input));
414 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
415 .ServiceDeleteOutput output = this.rendererServiceWrapper.performRenderer(serviceDeleteInput,
416 ServiceNotificationTypes.ServiceDeleteResult, null);
417 if (output == null) {
418 LOG.error(SERVICE_RECONFIGURE_MSG, LogMessages.RENDERER_DELETE_FAILED);
419 return ModelMappingUtils.createCreateServiceReply(
421 LogMessages.RENDERER_DELETE_FAILED);
422 //TODO check if RpcStatus.Successful is really expected here
424 LOG.info("RPC serviceReconfigure in progress...");
425 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
426 return ModelMappingUtils.createCreateServiceReply(
428 common.getResponseMessage());
432 public ListenableFuture<RpcResult<ServiceRestorationOutput>> serviceRestoration(ServiceRestorationInput input) {
433 String serviceName = input.getServiceName();
434 LOG.info("RPC serviceRestoration received for {}", serviceName);
435 Optional<Services> servicesObject = this.serviceDataStoreOperations.getService(serviceName);
437 if (!servicesObject.isPresent()) {
438 LOG.warn(SERVICE_RESTORATION_MSG, LogMessages.serviceNotInDS(serviceName));
439 return ModelMappingUtils.createRestoreServiceReply(
440 LogMessages.serviceNotInDS(serviceName));
443 Services service = servicesObject.orElseThrow();
444 State state = service.getOperationalState();
446 if (state == State.InService) {
447 LOG.error(SERVICE_RESTORATION_MSG, LogMessages.serviceInService(serviceName));
448 return ModelMappingUtils.createRestoreServiceReply(
449 LogMessages.serviceInService(serviceName));
452 DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx");
453 OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);
454 DateAndTime datetime = new DateAndTime(dtf.format(offsetDateTime));
455 SdncRequestHeaderBuilder sdncBuilder = new SdncRequestHeaderBuilder()
456 .setNotificationUrl(service.getSdncRequestHeader().getNotificationUrl())
457 .setRequestId(service.getSdncRequestHeader().getRequestId())
458 .setRequestSystemId(service.getSdncRequestHeader().getRequestSystemId())
459 .setRpcAction(RpcActions.ServiceDelete);
460 ServiceDeleteInputBuilder deleteInputBldr = new ServiceDeleteInputBuilder()
461 .setServiceDeleteReqInfo(new ServiceDeleteReqInfoBuilder()
462 .setServiceName(serviceName)
463 .setDueDate(datetime)
464 .setTailRetention(TailRetention.No).build())
465 .setSdncRequestHeader(sdncBuilder.build());
466 ServiceInput serviceInput = new ServiceInput(deleteInputBldr.build());
467 serviceInput.setServiceAEnd(service.getServiceAEnd());
468 serviceInput.setServiceZEnd(service.getServiceZEnd());
469 serviceInput.setConnectionType(service.getConnectionType());
470 HardConstraints hardConstraints = service.getHardConstraints();
471 if (hardConstraints == null) {
472 LOG.warn("service '{}' HardConstraints is not set !", serviceName);
474 SoftConstraints softConstraints = service.getSoftConstraints();
475 if (softConstraints == null) {
476 LOG.warn("service '{}' SoftConstraints is not set !", serviceName);
477 serviceInput.setSoftConstraints(DowngradeConstraints.convertToSoftConstraints(hardConstraints));
479 LOG.info("converting hard constraints to soft constraints ...");
480 serviceInput.setSoftConstraints(
481 DowngradeConstraints.updateSoftConstraints(hardConstraints, softConstraints));
483 serviceInput.setHardConstraints(DowngradeConstraints.downgradeHardConstraints(hardConstraints));
485 this.pceListenerImpl.setInput(serviceInput);
486 this.pceListenerImpl.setServiceReconfigure(true);
487 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
488 this.rendererListenerImpl.setServiceInput(serviceInput);
489 this.rendererListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
490 this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
491 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
492 .ServiceDeleteInput serviceDeleteInput = ModelMappingUtils.createServiceDeleteInput(
493 new ServiceInput(deleteInputBldr.build()));
494 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
495 .ServiceDeleteOutput output = this.rendererServiceWrapper.performRenderer(serviceDeleteInput,
496 ServiceNotificationTypes.ServiceDeleteResult, null);
497 if (output == null) {
498 LOG.error(SERVICE_RESTORATION_MSG, LogMessages.RENDERER_DELETE_FAILED);
499 return ModelMappingUtils.createRestoreServiceReply(LogMessages.RENDERER_DELETE_FAILED);
501 LOG.info("RPC serviceRestore in progress...");
502 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
503 return ModelMappingUtils.createRestoreServiceReply(common.getResponseMessage());
508 public ListenableFuture<RpcResult<EquipmentNotificationOutput>>
509 equipmentNotification(EquipmentNotificationInput input) {
510 // TODO Auto-generated method stub
515 public ListenableFuture<RpcResult<ServiceRerouteConfirmOutput>>
516 serviceRerouteConfirm(ServiceRerouteConfirmInput input) {
517 // TODO Auto-generated method stub
522 public ListenableFuture<RpcResult<ServiceRerouteOutput>> serviceReroute(ServiceRerouteInput input) {
523 String serviceName = input.getServiceName();
524 LOG.info("RPC serviceReroute received for {}", serviceName);
525 Optional<Services> servicesObject = this.serviceDataStoreOperations.getService(serviceName);
526 if (servicesObject.isEmpty()) {
527 LOG.warn("serviceReroute: {}", LogMessages.serviceNotInDS(serviceName));
528 return ModelMappingUtils.createRerouteServiceReply(
529 input, ResponseCodes.FINAL_ACK_YES,
530 LogMessages.serviceNotInDS(serviceName),
531 ResponseCodes.RESPONSE_FAILED);
533 Services service = servicesObject.orElseThrow();
534 Optional<ServicePaths> servicePathsObject = this.serviceDataStoreOperations.getServicePath(serviceName);
535 if (servicePathsObject.isEmpty()) {
536 LOG.warn("serviceReroute: {}", LogMessages.servicePathNotInDS(serviceName));
537 return ModelMappingUtils.createRerouteServiceReply(
538 input, ResponseCodes.FINAL_ACK_YES,
539 LogMessages.servicePathNotInDS(serviceName),
540 ResponseCodes.RESPONSE_FAILED);
542 ServicePaths servicePaths = servicePathsObject.orElseThrow();
543 // serviceInput for later use maybe...
544 ServiceInput serviceInput = new ServiceInput(input);
545 serviceInput.setServiceAEnd(service.getServiceAEnd());
546 serviceInput.setServiceZEnd(service.getServiceZEnd());
547 serviceInput.setConnectionType(service.getConnectionType());
548 serviceInput.setCommonId(service.getCommonId());
549 serviceInput.setHardConstraints(service.getHardConstraints());
550 serviceInput.setSoftConstraints(service.getSoftConstraints());
551 serviceInput.setCustomer(service.getCustomer());
552 serviceInput.setCustomerContact(service.getCustomerContact());
554 // Get the network xpdr termination points
555 Map<AToZKey, AToZ> mapaToz = servicePaths.getPathDescription().getAToZDirection().getAToZ();
556 String aendtp = ((TerminationPoint) mapaToz.get(new AToZKey(String.valueOf(mapaToz.size() - 3)))
560 String zendtp = ((TerminationPoint) mapaToz.get(new AToZKey("2"))
565 PathComputationRerouteRequestOutput output = this.pceServiceWrapper.performPCEReroute(
566 service.getHardConstraints(), service.getSoftConstraints(), input.getSdncRequestHeader(),
567 service.getServiceAEnd(), service.getServiceZEnd(),
568 new EndpointsBuilder().setAEndTp(aendtp).setZEndTp(zendtp).build());
570 if (output == null) {
571 LOG.error("serviceReroute: {}", LogMessages.PCE_FAILED);
572 return ModelMappingUtils.createRerouteServiceReply(
573 input, ResponseCodes.FINAL_ACK_YES,
574 LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED);
576 LOG.info("RPC ServiceReroute is done");
577 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
578 return ModelMappingUtils.createRerouteServiceReply(input, common.getAckFinalIndicator(),
579 common.getResponseMessage(), common.getResponseCode());
583 public ListenableFuture<RpcResult<ServiceReversionOutput>> serviceReversion(ServiceReversionInput input) {
584 // TODO Auto-generated method stub
589 public ListenableFuture<RpcResult<ServiceRollOutput>> serviceRoll(ServiceRollInput input) {
590 // TODO Auto-generated method stub
595 public ListenableFuture<RpcResult<NetworkReOptimizationOutput>>
596 networkReOptimization(NetworkReOptimizationInput input) {
597 // TODO Auto-generated method stub
602 public ListenableFuture<RpcResult<TempServiceDeleteOutput>> tempServiceDelete(TempServiceDeleteInput input) {
603 String commonId = input.getCommonId();
604 LOG.info("RPC temp serviceDelete request received for {}", commonId);
607 * Upon receipt of service-deleteService RPC, service header and sdnc-request
608 * header compliance are verified.
610 LOG.debug("checking Service Compliance ...");
611 ComplianceCheckResult serviceHandlerCheckResult = ServicehandlerComplianceCheck.check(
612 commonId, null, null, RpcActions.ServiceDelete, false, false
614 if (!serviceHandlerCheckResult.hasPassed()) {
615 LOG.warn(TEMP_SERVICE_DELETE_MSG, LogMessages.ABORT_SERVICE_NON_COMPLIANT);
616 return ModelMappingUtils.createDeleteServiceReply(
617 input, ResponseCodes.FINAL_ACK_YES,
618 LogMessages.SERVICE_NON_COMPLIANT, ResponseCodes.RESPONSE_FAILED);
621 //Check presence of service to be deleted
622 LOG.debug("service common-id '{}' is compliant", commonId);
623 Optional<org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.temp.service.list.Services>
625 this.serviceDataStoreOperations.getTempService(commonId);
626 if (service.isEmpty()) {
627 LOG.error(TEMP_SERVICE_DELETE_MSG, LogMessages.serviceNotInDS(commonId));
628 return ModelMappingUtils.createDeleteServiceReply(
629 input, ResponseCodes.FINAL_ACK_YES,
630 LogMessages.serviceNotInDS(commonId), ResponseCodes.RESPONSE_FAILED);
633 LOG.info("Service '{}' present in datastore !", commonId);
634 this.pceListenerImpl.setInput(new ServiceInput(input));
635 this.pceListenerImpl.setServiceReconfigure(false);
636 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
637 this.rendererListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
638 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
639 this.rendererListenerImpl.setTempService(true);
640 this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
641 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteOutput output =
642 this.rendererServiceWrapper.performRenderer(input, ServiceNotificationTypes.ServiceDeleteResult);
643 if (output == null) {
644 LOG.error(TEMP_SERVICE_DELETE_MSG, LogMessages.RENDERER_DELETE_FAILED);
645 return ModelMappingUtils.createDeleteServiceReply(
646 input, ResponseCodes.FINAL_ACK_YES,
647 LogMessages.RENDERER_DELETE_FAILED, ResponseCodes.RESPONSE_FAILED);
649 LOG.info("RPC tempServiceDelete in progress...");
650 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
651 return ModelMappingUtils.createDeleteServiceReply(
652 input, common.getAckFinalIndicator(),
653 common.getResponseMessage(), common.getResponseCode());
657 public ListenableFuture<RpcResult<TempServiceCreateOutput>> tempServiceCreate(TempServiceCreateInput input) {
658 LOG.info("RPC tempServiceCreate received");
660 OperationResult validationResult = ServiceCreateValidation.validateServiceCreateRequest(
661 new ServiceInput(input), RpcActions.TempServiceCreate);
662 if (! validationResult.isSuccess()) {
663 LOG.warn(TEMP_SERVICE_CREATE_MSG, LogMessages.ABORT_VALID_FAILED);
664 return ModelMappingUtils.createCreateServiceReply(
665 input, ResponseCodes.FINAL_ACK_YES,
666 validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
669 // Starting service create operation
670 LOG.debug(TEMP_SERVICE_CREATE_MSG, LogMessages.PCE_CALLING);
671 this.pceListenerImpl.setInput(new ServiceInput(input));
672 this.pceListenerImpl.setServiceReconfigure(false);
673 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
674 this.pceListenerImpl.setTempService(true);
675 this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
676 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
677 this.rendererListenerImpl.setTempService(true);
678 this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
679 PathComputationRequestOutput output = this.pceServiceWrapper.performPCE(input, true);
680 if (output == null) {
681 LOG.warn(TEMP_SERVICE_CREATE_MSG, LogMessages.ABORT_PCE_FAILED);
682 return ModelMappingUtils.createCreateServiceReply(
683 input, ResponseCodes.FINAL_ACK_YES,
684 LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED);
686 LOG.info("RPC tempServiceCreate in progress...");
687 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
688 return ModelMappingUtils.createCreateServiceReply(
689 input, common.getAckFinalIndicator(),
690 common.getResponseMessage(), common.getResponseCode());
694 public ListenableFuture<RpcResult<
695 ServiceDeleteComplexResultNotificationRequestOutput>> serviceDeleteComplexResultNotificationRequest(
696 ServiceDeleteComplexResultNotificationRequestInput input) {
697 // TODO Auto-generated method stub
702 public ListenableFuture<RpcResult<
703 ServiceCreateResultNotificationRequestOutput>> serviceCreateResultNotificationRequest(
704 ServiceCreateResultNotificationRequestInput input) {
705 // TODO Auto-generated method stub
710 public ListenableFuture<RpcResult<
711 ServiceDeleteResultNotificationRequestOutput>> serviceDeleteResultNotificationRequest(
712 ServiceDeleteResultNotificationRequestInput input) {
713 // TODO Auto-generated method stub
718 public ListenableFuture<RpcResult<
719 ServiceCreateComplexResultNotificationRequestOutput>> serviceCreateComplexResultNotificationRequest(
720 ServiceCreateComplexResultNotificationRequestInput input) {
721 // TODO Auto-generated method stub
726 public ListenableFuture<RpcResult<ServiceFeasibilityCheckBulkOutput>> serviceFeasibilityCheckBulk(
727 ServiceFeasibilityCheckBulkInput input) {
728 // TODO Auto-generated method stub
733 * Send notification to NBI notification in order to publish message.
734 * @param service PublishNotificationService
736 private void sendNbiNotification(PublishNotificationProcessService service) {
738 notificationPublishService.putNotification(service);
739 } catch (InterruptedException e) {
740 LOG.warn("Cannot send notification to nbi", e);
741 Thread.currentThread().interrupt();
747 public ListenableFuture<RpcResult<ServiceCreateBulkOutput>> serviceCreateBulk(ServiceCreateBulkInput input) {
748 // TODO Auto-generated method stub
753 public ListenableFuture<RpcResult<TempServiceCreateBulkOutput>> tempServiceCreateBulk(
754 TempServiceCreateBulkInput input) {
755 // TODO Auto-generated method stub
760 public ListenableFuture<RpcResult<ServiceRollResultNotificationRequestOutput>> serviceRollResultNotificationRequest(
761 ServiceRollResultNotificationRequestInput input) {
762 // TODO Auto-generated method stub
767 public ListenableFuture<RpcResult<ServiceReconfigureBulkOutput>> serviceReconfigureBulk(
768 ServiceReconfigureBulkInput input) {
769 // TODO Auto-generated method stub
774 public ListenableFuture<RpcResult<ServiceReconfigureResultNotificationRequestOutput>>
775 serviceReconfigureResultNotificationRequest(ServiceReconfigureResultNotificationRequestInput input) {
776 // TODO Auto-generated method stub
781 public ListenableFuture<RpcResult<ServiceRestorationResultNotificationRequestOutput>>
782 serviceRestorationResultNotificationRequest(ServiceRestorationResultNotificationRequestInput input) {
783 // TODO Auto-generated method stub
788 public ListenableFuture<RpcResult<ServiceReversionResultNotificationRequestOutput>>
789 serviceReversionResultNotificationRequest(ServiceReversionResultNotificationRequestInput input) {
790 // TODO Auto-generated method stub
795 public ListenableFuture<RpcResult<ServiceRerouteConfirmResultNotificationRequestOutput>>
796 serviceRerouteConfirmResultNotificationRequest(ServiceRerouteConfirmResultNotificationRequestInput input) {
797 // TODO Auto-generated method stub
802 public ListenableFuture<RpcResult<OpticalTunnelCreateOutput>> opticalTunnelCreate(OpticalTunnelCreateInput input) {
803 // TODO Auto-generated method stub
808 public ListenableFuture<RpcResult<OpticalTunnelRequestCancelOutput>> opticalTunnelRequestCancel(
809 OpticalTunnelRequestCancelInput input) {
810 // TODO Auto-generated method stub
816 * Implementation of the RPC to set OR operational modes in the catalog of the controller.
817 * Semantics of the RPC is such that the information in the input replaces the full content
818 * of the OR operational modes catalog in the config data store. Incremental changes to the
819 * catalog, if required, must be done via individual PUT/POST/DELETE RESTconf APIs.
821 * @param input AddOpenroadmOperationalModesToCatalogInput to be added to Catalog
822 * @return Result of the request
824 public ListenableFuture<RpcResult<AddOpenroadmOperationalModesToCatalogOutput>>
825 addOpenroadmOperationalModesToCatalog(AddOpenroadmOperationalModesToCatalogInput input) {
827 LOG.info("RPC addOpenroadmOperationalModesToCatalog in progress");
828 LOG.debug(" Input openRoadm {}", input);
830 OperationResult validationResult = CatalogValidation.validateORCatalogRequest(
831 new CatalogInput(input), RpcActions.FillCatalogWithOrOperationalModes);
832 if (! validationResult.isSuccess()) {
833 LOG.warn(ADD_OR_TO_CATALOG_MSG, LogMessages.ABORT_OR_TO_CATALOG_FAILED);
834 return ModelMappingUtils.addOpenroadmServiceReply(
835 input, ResponseCodes.FINAL_ACK_YES,
836 validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
838 LOG.info(" Request System Id {} " ,input.getSdncRequestHeader().getRequestSystemId());
839 LOG.info(" Rpc Action {} " ,input.getSdncRequestHeader().getRpcAction());
841 OpenroadmOperationalModes objToSave = CatalogMapper.createORModesToSave(input);
842 catalogDataStoreOperations.addOpenroadmOperationalModesToCatalog(objToSave);
843 LOG.info("RPC addOpenroadmOperationalModesToCatalog Completed");
844 return ModelMappingUtils.addOpenroadmServiceReply(input, ResponseCodes.FINAL_ACK_YES,
845 validationResult.getResultMessage(), ResponseCodes.RESPONSE_OK);
850 * Implementation of the RPC to set specific operational modes in the catalog of the controller.
851 * Semantics of the RPC is such that the information in the input replaces the full content
852 * of the specific operational modes catalog in the config data store. Incremental changes to the
853 * catalog, if required, must be done via individual PUT/POST/DELETE RESTconf APIs.
855 * @param input AddSpecificOperationalModesToCatalogInput to be added to Catalog
856 * @return Result of the request
858 public ListenableFuture<RpcResult<AddSpecificOperationalModesToCatalogOutput>> addSpecificOperationalModesToCatalog(
859 AddSpecificOperationalModesToCatalogInput input) {
861 LOG.info("RPC addSpecificOperationalModesToCatalog in progress");
862 LOG.debug(" Input openSpecificRoadm {}", input);
864 OperationResult validationResult = CatalogValidation.validateSpecificCatalogRequest(
865 new CatalogInput(input), RpcActions.FillCatalogWithSpecificOperationalModes);
866 if (! validationResult.isSuccess()) {
867 LOG.warn(ADD_SPECIFIC_TO_CATALOG_MSG, LogMessages.ABORT_SPECIFIC_TO_CATALOG_FAILED);
868 return ModelMappingUtils.addSpecificOpenroadmServiceReply(
869 input, ResponseCodes.FINAL_ACK_YES,
870 validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
872 LOG.info(" Request System Id {} " ,input.getSdncRequestHeader().getRequestSystemId());
873 LOG.info(" Rpc Action {} " ,input.getSdncRequestHeader().getRpcAction());
875 SpecificOperationalModes objToSave = CatalogMapper.createSpecificModesToSave(input);
876 catalogDataStoreOperations.addSpecificOperationalModesToCatalog(objToSave);
877 LOG.info("RPC addSpecificOperationalModesToCatalog Completed");
878 return ModelMappingUtils.addSpecificOpenroadmServiceReply(input, ResponseCodes.FINAL_ACK_YES,
879 validationResult.getResultMessage(), ResponseCodes.RESPONSE_OK);
883 public ListenableFuture<RpcResult<ServiceSrlgGetOutput>> serviceSrlgGet(ServiceSrlgGetInput input) {
884 // TODO Auto-generated method stub