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.rev240205.PathComputationRequestOutput;
40 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRerouteRequestOutput;
41 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.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.rev230728.PublishNotificationProcessService;
166 import org.opendaylight.yang.gen.v1.nbi.notifications.rev230728.PublishNotificationProcessServiceBuilder;
167 import org.opendaylight.yang.gen.v1.nbi.notifications.rev230728.notification.process.service.ServiceAEndBuilder;
168 import org.opendaylight.yang.gen.v1.nbi.notifications.rev230728.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.ErrorTag;
173 import org.opendaylight.yangtools.yang.common.ErrorType;
174 import org.opendaylight.yangtools.yang.common.RpcResult;
175 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
176 import org.osgi.service.component.annotations.Activate;
177 import org.osgi.service.component.annotations.Component;
178 import org.osgi.service.component.annotations.Deactivate;
179 import org.osgi.service.component.annotations.Reference;
180 import org.slf4j.Logger;
181 import org.slf4j.LoggerFactory;
185 * Top level service interface providing main OpenROADM controller services.
188 public class ServicehandlerImpl implements OrgOpenroadmServiceService {
189 private static final Logger LOG = LoggerFactory.getLogger(ServicehandlerImpl.class);
190 private static final String PUBLISHER = "ServiceHandler";
191 private static final String TEMP_SERVICE_CREATE_MSG = "tempServiceCreate: {}";
192 private static final String TEMP_SERVICE_DELETE_MSG = "tempServiceDelete: {}";
193 private static final String SERVICE_RESTORATION_MSG = "serviceRestoration: {}";
194 private static final String SERVICE_RECONFIGURE_MSG = "serviceReconfigure: {}";
195 private static final String SERVICE_FEASIBILITY_CHECK_MSG = "serviceFeasibilityCheck: {}";
196 private static final String SERVICE_DELETE_MSG = "serviceDelete: {}";
197 private static final String SERVICE_CREATE_MSG = "serviceCreate: {}";
198 private static final String ADD_OR_TO_CATALOG_MSG = "addORToCatalog: {}";
199 private static final String ADD_SPECIFIC_TO_CATALOG_MSG = "addSpecificToCatalog: {}";
201 private ServiceDataStoreOperations serviceDataStoreOperations;
202 private PCEServiceWrapper pceServiceWrapper;
203 private RendererServiceWrapper rendererServiceWrapper;
204 private PceListener pceListenerImpl;
205 private RendererListener rendererListenerImpl;
206 private NetworkListener networkModelListenerImpl;
207 private NotificationPublishService notificationPublishService;
208 private CatalogDataStoreOperations catalogDataStoreOperations;
209 private Registration reg;
212 public ServicehandlerImpl(@Reference RpcProviderService rpcProviderService,
213 @Reference PathComputationService pathComputationService,
214 @Reference RendererServiceOperations rendererServiceOperations,
215 @Reference NotificationPublishService notificationPublishService,
216 @Reference PceListener pceListenerImpl,
217 @Reference RendererListener rendererListenerImpl,
218 @Reference NetworkListener networkModelListenerImpl,
219 @Reference ServiceDataStoreOperations serviceDataStoreOperations,
220 @Reference CatalogDataStoreOperations catalogDataStoreOperations) {
221 this.catalogDataStoreOperations = catalogDataStoreOperations;
222 this.serviceDataStoreOperations = serviceDataStoreOperations;
223 this.notificationPublishService = notificationPublishService;
224 this.pceServiceWrapper = new PCEServiceWrapper(pathComputationService, notificationPublishService);
225 this.rendererServiceWrapper = new RendererServiceWrapper(rendererServiceOperations, notificationPublishService);
226 this.pceListenerImpl = pceListenerImpl;
227 this.rendererListenerImpl = rendererListenerImpl;
228 this.networkModelListenerImpl = networkModelListenerImpl;
229 this.reg = rpcProviderService.registerRpcImplementations(registerRPCs());
230 LOG.info("ServicehandlerImpl Initiated");
234 public void close() {
236 LOG.info("ServicehandlerImpl Closed");
240 // This is class is public so that these messages can be accessed from Junit (avoid duplications).
241 public static final class LogMessages {
243 public static final String PCE_CALLING;
244 public static final String ABORT_PCE_FAILED;
245 public static final String PCE_FAILED;
246 public static final String ABORT_SERVICE_NON_COMPLIANT;
247 public static final String SERVICE_NON_COMPLIANT;
248 public static final String RENDERER_DELETE_FAILED;
249 public static final String ABORT_VALID_FAILED;
250 public static final String ABORT_OR_TO_CATALOG_FAILED;
251 public static final String ABORT_SPECIFIC_TO_CATALOG_FAILED;
253 // Static blocks are generated once and spare memory.
255 PCE_CALLING = "Calling PCE";
256 ABORT_PCE_FAILED = "Aborting: PCE calculation failed ";
257 PCE_FAILED = "PCE calculation failed";
258 ABORT_SERVICE_NON_COMPLIANT = "Aborting: non-compliant service ";
259 SERVICE_NON_COMPLIANT = "non-compliant service";
260 RENDERER_DELETE_FAILED = "Renderer service delete failed";
261 ABORT_VALID_FAILED = "Aborting: validation of service create request failed";
262 ABORT_OR_TO_CATALOG_FAILED = "Aborting: validation of add OR to catalog request failed";
263 ABORT_SPECIFIC_TO_CATALOG_FAILED = "Aborting: validation of add Specific to catalog request failed";
266 public static String serviceInDS(String serviceName) {
267 return "Service '" + serviceName + "' already exists in datastore";
270 public static String serviceNotInDS(String serviceName) {
271 return "Service '" + serviceName + "' does not exist in datastore";
274 public static String servicePathNotInDS(String serviceName) {
275 return "Service Path from '" + serviceName + "' does not exist in datastore";
278 public static String serviceInService(String serviceName) {
279 return "Service '" + serviceName + "' is in 'inService' state";
282 private LogMessages() {
287 public final ListenableFuture<RpcResult<ServiceCreateOutput>> serviceCreate(ServiceCreateInput input) {
288 LOG.info("RPC serviceCreate received");
290 OperationResult validationResult = ServiceCreateValidation.validateServiceCreateRequest(
291 new ServiceInput(input), RpcActions.ServiceCreate);
292 if (!validationResult.isSuccess()) {
293 LOG.warn(SERVICE_CREATE_MSG, LogMessages.ABORT_VALID_FAILED);
294 return ModelMappingUtils.createCreateServiceReply(
295 input, ResponseCodes.FINAL_ACK_YES,
296 validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
298 //Check any presence of services with the same nameequipmentNotification
299 String serviceName = input.getServiceName();
300 if (this.serviceDataStoreOperations.getService(serviceName).isPresent()) {
301 LOG.warn(SERVICE_CREATE_MSG, LogMessages.serviceInDS(serviceName));
302 return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
303 LogMessages.serviceInDS(serviceName), ResponseCodes.RESPONSE_FAILED);
305 // TODO: Here we also have to check if there is an associated temp-service.
306 // TODO: If there is one, delete it from the temp-service-list??
307 this.pceListenerImpl.setInput(new ServiceInput(input));
308 this.pceListenerImpl.setServiceReconfigure(false);
309 this.pceListenerImpl.setTempService(false);
310 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
311 this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
312 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
313 // This ensures that the temp-service boolean is false, especially, when
314 // service-create is initiated after the temp-service-create
315 this.rendererListenerImpl.setTempService(false);
316 this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
317 LOG.debug(SERVICE_CREATE_MSG, LogMessages.PCE_CALLING);
318 PathComputationRequestOutput output = this.pceServiceWrapper.performPCE(input, true);
319 if (output == null) {
320 LOG.warn(SERVICE_CREATE_MSG, LogMessages.ABORT_PCE_FAILED);
321 sendNbiNotification(new PublishNotificationProcessServiceBuilder()
322 .setServiceName(serviceName)
323 .setServiceAEnd(new ServiceAEndBuilder(input.getServiceAEnd()).build())
324 .setServiceZEnd(new ServiceZEndBuilder(input.getServiceZEnd()).build())
325 .setCommonId(input.getCommonId())
326 .setConnectionType(input.getConnectionType())
327 .setResponseFailed(LogMessages.ABORT_PCE_FAILED)
328 .setMessage("ServiceCreate request failed ...")
329 .setOperationalState(State.Degraded)
330 .setPublisherName(PUBLISHER)
332 return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
333 LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED);
335 LOG.info("RPC serviceCreate in progress...");
336 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
337 return ModelMappingUtils.createCreateServiceReply(
338 input, common.getAckFinalIndicator(),
339 common.getResponseMessage(), common.getResponseCode());
343 public final ListenableFuture<RpcResult<ServiceDeleteOutput>> serviceDelete(ServiceDeleteInput input) {
344 String serviceName = input.getServiceDeleteReqInfo().getServiceName();
345 LOG.info("RPC serviceDelete request received for {}", serviceName);
347 * Upon receipt of service-deleteService RPC, service header and sdnc-request
348 * header compliance are verified.
350 ComplianceCheckResult serviceHandlerCheckResult =
351 ServicehandlerComplianceCheck.check(
352 input.getServiceDeleteReqInfo().getServiceName(),
353 input.getSdncRequestHeader(), null, RpcActions.ServiceDelete, false, true);
354 if (!serviceHandlerCheckResult.hasPassed()) {
355 LOG.warn(SERVICE_DELETE_MSG, LogMessages.ABORT_SERVICE_NON_COMPLIANT);
356 return ModelMappingUtils.createDeleteServiceReply(
357 input, ResponseCodes.FINAL_ACK_YES,
358 LogMessages.SERVICE_NON_COMPLIANT, ResponseCodes.RESPONSE_FAILED);
360 //Check presence of service to be deleted
361 Optional<Services> serviceOpt = this.serviceDataStoreOperations.getService(serviceName);
363 if (serviceOpt.isEmpty()) {
364 LOG.warn(SERVICE_DELETE_MSG, LogMessages.serviceNotInDS(serviceName));
365 return ModelMappingUtils.createDeleteServiceReply(
366 input, ResponseCodes.FINAL_ACK_YES,
367 LogMessages.serviceNotInDS(serviceName), ResponseCodes.RESPONSE_FAILED);
369 service = serviceOpt.orElseThrow();
370 LOG.debug("serviceDelete: Service '{}' found in datastore", serviceName);
371 this.pceListenerImpl.setInput(new ServiceInput(input));
372 this.pceListenerImpl.setServiceReconfigure(false);
373 this.pceListenerImpl.setTempService(false);
374 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
375 this.rendererListenerImpl.setTempService(false);
376 this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
377 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
378 this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
379 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteInput
380 serviceDeleteInput = ModelMappingUtils.createServiceDeleteInput(new ServiceInput(input));
381 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteOutput output =
382 this.rendererServiceWrapper.performRenderer(
383 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
572 return RpcResultBuilder.<EquipmentNotificationOutput>failed()
573 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
578 public final ListenableFuture<RpcResult<ServiceRerouteConfirmOutput>>
579 serviceRerouteConfirm(ServiceRerouteConfirmInput input) {
580 // TODO Auto-generated method stub
581 return RpcResultBuilder.<ServiceRerouteConfirmOutput>failed()
582 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
587 public final ListenableFuture<RpcResult<ServiceRerouteOutput>> serviceReroute(ServiceRerouteInput input) {
588 String serviceName = input.getServiceName();
589 LOG.info("RPC serviceReroute received for {}", serviceName);
590 Optional<Services> servicesObject = this.serviceDataStoreOperations.getService(serviceName);
591 if (servicesObject.isEmpty()) {
592 LOG.warn("serviceReroute: {}", LogMessages.serviceNotInDS(serviceName));
593 return ModelMappingUtils.createRerouteServiceReply(
594 input, ResponseCodes.FINAL_ACK_YES,
595 LogMessages.serviceNotInDS(serviceName),
596 ResponseCodes.RESPONSE_FAILED);
598 Services service = servicesObject.orElseThrow();
599 Optional<ServicePaths> servicePathsObject = this.serviceDataStoreOperations.getServicePath(serviceName);
600 if (servicePathsObject.isEmpty()) {
601 LOG.warn("serviceReroute: {}", LogMessages.servicePathNotInDS(serviceName));
602 return ModelMappingUtils.createRerouteServiceReply(
603 input, ResponseCodes.FINAL_ACK_YES,
604 LogMessages.servicePathNotInDS(serviceName),
605 ResponseCodes.RESPONSE_FAILED);
607 ServicePaths servicePaths = servicePathsObject.orElseThrow();
608 // serviceInput for later use maybe...
609 ServiceInput serviceInput = new ServiceInput(input);
610 serviceInput.setServiceAEnd(service.getServiceAEnd());
611 serviceInput.setServiceZEnd(service.getServiceZEnd());
612 serviceInput.setConnectionType(service.getConnectionType());
613 serviceInput.setCommonId(service.getCommonId());
614 serviceInput.setHardConstraints(service.getHardConstraints());
615 serviceInput.setSoftConstraints(service.getSoftConstraints());
616 serviceInput.setCustomer(service.getCustomer());
617 serviceInput.setCustomerContact(service.getCustomerContact());
619 // Get the network xpdr termination points
620 Map<AToZKey, AToZ> mapaToz = servicePaths.getPathDescription().getAToZDirection().getAToZ();
621 String aendtp = ((TerminationPoint) mapaToz.get(new AToZKey(String.valueOf(mapaToz.size() - 3)))
625 String zendtp = ((TerminationPoint) mapaToz.get(new AToZKey("2"))
630 PathComputationRerouteRequestOutput output = this.pceServiceWrapper.performPCEReroute(
631 service.getHardConstraints(), service.getSoftConstraints(), input.getSdncRequestHeader(),
632 service.getServiceAEnd(), service.getServiceZEnd(),
633 new EndpointsBuilder().setAEndTp(aendtp).setZEndTp(zendtp).build());
635 if (output == null) {
636 LOG.error("serviceReroute: {}", LogMessages.PCE_FAILED);
637 return ModelMappingUtils.createRerouteServiceReply(
638 input, ResponseCodes.FINAL_ACK_YES,
639 LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED);
641 LOG.info("RPC ServiceReroute is done");
642 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
643 return ModelMappingUtils.createRerouteServiceReply(input, common.getAckFinalIndicator(),
644 common.getResponseMessage(), common.getResponseCode());
648 public final ListenableFuture<RpcResult<ServiceReversionOutput>> serviceReversion(ServiceReversionInput input) {
649 // TODO Auto-generated method stub
650 return RpcResultBuilder.<ServiceReversionOutput>failed()
651 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
656 public final ListenableFuture<RpcResult<ServiceRollOutput>> serviceRoll(ServiceRollInput input) {
657 // TODO Auto-generated method stub
658 return RpcResultBuilder.<ServiceRollOutput>failed()
659 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
664 public final ListenableFuture<RpcResult<NetworkReOptimizationOutput>>
665 networkReOptimization(NetworkReOptimizationInput input) {
666 // TODO Auto-generated method stub
667 return RpcResultBuilder.<NetworkReOptimizationOutput>failed()
668 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
673 public final ListenableFuture<RpcResult<TempServiceDeleteOutput>> tempServiceDelete(TempServiceDeleteInput input) {
674 String commonId = input.getCommonId();
675 LOG.info("RPC temp serviceDelete request received for {}", commonId);
678 * Upon receipt of service-deleteService RPC, service header and sdnc-request
679 * header compliance are verified.
681 LOG.debug("checking Service Compliance ...");
682 ComplianceCheckResult serviceHandlerCheckResult = ServicehandlerComplianceCheck.check(
683 commonId, null, null, RpcActions.ServiceDelete, false, false
685 if (!serviceHandlerCheckResult.hasPassed()) {
686 LOG.warn(TEMP_SERVICE_DELETE_MSG, LogMessages.ABORT_SERVICE_NON_COMPLIANT);
687 return ModelMappingUtils.createDeleteServiceReply(
688 input, ResponseCodes.FINAL_ACK_YES,
689 LogMessages.SERVICE_NON_COMPLIANT, ResponseCodes.RESPONSE_FAILED);
692 //Check presence of service to be deleted
693 LOG.debug("service common-id '{}' is compliant", commonId);
694 Optional<org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.temp.service.list.Services>
696 this.serviceDataStoreOperations.getTempService(commonId);
697 if (serviceOpt.isEmpty()) {
698 LOG.error(TEMP_SERVICE_DELETE_MSG, LogMessages.serviceNotInDS(commonId));
699 return ModelMappingUtils.createDeleteServiceReply(
700 input, ResponseCodes.FINAL_ACK_YES,
701 LogMessages.serviceNotInDS(commonId), ResponseCodes.RESPONSE_FAILED);
703 LOG.info("Service '{}' present in datastore !", commonId);
704 this.pceListenerImpl.setInput(new ServiceInput(input));
705 this.pceListenerImpl.setServiceReconfigure(false);
706 this.pceListenerImpl.setTempService(true);
707 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
708 this.rendererListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
709 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
710 this.rendererListenerImpl.setTempService(true);
711 this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
712 org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526
713 .temp.service.list.Services service = serviceOpt.orElseThrow();
714 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteOutput output =
715 this.rendererServiceWrapper.performRenderer(input, ServiceNotificationTypes.ServiceDeleteResult,
717 if (output == null) {
718 LOG.error(TEMP_SERVICE_DELETE_MSG, LogMessages.RENDERER_DELETE_FAILED);
719 return ModelMappingUtils.createDeleteServiceReply(
720 input, ResponseCodes.FINAL_ACK_YES,
721 LogMessages.RENDERER_DELETE_FAILED, ResponseCodes.RESPONSE_FAILED);
723 LOG.info("RPC tempServiceDelete in progress...");
724 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
725 return ModelMappingUtils.createDeleteServiceReply(
726 input, common.getAckFinalIndicator(),
727 common.getResponseMessage(), common.getResponseCode());
731 public final ListenableFuture<RpcResult<TempServiceCreateOutput>> tempServiceCreate(TempServiceCreateInput input) {
732 LOG.info("RPC tempServiceCreate received");
734 OperationResult validationResult = ServiceCreateValidation.validateServiceCreateRequest(
735 new ServiceInput(input), RpcActions.TempServiceCreate);
736 if (! validationResult.isSuccess()) {
737 LOG.warn(TEMP_SERVICE_CREATE_MSG, LogMessages.ABORT_VALID_FAILED);
738 return ModelMappingUtils.createCreateServiceReply(
739 input, ResponseCodes.FINAL_ACK_YES,
740 validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
743 //Check any presence of temp-service with the same commonId
744 String commonId = input.getCommonId();
745 if (this.serviceDataStoreOperations.getTempService(commonId).isPresent()) {
746 LOG.warn(TEMP_SERVICE_CREATE_MSG, LogMessages.serviceInDS("Temp (" + commonId + ")"));
747 return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
748 LogMessages.serviceInDS("Temp (" + commonId + ")"), ResponseCodes.RESPONSE_FAILED);
751 // Starting service create operation
752 LOG.debug(TEMP_SERVICE_CREATE_MSG, LogMessages.PCE_CALLING);
753 this.pceListenerImpl.setInput(new ServiceInput(input));
754 this.pceListenerImpl.setServiceReconfigure(false);
755 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
756 this.pceListenerImpl.setTempService(true);
757 this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
758 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
759 this.rendererListenerImpl.setTempService(true);
760 this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
761 PathComputationRequestOutput output = this.pceServiceWrapper.performPCE(input, true);
762 if (output == null) {
763 LOG.warn(TEMP_SERVICE_CREATE_MSG, LogMessages.ABORT_PCE_FAILED);
764 return ModelMappingUtils.createCreateServiceReply(
765 input, ResponseCodes.FINAL_ACK_YES,
766 LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED);
768 LOG.info("RPC tempServiceCreate in progress...");
769 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
770 return ModelMappingUtils.createCreateServiceReply(
771 input, common.getAckFinalIndicator(),
772 common.getResponseMessage(), common.getResponseCode());
776 public final ListenableFuture<RpcResult<
777 ServiceDeleteComplexResultNotificationRequestOutput>> serviceDeleteComplexResultNotificationRequest(
778 ServiceDeleteComplexResultNotificationRequestInput input) {
779 // TODO Auto-generated method stub
780 return RpcResultBuilder.<ServiceDeleteComplexResultNotificationRequestOutput>failed()
781 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
786 public final ListenableFuture<RpcResult<
787 ServiceCreateResultNotificationRequestOutput>> serviceCreateResultNotificationRequest(
788 ServiceCreateResultNotificationRequestInput input) {
789 // TODO Auto-generated method stub
790 return RpcResultBuilder.<ServiceCreateResultNotificationRequestOutput>failed()
791 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
796 public final ListenableFuture<RpcResult<
797 ServiceDeleteResultNotificationRequestOutput>> serviceDeleteResultNotificationRequest(
798 ServiceDeleteResultNotificationRequestInput input) {
799 // TODO Auto-generated method stub
800 return RpcResultBuilder.<ServiceDeleteResultNotificationRequestOutput>failed()
801 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
806 public final ListenableFuture<RpcResult<
807 ServiceCreateComplexResultNotificationRequestOutput>> serviceCreateComplexResultNotificationRequest(
808 ServiceCreateComplexResultNotificationRequestInput input) {
809 // TODO Auto-generated method stub
810 return RpcResultBuilder.<ServiceCreateComplexResultNotificationRequestOutput>failed()
811 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
816 public final ListenableFuture<RpcResult<ServiceFeasibilityCheckBulkOutput>> serviceFeasibilityCheckBulk(
817 ServiceFeasibilityCheckBulkInput input) {
818 // TODO Auto-generated method stub
819 return RpcResultBuilder.<ServiceFeasibilityCheckBulkOutput>failed()
820 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
825 public final ListenableFuture<RpcResult<ServiceCreateBulkOutput>> serviceCreateBulk(ServiceCreateBulkInput input) {
826 // TODO Auto-generated method stub
827 return RpcResultBuilder.<ServiceCreateBulkOutput>failed()
828 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
833 public final ListenableFuture<RpcResult<TempServiceCreateBulkOutput>> tempServiceCreateBulk(
834 TempServiceCreateBulkInput input) {
835 // TODO Auto-generated method stub
836 return RpcResultBuilder.<TempServiceCreateBulkOutput>failed()
837 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
842 public final ListenableFuture<RpcResult<
843 ServiceRollResultNotificationRequestOutput>> serviceRollResultNotificationRequest(
844 ServiceRollResultNotificationRequestInput input) {
845 // TODO Auto-generated method stub
846 return RpcResultBuilder.<ServiceRollResultNotificationRequestOutput>failed()
847 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
852 public final ListenableFuture<RpcResult<ServiceReconfigureBulkOutput>> serviceReconfigureBulk(
853 ServiceReconfigureBulkInput input) {
854 // TODO Auto-generated method stub
855 return RpcResultBuilder.<ServiceReconfigureBulkOutput>failed()
856 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
861 public final ListenableFuture<RpcResult<ServiceReconfigureResultNotificationRequestOutput>>
862 serviceReconfigureResultNotificationRequest(ServiceReconfigureResultNotificationRequestInput input) {
863 // TODO Auto-generated method stub
864 return RpcResultBuilder.<ServiceReconfigureResultNotificationRequestOutput>failed()
865 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
870 public final ListenableFuture<RpcResult<ServiceRestorationResultNotificationRequestOutput>>
871 serviceRestorationResultNotificationRequest(ServiceRestorationResultNotificationRequestInput input) {
872 // TODO Auto-generated method stub
873 return RpcResultBuilder.<ServiceRestorationResultNotificationRequestOutput>failed()
874 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
879 public final ListenableFuture<RpcResult<ServiceReversionResultNotificationRequestOutput>>
880 serviceReversionResultNotificationRequest(ServiceReversionResultNotificationRequestInput input) {
881 // TODO Auto-generated method stub
882 return RpcResultBuilder.<ServiceReversionResultNotificationRequestOutput>failed()
883 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
888 public final ListenableFuture<RpcResult<ServiceRerouteConfirmResultNotificationRequestOutput>>
889 serviceRerouteConfirmResultNotificationRequest(ServiceRerouteConfirmResultNotificationRequestInput input) {
890 // TODO Auto-generated method stub
891 return RpcResultBuilder.<ServiceRerouteConfirmResultNotificationRequestOutput>failed()
892 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
897 public final ListenableFuture<RpcResult<
898 OpticalTunnelCreateOutput>> opticalTunnelCreate(OpticalTunnelCreateInput input) {
899 // TODO Auto-generated method stub
900 return RpcResultBuilder.<OpticalTunnelCreateOutput>failed()
901 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
906 public final ListenableFuture<RpcResult<OpticalTunnelRequestCancelOutput>> opticalTunnelRequestCancel(
907 OpticalTunnelRequestCancelInput input) {
908 // TODO Auto-generated method stub
909 return RpcResultBuilder.<OpticalTunnelRequestCancelOutput>failed()
910 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
916 * Implementation of the RPC to set OR operational modes in the catalog of the controller.
917 * Semantics of the RPC is such that the information in the input replaces the full content
918 * of the OR operational modes catalog in the config data store. Incremental changes to the
919 * catalog, if required, must be done via individual PUT/POST/DELETE RESTconf APIs.
921 * @param input AddOpenroadmOperationalModesToCatalogInput to be added to Catalog
922 * @return Result of the request
924 public final ListenableFuture<RpcResult<AddOpenroadmOperationalModesToCatalogOutput>>
925 addOpenroadmOperationalModesToCatalog(AddOpenroadmOperationalModesToCatalogInput input) {
927 LOG.info("RPC addOpenroadmOperationalModesToCatalog in progress");
928 LOG.debug(" Input openRoadm {}", input);
930 OperationResult validationResult = CatalogValidation.validateORCatalogRequest(
931 new CatalogInput(input), RpcActions.FillCatalogWithOrOperationalModes);
932 if (! validationResult.isSuccess()) {
933 LOG.warn(ADD_OR_TO_CATALOG_MSG, LogMessages.ABORT_OR_TO_CATALOG_FAILED);
934 return ModelMappingUtils.addOpenroadmServiceReply(
935 input, ResponseCodes.FINAL_ACK_YES,
936 validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
938 LOG.info(" Request System Id {} " ,input.getSdncRequestHeader().getRequestSystemId());
939 LOG.info(" Rpc Action {} " ,input.getSdncRequestHeader().getRpcAction());
941 OpenroadmOperationalModes objToSave = CatalogMapper.createORModesToSave(input);
942 catalogDataStoreOperations.addOpenroadmOperationalModesToCatalog(objToSave);
943 LOG.info("RPC addOpenroadmOperationalModesToCatalog Completed");
944 return ModelMappingUtils.addOpenroadmServiceReply(input, ResponseCodes.FINAL_ACK_YES,
945 validationResult.getResultMessage(), ResponseCodes.RESPONSE_OK);
950 * Implementation of the RPC to set specific operational modes in the catalog of the controller.
951 * Semantics of the RPC is such that the information in the input replaces the full content
952 * of the specific operational modes catalog in the config data store. Incremental changes to the
953 * catalog, if required, must be done via individual PUT/POST/DELETE RESTconf APIs.
955 * @param input AddSpecificOperationalModesToCatalogInput to be added to Catalog
956 * @return Result of the request
958 public final ListenableFuture<RpcResult<AddSpecificOperationalModesToCatalogOutput>>
959 addSpecificOperationalModesToCatalog(AddSpecificOperationalModesToCatalogInput input) {
961 LOG.info("RPC addSpecificOperationalModesToCatalog in progress");
962 LOG.debug(" Input openSpecificRoadm {}", input);
964 OperationResult validationResult = CatalogValidation.validateSpecificCatalogRequest(
965 new CatalogInput(input), RpcActions.FillCatalogWithSpecificOperationalModes);
966 if (! validationResult.isSuccess()) {
967 LOG.warn(ADD_SPECIFIC_TO_CATALOG_MSG, LogMessages.ABORT_SPECIFIC_TO_CATALOG_FAILED);
968 return ModelMappingUtils.addSpecificOpenroadmServiceReply(
969 input, ResponseCodes.FINAL_ACK_YES,
970 validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
972 LOG.info(" Request System Id {} " ,input.getSdncRequestHeader().getRequestSystemId());
973 LOG.info(" Rpc Action {} " ,input.getSdncRequestHeader().getRpcAction());
975 SpecificOperationalModes objToSave = CatalogMapper.createSpecificModesToSave(input);
976 catalogDataStoreOperations.addSpecificOperationalModesToCatalog(objToSave);
977 LOG.info("RPC addSpecificOperationalModesToCatalog Completed");
978 return ModelMappingUtils.addSpecificOpenroadmServiceReply(input, ResponseCodes.FINAL_ACK_YES,
979 validationResult.getResultMessage(), ResponseCodes.RESPONSE_OK);
983 public final ListenableFuture<RpcResult<ServiceSrlgGetOutput>> serviceSrlgGet(ServiceSrlgGetInput input) {
984 // TODO Auto-generated method stub
985 return RpcResultBuilder.<ServiceSrlgGetOutput>failed()
986 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
991 public final ListenableFuture<RpcResult<EndTerminalPerformanceInfoRequestOutput>> endTerminalPerformanceInfoRequest(
992 EndTerminalPerformanceInfoRequestInput input) {
993 // TODO Auto-generated method stub
994 return RpcResultBuilder.<EndTerminalPerformanceInfoRequestOutput>failed()
995 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
1000 public final ListenableFuture<RpcResult<EndTerminalActivationRequestOutput>> endTerminalActivationRequest(
1001 EndTerminalActivationRequestInput input) {
1002 // TODO Auto-generated method stub
1003 return RpcResultBuilder.<EndTerminalActivationRequestOutput>failed()
1004 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
1009 public final ListenableFuture<RpcResult<EndTerminalDeactivationRequestOutput>> endTerminalDeactivationRequest(
1010 EndTerminalDeactivationRequestInput input) {
1011 // TODO Auto-generated method stub
1012 return RpcResultBuilder.<EndTerminalDeactivationRequestOutput>failed()
1013 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
1018 public final ListenableFuture<RpcResult<EndTerminalPowerControlOutput>> endTerminalPowerControl(
1019 EndTerminalPowerControlInput input) {
1020 // TODO Auto-generated method stub
1021 return RpcResultBuilder.<EndTerminalPowerControlOutput>failed()
1022 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
1026 public Registration getRegisteredRpc() {
1031 * Send notification to NBI notification in order to publish message.
1032 * @param service PublishNotificationService
1034 private void sendNbiNotification(PublishNotificationProcessService service) {
1036 notificationPublishService.putNotification(service);
1037 } catch (InterruptedException e) {
1038 LOG.warn("Cannot send notification to nbi", e);
1039 Thread.currentThread().interrupt();
1043 private ImmutableClassToInstanceMap<Rpc<?, ?>> registerRPCs() {
1044 return ImmutableClassToInstanceMap.<Rpc<?, ?>>builder()
1045 .put(ServiceCreate.class, this::serviceCreate)
1046 .put(ServiceDelete.class, this::serviceDelete)
1047 .put(ServiceFeasibilityCheck.class, this::serviceFeasibilityCheck)
1048 .put(ServiceReconfigure.class, this::serviceReconfigure)
1049 .put(ServiceRestoration.class, this::serviceRestoration)
1050 .put(EquipmentNotification.class, this::equipmentNotification)
1051 .put(ServiceRerouteConfirm.class, this::serviceRerouteConfirm)
1052 .put(ServiceReroute.class, this::serviceReroute)
1053 .put(ServiceReversion.class, this::serviceReversion)
1054 .put(ServiceRoll.class, this::serviceRoll)
1055 .put(NetworkReOptimization.class, this::networkReOptimization)
1056 .put(TempServiceDelete.class, this::tempServiceDelete)
1057 .put(TempServiceCreate.class, this::tempServiceCreate)
1058 .put(ServiceDeleteComplexResultNotificationRequest.class,
1059 this::serviceDeleteComplexResultNotificationRequest)
1060 .put(ServiceCreateResultNotificationRequest.class, this::serviceCreateResultNotificationRequest)
1061 .put(ServiceDeleteResultNotificationRequest.class, this::serviceDeleteResultNotificationRequest)
1062 .put(ServiceCreateComplexResultNotificationRequest.class,
1063 this::serviceCreateComplexResultNotificationRequest)
1064 .put(ServiceFeasibilityCheckBulk.class, this::serviceFeasibilityCheckBulk)
1065 .put(ServiceCreateBulk.class, this::serviceCreateBulk)
1066 .put(TempServiceCreateBulk.class, this::tempServiceCreateBulk)
1067 .put(ServiceRollResultNotificationRequest.class, this::serviceRollResultNotificationRequest)
1068 .put(ServiceReconfigureBulk.class, this::serviceReconfigureBulk)
1069 .put(ServiceReconfigureResultNotificationRequest.class, this::serviceReconfigureResultNotificationRequest)
1070 .put(ServiceRestorationResultNotificationRequest.class, this::serviceRestorationResultNotificationRequest)
1071 .put(ServiceReversionResultNotificationRequest.class, this::serviceReversionResultNotificationRequest)
1072 .put(ServiceRerouteConfirmResultNotificationRequest.class,
1073 this::serviceRerouteConfirmResultNotificationRequest)
1074 .put(OpticalTunnelCreate.class, this::opticalTunnelCreate)
1075 .put(OpticalTunnelRequestCancel.class, this::opticalTunnelRequestCancel)
1076 .put(AddOpenroadmOperationalModesToCatalog.class, this::addOpenroadmOperationalModesToCatalog)
1077 .put(AddSpecificOperationalModesToCatalog.class, this::addSpecificOperationalModesToCatalog)
1078 .put(ServiceSrlgGet.class, this::serviceSrlgGet)
1079 .put(EndTerminalPerformanceInfoRequest.class, this::endTerminalPerformanceInfoRequest)
1080 .put(EndTerminalActivationRequest.class, this::endTerminalActivationRequest)
1081 .put(EndTerminalDeactivationRequest.class, this::endTerminalDeactivationRequest)
1082 .put(EndTerminalPowerControl.class, this::endTerminalPowerControl)