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.rev230925.PathComputationRequestOutput;
40 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRerouteRequestOutput;
41 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.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);
348 * Upon receipt of service-deleteService RPC, service header and sdnc-request
349 * header compliance are verified.
351 ComplianceCheckResult serviceHandlerCheckResult =
352 ServicehandlerComplianceCheck.check(
353 input.getServiceDeleteReqInfo().getServiceName(),
354 input.getSdncRequestHeader(), null, RpcActions.ServiceDelete, false, true);
355 if (!serviceHandlerCheckResult.hasPassed()) {
356 LOG.warn(SERVICE_DELETE_MSG, LogMessages.ABORT_SERVICE_NON_COMPLIANT);
357 return ModelMappingUtils.createDeleteServiceReply(
358 input, ResponseCodes.FINAL_ACK_YES,
359 LogMessages.SERVICE_NON_COMPLIANT, ResponseCodes.RESPONSE_FAILED);
362 //Check presence of service to be deleted
363 Optional<Services> serviceOpt = this.serviceDataStoreOperations.getService(serviceName);
365 if (serviceOpt.isEmpty()) {
366 LOG.warn(SERVICE_DELETE_MSG, LogMessages.serviceNotInDS(serviceName));
367 return ModelMappingUtils.createDeleteServiceReply(
368 input, ResponseCodes.FINAL_ACK_YES,
369 LogMessages.serviceNotInDS(serviceName), ResponseCodes.RESPONSE_FAILED);
371 service = serviceOpt.orElseThrow();
372 LOG.debug("serviceDelete: Service '{}' found in datastore", serviceName);
373 this.pceListenerImpl.setInput(new ServiceInput(input));
374 this.pceListenerImpl.setServiceReconfigure(false);
375 this.pceListenerImpl.setTempService(false);
376 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
377 this.rendererListenerImpl.setTempService(false);
378 this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
379 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
380 this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
381 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteInput
382 serviceDeleteInput = ModelMappingUtils.createServiceDeleteInput(new ServiceInput(input));
383 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteOutput output =
384 this.rendererServiceWrapper.performRenderer(
385 serviceDeleteInput, ServiceNotificationTypes.ServiceDeleteResult, service);
387 if (output == null) {
388 LOG.error(SERVICE_DELETE_MSG, LogMessages.RENDERER_DELETE_FAILED);
389 sendNbiNotification(new PublishNotificationProcessServiceBuilder()
390 .setServiceName(service.getServiceName())
391 .setServiceAEnd(new ServiceAEndBuilder(service.getServiceAEnd()).build())
392 .setServiceZEnd(new ServiceZEndBuilder(service.getServiceZEnd()).build())
393 .setCommonId(service.getCommonId())
394 .setConnectionType(service.getConnectionType())
395 .setMessage("ServiceDelete request failed ...")
396 .setOperationalState(State.InService)
397 .setResponseFailed(LogMessages.RENDERER_DELETE_FAILED)
398 .setPublisherName(PUBLISHER)
400 return ModelMappingUtils.createDeleteServiceReply(
401 input, ResponseCodes.FINAL_ACK_YES,
402 LogMessages.RENDERER_DELETE_FAILED, ResponseCodes.RESPONSE_FAILED);
405 LOG.debug("RPC serviceDelete in progress...");
406 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
407 return ModelMappingUtils.createDeleteServiceReply(
408 input, common.getAckFinalIndicator(),
409 common.getResponseMessage(), common.getResponseCode());
413 public final ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> serviceFeasibilityCheck(
414 ServiceFeasibilityCheckInput input) {
415 LOG.info("RPC serviceFeasibilityCheck received");
417 ServiceInput serviceInput = new ServiceInput(input);
418 OperationResult validationResult = ServiceCreateValidation.validateServiceCreateRequest(serviceInput,
419 RpcActions.ServiceFeasibilityCheck);
420 if (! validationResult.isSuccess()) {
421 LOG.warn(SERVICE_FEASIBILITY_CHECK_MSG, LogMessages.ABORT_VALID_FAILED);
422 return ModelMappingUtils.createCreateServiceReply(
423 input, ResponseCodes.FINAL_ACK_YES,
424 validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
426 this.pceListenerImpl.setInput(new ServiceInput(input));
427 this.pceListenerImpl.setServiceReconfigure(false);
428 this.pceListenerImpl.setServiceFeasiblity(true);
429 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
430 this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
431 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
432 this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
433 LOG.debug(SERVICE_FEASIBILITY_CHECK_MSG, LogMessages.PCE_CALLING);
434 PathComputationRequestOutput output = this.pceServiceWrapper.performPCE(input, true);
435 if (output == null) {
436 LOG.warn(SERVICE_FEASIBILITY_CHECK_MSG, LogMessages.ABORT_PCE_FAILED);
437 return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
438 LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED);
440 LOG.info("RPC serviceFeasibilityCheck in progress...");
441 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
442 return ModelMappingUtils.createCreateServiceReply(
443 input, common.getAckFinalIndicator(),
444 common.getResponseMessage(), common.getResponseCode());
448 public final ListenableFuture<RpcResult<
449 ServiceReconfigureOutput>> serviceReconfigure(ServiceReconfigureInput input) {
450 String serviceName = input.getServiceName();
451 LOG.info("RPC serviceReconfigure received for {}", serviceName);
452 Optional<Services> servicesObject = this.serviceDataStoreOperations.getService(serviceName);
453 if (servicesObject.isEmpty()) {
454 LOG.warn(SERVICE_RECONFIGURE_MSG, LogMessages.serviceNotInDS(serviceName));
455 return ModelMappingUtils.createCreateServiceReply(
457 LogMessages.serviceNotInDS(serviceName));
459 LOG.debug("Service '{}' found in datastore", serviceName);
460 OperationResult validationResult = ServiceCreateValidation
461 .validateServiceCreateRequest(new ServiceInput(input), RpcActions.ServiceReconfigure);
462 if (!validationResult.isSuccess()) {
463 LOG.warn(SERVICE_RECONFIGURE_MSG, LogMessages.ABORT_VALID_FAILED);
464 return ModelMappingUtils.createCreateServiceReply(
466 validationResult.getResultMessage());
468 this.pceListenerImpl.setInput(new ServiceInput(input));
469 this.pceListenerImpl.setServiceReconfigure(true);
470 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
471 this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
472 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
473 this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
474 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
475 .ServiceDeleteInput serviceDeleteInput =
476 ModelMappingUtils.createServiceDeleteInput(new ServiceInput(input));
477 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
478 .ServiceDeleteOutput output = this.rendererServiceWrapper.performRenderer(serviceDeleteInput,
479 ServiceNotificationTypes.ServiceDeleteResult, null);
480 if (output == null) {
481 LOG.error(SERVICE_RECONFIGURE_MSG, LogMessages.RENDERER_DELETE_FAILED);
482 return ModelMappingUtils.createCreateServiceReply(
484 LogMessages.RENDERER_DELETE_FAILED);
485 //TODO check if RpcStatus.Successful is really expected here
487 LOG.info("RPC serviceReconfigure in progress...");
488 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
489 return ModelMappingUtils.createCreateServiceReply(
491 common.getResponseMessage());
495 public final ListenableFuture<RpcResult<
496 ServiceRestorationOutput>> serviceRestoration(ServiceRestorationInput input) {
497 String serviceName = input.getServiceName();
498 LOG.info("RPC serviceRestoration received for {}", serviceName);
499 Optional<Services> servicesObject = this.serviceDataStoreOperations.getService(serviceName);
501 if (!servicesObject.isPresent()) {
502 LOG.warn(SERVICE_RESTORATION_MSG, LogMessages.serviceNotInDS(serviceName));
503 return ModelMappingUtils.createRestoreServiceReply(
504 LogMessages.serviceNotInDS(serviceName));
507 Services service = servicesObject.orElseThrow();
508 State state = service.getOperationalState();
510 if (state == State.InService) {
511 LOG.error(SERVICE_RESTORATION_MSG, LogMessages.serviceInService(serviceName));
512 return ModelMappingUtils.createRestoreServiceReply(
513 LogMessages.serviceInService(serviceName));
516 DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx");
517 OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);
518 DateAndTime datetime = new DateAndTime(dtf.format(offsetDateTime));
519 SdncRequestHeaderBuilder sdncBuilder = new SdncRequestHeaderBuilder()
520 .setNotificationUrl(service.getSdncRequestHeader().getNotificationUrl())
521 .setRequestId(service.getSdncRequestHeader().getRequestId())
522 .setRequestSystemId(service.getSdncRequestHeader().getRequestSystemId())
523 .setRpcAction(RpcActions.ServiceDelete);
524 ServiceDeleteInputBuilder deleteInputBldr = new ServiceDeleteInputBuilder()
525 .setServiceDeleteReqInfo(new ServiceDeleteReqInfoBuilder()
526 .setServiceName(serviceName)
527 .setDueDate(datetime)
528 .setTailRetention(TailRetention.No).build())
529 .setSdncRequestHeader(sdncBuilder.build());
530 ServiceInput serviceInput = new ServiceInput(deleteInputBldr.build());
531 serviceInput.setServiceAEnd(service.getServiceAEnd());
532 serviceInput.setServiceZEnd(service.getServiceZEnd());
533 serviceInput.setConnectionType(service.getConnectionType());
534 HardConstraints hardConstraints = service.getHardConstraints();
535 if (hardConstraints == null) {
536 LOG.warn("service '{}' HardConstraints is not set !", serviceName);
538 SoftConstraints softConstraints = service.getSoftConstraints();
539 if (softConstraints == null) {
540 LOG.warn("service '{}' SoftConstraints is not set !", serviceName);
541 serviceInput.setSoftConstraints(DowngradeConstraints.convertToSoftConstraints(hardConstraints));
543 LOG.info("converting hard constraints to soft constraints ...");
544 serviceInput.setSoftConstraints(
545 DowngradeConstraints.updateSoftConstraints(hardConstraints, softConstraints));
547 serviceInput.setHardConstraints(DowngradeConstraints.downgradeHardConstraints(hardConstraints));
549 this.pceListenerImpl.setInput(serviceInput);
550 this.pceListenerImpl.setServiceReconfigure(true);
551 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
552 this.rendererListenerImpl.setServiceInput(serviceInput);
553 this.rendererListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
554 this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
555 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
556 .ServiceDeleteInput serviceDeleteInput = ModelMappingUtils.createServiceDeleteInput(
557 new ServiceInput(deleteInputBldr.build()));
558 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
559 .ServiceDeleteOutput output = this.rendererServiceWrapper.performRenderer(serviceDeleteInput,
560 ServiceNotificationTypes.ServiceDeleteResult, null);
561 if (output == null) {
562 LOG.error(SERVICE_RESTORATION_MSG, LogMessages.RENDERER_DELETE_FAILED);
563 return ModelMappingUtils.createRestoreServiceReply(LogMessages.RENDERER_DELETE_FAILED);
565 LOG.info("RPC serviceRestore in progress...");
566 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
567 return ModelMappingUtils.createRestoreServiceReply(common.getResponseMessage());
572 public final ListenableFuture<RpcResult<EquipmentNotificationOutput>>
573 equipmentNotification(EquipmentNotificationInput input) {
574 // TODO Auto-generated method stub
575 return RpcResultBuilder.<EquipmentNotificationOutput>failed()
576 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
581 public final ListenableFuture<RpcResult<ServiceRerouteConfirmOutput>>
582 serviceRerouteConfirm(ServiceRerouteConfirmInput input) {
583 // TODO Auto-generated method stub
584 return RpcResultBuilder.<ServiceRerouteConfirmOutput>failed()
585 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
590 public final ListenableFuture<RpcResult<ServiceRerouteOutput>> serviceReroute(ServiceRerouteInput input) {
591 String serviceName = input.getServiceName();
592 LOG.info("RPC serviceReroute received for {}", serviceName);
593 Optional<Services> servicesObject = this.serviceDataStoreOperations.getService(serviceName);
594 if (servicesObject.isEmpty()) {
595 LOG.warn("serviceReroute: {}", LogMessages.serviceNotInDS(serviceName));
596 return ModelMappingUtils.createRerouteServiceReply(
597 input, ResponseCodes.FINAL_ACK_YES,
598 LogMessages.serviceNotInDS(serviceName),
599 ResponseCodes.RESPONSE_FAILED);
601 Services service = servicesObject.orElseThrow();
602 Optional<ServicePaths> servicePathsObject = this.serviceDataStoreOperations.getServicePath(serviceName);
603 if (servicePathsObject.isEmpty()) {
604 LOG.warn("serviceReroute: {}", LogMessages.servicePathNotInDS(serviceName));
605 return ModelMappingUtils.createRerouteServiceReply(
606 input, ResponseCodes.FINAL_ACK_YES,
607 LogMessages.servicePathNotInDS(serviceName),
608 ResponseCodes.RESPONSE_FAILED);
610 ServicePaths servicePaths = servicePathsObject.orElseThrow();
611 // serviceInput for later use maybe...
612 ServiceInput serviceInput = new ServiceInput(input);
613 serviceInput.setServiceAEnd(service.getServiceAEnd());
614 serviceInput.setServiceZEnd(service.getServiceZEnd());
615 serviceInput.setConnectionType(service.getConnectionType());
616 serviceInput.setCommonId(service.getCommonId());
617 serviceInput.setHardConstraints(service.getHardConstraints());
618 serviceInput.setSoftConstraints(service.getSoftConstraints());
619 serviceInput.setCustomer(service.getCustomer());
620 serviceInput.setCustomerContact(service.getCustomerContact());
622 // Get the network xpdr termination points
623 Map<AToZKey, AToZ> mapaToz = servicePaths.getPathDescription().getAToZDirection().getAToZ();
624 String aendtp = ((TerminationPoint) mapaToz.get(new AToZKey(String.valueOf(mapaToz.size() - 3)))
628 String zendtp = ((TerminationPoint) mapaToz.get(new AToZKey("2"))
633 PathComputationRerouteRequestOutput output = this.pceServiceWrapper.performPCEReroute(
634 service.getHardConstraints(), service.getSoftConstraints(), input.getSdncRequestHeader(),
635 service.getServiceAEnd(), service.getServiceZEnd(),
636 new EndpointsBuilder().setAEndTp(aendtp).setZEndTp(zendtp).build());
638 if (output == null) {
639 LOG.error("serviceReroute: {}", LogMessages.PCE_FAILED);
640 return ModelMappingUtils.createRerouteServiceReply(
641 input, ResponseCodes.FINAL_ACK_YES,
642 LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED);
644 LOG.info("RPC ServiceReroute is done");
645 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
646 return ModelMappingUtils.createRerouteServiceReply(input, common.getAckFinalIndicator(),
647 common.getResponseMessage(), common.getResponseCode());
651 public final ListenableFuture<RpcResult<ServiceReversionOutput>> serviceReversion(ServiceReversionInput input) {
652 // TODO Auto-generated method stub
653 return RpcResultBuilder.<ServiceReversionOutput>failed()
654 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
659 public final ListenableFuture<RpcResult<ServiceRollOutput>> serviceRoll(ServiceRollInput input) {
660 // TODO Auto-generated method stub
661 return RpcResultBuilder.<ServiceRollOutput>failed()
662 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
667 public final ListenableFuture<RpcResult<NetworkReOptimizationOutput>>
668 networkReOptimization(NetworkReOptimizationInput input) {
669 // TODO Auto-generated method stub
670 return RpcResultBuilder.<NetworkReOptimizationOutput>failed()
671 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
676 public final ListenableFuture<RpcResult<TempServiceDeleteOutput>> tempServiceDelete(TempServiceDeleteInput input) {
677 String commonId = input.getCommonId();
678 LOG.info("RPC temp serviceDelete request received for {}", commonId);
681 * Upon receipt of service-deleteService RPC, service header and sdnc-request
682 * header compliance are verified.
684 LOG.debug("checking Service Compliance ...");
685 ComplianceCheckResult serviceHandlerCheckResult = ServicehandlerComplianceCheck.check(
686 commonId, null, null, RpcActions.ServiceDelete, false, false
688 if (!serviceHandlerCheckResult.hasPassed()) {
689 LOG.warn(TEMP_SERVICE_DELETE_MSG, LogMessages.ABORT_SERVICE_NON_COMPLIANT);
690 return ModelMappingUtils.createDeleteServiceReply(
691 input, ResponseCodes.FINAL_ACK_YES,
692 LogMessages.SERVICE_NON_COMPLIANT, ResponseCodes.RESPONSE_FAILED);
695 //Check presence of service to be deleted
696 LOG.debug("service common-id '{}' is compliant", commonId);
697 Optional<org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.temp.service.list.Services>
699 this.serviceDataStoreOperations.getTempService(commonId);
700 if (serviceOpt.isEmpty()) {
701 LOG.error(TEMP_SERVICE_DELETE_MSG, LogMessages.serviceNotInDS(commonId));
702 return ModelMappingUtils.createDeleteServiceReply(
703 input, ResponseCodes.FINAL_ACK_YES,
704 LogMessages.serviceNotInDS(commonId), ResponseCodes.RESPONSE_FAILED);
706 LOG.info("Service '{}' present in datastore !", commonId);
707 this.pceListenerImpl.setInput(new ServiceInput(input));
708 this.pceListenerImpl.setServiceReconfigure(false);
709 this.pceListenerImpl.setTempService(true);
710 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
711 this.rendererListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
712 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
713 this.rendererListenerImpl.setTempService(true);
714 this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
715 org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526
716 .temp.service.list.Services service = serviceOpt.orElseThrow();
717 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteOutput output =
718 this.rendererServiceWrapper.performRenderer(input, ServiceNotificationTypes.ServiceDeleteResult,
720 if (output == null) {
721 LOG.error(TEMP_SERVICE_DELETE_MSG, LogMessages.RENDERER_DELETE_FAILED);
722 return ModelMappingUtils.createDeleteServiceReply(
723 input, ResponseCodes.FINAL_ACK_YES,
724 LogMessages.RENDERER_DELETE_FAILED, ResponseCodes.RESPONSE_FAILED);
726 LOG.info("RPC tempServiceDelete in progress...");
727 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
728 return ModelMappingUtils.createDeleteServiceReply(
729 input, common.getAckFinalIndicator(),
730 common.getResponseMessage(), common.getResponseCode());
734 public final ListenableFuture<RpcResult<TempServiceCreateOutput>> tempServiceCreate(TempServiceCreateInput input) {
735 LOG.info("RPC tempServiceCreate received");
737 OperationResult validationResult = ServiceCreateValidation.validateServiceCreateRequest(
738 new ServiceInput(input), RpcActions.TempServiceCreate);
739 if (! validationResult.isSuccess()) {
740 LOG.warn(TEMP_SERVICE_CREATE_MSG, LogMessages.ABORT_VALID_FAILED);
741 return ModelMappingUtils.createCreateServiceReply(
742 input, ResponseCodes.FINAL_ACK_YES,
743 validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
746 //Check any presence of temp-service with the same commonId
747 String commonId = input.getCommonId();
748 if (this.serviceDataStoreOperations.getTempService(commonId).isPresent()) {
749 LOG.warn(TEMP_SERVICE_CREATE_MSG, LogMessages.serviceInDS("Temp (" + commonId + ")"));
750 return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
751 LogMessages.serviceInDS("Temp (" + commonId + ")"), ResponseCodes.RESPONSE_FAILED);
754 // Starting service create operation
755 LOG.debug(TEMP_SERVICE_CREATE_MSG, LogMessages.PCE_CALLING);
756 this.pceListenerImpl.setInput(new ServiceInput(input));
757 this.pceListenerImpl.setServiceReconfigure(false);
758 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
759 this.pceListenerImpl.setTempService(true);
760 this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
761 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
762 this.rendererListenerImpl.setTempService(true);
763 this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
764 PathComputationRequestOutput output = this.pceServiceWrapper.performPCE(input, true);
765 if (output == null) {
766 LOG.warn(TEMP_SERVICE_CREATE_MSG, LogMessages.ABORT_PCE_FAILED);
767 return ModelMappingUtils.createCreateServiceReply(
768 input, ResponseCodes.FINAL_ACK_YES,
769 LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED);
771 LOG.info("RPC tempServiceCreate in progress...");
772 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
773 return ModelMappingUtils.createCreateServiceReply(
774 input, common.getAckFinalIndicator(),
775 common.getResponseMessage(), common.getResponseCode());
779 public final ListenableFuture<RpcResult<
780 ServiceDeleteComplexResultNotificationRequestOutput>> serviceDeleteComplexResultNotificationRequest(
781 ServiceDeleteComplexResultNotificationRequestInput input) {
782 // TODO Auto-generated method stub
783 return RpcResultBuilder.<ServiceDeleteComplexResultNotificationRequestOutput>failed()
784 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
789 public final ListenableFuture<RpcResult<
790 ServiceCreateResultNotificationRequestOutput>> serviceCreateResultNotificationRequest(
791 ServiceCreateResultNotificationRequestInput input) {
792 // TODO Auto-generated method stub
793 return RpcResultBuilder.<ServiceCreateResultNotificationRequestOutput>failed()
794 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
799 public final ListenableFuture<RpcResult<
800 ServiceDeleteResultNotificationRequestOutput>> serviceDeleteResultNotificationRequest(
801 ServiceDeleteResultNotificationRequestInput input) {
802 // TODO Auto-generated method stub
803 return RpcResultBuilder.<ServiceDeleteResultNotificationRequestOutput>failed()
804 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
809 public final ListenableFuture<RpcResult<
810 ServiceCreateComplexResultNotificationRequestOutput>> serviceCreateComplexResultNotificationRequest(
811 ServiceCreateComplexResultNotificationRequestInput input) {
812 // TODO Auto-generated method stub
813 return RpcResultBuilder.<ServiceCreateComplexResultNotificationRequestOutput>failed()
814 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
819 public final ListenableFuture<RpcResult<ServiceFeasibilityCheckBulkOutput>> serviceFeasibilityCheckBulk(
820 ServiceFeasibilityCheckBulkInput input) {
821 // TODO Auto-generated method stub
822 return RpcResultBuilder.<ServiceFeasibilityCheckBulkOutput>failed()
823 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
828 public final ListenableFuture<RpcResult<ServiceCreateBulkOutput>> serviceCreateBulk(ServiceCreateBulkInput input) {
829 // TODO Auto-generated method stub
830 return RpcResultBuilder.<ServiceCreateBulkOutput>failed()
831 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
836 public final ListenableFuture<RpcResult<TempServiceCreateBulkOutput>> tempServiceCreateBulk(
837 TempServiceCreateBulkInput input) {
838 // TODO Auto-generated method stub
839 return RpcResultBuilder.<TempServiceCreateBulkOutput>failed()
840 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
845 public final ListenableFuture<RpcResult<
846 ServiceRollResultNotificationRequestOutput>> serviceRollResultNotificationRequest(
847 ServiceRollResultNotificationRequestInput input) {
848 // TODO Auto-generated method stub
849 return RpcResultBuilder.<ServiceRollResultNotificationRequestOutput>failed()
850 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
855 public final ListenableFuture<RpcResult<ServiceReconfigureBulkOutput>> serviceReconfigureBulk(
856 ServiceReconfigureBulkInput input) {
857 // TODO Auto-generated method stub
858 return RpcResultBuilder.<ServiceReconfigureBulkOutput>failed()
859 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
864 public final ListenableFuture<RpcResult<ServiceReconfigureResultNotificationRequestOutput>>
865 serviceReconfigureResultNotificationRequest(ServiceReconfigureResultNotificationRequestInput input) {
866 // TODO Auto-generated method stub
867 return RpcResultBuilder.<ServiceReconfigureResultNotificationRequestOutput>failed()
868 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
873 public final ListenableFuture<RpcResult<ServiceRestorationResultNotificationRequestOutput>>
874 serviceRestorationResultNotificationRequest(ServiceRestorationResultNotificationRequestInput input) {
875 // TODO Auto-generated method stub
876 return RpcResultBuilder.<ServiceRestorationResultNotificationRequestOutput>failed()
877 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
882 public final ListenableFuture<RpcResult<ServiceReversionResultNotificationRequestOutput>>
883 serviceReversionResultNotificationRequest(ServiceReversionResultNotificationRequestInput input) {
884 // TODO Auto-generated method stub
885 return RpcResultBuilder.<ServiceReversionResultNotificationRequestOutput>failed()
886 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
891 public final ListenableFuture<RpcResult<ServiceRerouteConfirmResultNotificationRequestOutput>>
892 serviceRerouteConfirmResultNotificationRequest(ServiceRerouteConfirmResultNotificationRequestInput input) {
893 // TODO Auto-generated method stub
894 return RpcResultBuilder.<ServiceRerouteConfirmResultNotificationRequestOutput>failed()
895 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
900 public final ListenableFuture<RpcResult<
901 OpticalTunnelCreateOutput>> opticalTunnelCreate(OpticalTunnelCreateInput input) {
902 // TODO Auto-generated method stub
903 return RpcResultBuilder.<OpticalTunnelCreateOutput>failed()
904 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
909 public final ListenableFuture<RpcResult<OpticalTunnelRequestCancelOutput>> opticalTunnelRequestCancel(
910 OpticalTunnelRequestCancelInput input) {
911 // TODO Auto-generated method stub
912 return RpcResultBuilder.<OpticalTunnelRequestCancelOutput>failed()
913 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
919 * Implementation of the RPC to set OR operational modes in the catalog of the controller.
920 * Semantics of the RPC is such that the information in the input replaces the full content
921 * of the OR operational modes catalog in the config data store. Incremental changes to the
922 * catalog, if required, must be done via individual PUT/POST/DELETE RESTconf APIs.
924 * @param input AddOpenroadmOperationalModesToCatalogInput to be added to Catalog
925 * @return Result of the request
927 public final ListenableFuture<RpcResult<AddOpenroadmOperationalModesToCatalogOutput>>
928 addOpenroadmOperationalModesToCatalog(AddOpenroadmOperationalModesToCatalogInput input) {
930 LOG.info("RPC addOpenroadmOperationalModesToCatalog in progress");
931 LOG.debug(" Input openRoadm {}", input);
933 OperationResult validationResult = CatalogValidation.validateORCatalogRequest(
934 new CatalogInput(input), RpcActions.FillCatalogWithOrOperationalModes);
935 if (! validationResult.isSuccess()) {
936 LOG.warn(ADD_OR_TO_CATALOG_MSG, LogMessages.ABORT_OR_TO_CATALOG_FAILED);
937 return ModelMappingUtils.addOpenroadmServiceReply(
938 input, ResponseCodes.FINAL_ACK_YES,
939 validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
941 LOG.info(" Request System Id {} " ,input.getSdncRequestHeader().getRequestSystemId());
942 LOG.info(" Rpc Action {} " ,input.getSdncRequestHeader().getRpcAction());
944 OpenroadmOperationalModes objToSave = CatalogMapper.createORModesToSave(input);
945 catalogDataStoreOperations.addOpenroadmOperationalModesToCatalog(objToSave);
946 LOG.info("RPC addOpenroadmOperationalModesToCatalog Completed");
947 return ModelMappingUtils.addOpenroadmServiceReply(input, ResponseCodes.FINAL_ACK_YES,
948 validationResult.getResultMessage(), ResponseCodes.RESPONSE_OK);
953 * Implementation of the RPC to set specific operational modes in the catalog of the controller.
954 * Semantics of the RPC is such that the information in the input replaces the full content
955 * of the specific operational modes catalog in the config data store. Incremental changes to the
956 * catalog, if required, must be done via individual PUT/POST/DELETE RESTconf APIs.
958 * @param input AddSpecificOperationalModesToCatalogInput to be added to Catalog
959 * @return Result of the request
961 public final ListenableFuture<RpcResult<AddSpecificOperationalModesToCatalogOutput>>
962 addSpecificOperationalModesToCatalog(AddSpecificOperationalModesToCatalogInput input) {
964 LOG.info("RPC addSpecificOperationalModesToCatalog in progress");
965 LOG.debug(" Input openSpecificRoadm {}", input);
967 OperationResult validationResult = CatalogValidation.validateSpecificCatalogRequest(
968 new CatalogInput(input), RpcActions.FillCatalogWithSpecificOperationalModes);
969 if (! validationResult.isSuccess()) {
970 LOG.warn(ADD_SPECIFIC_TO_CATALOG_MSG, LogMessages.ABORT_SPECIFIC_TO_CATALOG_FAILED);
971 return ModelMappingUtils.addSpecificOpenroadmServiceReply(
972 input, ResponseCodes.FINAL_ACK_YES,
973 validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
975 LOG.info(" Request System Id {} " ,input.getSdncRequestHeader().getRequestSystemId());
976 LOG.info(" Rpc Action {} " ,input.getSdncRequestHeader().getRpcAction());
978 SpecificOperationalModes objToSave = CatalogMapper.createSpecificModesToSave(input);
979 catalogDataStoreOperations.addSpecificOperationalModesToCatalog(objToSave);
980 LOG.info("RPC addSpecificOperationalModesToCatalog Completed");
981 return ModelMappingUtils.addSpecificOpenroadmServiceReply(input, ResponseCodes.FINAL_ACK_YES,
982 validationResult.getResultMessage(), ResponseCodes.RESPONSE_OK);
986 public final ListenableFuture<RpcResult<ServiceSrlgGetOutput>> serviceSrlgGet(ServiceSrlgGetInput input) {
987 // TODO Auto-generated method stub
988 return RpcResultBuilder.<ServiceSrlgGetOutput>failed()
989 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
994 public final ListenableFuture<RpcResult<EndTerminalPerformanceInfoRequestOutput>> endTerminalPerformanceInfoRequest(
995 EndTerminalPerformanceInfoRequestInput input) {
996 // TODO Auto-generated method stub
997 return RpcResultBuilder.<EndTerminalPerformanceInfoRequestOutput>failed()
998 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
1003 public final ListenableFuture<RpcResult<EndTerminalActivationRequestOutput>> endTerminalActivationRequest(
1004 EndTerminalActivationRequestInput input) {
1005 // TODO Auto-generated method stub
1006 return RpcResultBuilder.<EndTerminalActivationRequestOutput>failed()
1007 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
1012 public final ListenableFuture<RpcResult<EndTerminalDeactivationRequestOutput>> endTerminalDeactivationRequest(
1013 EndTerminalDeactivationRequestInput input) {
1014 // TODO Auto-generated method stub
1015 return RpcResultBuilder.<EndTerminalDeactivationRequestOutput>failed()
1016 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
1021 public final ListenableFuture<RpcResult<EndTerminalPowerControlOutput>> endTerminalPowerControl(
1022 EndTerminalPowerControlInput input) {
1023 // TODO Auto-generated method stub
1024 return RpcResultBuilder.<EndTerminalPowerControlOutput>failed()
1025 .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
1029 public Registration getRegisteredRpc() {
1034 * Send notification to NBI notification in order to publish message.
1035 * @param service PublishNotificationService
1037 private void sendNbiNotification(PublishNotificationProcessService service) {
1039 notificationPublishService.putNotification(service);
1040 } catch (InterruptedException e) {
1041 LOG.warn("Cannot send notification to nbi", e);
1042 Thread.currentThread().interrupt();
1046 private ImmutableClassToInstanceMap<Rpc<?, ?>> registerRPCs() {
1047 return ImmutableClassToInstanceMap.<Rpc<?, ?>>builder()
1048 .put(ServiceCreate.class, this::serviceCreate)
1049 .put(ServiceDelete.class, this::serviceDelete)
1050 .put(ServiceFeasibilityCheck.class, this::serviceFeasibilityCheck)
1051 .put(ServiceReconfigure.class, this::serviceReconfigure)
1052 .put(ServiceRestoration.class, this::serviceRestoration)
1053 .put(EquipmentNotification.class, this::equipmentNotification)
1054 .put(ServiceRerouteConfirm.class, this::serviceRerouteConfirm)
1055 .put(ServiceReroute.class, this::serviceReroute)
1056 .put(ServiceReversion.class, this::serviceReversion)
1057 .put(ServiceRoll.class, this::serviceRoll)
1058 .put(NetworkReOptimization.class, this::networkReOptimization)
1059 .put(TempServiceDelete.class, this::tempServiceDelete)
1060 .put(TempServiceCreate.class, this::tempServiceCreate)
1061 .put(ServiceDeleteComplexResultNotificationRequest.class,
1062 this::serviceDeleteComplexResultNotificationRequest)
1063 .put(ServiceCreateResultNotificationRequest.class, this::serviceCreateResultNotificationRequest)
1064 .put(ServiceDeleteResultNotificationRequest.class, this::serviceDeleteResultNotificationRequest)
1065 .put(ServiceCreateComplexResultNotificationRequest.class,
1066 this::serviceCreateComplexResultNotificationRequest)
1067 .put(ServiceFeasibilityCheckBulk.class, this::serviceFeasibilityCheckBulk)
1068 .put(ServiceCreateBulk.class, this::serviceCreateBulk)
1069 .put(TempServiceCreateBulk.class, this::tempServiceCreateBulk)
1070 .put(ServiceRollResultNotificationRequest.class, this::serviceRollResultNotificationRequest)
1071 .put(ServiceReconfigureBulk.class, this::serviceReconfigureBulk)
1072 .put(ServiceReconfigureResultNotificationRequest.class, this::serviceReconfigureResultNotificationRequest)
1073 .put(ServiceRestorationResultNotificationRequest.class, this::serviceRestorationResultNotificationRequest)
1074 .put(ServiceReversionResultNotificationRequest.class, this::serviceReversionResultNotificationRequest)
1075 .put(ServiceRerouteConfirmResultNotificationRequest.class,
1076 this::serviceRerouteConfirmResultNotificationRequest)
1077 .put(OpticalTunnelCreate.class, this::opticalTunnelCreate)
1078 .put(OpticalTunnelRequestCancel.class, this::opticalTunnelRequestCancel)
1079 .put(AddOpenroadmOperationalModesToCatalog.class, this::addOpenroadmOperationalModesToCatalog)
1080 .put(AddSpecificOperationalModesToCatalog.class, this::addSpecificOperationalModesToCatalog)
1081 .put(ServiceSrlgGet.class, this::serviceSrlgGet)
1082 .put(EndTerminalPerformanceInfoRequest.class, this::endTerminalPerformanceInfoRequest)
1083 .put(EndTerminalActivationRequest.class, this::endTerminalActivationRequest)
1084 .put(EndTerminalDeactivationRequest.class, this::endTerminalDeactivationRequest)
1085 .put(EndTerminalPowerControl.class, this::endTerminalPowerControl)