+ private void trySetResponseMessage(VfModuleTopologyOperationOutputBuilder responseBuilder, ErrorObject error) {
+ if (!error.getMessage().isEmpty()) {
+ responseBuilder.setResponseMessage(error.getMessage());
+ }
+ }
+
+ private void trySaveService(VfModuleTopologyOperationInput input, ServiceBuilder serviceBuilder) {
+ if (isValidRequest(input) &&
+ (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Unassign) ||
+ input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Activate))) {
+ // Only update operational tree on activate or delete
+
+ log.info(UPDATING_TREE_INFO_MESSAGE);
+ saveService(serviceBuilder.build(), false, LogicalDatastoreType.OPERATIONAL);
+ }
+ }
+
+ private void trySetSvcRequestId(VfModuleTopologyOperationInput input,
+ VfModuleTopologyOperationOutputBuilder responseBuilder) {
+ if (input.getSdncRequestHeader() != null) {
+ responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
+ }
+ }
+
+ private boolean hasInvalidVfModule(VfModuleTopologyOperationInput input) {
+ return input.getVfModuleInformation() == null || input.getVfModuleInformation().getVfModuleId() == null
+ || input.getVfModuleInformation().getVfModuleId().length() == 0;
+ }
+
+ private boolean hasInvalidVnf(VfModuleTopologyOperationInput input) {
+ return input.getVnfInformation() == null || input.getVnfInformation().getVnfId() == null
+ || input.getVnfInformation().getVnfId().length() == 0;
+ }
+
+ private boolean hasInvalidService(VfModuleTopologyOperationInput input) {
+ return input == null || input.getServiceInformation() == null
+ || input.getServiceInformation().getServiceInstanceId() == null
+ || input.getServiceInformation().getServiceInstanceId().length() == 0;
+ }
+