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.collect.ImmutableClassToInstanceMap;
11 import com.google.common.util.concurrent.ListenableFuture;
12 import java.time.OffsetDateTime;
13 import java.time.ZoneOffset;
14 import java.time.format.DateTimeFormatter;
16 import java.util.Optional;
17 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
18 import org.opendaylight.mdsal.binding.api.RpcProviderService;
19 import org.opendaylight.transportpce.common.OperationResult;
20 import org.opendaylight.transportpce.common.ResponseCodes;
21 import org.opendaylight.transportpce.pce.service.PathComputationService;
22 import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
23 import org.opendaylight.transportpce.servicehandler.CatalogInput;
24 import org.opendaylight.transportpce.servicehandler.DowngradeConstraints;
25 import org.opendaylight.transportpce.servicehandler.ModelMappingUtils;
26 import org.opendaylight.transportpce.servicehandler.ServiceInput;
27 import org.opendaylight.transportpce.servicehandler.catalog.CatalogDataStoreOperations;
28 import org.opendaylight.transportpce.servicehandler.catalog.CatalogMapper;
29 import org.opendaylight.transportpce.servicehandler.listeners.NetworkListener;
30 import org.opendaylight.transportpce.servicehandler.listeners.PceListener;
31 import org.opendaylight.transportpce.servicehandler.listeners.RendererListener;
32 import org.opendaylight.transportpce.servicehandler.service.PCEServiceWrapper;
33 import org.opendaylight.transportpce.servicehandler.service.RendererServiceWrapper;
34 import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperations;
35 import org.opendaylight.transportpce.servicehandler.validation.CatalogValidation;
36 import org.opendaylight.transportpce.servicehandler.validation.ServiceCreateValidation;
37 import org.opendaylight.transportpce.servicehandler.validation.checks.ComplianceCheckResult;
38 import org.opendaylight.transportpce.servicehandler.validation.checks.ServicehandlerComplianceCheck;
39 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.PathComputationRequestOutput;
40 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.PathComputationRerouteRequestOutput;
41 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.path.computation.reroute.request.input.EndpointsBuilder;
42 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.RpcActions;
43 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.ServiceNotificationTypes;
44 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.configuration.response.common.ConfigurationResponseCommon;
45 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.sdnc.request.header.SdncRequestHeaderBuilder;
46 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
47 import org.opendaylight.yang.gen.v1.http.org.openroadm.operational.mode.catalog.rev230526.operational.mode.catalog.OpenroadmOperationalModes;
48 import org.opendaylight.yang.gen.v1.http.org.openroadm.operational.mode.catalog.rev230526.operational.mode.catalog.SpecificOperationalModes;
49 import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.routing.constraints.HardConstraints;
50 import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.routing.constraints.SoftConstraints;
51 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.AddOpenroadmOperationalModesToCatalog;
52 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.AddOpenroadmOperationalModesToCatalogInput;
53 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.AddOpenroadmOperationalModesToCatalogOutput;
54 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.AddSpecificOperationalModesToCatalog;
55 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.AddSpecificOperationalModesToCatalogInput;
56 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.AddSpecificOperationalModesToCatalogOutput;
57 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.EndTerminalActivationRequest;
58 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.EndTerminalActivationRequestInput;
59 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.EndTerminalActivationRequestOutput;
60 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.EndTerminalDeactivationRequest;
61 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.EndTerminalDeactivationRequestInput;
62 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.EndTerminalDeactivationRequestOutput;
63 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.EndTerminalPerformanceInfoRequest;
64 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.EndTerminalPerformanceInfoRequestInput;
65 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.EndTerminalPerformanceInfoRequestOutput;
66 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.EndTerminalPowerControl;
67 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.EndTerminalPowerControlInput;
68 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.EndTerminalPowerControlOutput;
69 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.EquipmentNotification;
70 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.EquipmentNotificationInput;
71 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.EquipmentNotificationOutput;
72 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.NetworkReOptimization;
73 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.NetworkReOptimizationInput;
74 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.NetworkReOptimizationOutput;
75 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.OpticalTunnelCreate;
76 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.OpticalTunnelCreateInput;
77 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.OpticalTunnelCreateOutput;
78 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.OpticalTunnelRequestCancel;
79 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.OpticalTunnelRequestCancelInput;
80 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.OpticalTunnelRequestCancelOutput;
81 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.OrgOpenroadmServiceService;
82 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceCreate;
83 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceCreateBulk;
84 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceCreateBulkInput;
85 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceCreateBulkOutput;
86 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceCreateComplexResultNotificationRequest;
87 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceCreateComplexResultNotificationRequestInput;
88 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceCreateComplexResultNotificationRequestOutput;
89 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceCreateInput;
90 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceCreateOutput;
91 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceCreateResultNotificationRequest;
92 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceCreateResultNotificationRequestInput;
93 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceCreateResultNotificationRequestOutput;
94 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceDelete;
95 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceDeleteComplexResultNotificationRequest;
96 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceDeleteComplexResultNotificationRequestInput;
97 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceDeleteComplexResultNotificationRequestOutput;
98 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceDeleteInput;
99 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceDeleteInputBuilder;
100 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceDeleteOutput;
101 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceDeleteResultNotificationRequest;
102 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceDeleteResultNotificationRequestInput;
103 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceDeleteResultNotificationRequestOutput;
104 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceFeasibilityCheck;
105 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceFeasibilityCheckBulk;
106 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceFeasibilityCheckBulkInput;
107 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceFeasibilityCheckBulkOutput;
108 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceFeasibilityCheckInput;
109 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceFeasibilityCheckOutput;
110 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceReconfigure;
111 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceReconfigureBulk;
112 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceReconfigureBulkInput;
113 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceReconfigureBulkOutput;
114 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceReconfigureInput;
115 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceReconfigureOutput;
116 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceReconfigureResultNotificationRequest;
117 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceReconfigureResultNotificationRequestInput;
118 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceReconfigureResultNotificationRequestOutput;
119 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceReroute;
120 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRerouteConfirm;
121 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRerouteConfirmInput;
122 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRerouteConfirmOutput;
123 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRerouteConfirmResultNotificationRequest;
124 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRerouteConfirmResultNotificationRequestInput;
125 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRerouteConfirmResultNotificationRequestOutput;
126 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRerouteInput;
127 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRerouteOutput;
128 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRestoration;
129 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRestorationInput;
130 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRestorationOutput;
131 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRestorationResultNotificationRequest;
132 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRestorationResultNotificationRequestInput;
133 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRestorationResultNotificationRequestOutput;
134 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceReversion;
135 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceReversionInput;
136 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceReversionOutput;
137 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceReversionResultNotificationRequest;
138 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceReversionResultNotificationRequestInput;
139 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceReversionResultNotificationRequestOutput;
140 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRoll;
141 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRollInput;
142 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRollOutput;
143 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRollResultNotificationRequest;
144 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRollResultNotificationRequestInput;
145 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRollResultNotificationRequestOutput;
146 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceSrlgGet;
147 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceSrlgGetInput;
148 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceSrlgGetOutput;
149 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.TempServiceCreate;
150 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.TempServiceCreateBulk;
151 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.TempServiceCreateBulkInput;
152 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.TempServiceCreateBulkOutput;
153 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.TempServiceCreateInput;
154 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.TempServiceCreateOutput;
155 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.TempServiceDelete;
156 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.TempServiceDeleteInput;
157 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.TempServiceDeleteOutput;
158 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.service.delete.input.ServiceDeleteReqInfo.TailRetention;
159 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.service.delete.input.ServiceDeleteReqInfoBuilder;
160 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.service.list.Services;
161 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev230501.path.description.atoz.direction.AToZ;
162 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev230501.path.description.atoz.direction.AToZKey;
163 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev230501.pce.resource.resource.resource.TerminationPoint;
164 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.service.path.list.ServicePaths;
165 import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService;
166 import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessServiceBuilder;
167 import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceAEndBuilder;
168 import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceZEndBuilder;
169 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
170 import org.opendaylight.yangtools.concepts.Registration;
171 import org.opendaylight.yangtools.yang.binding.Rpc;
172 import org.opendaylight.yangtools.yang.common.RpcResult;
173 import org.osgi.service.component.annotations.Activate;
174 import org.osgi.service.component.annotations.Component;
175 import org.osgi.service.component.annotations.Deactivate;
176 import org.osgi.service.component.annotations.Reference;
177 import org.slf4j.Logger;
178 import org.slf4j.LoggerFactory;
182 * Top level service interface providing main OpenROADM controller services.
185 public class ServicehandlerImpl implements OrgOpenroadmServiceService {
186 private static final Logger LOG = LoggerFactory.getLogger(ServicehandlerImpl.class);
187 private static final String PUBLISHER = "ServiceHandler";
188 private static final String TEMP_SERVICE_CREATE_MSG = "tempServiceCreate: {}";
189 private static final String TEMP_SERVICE_DELETE_MSG = "tempServiceDelete: {}";
190 private static final String SERVICE_RESTORATION_MSG = "serviceRestoration: {}";
191 private static final String SERVICE_RECONFIGURE_MSG = "serviceReconfigure: {}";
192 private static final String SERVICE_FEASIBILITY_CHECK_MSG = "serviceFeasibilityCheck: {}";
193 private static final String SERVICE_DELETE_MSG = "serviceDelete: {}";
194 private static final String SERVICE_CREATE_MSG = "serviceCreate: {}";
195 private static final String ADD_OR_TO_CATALOG_MSG = "addORToCatalog: {}";
196 private static final String ADD_SPECIFIC_TO_CATALOG_MSG = "addSpecificToCatalog: {}";
198 private ServiceDataStoreOperations serviceDataStoreOperations;
199 private PCEServiceWrapper pceServiceWrapper;
200 private RendererServiceWrapper rendererServiceWrapper;
201 private PceListener pceListenerImpl;
202 private RendererListener rendererListenerImpl;
203 private NetworkListener networkModelListenerImpl;
204 private NotificationPublishService notificationPublishService;
205 private CatalogDataStoreOperations catalogDataStoreOperations;
206 private Registration reg;
209 public ServicehandlerImpl(@Reference RpcProviderService rpcProviderService,
210 @Reference PathComputationService pathComputationService,
211 @Reference RendererServiceOperations rendererServiceOperations,
212 @Reference NotificationPublishService notificationPublishService,
213 @Reference PceListener pceListenerImpl,
214 @Reference RendererListener rendererListenerImpl,
215 @Reference NetworkListener networkModelListenerImpl,
216 @Reference ServiceDataStoreOperations serviceDataStoreOperations,
217 @Reference CatalogDataStoreOperations catalogDataStoreOperations) {
218 this.catalogDataStoreOperations = catalogDataStoreOperations;
219 this.serviceDataStoreOperations = serviceDataStoreOperations;
220 this.notificationPublishService = notificationPublishService;
221 this.pceServiceWrapper = new PCEServiceWrapper(pathComputationService, notificationPublishService);
222 this.rendererServiceWrapper = new RendererServiceWrapper(rendererServiceOperations, notificationPublishService);
223 this.pceListenerImpl = pceListenerImpl;
224 this.rendererListenerImpl = rendererListenerImpl;
225 this.networkModelListenerImpl = networkModelListenerImpl;
226 this.reg = rpcProviderService.registerRpcImplementations(registerRPCs());
227 LOG.info("ServicehandlerImpl Initiated");
231 public void close() {
233 LOG.info("ServicehandlerImpl Closed");
237 // This is class is public so that these messages can be accessed from Junit (avoid duplications).
238 public static final class LogMessages {
240 public static final String PCE_CALLING;
241 public static final String ABORT_PCE_FAILED;
242 public static final String PCE_FAILED;
243 public static final String ABORT_SERVICE_NON_COMPLIANT;
244 public static final String SERVICE_NON_COMPLIANT;
245 public static final String RENDERER_DELETE_FAILED;
246 public static final String ABORT_VALID_FAILED;
247 public static final String ABORT_OR_TO_CATALOG_FAILED;
248 public static final String ABORT_SPECIFIC_TO_CATALOG_FAILED;
250 // Static blocks are generated once and spare memory.
252 PCE_CALLING = "Calling PCE";
253 ABORT_PCE_FAILED = "Aborting: PCE calculation failed ";
254 PCE_FAILED = "PCE calculation failed";
255 ABORT_SERVICE_NON_COMPLIANT = "Aborting: non-compliant service ";
256 SERVICE_NON_COMPLIANT = "non-compliant service";
257 RENDERER_DELETE_FAILED = "Renderer service delete failed";
258 ABORT_VALID_FAILED = "Aborting: validation of service create request failed";
259 ABORT_OR_TO_CATALOG_FAILED = "Aborting: validation of add OR to catalog request failed";
260 ABORT_SPECIFIC_TO_CATALOG_FAILED = "Aborting: validation of add Specific to catalog request failed";
263 public static String serviceInDS(String serviceName) {
264 return "Service '" + serviceName + "' already exists in datastore";
267 public static String serviceNotInDS(String serviceName) {
268 return "Service '" + serviceName + "' does not exist in datastore";
271 public static String servicePathNotInDS(String serviceName) {
272 return "Service Path from '" + serviceName + "' does not exist in datastore";
275 public static String serviceInService(String serviceName) {
276 return "Service '" + serviceName + "' is in 'inService' state";
279 private LogMessages() {
284 public final ListenableFuture<RpcResult<ServiceCreateOutput>> serviceCreate(ServiceCreateInput input) {
285 LOG.info("RPC serviceCreate received");
287 OperationResult validationResult = ServiceCreateValidation.validateServiceCreateRequest(
288 new ServiceInput(input), RpcActions.ServiceCreate);
289 if (!validationResult.isSuccess()) {
290 LOG.warn(SERVICE_CREATE_MSG, LogMessages.ABORT_VALID_FAILED);
291 return ModelMappingUtils.createCreateServiceReply(
292 input, ResponseCodes.FINAL_ACK_YES,
293 validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
295 //Check any presence of services with the same name
296 String serviceName = input.getServiceName();
297 if (this.serviceDataStoreOperations.getService(serviceName).isPresent()) {
298 LOG.warn(SERVICE_CREATE_MSG, LogMessages.serviceInDS(serviceName));
299 return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
300 LogMessages.serviceInDS(serviceName), ResponseCodes.RESPONSE_FAILED);
302 // TODO: Here we also have to check if there is an associated temp-service.
303 // TODO: If there is one, delete it from the temp-service-list??
304 this.pceListenerImpl.setInput(new ServiceInput(input));
305 this.pceListenerImpl.setServiceReconfigure(false);
306 this.pceListenerImpl.setTempService(false);
307 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
308 this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
309 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
310 // This ensures that the temp-service boolean is false, especially, when
311 // service-create is initiated after the temp-service-create
312 this.rendererListenerImpl.setTempService(false);
313 this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
314 LOG.debug(SERVICE_CREATE_MSG, LogMessages.PCE_CALLING);
315 PathComputationRequestOutput output = this.pceServiceWrapper.performPCE(input, true);
316 if (output == null) {
317 LOG.warn(SERVICE_CREATE_MSG, LogMessages.ABORT_PCE_FAILED);
318 sendNbiNotification(new PublishNotificationProcessServiceBuilder()
319 .setServiceName(serviceName)
320 .setServiceAEnd(new ServiceAEndBuilder(input.getServiceAEnd()).build())
321 .setServiceZEnd(new ServiceZEndBuilder(input.getServiceZEnd()).build())
322 .setCommonId(input.getCommonId())
323 .setConnectionType(input.getConnectionType())
324 .setResponseFailed(LogMessages.ABORT_PCE_FAILED)
325 .setMessage("ServiceCreate request failed ...")
326 .setOperationalState(State.Degraded)
327 .setPublisherName(PUBLISHER)
329 return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
330 LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED);
332 LOG.info("RPC serviceCreate in progress...");
333 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
334 return ModelMappingUtils.createCreateServiceReply(
335 input, common.getAckFinalIndicator(),
336 common.getResponseMessage(), common.getResponseCode());
340 public final ListenableFuture<RpcResult<ServiceDeleteOutput>> serviceDelete(ServiceDeleteInput input) {
341 String serviceName = input.getServiceDeleteReqInfo().getServiceName();
342 LOG.info("RPC serviceDelete request received for {}", serviceName);
345 * Upon receipt of service-deleteService RPC, service header and sdnc-request
346 * header compliance are verified.
348 ComplianceCheckResult serviceHandlerCheckResult =
349 ServicehandlerComplianceCheck.check(
350 input.getServiceDeleteReqInfo().getServiceName(),
351 input.getSdncRequestHeader(), null, RpcActions.ServiceDelete, false, true);
352 if (!serviceHandlerCheckResult.hasPassed()) {
353 LOG.warn(SERVICE_DELETE_MSG, LogMessages.ABORT_SERVICE_NON_COMPLIANT);
354 return ModelMappingUtils.createDeleteServiceReply(
355 input, ResponseCodes.FINAL_ACK_YES,
356 LogMessages.SERVICE_NON_COMPLIANT, ResponseCodes.RESPONSE_FAILED);
359 //Check presence of service to be deleted
360 Optional<Services> serviceOpt = this.serviceDataStoreOperations.getService(serviceName);
362 if (serviceOpt.isEmpty()) {
363 LOG.warn(SERVICE_DELETE_MSG, LogMessages.serviceNotInDS(serviceName));
364 return ModelMappingUtils.createDeleteServiceReply(
365 input, ResponseCodes.FINAL_ACK_YES,
366 LogMessages.serviceNotInDS(serviceName), ResponseCodes.RESPONSE_FAILED);
368 service = serviceOpt.orElseThrow();
369 LOG.debug("serviceDelete: Service '{}' found in datastore", serviceName);
370 this.pceListenerImpl.setInput(new ServiceInput(input));
371 this.pceListenerImpl.setServiceReconfigure(false);
372 this.pceListenerImpl.setTempService(false);
373 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
374 this.rendererListenerImpl.setTempService(false);
375 this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
376 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
377 this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
378 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteInput
379 serviceDeleteInput = ModelMappingUtils.createServiceDeleteInput(new ServiceInput(input));
380 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteOutput output =
381 this.rendererServiceWrapper.performRenderer(
382 serviceDeleteInput, ServiceNotificationTypes.ServiceDeleteResult, service);
384 if (output == null) {
385 LOG.error(SERVICE_DELETE_MSG, LogMessages.RENDERER_DELETE_FAILED);
386 sendNbiNotification(new PublishNotificationProcessServiceBuilder()
387 .setServiceName(service.getServiceName())
388 .setServiceAEnd(new ServiceAEndBuilder(service.getServiceAEnd()).build())
389 .setServiceZEnd(new ServiceZEndBuilder(service.getServiceZEnd()).build())
390 .setCommonId(service.getCommonId())
391 .setConnectionType(service.getConnectionType())
392 .setMessage("ServiceDelete request failed ...")
393 .setOperationalState(State.InService)
394 .setResponseFailed(LogMessages.RENDERER_DELETE_FAILED)
395 .setPublisherName(PUBLISHER)
397 return ModelMappingUtils.createDeleteServiceReply(
398 input, ResponseCodes.FINAL_ACK_YES,
399 LogMessages.RENDERER_DELETE_FAILED, ResponseCodes.RESPONSE_FAILED);
402 LOG.debug("RPC serviceDelete in progress...");
403 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
404 return ModelMappingUtils.createDeleteServiceReply(
405 input, common.getAckFinalIndicator(),
406 common.getResponseMessage(), common.getResponseCode());
410 public final ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> serviceFeasibilityCheck(
411 ServiceFeasibilityCheckInput input) {
412 LOG.info("RPC serviceFeasibilityCheck received");
414 ServiceInput serviceInput = new ServiceInput(input);
415 OperationResult validationResult = ServiceCreateValidation.validateServiceCreateRequest(serviceInput,
416 RpcActions.ServiceFeasibilityCheck);
417 if (! validationResult.isSuccess()) {
418 LOG.warn(SERVICE_FEASIBILITY_CHECK_MSG, LogMessages.ABORT_VALID_FAILED);
419 return ModelMappingUtils.createCreateServiceReply(
420 input, ResponseCodes.FINAL_ACK_YES,
421 validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
423 this.pceListenerImpl.setInput(new ServiceInput(input));
424 this.pceListenerImpl.setServiceReconfigure(false);
425 this.pceListenerImpl.setServiceFeasiblity(true);
426 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
427 this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
428 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
429 this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
430 LOG.debug(SERVICE_FEASIBILITY_CHECK_MSG, LogMessages.PCE_CALLING);
431 PathComputationRequestOutput output = this.pceServiceWrapper.performPCE(input, true);
432 if (output == null) {
433 LOG.warn(SERVICE_FEASIBILITY_CHECK_MSG, LogMessages.ABORT_PCE_FAILED);
434 return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
435 LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED);
437 LOG.info("RPC serviceFeasibilityCheck in progress...");
438 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
439 return ModelMappingUtils.createCreateServiceReply(
440 input, common.getAckFinalIndicator(),
441 common.getResponseMessage(), common.getResponseCode());
445 public final ListenableFuture<RpcResult<
446 ServiceReconfigureOutput>> serviceReconfigure(ServiceReconfigureInput input) {
447 String serviceName = input.getServiceName();
448 LOG.info("RPC serviceReconfigure received for {}", serviceName);
449 Optional<Services> servicesObject = this.serviceDataStoreOperations.getService(serviceName);
450 if (servicesObject.isEmpty()) {
451 LOG.warn(SERVICE_RECONFIGURE_MSG, LogMessages.serviceNotInDS(serviceName));
452 return ModelMappingUtils.createCreateServiceReply(
454 LogMessages.serviceNotInDS(serviceName));
456 LOG.debug("Service '{}' found in datastore", serviceName);
457 OperationResult validationResult = ServiceCreateValidation
458 .validateServiceCreateRequest(new ServiceInput(input), RpcActions.ServiceReconfigure);
459 if (!validationResult.isSuccess()) {
460 LOG.warn(SERVICE_RECONFIGURE_MSG, LogMessages.ABORT_VALID_FAILED);
461 return ModelMappingUtils.createCreateServiceReply(
463 validationResult.getResultMessage());
465 this.pceListenerImpl.setInput(new ServiceInput(input));
466 this.pceListenerImpl.setServiceReconfigure(true);
467 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
468 this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
469 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
470 this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
471 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
472 .ServiceDeleteInput serviceDeleteInput =
473 ModelMappingUtils.createServiceDeleteInput(new ServiceInput(input));
474 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
475 .ServiceDeleteOutput output = this.rendererServiceWrapper.performRenderer(serviceDeleteInput,
476 ServiceNotificationTypes.ServiceDeleteResult, null);
477 if (output == null) {
478 LOG.error(SERVICE_RECONFIGURE_MSG, LogMessages.RENDERER_DELETE_FAILED);
479 return ModelMappingUtils.createCreateServiceReply(
481 LogMessages.RENDERER_DELETE_FAILED);
482 //TODO check if RpcStatus.Successful is really expected here
484 LOG.info("RPC serviceReconfigure in progress...");
485 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
486 return ModelMappingUtils.createCreateServiceReply(
488 common.getResponseMessage());
492 public final ListenableFuture<RpcResult<
493 ServiceRestorationOutput>> serviceRestoration(ServiceRestorationInput input) {
494 String serviceName = input.getServiceName();
495 LOG.info("RPC serviceRestoration received for {}", serviceName);
496 Optional<Services> servicesObject = this.serviceDataStoreOperations.getService(serviceName);
498 if (!servicesObject.isPresent()) {
499 LOG.warn(SERVICE_RESTORATION_MSG, LogMessages.serviceNotInDS(serviceName));
500 return ModelMappingUtils.createRestoreServiceReply(
501 LogMessages.serviceNotInDS(serviceName));
504 Services service = servicesObject.orElseThrow();
505 State state = service.getOperationalState();
507 if (state == State.InService) {
508 LOG.error(SERVICE_RESTORATION_MSG, LogMessages.serviceInService(serviceName));
509 return ModelMappingUtils.createRestoreServiceReply(
510 LogMessages.serviceInService(serviceName));
513 DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx");
514 OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);
515 DateAndTime datetime = new DateAndTime(dtf.format(offsetDateTime));
516 SdncRequestHeaderBuilder sdncBuilder = new SdncRequestHeaderBuilder()
517 .setNotificationUrl(service.getSdncRequestHeader().getNotificationUrl())
518 .setRequestId(service.getSdncRequestHeader().getRequestId())
519 .setRequestSystemId(service.getSdncRequestHeader().getRequestSystemId())
520 .setRpcAction(RpcActions.ServiceDelete);
521 ServiceDeleteInputBuilder deleteInputBldr = new ServiceDeleteInputBuilder()
522 .setServiceDeleteReqInfo(new ServiceDeleteReqInfoBuilder()
523 .setServiceName(serviceName)
524 .setDueDate(datetime)
525 .setTailRetention(TailRetention.No).build())
526 .setSdncRequestHeader(sdncBuilder.build());
527 ServiceInput serviceInput = new ServiceInput(deleteInputBldr.build());
528 serviceInput.setServiceAEnd(service.getServiceAEnd());
529 serviceInput.setServiceZEnd(service.getServiceZEnd());
530 serviceInput.setConnectionType(service.getConnectionType());
531 HardConstraints hardConstraints = service.getHardConstraints();
532 if (hardConstraints == null) {
533 LOG.warn("service '{}' HardConstraints is not set !", serviceName);
535 SoftConstraints softConstraints = service.getSoftConstraints();
536 if (softConstraints == null) {
537 LOG.warn("service '{}' SoftConstraints is not set !", serviceName);
538 serviceInput.setSoftConstraints(DowngradeConstraints.convertToSoftConstraints(hardConstraints));
540 LOG.info("converting hard constraints to soft constraints ...");
541 serviceInput.setSoftConstraints(
542 DowngradeConstraints.updateSoftConstraints(hardConstraints, softConstraints));
544 serviceInput.setHardConstraints(DowngradeConstraints.downgradeHardConstraints(hardConstraints));
546 this.pceListenerImpl.setInput(serviceInput);
547 this.pceListenerImpl.setServiceReconfigure(true);
548 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
549 this.rendererListenerImpl.setServiceInput(serviceInput);
550 this.rendererListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
551 this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
552 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
553 .ServiceDeleteInput serviceDeleteInput = ModelMappingUtils.createServiceDeleteInput(
554 new ServiceInput(deleteInputBldr.build()));
555 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
556 .ServiceDeleteOutput output = this.rendererServiceWrapper.performRenderer(serviceDeleteInput,
557 ServiceNotificationTypes.ServiceDeleteResult, null);
558 if (output == null) {
559 LOG.error(SERVICE_RESTORATION_MSG, LogMessages.RENDERER_DELETE_FAILED);
560 return ModelMappingUtils.createRestoreServiceReply(LogMessages.RENDERER_DELETE_FAILED);
562 LOG.info("RPC serviceRestore in progress...");
563 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
564 return ModelMappingUtils.createRestoreServiceReply(common.getResponseMessage());
569 public final ListenableFuture<RpcResult<EquipmentNotificationOutput>>
570 equipmentNotification(EquipmentNotificationInput input) {
571 // TODO Auto-generated method stub
576 public final ListenableFuture<RpcResult<ServiceRerouteConfirmOutput>>
577 serviceRerouteConfirm(ServiceRerouteConfirmInput input) {
578 // TODO Auto-generated method stub
583 public final ListenableFuture<RpcResult<ServiceRerouteOutput>> serviceReroute(ServiceRerouteInput input) {
584 String serviceName = input.getServiceName();
585 LOG.info("RPC serviceReroute received for {}", serviceName);
586 Optional<Services> servicesObject = this.serviceDataStoreOperations.getService(serviceName);
587 if (servicesObject.isEmpty()) {
588 LOG.warn("serviceReroute: {}", LogMessages.serviceNotInDS(serviceName));
589 return ModelMappingUtils.createRerouteServiceReply(
590 input, ResponseCodes.FINAL_ACK_YES,
591 LogMessages.serviceNotInDS(serviceName),
592 ResponseCodes.RESPONSE_FAILED);
594 Services service = servicesObject.orElseThrow();
595 Optional<ServicePaths> servicePathsObject = this.serviceDataStoreOperations.getServicePath(serviceName);
596 if (servicePathsObject.isEmpty()) {
597 LOG.warn("serviceReroute: {}", LogMessages.servicePathNotInDS(serviceName));
598 return ModelMappingUtils.createRerouteServiceReply(
599 input, ResponseCodes.FINAL_ACK_YES,
600 LogMessages.servicePathNotInDS(serviceName),
601 ResponseCodes.RESPONSE_FAILED);
603 ServicePaths servicePaths = servicePathsObject.orElseThrow();
604 // serviceInput for later use maybe...
605 ServiceInput serviceInput = new ServiceInput(input);
606 serviceInput.setServiceAEnd(service.getServiceAEnd());
607 serviceInput.setServiceZEnd(service.getServiceZEnd());
608 serviceInput.setConnectionType(service.getConnectionType());
609 serviceInput.setCommonId(service.getCommonId());
610 serviceInput.setHardConstraints(service.getHardConstraints());
611 serviceInput.setSoftConstraints(service.getSoftConstraints());
612 serviceInput.setCustomer(service.getCustomer());
613 serviceInput.setCustomerContact(service.getCustomerContact());
615 // Get the network xpdr termination points
616 Map<AToZKey, AToZ> mapaToz = servicePaths.getPathDescription().getAToZDirection().getAToZ();
617 String aendtp = ((TerminationPoint) mapaToz.get(new AToZKey(String.valueOf(mapaToz.size() - 3)))
621 String zendtp = ((TerminationPoint) mapaToz.get(new AToZKey("2"))
626 PathComputationRerouteRequestOutput output = this.pceServiceWrapper.performPCEReroute(
627 service.getHardConstraints(), service.getSoftConstraints(), input.getSdncRequestHeader(),
628 service.getServiceAEnd(), service.getServiceZEnd(),
629 new EndpointsBuilder().setAEndTp(aendtp).setZEndTp(zendtp).build());
631 if (output == null) {
632 LOG.error("serviceReroute: {}", LogMessages.PCE_FAILED);
633 return ModelMappingUtils.createRerouteServiceReply(
634 input, ResponseCodes.FINAL_ACK_YES,
635 LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED);
637 LOG.info("RPC ServiceReroute is done");
638 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
639 return ModelMappingUtils.createRerouteServiceReply(input, common.getAckFinalIndicator(),
640 common.getResponseMessage(), common.getResponseCode());
644 public final ListenableFuture<RpcResult<ServiceReversionOutput>> serviceReversion(ServiceReversionInput input) {
645 // TODO Auto-generated method stub
650 public final ListenableFuture<RpcResult<ServiceRollOutput>> serviceRoll(ServiceRollInput input) {
651 // TODO Auto-generated method stub
656 public final ListenableFuture<RpcResult<NetworkReOptimizationOutput>>
657 networkReOptimization(NetworkReOptimizationInput input) {
658 // TODO Auto-generated method stub
663 public final ListenableFuture<RpcResult<TempServiceDeleteOutput>> tempServiceDelete(TempServiceDeleteInput input) {
664 String commonId = input.getCommonId();
665 LOG.info("RPC temp serviceDelete request received for {}", commonId);
668 * Upon receipt of service-deleteService RPC, service header and sdnc-request
669 * header compliance are verified.
671 LOG.debug("checking Service Compliance ...");
672 ComplianceCheckResult serviceHandlerCheckResult = ServicehandlerComplianceCheck.check(
673 commonId, null, null, RpcActions.ServiceDelete, false, false
675 if (!serviceHandlerCheckResult.hasPassed()) {
676 LOG.warn(TEMP_SERVICE_DELETE_MSG, LogMessages.ABORT_SERVICE_NON_COMPLIANT);
677 return ModelMappingUtils.createDeleteServiceReply(
678 input, ResponseCodes.FINAL_ACK_YES,
679 LogMessages.SERVICE_NON_COMPLIANT, ResponseCodes.RESPONSE_FAILED);
682 //Check presence of service to be deleted
683 LOG.debug("service common-id '{}' is compliant", commonId);
684 Optional<org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.temp.service.list.Services>
686 this.serviceDataStoreOperations.getTempService(commonId);
687 if (serviceOpt.isEmpty()) {
688 LOG.error(TEMP_SERVICE_DELETE_MSG, LogMessages.serviceNotInDS(commonId));
689 return ModelMappingUtils.createDeleteServiceReply(
690 input, ResponseCodes.FINAL_ACK_YES,
691 LogMessages.serviceNotInDS(commonId), ResponseCodes.RESPONSE_FAILED);
693 LOG.info("Service '{}' present in datastore !", commonId);
694 this.pceListenerImpl.setInput(new ServiceInput(input));
695 this.pceListenerImpl.setServiceReconfigure(false);
696 this.pceListenerImpl.setTempService(true);
697 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
698 this.rendererListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
699 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
700 this.rendererListenerImpl.setTempService(true);
701 this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
702 org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526
703 .temp.service.list.Services service = serviceOpt.orElseThrow();
704 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteOutput output =
705 this.rendererServiceWrapper.performRenderer(input, ServiceNotificationTypes.ServiceDeleteResult,
707 if (output == null) {
708 LOG.error(TEMP_SERVICE_DELETE_MSG, LogMessages.RENDERER_DELETE_FAILED);
709 return ModelMappingUtils.createDeleteServiceReply(
710 input, ResponseCodes.FINAL_ACK_YES,
711 LogMessages.RENDERER_DELETE_FAILED, ResponseCodes.RESPONSE_FAILED);
713 LOG.info("RPC tempServiceDelete in progress...");
714 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
715 return ModelMappingUtils.createDeleteServiceReply(
716 input, common.getAckFinalIndicator(),
717 common.getResponseMessage(), common.getResponseCode());
721 public final ListenableFuture<RpcResult<TempServiceCreateOutput>> tempServiceCreate(TempServiceCreateInput input) {
722 LOG.info("RPC tempServiceCreate received");
724 OperationResult validationResult = ServiceCreateValidation.validateServiceCreateRequest(
725 new ServiceInput(input), RpcActions.TempServiceCreate);
726 if (! validationResult.isSuccess()) {
727 LOG.warn(TEMP_SERVICE_CREATE_MSG, LogMessages.ABORT_VALID_FAILED);
728 return ModelMappingUtils.createCreateServiceReply(
729 input, ResponseCodes.FINAL_ACK_YES,
730 validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
733 //Check any presence of temp-service with the same commonId
734 String commonId = input.getCommonId();
735 if (this.serviceDataStoreOperations.getTempService(commonId).isPresent()) {
736 LOG.warn(TEMP_SERVICE_CREATE_MSG, LogMessages.serviceInDS("Temp (" + commonId + ")"));
737 return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
738 LogMessages.serviceInDS("Temp (" + commonId + ")"), ResponseCodes.RESPONSE_FAILED);
741 // Starting service create operation
742 LOG.debug(TEMP_SERVICE_CREATE_MSG, LogMessages.PCE_CALLING);
743 this.pceListenerImpl.setInput(new ServiceInput(input));
744 this.pceListenerImpl.setServiceReconfigure(false);
745 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
746 this.pceListenerImpl.setTempService(true);
747 this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
748 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
749 this.rendererListenerImpl.setTempService(true);
750 this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
751 PathComputationRequestOutput output = this.pceServiceWrapper.performPCE(input, true);
752 if (output == null) {
753 LOG.warn(TEMP_SERVICE_CREATE_MSG, LogMessages.ABORT_PCE_FAILED);
754 return ModelMappingUtils.createCreateServiceReply(
755 input, ResponseCodes.FINAL_ACK_YES,
756 LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED);
758 LOG.info("RPC tempServiceCreate in progress...");
759 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
760 return ModelMappingUtils.createCreateServiceReply(
761 input, common.getAckFinalIndicator(),
762 common.getResponseMessage(), common.getResponseCode());
766 public final ListenableFuture<RpcResult<
767 ServiceDeleteComplexResultNotificationRequestOutput>> serviceDeleteComplexResultNotificationRequest(
768 ServiceDeleteComplexResultNotificationRequestInput input) {
769 // TODO Auto-generated method stub
774 public final ListenableFuture<RpcResult<
775 ServiceCreateResultNotificationRequestOutput>> serviceCreateResultNotificationRequest(
776 ServiceCreateResultNotificationRequestInput input) {
777 // TODO Auto-generated method stub
782 public final ListenableFuture<RpcResult<
783 ServiceDeleteResultNotificationRequestOutput>> serviceDeleteResultNotificationRequest(
784 ServiceDeleteResultNotificationRequestInput input) {
785 // TODO Auto-generated method stub
790 public final ListenableFuture<RpcResult<
791 ServiceCreateComplexResultNotificationRequestOutput>> serviceCreateComplexResultNotificationRequest(
792 ServiceCreateComplexResultNotificationRequestInput input) {
793 // TODO Auto-generated method stub
798 public final ListenableFuture<RpcResult<ServiceFeasibilityCheckBulkOutput>> serviceFeasibilityCheckBulk(
799 ServiceFeasibilityCheckBulkInput input) {
800 // TODO Auto-generated method stub
805 public final ListenableFuture<RpcResult<ServiceCreateBulkOutput>> serviceCreateBulk(ServiceCreateBulkInput input) {
806 // TODO Auto-generated method stub
811 public final ListenableFuture<RpcResult<TempServiceCreateBulkOutput>> tempServiceCreateBulk(
812 TempServiceCreateBulkInput input) {
813 // TODO Auto-generated method stub
818 public final ListenableFuture<RpcResult<
819 ServiceRollResultNotificationRequestOutput>> serviceRollResultNotificationRequest(
820 ServiceRollResultNotificationRequestInput input) {
821 // TODO Auto-generated method stub
826 public final ListenableFuture<RpcResult<ServiceReconfigureBulkOutput>> serviceReconfigureBulk(
827 ServiceReconfigureBulkInput input) {
828 // TODO Auto-generated method stub
833 public final ListenableFuture<RpcResult<ServiceReconfigureResultNotificationRequestOutput>>
834 serviceReconfigureResultNotificationRequest(ServiceReconfigureResultNotificationRequestInput input) {
835 // TODO Auto-generated method stub
840 public final ListenableFuture<RpcResult<ServiceRestorationResultNotificationRequestOutput>>
841 serviceRestorationResultNotificationRequest(ServiceRestorationResultNotificationRequestInput input) {
842 // TODO Auto-generated method stub
847 public final ListenableFuture<RpcResult<ServiceReversionResultNotificationRequestOutput>>
848 serviceReversionResultNotificationRequest(ServiceReversionResultNotificationRequestInput input) {
849 // TODO Auto-generated method stub
854 public final ListenableFuture<RpcResult<ServiceRerouteConfirmResultNotificationRequestOutput>>
855 serviceRerouteConfirmResultNotificationRequest(ServiceRerouteConfirmResultNotificationRequestInput input) {
856 // TODO Auto-generated method stub
861 public final ListenableFuture<RpcResult<
862 OpticalTunnelCreateOutput>> opticalTunnelCreate(OpticalTunnelCreateInput input) {
863 // TODO Auto-generated method stub
868 public final ListenableFuture<RpcResult<OpticalTunnelRequestCancelOutput>> opticalTunnelRequestCancel(
869 OpticalTunnelRequestCancelInput input) {
870 // TODO Auto-generated method stub
876 * Implementation of the RPC to set OR operational modes in the catalog of the controller.
877 * Semantics of the RPC is such that the information in the input replaces the full content
878 * of the OR operational modes catalog in the config data store. Incremental changes to the
879 * catalog, if required, must be done via individual PUT/POST/DELETE RESTconf APIs.
881 * @param input AddOpenroadmOperationalModesToCatalogInput to be added to Catalog
882 * @return Result of the request
884 public final ListenableFuture<RpcResult<AddOpenroadmOperationalModesToCatalogOutput>>
885 addOpenroadmOperationalModesToCatalog(AddOpenroadmOperationalModesToCatalogInput input) {
887 LOG.info("RPC addOpenroadmOperationalModesToCatalog in progress");
888 LOG.debug(" Input openRoadm {}", input);
890 OperationResult validationResult = CatalogValidation.validateORCatalogRequest(
891 new CatalogInput(input), RpcActions.FillCatalogWithOrOperationalModes);
892 if (! validationResult.isSuccess()) {
893 LOG.warn(ADD_OR_TO_CATALOG_MSG, LogMessages.ABORT_OR_TO_CATALOG_FAILED);
894 return ModelMappingUtils.addOpenroadmServiceReply(
895 input, ResponseCodes.FINAL_ACK_YES,
896 validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
898 LOG.info(" Request System Id {} " ,input.getSdncRequestHeader().getRequestSystemId());
899 LOG.info(" Rpc Action {} " ,input.getSdncRequestHeader().getRpcAction());
901 OpenroadmOperationalModes objToSave = CatalogMapper.createORModesToSave(input);
902 catalogDataStoreOperations.addOpenroadmOperationalModesToCatalog(objToSave);
903 LOG.info("RPC addOpenroadmOperationalModesToCatalog Completed");
904 return ModelMappingUtils.addOpenroadmServiceReply(input, ResponseCodes.FINAL_ACK_YES,
905 validationResult.getResultMessage(), ResponseCodes.RESPONSE_OK);
910 * Implementation of the RPC to set specific operational modes in the catalog of the controller.
911 * Semantics of the RPC is such that the information in the input replaces the full content
912 * of the specific operational modes catalog in the config data store. Incremental changes to the
913 * catalog, if required, must be done via individual PUT/POST/DELETE RESTconf APIs.
915 * @param input AddSpecificOperationalModesToCatalogInput to be added to Catalog
916 * @return Result of the request
918 public final ListenableFuture<RpcResult<AddSpecificOperationalModesToCatalogOutput>>
919 addSpecificOperationalModesToCatalog(AddSpecificOperationalModesToCatalogInput input) {
921 LOG.info("RPC addSpecificOperationalModesToCatalog in progress");
922 LOG.debug(" Input openSpecificRoadm {}", input);
924 OperationResult validationResult = CatalogValidation.validateSpecificCatalogRequest(
925 new CatalogInput(input), RpcActions.FillCatalogWithSpecificOperationalModes);
926 if (! validationResult.isSuccess()) {
927 LOG.warn(ADD_SPECIFIC_TO_CATALOG_MSG, LogMessages.ABORT_SPECIFIC_TO_CATALOG_FAILED);
928 return ModelMappingUtils.addSpecificOpenroadmServiceReply(
929 input, ResponseCodes.FINAL_ACK_YES,
930 validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
932 LOG.info(" Request System Id {} " ,input.getSdncRequestHeader().getRequestSystemId());
933 LOG.info(" Rpc Action {} " ,input.getSdncRequestHeader().getRpcAction());
935 SpecificOperationalModes objToSave = CatalogMapper.createSpecificModesToSave(input);
936 catalogDataStoreOperations.addSpecificOperationalModesToCatalog(objToSave);
937 LOG.info("RPC addSpecificOperationalModesToCatalog Completed");
938 return ModelMappingUtils.addSpecificOpenroadmServiceReply(input, ResponseCodes.FINAL_ACK_YES,
939 validationResult.getResultMessage(), ResponseCodes.RESPONSE_OK);
943 public final ListenableFuture<RpcResult<ServiceSrlgGetOutput>> serviceSrlgGet(ServiceSrlgGetInput input) {
944 // TODO Auto-generated method stub
949 public final ListenableFuture<RpcResult<EndTerminalPerformanceInfoRequestOutput>> endTerminalPerformanceInfoRequest(
950 EndTerminalPerformanceInfoRequestInput input) {
951 // TODO Auto-generated method stub
956 public final ListenableFuture<RpcResult<EndTerminalActivationRequestOutput>> endTerminalActivationRequest(
957 EndTerminalActivationRequestInput input) {
958 // TODO Auto-generated method stub
963 public final ListenableFuture<RpcResult<EndTerminalDeactivationRequestOutput>> endTerminalDeactivationRequest(
964 EndTerminalDeactivationRequestInput input) {
965 // TODO Auto-generated method stub
970 public final ListenableFuture<RpcResult<EndTerminalPowerControlOutput>> endTerminalPowerControl(
971 EndTerminalPowerControlInput input) {
972 // TODO Auto-generated method stub
976 public Registration getRegisteredRpc() {
981 * Send notification to NBI notification in order to publish message.
982 * @param service PublishNotificationService
984 private void sendNbiNotification(PublishNotificationProcessService service) {
986 notificationPublishService.putNotification(service);
987 } catch (InterruptedException e) {
988 LOG.warn("Cannot send notification to nbi", e);
989 Thread.currentThread().interrupt();
993 private ImmutableClassToInstanceMap<Rpc<?, ?>> registerRPCs() {
994 return ImmutableClassToInstanceMap.<Rpc<?, ?>>builder()
995 .put(ServiceCreate.class, this::serviceCreate)
996 .put(ServiceDelete.class, this::serviceDelete)
997 .put(ServiceFeasibilityCheck.class, this::serviceFeasibilityCheck)
998 .put(ServiceReconfigure.class, this::serviceReconfigure)
999 .put(ServiceRestoration.class, this::serviceRestoration)
1000 .put(EquipmentNotification.class, this::equipmentNotification)
1001 .put(ServiceRerouteConfirm.class, this::serviceRerouteConfirm)
1002 .put(ServiceReroute.class, this::serviceReroute)
1003 .put(ServiceReversion.class, this::serviceReversion)
1004 .put(ServiceRoll.class, this::serviceRoll)
1005 .put(NetworkReOptimization.class, this::networkReOptimization)
1006 .put(TempServiceDelete.class, this::tempServiceDelete)
1007 .put(TempServiceCreate.class, this::tempServiceCreate)
1008 .put(ServiceDeleteComplexResultNotificationRequest.class,
1009 this::serviceDeleteComplexResultNotificationRequest)
1010 .put(ServiceCreateResultNotificationRequest.class, this::serviceCreateResultNotificationRequest)
1011 .put(ServiceDeleteResultNotificationRequest.class, this::serviceDeleteResultNotificationRequest)
1012 .put(ServiceCreateComplexResultNotificationRequest.class,
1013 this::serviceCreateComplexResultNotificationRequest)
1014 .put(ServiceFeasibilityCheckBulk.class, this::serviceFeasibilityCheckBulk)
1015 .put(ServiceCreateBulk.class, this::serviceCreateBulk)
1016 .put(TempServiceCreateBulk.class, this::tempServiceCreateBulk)
1017 .put(ServiceRollResultNotificationRequest.class, this::serviceRollResultNotificationRequest)
1018 .put(ServiceReconfigureBulk.class, this::serviceReconfigureBulk)
1019 .put(ServiceReconfigureResultNotificationRequest.class, this::serviceReconfigureResultNotificationRequest)
1020 .put(ServiceRestorationResultNotificationRequest.class, this::serviceRestorationResultNotificationRequest)
1021 .put(ServiceReversionResultNotificationRequest.class, this::serviceReversionResultNotificationRequest)
1022 .put(ServiceRerouteConfirmResultNotificationRequest.class,
1023 this::serviceRerouteConfirmResultNotificationRequest)
1024 .put(OpticalTunnelCreate.class, this::opticalTunnelCreate)
1025 .put(OpticalTunnelRequestCancel.class, this::opticalTunnelRequestCancel)
1026 .put(AddOpenroadmOperationalModesToCatalog.class, this::addOpenroadmOperationalModesToCatalog)
1027 .put(AddSpecificOperationalModesToCatalog.class, this::addSpecificOperationalModesToCatalog)
1028 .put(ServiceSrlgGet.class, this::serviceSrlgGet)
1029 .put(EndTerminalPerformanceInfoRequest.class, this::endTerminalPerformanceInfoRequest)
1030 .put(EndTerminalActivationRequest.class, this::endTerminalActivationRequest)
1031 .put(EndTerminalDeactivationRequest.class, this::endTerminalDeactivationRequest)
1032 .put(EndTerminalPowerControl.class, this::endTerminalPowerControl)