private final OtnDeviceRendererService otnDeviceRenderer;
private final OtnServicePathInput otnServicePathInput;
+ private final String serviceType;
public OtnDeviceRenderingTask(OtnDeviceRendererService otnDeviceRendererService,
- OtnServicePathInput otnServicePathInput) {
+ OtnServicePathInput otnServicePathInput, String serviceType) {
this.otnDeviceRenderer = otnDeviceRendererService;
this.otnServicePathInput = otnServicePathInput;
+ this.serviceType = serviceType;
}
@Override
public OtnDeviceRenderingResult call() throws Exception {
OtnServicePathOutput output;
+ String operation;
switch (this.otnServicePathInput.getOperation()) {
case Create:
- output = this.otnDeviceRenderer.setupOtnServicePath(this.otnServicePathInput);
- if (!output.getSuccess()) {
- LOG.error("Device rendering setup otn service path failed.");
- return OtnDeviceRenderingResult.failed("Operation Failed");
- }
- LOG.info("Device rendering setup otn service path finished successfully.");
- return OtnDeviceRenderingResult.ok(new ArrayList<>(output.nonnullNodeInterface().values()),
- new ArrayList<>(output.nonnullLinkTp()));
+ operation = "setup";
+ output = this.otnDeviceRenderer.setupOtnServicePath(this.otnServicePathInput, this.serviceType);
+ break;
case Delete:
- output = this.otnDeviceRenderer.deleteOtnServicePath(this.otnServicePathInput);
- if (!output.getSuccess()) {
- LOG.error("Device rendering delete otn service path failed.");
- return OtnDeviceRenderingResult.failed("Operation Failed");
- }
- LOG.info("Device rendering delete otn service path finished successfully.");
- return OtnDeviceRenderingResult.ok(new ArrayList<>(output.nonnullNodeInterface().values()),
- new ArrayList<>(output.nonnullLinkTp()));
+ operation = "delete";
+ output = this.otnDeviceRenderer.deleteOtnServicePath(this.otnServicePathInput, this.serviceType);
+ break;
default:
- return OtnDeviceRenderingResult.failed("Device rendering failed - unknwon operation");
+ return OtnDeviceRenderingResult.failed("Device rendering failed - unknown operation");
}
+ if (!output.getSuccess()) {
+ LOG.error("Device rendering {} otn service path failed.", operation);
+ return OtnDeviceRenderingResult.failed("Operation Failed");
+ }
+ LOG.info("Device rendering {} otn service path finished successfully.", operation);
+ return OtnDeviceRenderingResult.ok(new ArrayList<>(output.nonnullNodeInterface().values()),
+ new ArrayList<>(output.nonnullLinkTp()));
}
}