diff options
author | 2021-05-01 13:33:34 -0400 | |
---|---|---|
committer | 2021-05-01 13:33:34 -0400 | |
commit | e60be23a762ef1b1f93d3717d0f1d88ae2d94a33 (patch) | |
tree | 52aa4a83285476fced019e7fb0410d1a864c153a /ms/gra/gra-app | |
parent | 2895f181a0cb648d2eb9b258ce86d4e38855c7e2 (diff) |
Remove unneeded preload operational data
Preload data is never used from operational tree - only config tree.
Change-Id: I8189952ea3595ffc4fedbf27c2034f41c243bf5b
Issue-ID: SDNC-1517
Signed-off-by: Dan Timoney <dtimoney@att.com>
Diffstat (limited to 'ms/gra/gra-app')
6 files changed, 0 insertions, 291 deletions
diff --git a/ms/gra/gra-app/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/OperationalApiController.java b/ms/gra/gra-app/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/OperationalApiController.java index aeecd63..d05a35b 100644 --- a/ms/gra/gra-app/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/OperationalApiController.java +++ b/ms/gra/gra-app/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/OperationalApiController.java @@ -33,9 +33,6 @@ public class OperationalApiController implements OperationalApi { private final HttpServletRequest request; @Autowired - private OperationalPreloadDataRepository operationalPreloadDataRepository; - - @Autowired private OperationalServicesRepository operationalServicesRepository; @Autowired @@ -56,67 +53,6 @@ public class OperationalApiController implements OperationalApi { return Optional.ofNullable(request); } - - @Override - public ResponseEntity<GenericResourceApiPreloadModelInformation> operationalGENERICRESOURCEAPIpreloadInformationGet() { - GenericResourceApiPreloadModelInformation genericResourceApiPreloadModelInformation = new GenericResourceApiPreloadModelInformation(); - - operationalPreloadDataRepository.findAll().forEach(configPreloadData -> { - GenericResourceApiPreloadmodelinformationPreloadList preloadListItem = new GenericResourceApiPreloadmodelinformationPreloadList(); - - preloadListItem.setPreloadId(configPreloadData.getPreloadId()); - preloadListItem.setPreloadType(configPreloadData.getPreloadType()); - try { - preloadListItem.setPreloadData(objectMapper.readValue(configPreloadData.getPreloadData(), GenericResourceApiPreloaddataPreloadData.class)); - } catch (JsonProcessingException e) { - log.error("Could not convert preload data", e); - } - genericResourceApiPreloadModelInformation.addPreloadListItem(preloadListItem); - }); - - - return new ResponseEntity<>(genericResourceApiPreloadModelInformation, HttpStatus.OK); - } - - - @Override - public ResponseEntity<GenericResourceApiPreloadmodelinformationPreloadList> operationalGENERICRESOURCEAPIpreloadInformationPreloadListPreloadIdPreloadTypeGet(String preloadId, String preloadType) { - List<OperationalPreloadData> preloadData = operationalPreloadDataRepository.findByPreloadIdAndPreloadType(preloadId, preloadType); - if (preloadData != null) { - if (!preloadData.isEmpty()) { - OperationalPreloadData preloadDataItem = preloadData.get(0); - GenericResourceApiPreloadmodelinformationPreloadList preloadDataList = new GenericResourceApiPreloadmodelinformationPreloadList(); - preloadDataList.setPreloadId(preloadDataItem.getPreloadId()); - preloadDataList.setPreloadType(preloadDataItem.getPreloadType()); - try { - preloadDataList.setPreloadData(objectMapper.readValue(preloadDataItem.getPreloadData(), GenericResourceApiPreloaddataPreloadData.class)); - } catch (JsonProcessingException e) { - log.error("Cannot convert preload data", e); - } - return new ResponseEntity<>(preloadDataList, HttpStatus.OK); - } - } - return new ResponseEntity<>(HttpStatus.NOT_FOUND); - } - - - @Override - public ResponseEntity<GenericResourceApiPreloaddataPreloadData> operationalGENERICRESOURCEAPIpreloadInformationPreloadListPreloadIdPreloadTypePreloadDataGet(String preloadId, String preloadType) { - List<OperationalPreloadData> preloadData = operationalPreloadDataRepository.findByPreloadIdAndPreloadType(preloadId, preloadType); - if (preloadData != null) { - if (!preloadData.isEmpty()) { - OperationalPreloadData preloadDataItem = preloadData.get(0); - try { - return new ResponseEntity<>(objectMapper.readValue(preloadDataItem.getPreloadData(), GenericResourceApiPreloaddataPreloadData.class), HttpStatus.OK); - } catch (JsonProcessingException e) { - log.error("Cannot convert preload data", e); - } - } - } - return new ResponseEntity<>(HttpStatus.NOT_FOUND); - } - - @Override public ResponseEntity<GenericResourceApiServiceModelInfrastructure> operationalGENERICRESOURCEAPIservicesGet() { GenericResourceApiServiceModelInfrastructure modelInfrastructure = new GenericResourceApiServiceModelInfrastructure(); diff --git a/ms/gra/gra-app/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/OperationsApiController.java b/ms/gra/gra-app/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/OperationsApiController.java index 6b0a463..707c04a 100644 --- a/ms/gra/gra-app/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/OperationsApiController.java +++ b/ms/gra/gra-app/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/OperationsApiController.java @@ -54,8 +54,6 @@ import org.onap.sdnc.apps.ms.gra.data.ConfigVfModulesRepository; import org.onap.sdnc.apps.ms.gra.data.ConfigVnfsRepository; import org.onap.sdnc.apps.ms.gra.data.OperationalContrailRouteAllottedResourcesRepository; import org.onap.sdnc.apps.ms.gra.data.OperationalPortMirrorConfigurationsRepository; -import org.onap.sdnc.apps.ms.gra.data.OperationalPreloadData; -import org.onap.sdnc.apps.ms.gra.data.OperationalPreloadDataRepository; import org.onap.sdnc.apps.ms.gra.data.OperationalServices; import org.onap.sdnc.apps.ms.gra.data.OperationalServicesRepository; import org.onap.sdnc.apps.ms.gra.swagger.OperationsApi; @@ -137,9 +135,6 @@ public class OperationsApiController implements OperationsApi { private ConfigPreloadDataRepository configPreloadDataRepository; @Autowired - private OperationalPreloadDataRepository operationalPreloadDataRepository; - - @Autowired private ConfigServicesRepository configServicesRepository; @Autowired @@ -259,19 +254,6 @@ public class OperationsApiController implements OperationsApi { return new ResponseEntity<>(retval, HttpStatus.INTERNAL_SERVER_ERROR); } - // Add operational tree data to SvcLogicContext - try { - preloadData = getOperationalPreloadData(preloadId, preloadType); - ctxIn.mergeJson("operational-data", objectMapper.writeValueAsString(preloadData)); - } catch (JsonProcessingException e) { - log.error("exiting {} due to parse error on saved operational preload data", svcOperation); - resp.setResponseCode("500"); - resp.setResponseMessage("internal error"); - resp.setAckFinalIndicator("Y"); - retval.setOutput(resp); - return new ResponseEntity<>(retval, HttpStatus.INTERNAL_SERVER_ERROR); - } - // Call DG try { // Any of these can throw a nullpointer exception @@ -290,7 +272,6 @@ public class OperationsApiController implements OperationsApi { GenericResourceApiPreloaddataPreloadData preloadToLoad = objectMapper.readValue(ctxJson, GenericResourceApiPreloaddataPreloadData.class); saveConfigPreloadData(preloadId, preloadType, preloadToLoad); - saveOperationalPreloadData(preloadId, preloadType, preloadToLoad); } } catch (NullPointerException npe) { @@ -374,19 +355,6 @@ public class OperationsApiController implements OperationsApi { return new ResponseEntity<>(retval, HttpStatus.INTERNAL_SERVER_ERROR); } - // Add operational tree data to SvcLogicContext - try { - preloadData = getOperationalPreloadData(preloadId, preloadType); - ctxIn.mergeJson("operational-data", objectMapper.writeValueAsString(preloadData)); - } catch (JsonProcessingException e) { - log.error("exiting {} due to parse error on saved operational preload data", svcOperation); - resp.setResponseCode("500"); - resp.setResponseMessage("internal error"); - resp.setAckFinalIndicator("Y"); - retval.setOutput(resp); - return new ResponseEntity<>(retval, HttpStatus.INTERNAL_SERVER_ERROR); - } - // Call DG try { // Any of these can throw a nullpointer exception @@ -404,7 +372,6 @@ public class OperationsApiController implements OperationsApi { GenericResourceApiPreloaddataPreloadData preloadToLoad = objectMapper.readValue(ctxJson, GenericResourceApiPreloaddataPreloadData.class); saveConfigPreloadData(preloadId, preloadType, preloadToLoad); - saveOperationalPreloadData(preloadId, preloadType, preloadToLoad); } } catch (NullPointerException npe) { @@ -514,20 +481,6 @@ public class OperationsApiController implements OperationsApi { } } - private GenericResourceApiPreloaddataPreloadData getOperationalPreloadData(String preloadId, String preloadType) - throws JsonProcessingException { - - List<OperationalPreloadData> configPreloadData = operationalPreloadDataRepository - .findByPreloadIdAndPreloadType(preloadId, preloadType); - - if (configPreloadData.isEmpty()) { - return (null); - } else { - return (objectMapper.readValue(configPreloadData.get(0).getPreloadData(), - GenericResourceApiPreloaddataPreloadData.class)); - } - } - private void saveConfigPreloadData(String preloadId, String preloadType, GenericResourceApiPreloaddataPreloadData preloadData) throws JsonProcessingException { @@ -537,16 +490,6 @@ public class OperationsApiController implements OperationsApi { } - private void saveOperationalPreloadData(String preloadId, String preloadType, - GenericResourceApiPreloaddataPreloadData preloadData) throws JsonProcessingException { - - operationalPreloadDataRepository.deleteByPreloadIdAndPreloadType(preloadId, preloadType); - operationalPreloadDataRepository - .save(new OperationalPreloadData(preloadId, preloadType, objectMapper.writeValueAsString(preloadData))); - - } - - @Override public ResponseEntity<GenericResourceApiNetworkTopologyOperation> operationsGENERICRESOURCEAPInetworkTopologyOperationPost( @Valid GenericResourceApiNetworkOperationInformationBodyparam input) throws RestException { diff --git a/ms/gra/gra-app/src/main/java/org/onap/sdnc/apps/ms/gra/data/OperationalPreloadData.java b/ms/gra/gra-app/src/main/java/org/onap/sdnc/apps/ms/gra/data/OperationalPreloadData.java deleted file mode 100644 index c63926d..0000000 --- a/ms/gra/gra-app/src/main/java/org/onap/sdnc/apps/ms/gra/data/OperationalPreloadData.java +++ /dev/null @@ -1,81 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SDNC - * ================================================================================ - * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.sdnc.apps.ms.gra.data; - -import org.hibernate.validator.constraints.Length; - -import javax.persistence.*; - -@Entity(name = "OPERATIONAL_PRELOAD_DATA") -@Table(name="OPERATIONAL_PRELOAD_DATA") -@IdClass(PreloadDataKey.class) -public class OperationalPreloadData { - - @Id - @Length(max = 100) - @Column(length = 100) - private String preloadId; - - @Id - @Length(max = 25) - @Column(length = 25) - private String preloadType; - - @Lob - @Column(length=10000) - private String preloadData; - - public OperationalPreloadData() { - this.preloadId = ""; - this.preloadType = ""; - this.preloadData = ""; - } - - public OperationalPreloadData(String preloadId, String preloadType, String preloadData) { - this.preloadId = preloadId; - this.preloadType = preloadType; - this.preloadData = preloadData; - } - - public String getPreloadId() { - return preloadId; - } - - public void setPreloadId(String preloadId) { - this.preloadId = preloadId; - } - - public String getPreloadType() { - return preloadType; - } - - public void setPreloadType(String preloadType) { - this.preloadType = preloadType; - } - - public String getPreloadData() { - return preloadData; - } - - public void setPreloadData(String preloadData) { - this.preloadData = preloadData; - } - -} diff --git a/ms/gra/gra-app/src/main/java/org/onap/sdnc/apps/ms/gra/data/OperationalPreloadDataRepository.java b/ms/gra/gra-app/src/main/java/org/onap/sdnc/apps/ms/gra/data/OperationalPreloadDataRepository.java deleted file mode 100644 index a3eb0da..0000000 --- a/ms/gra/gra-app/src/main/java/org/onap/sdnc/apps/ms/gra/data/OperationalPreloadDataRepository.java +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SDNC - * ================================================================================ - * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdnc.apps.ms.gra.data; - -import org.springframework.data.repository.CrudRepository; -import org.springframework.transaction.annotation.Transactional; - -import java.util.List; - -@Transactional -public interface OperationalPreloadDataRepository extends CrudRepository<OperationalPreloadData, Long> { - - List<OperationalPreloadData> findByPreloadIdAndPreloadType(String preloadId, String preloadType); - long deleteByPreloadIdAndPreloadType(String preloadId, String preloadType); - -} - diff --git a/ms/gra/gra-app/src/main/resources/db/changelog/db.changelog-master.yaml b/ms/gra/gra-app/src/main/resources/db/changelog/db.changelog-master.yaml index 087c324..2b75ac8 100644 --- a/ms/gra/gra-app/src/main/resources/db/changelog/db.changelog-master.yaml +++ b/ms/gra/gra-app/src/main/resources/db/changelog/db.changelog-master.yaml @@ -315,33 +315,6 @@ databaseChangeLog: name: svcData type: clob - changeSet: - id: 20210211-9 - author: dtimoney@att.com - preConditions: - - onFail: MARK_RAN - - not: - - tableExists: - tableName: OPERATIONAL_PRELOAD_DATA - changes: - - createTable: - tableName: OPERATIONAL_PRELOAD_DATA - columns: - - column: - name: preloadId - type: varchar(100) - constraints: - nullable: false - primaryKey: true - - column: - constraints: - nullable: false - primaryKey: true - name: preloadType - type: varchar(25) - - column: - name: preloadData - type: clob -- changeSet: id: 20210211-10 author: dtimoney@att.com preConditions: diff --git a/ms/gra/gra-app/src/test/resources/db/changelog/db.changelog-master.yaml b/ms/gra/gra-app/src/test/resources/db/changelog/db.changelog-master.yaml index 29d98e6..ffb2eb3 100644 --- a/ms/gra/gra-app/src/test/resources/db/changelog/db.changelog-master.yaml +++ b/ms/gra/gra-app/src/test/resources/db/changelog/db.changelog-master.yaml @@ -315,33 +315,6 @@ databaseChangeLog: name: svcData type: clob - changeSet: - id: 20210211-9 - author: dtimoney@att.com - preConditions: - - onFail: MARK_RAN - - not: - - tableExists: - tableName: OPERATIONAL_PRELOAD_DATA - changes: - - createTable: - tableName: OPERATIONAL_PRELOAD_DATA - columns: - - column: - name: preloadId - type: varchar(100) - constraints: - nullable: false - primaryKey: true - - column: - constraints: - nullable: false - primaryKey: true - name: preloadType - type: varchar(25) - - column: - name: preloadData - type: clob -- changeSet: id: 20210211-11 author: dtimoney@att.com preConditions: |