- if (readService.isPresent()) {
- try {
- WriteTransaction writeTx = this.dataBroker.newWriteOnlyTransaction();
- InstanceIdentifier<org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.temp.service.list
- .Services> iid = InstanceIdentifier.create(TempServiceList.class)
- .child(org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.temp.service.list
- .Services.class, new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531
- .temp.service.list.ServicesKey(serviceName));
- org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.temp.service.list
- .Services services = new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.temp
- .service.list.ServicesBuilder(readService.get()).setOperationalState(operationalState)
- .setAdministrativeState(administrativeState)
- .build();
- writeTx.merge(LogicalDatastoreType.OPERATIONAL, iid, services);
- writeTx.commit().get(Timeouts.DATASTORE_WRITE, TimeUnit.MILLISECONDS);
- return OperationResult.ok(SUCCESSFUL_MESSAGE);
- } catch (TimeoutException | InterruptedException | ExecutionException e) {
- String message = "Failed to modify temp service " + serviceName + " from Temp Service List";
- LOG.warn(message, e);
- return OperationResult.failed(message);
- }
- } else {
- String message = "Temp Service " + serviceName + " is not present!";
- LOG.warn(message);
- return OperationResult.failed(message);
+ if (!readService.isPresent()) {
+ LOG.warn("modifyTempService: {}", LogMessages.SERVICE_NOT_FOUND);
+ return OperationResult.failed(LogMessages.SERVICE_NOT_FOUND);
+ }
+ try {
+ WriteTransaction writeTx = this.dataBroker.newWriteOnlyTransaction();
+ InstanceIdentifier<org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.temp.service.list
+ .Services> iid = InstanceIdentifier.create(TempServiceList.class)
+ .child(org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.temp.service.list
+ .Services.class, new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531
+ .temp.service.list.ServicesKey(serviceName));
+ org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.temp.service.list
+ .Services services = new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.temp
+ .service.list.ServicesBuilder(readService.get()).setOperationalState(operationalState)
+ .setAdministrativeState(administrativeState)
+ .build();
+ writeTx.merge(LogicalDatastoreType.OPERATIONAL, iid, services);
+ writeTx.commit().get(Timeouts.DATASTORE_WRITE, TimeUnit.MILLISECONDS);
+ return OperationResult.ok(LogMessages.SUCCESSFUL_MESSAGE);
+ } catch (TimeoutException | InterruptedException | ExecutionException e) {
+ LOG.warn("modifyTempService : {}", LogMessages.failedTo("modify Temp", serviceName), e);
+ return OperationResult.failed(LogMessages.failedTo("modify Temp", serviceName));