From e45ea4d14e39b93c667047d2fe8990f69a8278a2 Mon Sep 17 00:00:00 2001 From: "mukesh.paliwal" Date: Wed, 17 Feb 2021 12:09:24 +0530 Subject: remove mso-cnf-adapter from so Issue-ID: SO-3534 Signed-off-by: mukesh.paliwal Change-Id: I85a7ad93e9a89190805b508be25163bcbdd7c334 --- .../onap/so/adapters/cnf/MSOCnfApplication.java | 52 -- .../onap/so/adapters/cnf/WebSecurityConfig.java | 35 -- .../cnf/exceptions/ApplicationException.java | 66 -- .../so/adapters/cnf/model/BpmnInstanceRequest.java | 87 --- .../org/onap/so/adapters/cnf/model/Config.java | 31 - .../adapters/cnf/model/ConfigTemplateEntity.java | 42 -- .../so/adapters/cnf/model/ConfigurationEntity.java | 54 -- .../cnf/model/ConfigurationRollbackEntity.java | 22 - .../so/adapters/cnf/model/ConnectivityInfo.java | 53 -- .../so/adapters/cnf/model/ConnectivityRecords.java | 23 - .../onap/so/adapters/cnf/model/ErrorResponse.java | 63 -- .../so/adapters/cnf/model/GroupVersionKind.java | 66 -- .../adapters/cnf/model/InstanceMiniResponse.java | 62 -- .../cnf/model/InstanceMiniResponseList.java | 45 -- .../so/adapters/cnf/model/InstanceResponse.java | 99 --- .../adapters/cnf/model/InstanceStatusResponse.java | 84 --- .../cnf/model/MulticloudInstanceRequest.java | 87 --- .../cnf/model/OtherConnectivityListEntity.java | 23 - .../org/onap/so/adapters/cnf/model/PodStatus.java | 71 --- .../onap/so/adapters/cnf/model/ProfileEntity.java | 74 --- .../org/onap/so/adapters/cnf/model/Resource.java | 54 -- .../adapters/cnf/model/ResourceBundleEntity.java | 65 -- .../org/onap/so/adapters/cnf/model/Response.java | 39 -- .../java/org/onap/so/adapters/cnf/model/Tag.java | 20 - .../onap/so/adapters/cnf/rest/CnfAdapterRest.java | 677 --------------------- .../so/adapters/cnf/service/CnfAdapterService.java | 251 -------- .../onap/so/adapters/cnf/util/CNfAdapterUtil.java | 94 --- 27 files changed, 2339 deletions(-) delete mode 100644 adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/MSOCnfApplication.java delete mode 100644 adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/WebSecurityConfig.java delete mode 100644 adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/exceptions/ApplicationException.java delete mode 100644 adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/BpmnInstanceRequest.java delete mode 100644 adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/Config.java delete mode 100644 adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ConfigTemplateEntity.java delete mode 100644 adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ConfigurationEntity.java delete mode 100644 adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ConfigurationRollbackEntity.java delete mode 100644 adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ConnectivityInfo.java delete mode 100644 adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ConnectivityRecords.java delete mode 100644 adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ErrorResponse.java delete mode 100644 adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/GroupVersionKind.java delete mode 100644 adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceMiniResponse.java delete mode 100644 adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceMiniResponseList.java delete mode 100644 adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceResponse.java delete mode 100644 adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceStatusResponse.java delete mode 100644 adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/MulticloudInstanceRequest.java delete mode 100644 adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/OtherConnectivityListEntity.java delete mode 100644 adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/PodStatus.java delete mode 100644 adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ProfileEntity.java delete mode 100644 adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/Resource.java delete mode 100644 adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ResourceBundleEntity.java delete mode 100644 adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/Response.java delete mode 100644 adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/Tag.java delete mode 100644 adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/rest/CnfAdapterRest.java delete mode 100644 adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/service/CnfAdapterService.java delete mode 100644 adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/util/CNfAdapterUtil.java (limited to 'adapters/mso-cnf-adapter/src/main/java') diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/MSOCnfApplication.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/MSOCnfApplication.java deleted file mode 100644 index 0ba40e2700..0000000000 --- a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/MSOCnfApplication.java +++ /dev/null @@ -1,52 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.so.adapters.cnf; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; -import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; -import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration; -import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; -import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.client.RestTemplate; - -@SpringBootApplication -@ComponentScan(basePackages = {"org.onap.so.adapters.cnf"}) -@EnableAutoConfiguration(exclude = {LiquibaseAutoConfiguration.class, HibernateJpaAutoConfiguration.class, - DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class, - SecurityAutoConfiguration.class}) -@Configuration -public class MSOCnfApplication { - - public static void main(String... args) { - SpringApplication.run(MSOCnfApplication.class, args); - } - - @Bean - public RestTemplate restTemplate() { - return new RestTemplate(); - } -} diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/WebSecurityConfig.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/WebSecurityConfig.java deleted file mode 100644 index 03bfd54eef..0000000000 --- a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/WebSecurityConfig.java +++ /dev/null @@ -1,35 +0,0 @@ - -package org.onap.so.adapters.cnf; -/* - * ============LICENSE_START==================================================== === ONAP - SO - * ============================================================================= === Copyright (C) 2020 Huawei - * Technologies Co., Ltd. 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====================================================== === - * - */ - -import org.springframework.context.annotation.Configuration; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; - -@EnableWebSecurity - -@Configuration -public class WebSecurityConfig extends WebSecurityConfigurerAdapter { - - @Override - protected void configure(HttpSecurity http) throws Exception { - http.csrf().disable(); - } - -} diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/exceptions/ApplicationException.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/exceptions/ApplicationException.java deleted file mode 100644 index c950cf6b2a..0000000000 --- a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/exceptions/ApplicationException.java +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.so.adapters.cnf.exceptions; - -import static org.onap.so.adapters.cnf.util.CNfAdapterUtil.marshal; -import org.onap.so.adapters.cnf.model.ErrorResponse; -import org.springframework.http.ResponseEntity; - -public class ApplicationException extends Exception { - - private static final long serialVersionUID = 1L; - - private int errorCode; - - private String errorMsg; - - public ApplicationException(int errorCode, String errorMsg) { - this.errorCode = errorCode; - this.errorMsg = errorMsg; - } - - public int getErrorCode() { - return errorCode; - } - - public void setErrorCode(int errorCode) { - this.errorCode = errorCode; - } - - public String getErrorMsg() { - return errorMsg; - } - - public void setErrorMsg(String errorMsg) { - this.errorMsg = errorMsg; - } - - public ResponseEntity buildErrorResponse() { - String message; - try { - ErrorResponse err = new ErrorResponse(errorCode, errorMsg); - message = marshal(err); - } catch (ApplicationException e) { - return ResponseEntity.status(500).body("Internal Server Error"); - } - return ResponseEntity.status(errorCode).body(message); - } -} diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/BpmnInstanceRequest.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/BpmnInstanceRequest.java deleted file mode 100644 index 2e76d51da2..0000000000 --- a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/BpmnInstanceRequest.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.onap.so.adapters.cnf.model; - -import java.util.Map; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -@JsonIgnoreProperties(value = "true") -public class BpmnInstanceRequest { - - @JsonProperty(value = "modelInvariantId") - private String modelInvariantId; - - @JsonProperty(value = "modelVersionId") - private String modelVersionId; - - @JsonProperty(value = "k8sRBProfileName") - private String k8sRBProfileName; - - @JsonProperty(value = "cloudRegionId") - private String cloudRegionId; - - @JsonProperty(value = "vfModuleUUID") - private String vfModuleUUID; - - @JsonProperty(value = "labels") - private Map labels; - - @JsonProperty(value = "overrideValues") - private Map overrideValues; - - public String getModelInvariantId() { - return modelInvariantId; - } - - public void setModelInvariantId(String modelInvariantId) { - this.modelInvariantId = modelInvariantId; - } - - public String getModelVersionId() { - return modelVersionId; - } - - public void setModelVersionId(String modelVersionId) { - this.modelVersionId = modelVersionId; - } - - public String getK8sRBProfileName() { - return k8sRBProfileName; - } - - public void setK8sRBProfileName(String k8sRBProfileName) { - this.k8sRBProfileName = k8sRBProfileName; - } - - public String getCloudRegionId() { - return cloudRegionId; - } - - public void setCloudRegionId(String cloudRegionId) { - this.cloudRegionId = cloudRegionId; - } - - public String getVfModuleUUID() { - return vfModuleUUID; - } - - public void setVfModuleUUID(String vfModuleUUID) { - this.vfModuleUUID = vfModuleUUID; - } - - public Map getLabels() { - return labels; - } - - public void setLabels(Map labels) { - this.labels = labels; - } - - public Map getOverrideValues() { - return overrideValues; - } - - public void setOverrideValues(Map overrideValues) { - this.overrideValues = overrideValues; - } - -} diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/Config.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/Config.java deleted file mode 100644 index b901a39706..0000000000 --- a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/Config.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.onap.so.adapters.cnf.model; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -@JsonIgnoreProperties(value = "true") -public class Config { - - @JsonProperty(value = "config-version") - private String configVersion; - - @JsonProperty(value = "config-tag") - private String configTag; - - public Object getConfigVersion() { - return configVersion; - } - - public void setConfigVersion(String configVersion) { - this.configVersion = configVersion; - } - - public Object getConfigTag() { - return configTag; - } - - public void setConfigTag(String configTag) { - this.configTag = configTag; - } - -} diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ConfigTemplateEntity.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ConfigTemplateEntity.java deleted file mode 100644 index 2ed35b865f..0000000000 --- a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ConfigTemplateEntity.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.onap.so.adapters.cnf.model; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -@JsonIgnoreProperties(value = "true") -public class ConfigTemplateEntity { - - @JsonProperty(value = "template-name") - private String templateName; - - @JsonProperty(value = "description") - private String description; - - @JsonProperty(value = "chart-name") - private String chartName; - - public String getTemplateName() { - return templateName; - } - - public void setTemplateName(String templateName) { - this.templateName = templateName; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getChartName() { - return chartName; - } - - public void setChartName(String chartName) { - this.chartName = chartName; - } - -} diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ConfigurationEntity.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ConfigurationEntity.java deleted file mode 100644 index 7f6ae865e2..0000000000 --- a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ConfigurationEntity.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.onap.so.adapters.cnf.model; - -import java.util.Map; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -@JsonIgnoreProperties(value = "true") -public class ConfigurationEntity { - - @JsonProperty(value = "template-name") - private String templateName; - - @JsonProperty(value = "config-name") - private String configName; - - @JsonProperty(value = "description") - private String description; - - @JsonProperty(value = "values") - private Map values; - - public String getTemplateName() { - return templateName; - } - - public void setTemplateName(String templateName) { - this.templateName = templateName; - } - - public String getConfigName() { - return configName; - } - - public void setConfigName(String configName) { - this.configName = configName; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Map getValues() { - return values; - } - - public void setValues(Map values) { - this.values = values; - } - -} diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ConfigurationRollbackEntity.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ConfigurationRollbackEntity.java deleted file mode 100644 index bf78d9c049..0000000000 --- a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ConfigurationRollbackEntity.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.onap.so.adapters.cnf.model; - -import java.util.List; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -@JsonIgnoreProperties(value = "true") -public class ConfigurationRollbackEntity { - - // TODO - @JsonProperty(value = "anyOf") - private List anyOf; - - public List getAnyOf() { - return anyOf; - } - - public void setAnyOf(List anyOf) { - this.anyOf = anyOf; - } - -} diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ConnectivityInfo.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ConnectivityInfo.java deleted file mode 100644 index a2554d1618..0000000000 --- a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ConnectivityInfo.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.onap.so.adapters.cnf.model; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -@JsonIgnoreProperties(value = "true") -public class ConnectivityInfo { - - @JsonProperty(value = "cloud-region") - private String cloudRegion; - - @JsonProperty(value = "cloud-owner") - private String cloudOwner; - - @JsonProperty(value = "kubeconfig") - private String kubeconfig; - - @JsonProperty(value = "other-connectivity-list") - private OtherConnectivityListEntity otherConnectivityListEntity; - - public String getCloudRegion() { - return cloudRegion; - } - - public void setCloudRegion(String cloudRegion) { - this.cloudRegion = cloudRegion; - } - - public String getCloudOwner() { - return cloudOwner; - } - - public void setCloudOwner(String cloudOwner) { - this.cloudOwner = cloudOwner; - } - - public OtherConnectivityListEntity getOtherConnectivityListEntity() { - return otherConnectivityListEntity; - } - - public void setOtherConnectivityListEntity(OtherConnectivityListEntity otherConnectivityListEntity) { - this.otherConnectivityListEntity = otherConnectivityListEntity; - } - - public String getKubeconfig() { - return kubeconfig; - } - - public void setKubeconfig(String kubeconfig) { - this.kubeconfig = kubeconfig; - } - -} diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ConnectivityRecords.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ConnectivityRecords.java deleted file mode 100644 index 06cfdf1602..0000000000 --- a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ConnectivityRecords.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.onap.so.adapters.cnf.model; - -import java.util.Map; - -public class ConnectivityRecords { - - /* - * private String connectivityRecordName; private String fQDNOrIP; private String caCertToVerifyServer; private - * String sslInitiator; private String userName; private String password; private String privateKey; private String - * certToPresent; - */ - - private Map records; - - public Map getRecords() { - return records; - } - - public void setRecords(Map records) { - this.records = records; - } - -} diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ErrorResponse.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ErrorResponse.java deleted file mode 100644 index 135adcc143..0000000000 --- a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ErrorResponse.java +++ /dev/null @@ -1,63 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.so.adapters.cnf.model; - -public class ErrorResponse { - - private int status; - - private String error; - - private String message; - - public ErrorResponse(int status, String message) { - this.status = status; - this.message = message; - this.error = "Bad Request"; - } - - public int getStatus() { - return status; - } - - public void setStatus(int status) { - this.status = status; - } - - public String getError() { - if (status == 500) { - this.error = "Internal Server Error"; - } - return error; - } - - public void setError(String error) { - this.error = error; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } -} diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/GroupVersionKind.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/GroupVersionKind.java deleted file mode 100644 index bfa5505ccc..0000000000 --- a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/GroupVersionKind.java +++ /dev/null @@ -1,66 +0,0 @@ - -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.so.adapters.cnf.model; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"Group", "Version", "Kind"}) -public class GroupVersionKind { - @JsonProperty("Group") - private String group; - @JsonProperty("Version") - private String version; - @JsonProperty("Kind") - private String kind; - - @JsonProperty("Group") - public String getGroup() { - return group; - } - - @JsonProperty("Group") - public void setGroup(String group) { - this.group = group; - } - - @JsonProperty("Version") - public String getVersion() { - return version; - } - - @JsonProperty("Version") - public void setVersion(String version) { - this.version = version; - } - - @JsonProperty("Kind") - public String getKind() { - return kind; - } - - @JsonProperty("Kind") - public void setKind(String kind) { - this.kind = kind; - } -} diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceMiniResponse.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceMiniResponse.java deleted file mode 100644 index 58040826dd..0000000000 --- a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceMiniResponse.java +++ /dev/null @@ -1,62 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.so.adapters.cnf.model; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(value = "true") -public class InstanceMiniResponse extends Response { - - private String id; - private MulticloudInstanceRequest request; - private String nameSpace; - - public InstanceMiniResponse(String errorMsg) { - super(errorMsg); - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public MulticloudInstanceRequest getRequest() { - return request; - } - - public void setRequest(MulticloudInstanceRequest request) { - this.request = request; - } - - public String getNameSpace() { - return nameSpace; - } - - public void setNameSpace(String nameSpace) { - this.nameSpace = nameSpace; - } - -} diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceMiniResponseList.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceMiniResponseList.java deleted file mode 100644 index ad70fbb7d0..0000000000 --- a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceMiniResponseList.java +++ /dev/null @@ -1,45 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.so.adapters.cnf.model; - -import java.util.List; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(value = "true") -public class InstanceMiniResponseList extends Response { - - public InstanceMiniResponseList(String errorMsg) { - super(errorMsg); - } - - private List instancList; - - public List getInstancList() { - return instancList; - } - - public void setInstancList(List instancList) { - this.instancList = instancList; - } - -} diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceResponse.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceResponse.java deleted file mode 100644 index ae63f86c8a..0000000000 --- a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceResponse.java +++ /dev/null @@ -1,99 +0,0 @@ - -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.so.adapters.cnf.model; - -import java.util.List; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"id", "request", "namespace", "release-name", "resources"}) -@JsonIgnoreProperties(value = "true") -public class InstanceResponse { - - @JsonProperty("id") - private String id; - - @JsonProperty("request") - private MulticloudInstanceRequest request; - - @JsonProperty("namespace") - private String namespace; - - @JsonProperty("release-name") - private String releaseName; - - @JsonProperty("resources") - private List resources; - - @JsonProperty("id") - public String getId() { - return id; - } - - @JsonProperty("id") - public void setId(String id) { - this.id = id; - } - - @JsonProperty("request") - public MulticloudInstanceRequest getRequest() { - return request; - } - - @JsonProperty("request") - public void setRequest(MulticloudInstanceRequest request) { - this.request = request; - } - - @JsonProperty("namespace") - public String getNamespace() { - return namespace; - } - - @JsonProperty("namespace") - public void setNamespace(String namespace) { - this.namespace = namespace; - } - - @JsonProperty("resources") - public List getResources() { - return resources; - } - - @JsonProperty("resources") - public void setResources(List resources) { - this.resources = resources; - } - - @JsonProperty("release-name") - public String getReleaseName() { - return releaseName; - } - - @JsonProperty("release-name") - public void setReleaseName(String releaseName) { - this.releaseName = releaseName; - } - -} diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceStatusResponse.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceStatusResponse.java deleted file mode 100644 index 2472684bc0..0000000000 --- a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceStatusResponse.java +++ /dev/null @@ -1,84 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.so.adapters.cnf.model; - -import java.util.List; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(value = "true") -public class InstanceStatusResponse extends Response { - - public InstanceStatusResponse(String errorMsg) { - super(errorMsg); - } - - private MulticloudInstanceRequest request; - - private boolean ready; - - private String resourceCount; - - private List podStatuses; - - private List servicesStatuses; - - public MulticloudInstanceRequest getRequest() { - return request; - } - - public void setRequest(MulticloudInstanceRequest request) { - this.request = request; - } - - public boolean isReady() { - return ready; - } - - public void setReady(boolean ready) { - this.ready = ready; - } - - public String getResourceCount() { - return resourceCount; - } - - public void setResourceCount(String resourceCount) { - this.resourceCount = resourceCount; - } - - public List getPodStatuses() { - return podStatuses; - } - - public void setPodStatuses(List podStatuses) { - this.podStatuses = podStatuses; - } - - public List getServicesStatuses() { - return servicesStatuses; - } - - public void setServicesStatuses(List servicesStatuses) { - this.servicesStatuses = servicesStatuses; - } - -} diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/MulticloudInstanceRequest.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/MulticloudInstanceRequest.java deleted file mode 100644 index b1719cbd7d..0000000000 --- a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/MulticloudInstanceRequest.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.onap.so.adapters.cnf.model; - -import java.util.Map; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -@JsonIgnoreProperties(value = "true") -public class MulticloudInstanceRequest { - - @JsonProperty(value = "cloud-region") - private String cloudRegion; - - @JsonProperty(value = "rb-name") - private String rbName; - - @JsonProperty(value = "rb-version") - private String rbVersion; - - @JsonProperty(value = "profile-name") - private String profileName; - - @JsonProperty(value = "labels") - private Map labels; - - @JsonProperty(value = "override-values") - private Map overrideValues; - - @JsonProperty(value = "release-name") - private String vfModuleUuid; - - public String getCloudRegion() { - return cloudRegion; - } - - public void setCloudRegion(String cloudRegion) { - this.cloudRegion = cloudRegion; - } - - public String getRbName() { - return rbName; - } - - public void setRbName(String rbName) { - this.rbName = rbName; - } - - public String getRbVersion() { - return rbVersion; - } - - public void setRbVersion(String rbVersion) { - this.rbVersion = rbVersion; - } - - public String getProfileName() { - return profileName; - } - - public void setProfileName(String profileName) { - this.profileName = profileName; - } - - public Map getLabels() { - return labels; - } - - public void setLabels(Map labels) { - this.labels = labels; - } - - public Map getOverrideValues() { - return overrideValues; - } - - public void setOverrideValues(Map overrideValues) { - this.overrideValues = overrideValues; - } - - public String getVfModuleUuid() { - return vfModuleUuid; - } - - public void setVfModuleUuid(String vfModuleUuid) { - this.vfModuleUuid = vfModuleUuid; - } - -} diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/OtherConnectivityListEntity.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/OtherConnectivityListEntity.java deleted file mode 100644 index dd10252a0b..0000000000 --- a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/OtherConnectivityListEntity.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.onap.so.adapters.cnf.model; - -import java.util.List; -import java.util.Map; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -@JsonIgnoreProperties(value = "true") -public class OtherConnectivityListEntity { - - @JsonProperty(value = "connectivity-records") - private List> connectivityRecordsList; - - public List> getConnectivityRecordsList() { - return connectivityRecordsList; - } - - public void setConnectivityRecordsList(List> connectivityRecordsList) { - this.connectivityRecordsList = connectivityRecordsList; - } - - -} diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/PodStatus.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/PodStatus.java deleted file mode 100644 index ed04601b2c..0000000000 --- a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/PodStatus.java +++ /dev/null @@ -1,71 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.so.adapters.cnf.model; - -public class PodStatus { - - private String name; - private String nameSpace; - private boolean ready; - private String status; - private String[] ipAddresses; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getNameSpace() { - return nameSpace; - } - - public void setNameSpace(String nameSpace) { - this.nameSpace = nameSpace; - } - - public boolean isReady() { - return ready; - } - - public void setReady(boolean ready) { - this.ready = ready; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String[] getIpAddresses() { - return ipAddresses; - } - - public void setIpAddresses(String[] ipAddresses) { - this.ipAddresses = ipAddresses; - } - -} diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ProfileEntity.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ProfileEntity.java deleted file mode 100644 index 875ef0d9a1..0000000000 --- a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ProfileEntity.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.onap.so.adapters.cnf.model; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -@JsonIgnoreProperties(value = "true") -public class ProfileEntity { - - @JsonProperty(value = "rb-name") - private String rbName; - - @JsonProperty(value = "rb-version") - private String rbVersion; - - @JsonProperty(value = "profile-name") - private String profileName; - - @JsonProperty(value = "release-name") - private String releaseName; - - @JsonProperty(value = "namespace") - private String nameSpace; - - @JsonProperty(value = "kubernetes-version") - private String kubernetesVersion; - - public String getRbName() { - return rbName; - } - - public void setRbName(String rbName) { - this.rbName = rbName; - } - - public String getRbVersion() { - return rbVersion; - } - - public void setRbVersion(String rbVersion) { - this.rbVersion = rbVersion; - } - - public String getProfileName() { - return profileName; - } - - public void setProfileName(String profileName) { - this.profileName = profileName; - } - - public String getReleaseName() { - return releaseName; - } - - public void setReleaseName(String releaseName) { - this.releaseName = releaseName; - } - - public String getNameSpace() { - return nameSpace; - } - - public void setNameSpace(String nameSpace) { - this.nameSpace = nameSpace; - } - - public String getKubernetesVersion() { - return kubernetesVersion; - } - - public void setKubernetesVersion(String kubernetesVersion) { - this.kubernetesVersion = kubernetesVersion; - } -} diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/Resource.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/Resource.java deleted file mode 100644 index d18cd76039..0000000000 --- a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/Resource.java +++ /dev/null @@ -1,54 +0,0 @@ - -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.so.adapters.cnf.model; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"GVK", "Name"}) -public class Resource { - @JsonProperty("GVK") - private GroupVersionKind gVK; - @JsonProperty("Name") - private String name; - - @JsonProperty("GVK") - public GroupVersionKind getGVK() { - return gVK; - } - - @JsonProperty("GVK") - public void setGVK(GroupVersionKind gVK) { - this.gVK = gVK; - } - - @JsonProperty("Name") - public String getName() { - return name; - } - - @JsonProperty("Name") - public void setName(String name) { - this.name = name; - } -} diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ResourceBundleEntity.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ResourceBundleEntity.java deleted file mode 100644 index bc3a8ad34b..0000000000 --- a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ResourceBundleEntity.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.onap.so.adapters.cnf.model; - -import java.util.Map; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -@JsonIgnoreProperties(value = "true") -public class ResourceBundleEntity { - - @JsonProperty(value = "rb-name") - private String rbName; - - @JsonProperty(value = "rb-version") - private String rbVersion; - - @JsonProperty(value = "chart-name") - private String chartName; - - @JsonProperty(value = "description") - private String description; - - @JsonProperty(value = "labels") - private Map labels; - - public String getRbName() { - return rbName; - } - - public void setRbName(String rbName) { - this.rbName = rbName; - } - - public String getRbVersion() { - return rbVersion; - } - - public void setRbVersion(String rbVersion) { - this.rbVersion = rbVersion; - } - - public String getChartName() { - return chartName; - } - - public void setChartName(String chartName) { - this.chartName = chartName; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Map getLabels() { - return labels; - } - - public void setLabels(Map labels) { - this.labels = labels; - } - -} diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/Response.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/Response.java deleted file mode 100644 index 423022393c..0000000000 --- a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/Response.java +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.so.adapters.cnf.model; - -public class Response { - - private String errorMsg; - - public Response(String errorMsg) { - this.errorMsg = errorMsg; - } - - public String getErrorMsg() { - return errorMsg; - } - - public void setErrorMsg(String errorMsg) { - this.errorMsg = errorMsg; - } - -} diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/Tag.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/Tag.java deleted file mode 100644 index 70faefa150..0000000000 --- a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/Tag.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.onap.so.adapters.cnf.model; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -@JsonIgnoreProperties(value = "true") -public class Tag { - - @JsonProperty(value = "tag-name") - private String tagName; - - public String getTagName() { - return tagName; - } - - public void setTagName(String tagName) { - this.tagName = tagName; - } - -} diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/rest/CnfAdapterRest.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/rest/CnfAdapterRest.java deleted file mode 100644 index c69b63fe16..0000000000 --- a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/rest/CnfAdapterRest.java +++ /dev/null @@ -1,677 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.so.adapters.cnf.rest; - -import java.io.File; -import java.io.IOException; -import org.apache.http.HttpEntity; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpDelete; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.methods.HttpPut; -import org.apache.http.entity.ContentType; -import org.apache.http.entity.StringEntity; -import org.apache.http.entity.mime.HttpMultipartMode; -import org.apache.http.entity.mime.MultipartEntityBuilder; -import org.apache.http.entity.mime.content.FileBody; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.util.EntityUtils; -import org.onap.so.adapters.cnf.model.BpmnInstanceRequest; -import org.onap.so.adapters.cnf.model.ConfigTemplateEntity; -import org.onap.so.adapters.cnf.model.ConfigurationEntity; -import org.onap.so.adapters.cnf.model.ConfigurationRollbackEntity; -import org.onap.so.adapters.cnf.model.ConnectivityInfo; -import org.onap.so.adapters.cnf.model.ProfileEntity; -import org.onap.so.adapters.cnf.model.ResourceBundleEntity; -import org.onap.so.adapters.cnf.model.Tag; -import org.onap.so.adapters.cnf.service.CnfAdapterService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.multipart.MultipartFile; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; - -@RestController -public class CnfAdapterRest { - - private static final Logger logger = LoggerFactory.getLogger(CnfAdapterRest.class); - private final CloseableHttpClient httpClient = HttpClients.createDefault(); - - @Autowired - private CnfAdapterService cnfAdapterService; - - @ResponseBody - @RequestMapping(value = {"/api/cnf-adapter/v1/healthcheck"}, method = RequestMethod.GET, - produces = "application/json") - public String healthCheck() throws Exception { - - logger.info("healthCheck called."); - return cnfAdapterService.healthCheck(); - - } - - @ResponseBody - @RequestMapping(value = {"/api/cnf-adapter/v1/instance"}, method = RequestMethod.POST, - produces = "application/json", consumes = "application/json") - public String createInstance(@RequestBody BpmnInstanceRequest bpmnInstanceRequest) - throws JsonParseException, JsonMappingException, IOException { - - logger.info("createInstance called."); - return cnfAdapterService.createInstance(bpmnInstanceRequest); - } - - @ResponseBody - @RequestMapping(value = {"/api/cnf-adapter/v1/instance/{instID}"}, method = RequestMethod.GET, - produces = "application/json") - public String getInstanceByInstanceId(@PathVariable("instID") String instanceId) - throws JsonParseException, JsonMappingException, IOException { - - logger.info("getInstanceByInstanceId called."); - - return cnfAdapterService.getInstanceByInstanceId(instanceId); - - } - - @ResponseBody - @RequestMapping(value = {"/api/cnf-adapter/v1/instance/{instID}/status"}, method = RequestMethod.GET, - produces = "application/json") - public String getInstanceStatusByInstanceId(@PathVariable("instID") String instanceId) - throws JsonParseException, JsonMappingException, IOException { - - logger.info("getInstanceStatusByInstanceId called."); - - return cnfAdapterService.getInstanceStatusByInstanceId(instanceId); - - } - - @RequestMapping(value = {"/api/cnf-adapter/v1/instance"}, method = RequestMethod.GET, produces = "application/json") - public String getInstanceByRBNameOrRBVersionOrProfileName( - @RequestParam(value = "rb-name", required = false) String rbName, - @RequestParam(value = "rb-version", required = false) String rbVersion, - @RequestParam(value = "profile-name", required = false) String profileName) - throws JsonParseException, JsonMappingException, IOException { - - logger.info("getInstanceByRBNameOrRBVersionOrProfileName called."); - return cnfAdapterService.getInstanceByRBNameOrRBVersionOrProfileName(rbName, rbVersion, profileName); - - } - - @ResponseBody - @RequestMapping(value = {"/api/cnf-adapter/v1/instance/{instID}"}, method = RequestMethod.DELETE, - produces = "application/json") - public String deleteInstanceByInstanceId(@PathVariable("instID") String instanceID) - throws JsonParseException, JsonMappingException, IOException { - - logger.info("deleteInstanceByInstanceId called."); - return cnfAdapterService.deleteInstanceByInstanceId(instanceID); - - } - - @ResponseBody - @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition"}, method = RequestMethod.POST, - produces = "application/json") - public String createRB(@RequestBody ResourceBundleEntity rB) throws Exception { - - logger.info("ResourceBundleEntity:" + rB.toString()); - - // TODO - // Below URL should be changed as appropriate multicloud URL. - HttpPost post = new HttpPost("http://multicloud-k8s:9015/v1/rb/definition"); - ObjectMapper objectMapper = new ObjectMapper(); - objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); - String requestBody = objectMapper.writeValueAsString(rB); - StringEntity requestEntity = new StringEntity(requestBody, ContentType.APPLICATION_JSON); - post.setEntity(requestEntity); - - try (CloseableHttpClient httpClient = HttpClients.createDefault(); - CloseableHttpResponse response = httpClient.execute(post)) { - logger.info("response:" + response.getEntity()); - return EntityUtils.toString(response.getEntity()); - } - } - - @ResponseBody - @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}"}, method = RequestMethod.GET, - produces = "application/json") - public String getRB(@PathVariable("rb-name") String rbName, @PathVariable("rb-version") String rbVersion) - throws Exception { - - logger.info("get RB called."); - - // TODO - // Below URL should be changed as appropriate multicloud URL. - HttpGet req = new HttpGet("http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion); - try (CloseableHttpResponse response = httpClient.execute(req)) { - logger.info("response:" + response.getEntity()); - return EntityUtils.toString(response.getEntity()); - } - } - - @ResponseBody - @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}"}, method = RequestMethod.DELETE, - produces = "application/json") - public String deleteRB(@PathVariable("rb-name") String rbName, @PathVariable("rb-version") String rbVersion) - throws Exception { - - logger.info("delete RB called."); - - // TODO - // Below URL should be changed as appropriate multicloud URL. - HttpDelete req = new HttpDelete("http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion); - - try (CloseableHttpResponse response = httpClient.execute(req)) { - logger.info("response:" + response.getEntity()); - return EntityUtils.toString(response.getEntity()); - } - - } - - @ResponseBody - @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}"}, method = RequestMethod.GET, - produces = "application/json") - public String getListOfRB(@PathVariable("rb-name") String rbName) throws Exception { - - logger.info("getListOfRB called."); - - // TODO - // Below URL should be changed as appropriate multicloud URL. - HttpGet req = new HttpGet("http://multicloud-k8s:9015/v1/rb/definition/" + rbName); - - try (CloseableHttpResponse response = httpClient.execute(req)) { - logger.info("response:" + response.getEntity()); - return EntityUtils.toString(response.getEntity()); - } - - } - - @ResponseBody - @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition"}, method = RequestMethod.GET, - produces = "application/json") - public String getListOfRBWithoutUsingRBName() throws Exception { - - logger.info("getListOfRBWithoutUsingRBName called."); - - // TODO - // Below URL should be changed as appropriate multicloud URL. - HttpGet req = new HttpGet("http://multicloud-k8s:9015/v1/rb/definition"); - - try (CloseableHttpResponse response = httpClient.execute(req)) { - logger.info("response:" + response.getEntity()); - return EntityUtils.toString(response.getEntity()); - } - - } - - @ResponseBody - @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}/content"}, - method = RequestMethod.POST, produces = "multipart/form-data") - public String uploadArtifactForRB(@RequestParam("file") MultipartFile file, @PathVariable("rb-name") String rbName, - @PathVariable("rb-version") String rbVersion) throws Exception { - - logger.info("Upload Artifact For RB called."); - - File convFile = new File(file.getOriginalFilename()); - file.transferTo(convFile); - FileBody fileBody = new FileBody(convFile, ContentType.DEFAULT_BINARY); - MultipartEntityBuilder builder = MultipartEntityBuilder.create(); - builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); - builder.addPart("file", fileBody); - HttpEntity entity = builder.build(); - - // TODO - // Below URL should be changed as appropriate multicloud URL. - HttpPost post = - new HttpPost("http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion + "/content"); - post.setHeader("Content-Type", "multipart/form-data"); - logger.info(String.valueOf(post)); - post.setEntity(entity); - - try (CloseableHttpClient httpClient = HttpClients.createDefault(); - CloseableHttpResponse response = httpClient.execute(post)) { - logger.info("response:" + response.getEntity()); - return EntityUtils.toString(response.getEntity()); - } - } - - @ResponseBody - @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}/profile"}, - method = RequestMethod.POST, produces = "application/json") - public String createProfile(@RequestBody ProfileEntity fE, @PathVariable("rb-name") String rbName, - @PathVariable("rb-version") String rbVersion) throws Exception { - - logger.info("create Profile called."); - - // TODO - // Below URL should be changed as appropriate multicloud URL. - HttpPost post = - new HttpPost("http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion + "/profile"); - ObjectMapper objectMapper = new ObjectMapper(); - String requestBody = objectMapper.writeValueAsString(fE); - StringEntity requestEntity = new StringEntity(requestBody, ContentType.APPLICATION_JSON); - post.setEntity(requestEntity); - - try (CloseableHttpClient httpClient = HttpClients.createDefault(); - CloseableHttpResponse response = httpClient.execute(post)) { - logger.info("response:" + response.getEntity()); - return EntityUtils.toString(response.getEntity()); - } - } - - @ResponseBody - @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}/profile/{pr-name}"}, - method = RequestMethod.GET, produces = "application/json") - public String getProfile(@PathVariable("rb-name") String rbName, @PathVariable("rb-version") String rbVersion, - @PathVariable("pr-name") String prName) throws Exception { - - logger.info("get Profile called."); - - // TODO - // Below URL should be changed as appropriate multicloud URL. - HttpGet req = new HttpGet( - "http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion + "/profile/" + prName); - - try (CloseableHttpResponse response = httpClient.execute(req)) { - logger.info("response:" + response.getEntity()); - return EntityUtils.toString(response.getEntity()); - } - } - - @ResponseBody - @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}/profile"}, - method = RequestMethod.GET, produces = "application/json") - public String getListOfProfile(@PathVariable("rb-name") String rbName, @PathVariable("rb-version") String rbVersion) - throws Exception { - - logger.info("getListOfProfile called."); - - // TODO - // Below URL should be changed as appropriate multicloud URL. - HttpGet req = - new HttpGet("http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion + "/profile"); - - try (CloseableHttpResponse response = httpClient.execute(req)) { - logger.info("response:" + response.getEntity()); - return EntityUtils.toString(response.getEntity()); - } - } - - @ResponseBody - @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}/profile/{pr-name}"}, - method = RequestMethod.DELETE, produces = "application/json") - public String deleteProfile(@PathVariable("rb-name") String rbName, @PathVariable("rb-version") String rbVersion, - @PathVariable("pr-name") String prName) throws Exception { - - logger.info("delete Profile called."); - - // TODO - // Below URL should be changed as appropriate multicloud URL. - HttpDelete req = new HttpDelete( - "http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion + "/profile/" + prName); - - try (CloseableHttpResponse response = httpClient.execute(req)) { - logger.info("response:" + response.getEntity()); - return EntityUtils.toString(response.getEntity()); - } - - } - - @ResponseBody - @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}/profile/{pr-name}/content"}, - method = RequestMethod.POST, produces = "multipart/form-data") - public String uploadArtifactForProfile(@RequestParam("file") MultipartFile file, - @PathVariable("rb-name") String rbName, @PathVariable("rb-version") String rbVersion, - @PathVariable("pr-name") String prName) throws Exception { - - logger.info("Upload Artifact For Profile called."); - - File convFile = new File(file.getOriginalFilename()); - file.transferTo(convFile); - FileBody fileBody = new FileBody(convFile, ContentType.DEFAULT_BINARY); - MultipartEntityBuilder builder = MultipartEntityBuilder.create(); - builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); - builder.addPart("file", fileBody); - HttpEntity entity = builder.build(); - - // TODO - // Below URL should be changed as appropriate multicloud URL. - HttpPost post = new HttpPost("http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion - + "/profile/" + prName + "/content"); - post.setHeader("Content-Type", "multipart/form-data"); - - logger.info(String.valueOf(post)); - post.setEntity(entity); - - try (CloseableHttpClient httpClient = HttpClients.createDefault(); - CloseableHttpResponse response = httpClient.execute(post)) { - logger.info("response:" + response.getEntity()); - return EntityUtils.toString(response.getEntity()); - } - } - - @ResponseBody - @RequestMapping(value = {"/api/cnf-adapter/v1/definition/{rb-name}/{rb-version}/profile/{profile-name}/config"}, - method = RequestMethod.POST, produces = "application/json") - public String createConfiguration(@RequestBody ConfigurationEntity cE, @PathVariable("rb-name") String rbName, - @PathVariable("rb-version") String rbVersion, @PathVariable("profile-name") String prName) - throws Exception { - - logger.info("create Configuration called."); - - // TODO - // Below URL should be changed as appropriate multicloud URL. - HttpPost post = new HttpPost("http://multicloud-k8s:9015/v1/definition/" + rbName + "/" + rbVersion - + "/profile/" + prName + "/config"); - ObjectMapper objectMapper = new ObjectMapper(); - String requestBody = objectMapper.writeValueAsString(cE); - StringEntity requestEntity = new StringEntity(requestBody, ContentType.APPLICATION_JSON); - post.setEntity(requestEntity); - - try (CloseableHttpClient httpClient = HttpClients.createDefault(); - CloseableHttpResponse response = httpClient.execute(post)) { - logger.info("response:" + response.getEntity()); - return EntityUtils.toString(response.getEntity()); - } - } - - @ResponseBody - @RequestMapping( - value = {"/api/cnf-adapter/v1/definition/{rb-name}/{rb-version}/profile/{profile-name}/config/{cfg-name}"}, - method = RequestMethod.GET, produces = "application/json") - public String getConfiguration(@PathVariable("rb-name") String rbName, @PathVariable("rb-version") String rbVersion, - @PathVariable("profile-name") String prName, @PathVariable("cfg-name") String cfgName) throws Exception { - - logger.info("get Configuration called."); - - // TODO - // Below URL should be changed as appropriate multicloud URL. - HttpGet req = new HttpGet("http://multicloud-k8s:9015/v1/definition/" + rbName + "/" + rbVersion + "/profile/" - + prName + "/config/" + cfgName); - - try (CloseableHttpResponse response = httpClient.execute(req)) { - logger.info("response:" + response.getEntity()); - return EntityUtils.toString(response.getEntity()); - } - } - - @ResponseBody - @RequestMapping( - value = {"/api/cnf-adapter/v1/definition/{rb-name}/{rb-version}/profile/{profile-name}/config/{cfg-name}"}, - method = RequestMethod.DELETE, produces = "application/json") - public String deleteConfiguration(@PathVariable("rb-name") String rbName, - @PathVariable("rb-version") String rbVersion, @PathVariable("profile-name") String prName, - @PathVariable("cfg-name") String cfgName) throws Exception { - - logger.info("delete Configuration called."); - - // TODO - // Below URL should be changed as appropriate multicloud URL. - HttpDelete req = new HttpDelete("http://multicloud-k8s:9015/v1/definition/" + rbName + "/" + rbVersion - + "/profile/" + prName + "/config/" + cfgName); - - try (CloseableHttpResponse response = httpClient.execute(req)) { - logger.info("response:" + response.getEntity()); - return EntityUtils.toString(response.getEntity()); - } - - } - - @ResponseBody - @RequestMapping( - value = {"/api/cnf-adapter/v1/definition/{rb-name}/{rb-version}/profile/{profile-name}/config/{cfg-name}"}, - method = RequestMethod.PUT, produces = "application/json") - public String updateConfiguration(@RequestBody ConfigurationEntity cE, @PathVariable("rb-name") String rbName, - @PathVariable("rb-version") String rbVersion, @PathVariable("profile-name") String prName, - @PathVariable("cfg-name") String cfgName) throws Exception { - - logger.info("update Configuration called."); - - // TODO - // Below URL should be changed as appropriate multicloud URL. - HttpPut post = new HttpPut("http://multicloud-k8s:9015/v1/definition/" + rbName + "/" + rbVersion + "/profile/" - + prName + "/config/" + cfgName); - ObjectMapper objectMapper = new ObjectMapper(); - String requestBody = objectMapper.writeValueAsString(cE); - StringEntity requestEntity = new StringEntity(requestBody, ContentType.APPLICATION_JSON); - post.setEntity(requestEntity); - - try (CloseableHttpClient httpClient = HttpClients.createDefault(); - CloseableHttpResponse response = httpClient.execute(post)) { - logger.info("response:" + response.getEntity()); - return EntityUtils.toString(response.getEntity()); - } - } - - @ResponseBody - @RequestMapping(value = {"/api/cnf-adapter/v1/definition/{rb-name}/{rb-version}/profile/{profile-name}/tagit"}, - method = RequestMethod.POST, produces = "application/json") - public String tagConfigurationValue(@RequestBody Tag tag, @PathVariable("rb-name") String rbName, - @PathVariable("rb-version") String rbVersion, @PathVariable("pr-name") String prName) throws Exception { - logger.info("Tag Configuration called."); - - // TODO - // Below URL should be changed as appropriate multicloud URL. - HttpPost post = new HttpPost("http://multicloud-k8s:9015/v1/definition/" + rbName + "/" + rbVersion - + "/profile/" + prName + "/config/tagit"); - - ObjectMapper objectMapper = new ObjectMapper(); - String requestBody = objectMapper.writeValueAsString(tag); - StringEntity requestEntity = new StringEntity(requestBody, ContentType.APPLICATION_JSON); - post.setEntity(requestEntity); - - try (CloseableHttpClient httpClient = HttpClients.createDefault(); - CloseableHttpResponse response = httpClient.execute(post)) { - logger.info("response:" + response.getEntity()); - return EntityUtils.toString(response.getEntity()); - } - } - - @ResponseBody - @RequestMapping(value = {"/api/cnf-adapter/v1/connectivity-info"}, method = RequestMethod.POST, - produces = "application/json") - public String createConnectivityInfo(@RequestBody ConnectivityInfo cIE) throws Exception { - - logger.info("create ConnectivityInfo called."); - - // TODO - // Below URL should be changed as appropriate multicloud URL. - HttpPost post = new HttpPost("http://multicloud-k8s:9015/v1/connectivity-info"); - ObjectMapper objectMapper = new ObjectMapper(); - String requestBody = objectMapper.writeValueAsString(cIE); - StringEntity requestEntity = new StringEntity(requestBody, ContentType.APPLICATION_JSON); - post.setEntity(requestEntity); - - try (CloseableHttpClient httpClient = HttpClients.createDefault(); - CloseableHttpResponse response = httpClient.execute(post)) { - logger.info("response:" + response.getEntity()); - return EntityUtils.toString(response.getEntity()); - } - } - - @ResponseBody - @RequestMapping(value = {"/api/cnf-adapter/v1/connectivity-info/{connname}"}, method = RequestMethod.GET, - produces = "application/json") - public String getConnectivityInfo(@PathVariable("connname") String connName) throws Exception { - - logger.info("get Connectivity Info called."); - - // TODO - // Below URL should be changed as appropriate multicloud URL. - HttpGet req = new HttpGet("http://multicloud-k8s:9015/v1/connectivity-info/" + connName); - - try (CloseableHttpResponse response = httpClient.execute(req)) { - logger.info("response:" + response.getEntity()); - return EntityUtils.toString(response.getEntity()); - } - } - - @ResponseBody - @RequestMapping(value = {"/api/cnf-adapter/v1/connectivity-info/{connname}"}, method = RequestMethod.DELETE, - produces = "application/json") - public String deleteConnectivityInfo(@PathVariable("connname") String connName) throws Exception { - - logger.info("delete Connectivity Info called."); - - // TODO - // Below URL should be changed as appropriate multicloud URL. - HttpDelete req = new HttpDelete("http://multicloud-k8s:9015/v1/connectivity-info/" + connName); - - try (CloseableHttpResponse response = httpClient.execute(req)) { - logger.info("response:" + response.getEntity()); - return EntityUtils.toString(response.getEntity()); - } - - } - - @ResponseBody - @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}/config-template"}, - method = RequestMethod.POST, produces = "application/json") - public String createConfigTemplate(@RequestBody ConfigTemplateEntity tE, @PathVariable("rb-name") String rbName, - @PathVariable("rb-version") String rbVersion) throws Exception { - - logger.info("createConfigTemplate called."); - - // TODO - // Below URL should be changed as appropriate multicloud URL. - HttpPost post = new HttpPost( - "http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion + "/config-template"); - ObjectMapper objectMapper = new ObjectMapper(); - String requestBody = objectMapper.writeValueAsString(tE); - StringEntity requestEntity = new StringEntity(requestBody, ContentType.APPLICATION_JSON); - post.setEntity(requestEntity); - - try (CloseableHttpClient httpClient = HttpClients.createDefault(); - CloseableHttpResponse response = httpClient.execute(post)) { - logger.info("response:" + response.getEntity()); - return EntityUtils.toString(response.getEntity()); - } - } - - @ResponseBody - @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}/config-template/{tname}"}, - method = RequestMethod.GET, produces = "application/json") - public String getConfigTemplate(@PathVariable("rb-name") String rbName, - @PathVariable("rb-version") String rbVersion, @PathVariable("tname") String tName) throws Exception { - - logger.info("getConfigTemplate called."); - - // TODO - // Below URL should be changed as appropriate multicloud URL. - HttpGet req = new HttpGet("http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion - + "/config-template/" + tName); - - try (CloseableHttpResponse response = httpClient.execute(req)) { - logger.info("response:" + response.getEntity()); - return EntityUtils.toString(response.getEntity()); - } - } - - @ResponseBody - @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}/config-template/{tname}"}, - method = RequestMethod.DELETE, produces = "application/json") - public String deleteTemplate(@PathVariable("rb-name") String rbName, @PathVariable("rb-version") String rbVersion, - @PathVariable("tname") String tName) throws Exception { - - logger.info("deleteTemplate called."); - - // TODO - // Below URL should be changed as appropriate multicloud URL. - HttpDelete req = new HttpDelete("http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion - + "/config-template/" + tName); - - try (CloseableHttpResponse response = httpClient.execute(req)) { - logger.info("response:" + response.getEntity()); - return EntityUtils.toString(response.getEntity()); - } - - } - - @ResponseBody - @RequestMapping( - value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}/config-template/{tname}/content"}, - method = RequestMethod.POST, produces = "multipart/form-data") - public String uploadTarFileForTemplate(@RequestParam("file") MultipartFile file, - @PathVariable("rb-name") String rbName, @PathVariable("rb-version") String rbVersion, - @PathVariable("tname") String tName) throws Exception { - - logger.info("uploadTarFileForTemplate called."); - - File convFile = new File(file.getOriginalFilename()); - file.transferTo(convFile); - FileBody fileBody = new FileBody(convFile, ContentType.DEFAULT_BINARY); - MultipartEntityBuilder builder = MultipartEntityBuilder.create(); - builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); - builder.addPart("file", fileBody); - HttpEntity entity = builder.build(); - - // TODO - // Below URL should be changed as appropriate multicloud URL. - HttpPost post = new HttpPost("http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion - + "/config-template/" + tName + "/content"); - post.setHeader("Content-Type", "multipart/form-data"); - - logger.info(String.valueOf(post)); - post.setEntity(entity); - - try (CloseableHttpClient httpClient = HttpClients.createDefault(); - CloseableHttpResponse response = httpClient.execute(post)) { - logger.info("response:" + response.getEntity()); - return EntityUtils.toString(response.getEntity()); - } - } - - @ResponseBody - @RequestMapping(value = {"/api/cnf-adapter/v1/definition/{rbName}/{rbVersion}/profile/{prName}/config/rollback"}, - method = RequestMethod.DELETE, produces = "application/json") - public String rollbackConfiguration(@RequestBody ConfigurationRollbackEntity rE, - @PathVariable("rbName") String rbName, @PathVariable("rbVersion") String rbVersion, - @PathVariable("prName") String prName) throws Exception { - logger.info("rollbackConfiguration called."); - - // TODO - // Below URL should be changed as appropriate multicloud URL. - HttpPost post = new HttpPost("http://multicloud-k8s:9015/v1/definition/" + rbName + "/" + rbVersion - + "/profile/" + prName + "/config/rollback"); - - ObjectMapper objectMapper = new ObjectMapper(); - String requestBody = objectMapper.writeValueAsString(rE); - StringEntity requestEntity = new StringEntity(requestBody, ContentType.APPLICATION_JSON); - post.setEntity(requestEntity); - - try (CloseableHttpClient httpClient = HttpClients.createDefault(); - CloseableHttpResponse response = httpClient.execute(post)) { - logger.info("response:" + response.getEntity()); - return EntityUtils.toString(response.getEntity()); - } - } - -} diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/service/CnfAdapterService.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/service/CnfAdapterService.java deleted file mode 100644 index a134bace1f..0000000000 --- a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/service/CnfAdapterService.java +++ /dev/null @@ -1,251 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.so.adapters.cnf.service; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import javax.persistence.EntityNotFoundException; -import javax.ws.rs.core.UriBuilder; -import org.apache.http.HttpStatus; -import org.onap.so.adapters.cnf.model.BpmnInstanceRequest; -import org.onap.so.adapters.cnf.model.MulticloudInstanceRequest; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Service; -import org.springframework.web.client.HttpClientErrorException; -import org.springframework.web.client.HttpStatusCodeException; -import org.springframework.web.client.RestTemplate; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; - -@Service -public class CnfAdapterService { - private static final Logger logger = LoggerFactory.getLogger(CnfAdapterService.class); - @Autowired - private RestTemplate restTemplate; - private static final String INSTANCE_CREATE_PATH = "/v1/instance"; - private static final String HEALTH_CHECK = "/v1/healthcheck"; - - public String healthCheck() { - - logger.info("CnfAdapterService healthCheck called"); - ResponseEntity result = null; - try { - - // String uri = env.getRequiredProperty("multicloud.endpoint"); //TODO: - // This needs to be added as well - // for configuration - String uri = "http://multicloud-k8s:9015"; // TODO: What is the correct uri? - String endpoint = UriBuilder.fromUri(uri).path(HEALTH_CHECK).build().toString(); - HttpEntity requestEntity = new HttpEntity<>(getHttpHeaders()); - result = restTemplate.exchange(endpoint, HttpMethod.GET, requestEntity, String.class); - return result.getBody(); - } catch (HttpClientErrorException e) { - logger.error("Error Calling Multicloud, e"); - if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) { - throw new EntityNotFoundException(e.getResponseBodyAsString()); - } - throw e; - } catch (HttpStatusCodeException e) { - logger.error("Error in Multicloud, e"); - throw e; - } - } - - public String createInstance(BpmnInstanceRequest bpmnInstanceRequest) - throws JsonParseException, JsonMappingException, IOException { - try { - logger.info("CnfAdapterService createInstance called"); - MulticloudInstanceRequest multicloudInstanceRequest = new MulticloudInstanceRequest(); - ResponseEntity instanceResponse = null; - if (bpmnInstanceRequest.getK8sRBProfileName() != null) { - multicloudInstanceRequest.setCloudRegion(bpmnInstanceRequest.getCloudRegionId()); - multicloudInstanceRequest.setLabels(bpmnInstanceRequest.getLabels()); - multicloudInstanceRequest.setOverrideValues(bpmnInstanceRequest.getOverrideValues()); - multicloudInstanceRequest.setProfileName(bpmnInstanceRequest.getK8sRBProfileName()); - multicloudInstanceRequest.setRbName(bpmnInstanceRequest.getModelInvariantId()); - multicloudInstanceRequest.setRbVersion(bpmnInstanceRequest.getModelVersionId()); - multicloudInstanceRequest.setVfModuleUuid(bpmnInstanceRequest.getVfModuleUUID()); - } else { - logger.error("k8sProfileName should not be null"); - // return instanceResponse; - } - // String uri = env.getRequiredProperty("multicloud.endpoint"); //TODO: - // This needs to be added as well - // for configuration - String uri = "http://multicloud-k8s:9015"; // TODO: What is the correct uri? - String endpoint = UriBuilder.fromUri(uri).path(INSTANCE_CREATE_PATH).build().toString(); - HttpEntity entity = getHttpEntity(multicloudInstanceRequest); - instanceResponse = restTemplate.exchange(endpoint, HttpMethod.POST, entity, String.class); - return instanceResponse.getBody(); - } catch (HttpClientErrorException e) { - logger.error("Error Calling Multicloud, e"); - if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) { - throw new EntityNotFoundException(e.getResponseBodyAsString()); - } - throw e; - } catch (HttpStatusCodeException e) { - logger.error("Error in Multicloud, e"); - throw e; - } - } - - public String getInstanceByInstanceId(String instanceId) - throws JsonParseException, JsonMappingException, IOException { - - logger.info("CnfAdapterService getInstanceByInstanceId called"); - ResponseEntity instanceResponse = null; - try { - - // String uri = env.getRequiredProperty("multicloud.endpoint"); //TODO: - // This needs to be added as well - // for configuration - String uri = "http://multicloud-k8s:9015"; // TODO: What is the correct uri? - String path = "/v1/instance/" + instanceId; - String endpoint = UriBuilder.fromUri(uri).path(path).build().toString(); - HttpEntity requestEntity = new HttpEntity<>(getHttpHeaders()); - instanceResponse = restTemplate.exchange(endpoint, HttpMethod.GET, requestEntity, String.class); - return instanceResponse.getBody(); - } catch (HttpClientErrorException e) { - logger.error("Error Calling Multicloud, e"); - if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) { - throw new EntityNotFoundException(e.getResponseBodyAsString()); - } - throw e; - } catch (HttpStatusCodeException e) { - logger.error("Error in Multicloud, e"); - throw e; - } - } - - public String getInstanceStatusByInstanceId(String instanceId) - throws JsonParseException, JsonMappingException, IOException { - - logger.info("CnfAdapterService getInstanceStatusByInstanceId called"); - ResponseEntity instanceResponse = null; - try { - - // String uri = env.getRequiredProperty("multicloud.endpoint"); //TODO: - // This needs to be added as well - // for configuration - String uri = "http://multicloud-k8s:9015"; // TODO: What is the correct uri? - String path = "/v1/instance/" + instanceId + "/status"; - String endpoint = UriBuilder.fromUri(uri).path(path).build().toString(); - HttpEntity requestEntity = new HttpEntity<>(getHttpHeaders()); - instanceResponse = restTemplate.exchange(endpoint, HttpMethod.GET, requestEntity, String.class); - return instanceResponse.getBody(); - } catch (HttpClientErrorException e) { - logger.error("Error Calling Multicloud, e"); - if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) { - throw new EntityNotFoundException(e.getResponseBodyAsString()); - } - throw e; - } catch (HttpStatusCodeException e) { - logger.error("Error in Multicloud, e"); - throw e; - } - - } - - public String getInstanceByRBNameOrRBVersionOrProfileName(String rbName, String rbVersion, String profileName) - throws JsonParseException, JsonMappingException, IOException { - - logger.info("CnfAdapterService getInstanceByRBNameOrRBVersionOrProfileName called"); - ResponseEntity instanceMiniResponseList = null; - try { - - // String uri = env.getRequiredProperty("multicloud.endpoint"); //TODO: - // This needs to be added as well - // for configuration - String uri = "http://multicloud-k8s:9015"; // TODO: What is the correct uri? - String path = - "/v1/instance" + "?rb-name=" + rbName + "&rb-version=" + rbVersion + "&profile-name=" + profileName; - String endPoint = uri + path; - HttpEntity requestEntity = new HttpEntity<>(getHttpHeaders()); - instanceMiniResponseList = restTemplate.exchange(endPoint, HttpMethod.GET, requestEntity, String.class); - return instanceMiniResponseList.getBody(); - } catch (HttpClientErrorException e) { - logger.error("Error Calling Multicloud, e"); - if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) { - throw new EntityNotFoundException(e.getResponseBodyAsString()); - } - throw e; - } catch (HttpStatusCodeException e) { - logger.error("Error in Multicloud, e"); - throw e; - } - } - - public String deleteInstanceByInstanceId(String instanceId) - throws JsonParseException, JsonMappingException, IOException { - - logger.info("CnfAdapterService deleteInstanceByInstanceId called"); - ResponseEntity result = null; - try { - - // String uri = env.getRequiredProperty("multicloud.endpoint"); //TODO: - // This needs to be added as well - // for configuration - String uri = "http://multicloud-k8s:9015"; // TODO: What is the correct uri? - String path = "/v1/instance/" + instanceId; - String endpoint = UriBuilder.fromUri(uri).path(path).build().toString(); - HttpEntity requestEntity = new HttpEntity<>(getHttpHeaders()); - result = restTemplate.exchange(endpoint, HttpMethod.DELETE, requestEntity, String.class); - return result.getBody(); - } catch (HttpClientErrorException e) { - logger.error("Error Calling Multicloud, e"); - if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) { - throw new EntityNotFoundException(e.getResponseBodyAsString()); - } - throw e; - } catch (HttpStatusCodeException e) { - logger.error("Error in Multicloud, e"); - throw e; - } - } - - protected HttpHeaders getHttpHeaders() { - HttpHeaders headers = new HttpHeaders(); - List acceptableMediaTypes = new ArrayList<>(); - acceptableMediaTypes.add(MediaType.APPLICATION_JSON); - headers.setAccept(acceptableMediaTypes); - headers.setContentType(MediaType.APPLICATION_JSON); - /* - * try { String userCredentials = CryptoUtils.decrypt(env.getRequiredProperty("mso.cnf.adapter.auth"), - * env.getRequiredProperty("mso.msoKey")); if (userCredentials != null) { headers.add(HttpHeaders.AUTHORIZATION, - * "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes())); } } catch - * (GeneralSecurityException e) { logger.error("Security exception", e); } - */ - return headers; - } - - protected HttpEntity getHttpEntity(MulticloudInstanceRequest request) { - HttpHeaders headers = getHttpHeaders(); - return new HttpEntity<>(request, headers); - } -} diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/util/CNfAdapterUtil.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/util/CNfAdapterUtil.java deleted file mode 100644 index 25e506c55e..0000000000 --- a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/util/CNfAdapterUtil.java +++ /dev/null @@ -1,94 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.so.adapters.cnf.util; - -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; -import org.onap.so.adapters.cnf.exceptions.ApplicationException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.onap.logging.filter.base.ErrorCode; -import static org.onap.so.logger.LoggingAnchor.THREE; -import static org.onap.so.logger.MessageEnum.RA_NS_EXC; - -public class CNfAdapterUtil { - - private static final Logger LOGGER = LoggerFactory.getLogger(CNfAdapterUtil.class); - - public static final int BAD_REQUEST = 400; - - private static final String UNMARSHAL_FAIL_MSG = "Failed to unmarshal json"; - - private static final String MARSHAL_FAIL_MSG = "Failed to marshal object"; - - private static final ObjectMapper MAPPER = new ObjectMapper(); - - public static class StatusDesc { - - public static final String ALLOCATE_NSS_SUCCESS = "Allocating nss is " + "successful"; - - public static final String CREATE_NSS_SUCCESS = "Creating nss is " + "successful"; - - public static final String DEALLOCATE_NSS_SUCCESS = "Deallocate nss " + "is successful"; - - public static final String ACTIVATE_NSS_SUCCESS = "Activate nss " + "is successful"; - - public static final String DEACTIVATE_NSS_SUCCESS = "Deactivate nss " + "is successful"; - - public static final String QUERY_JOB_STATUS_FAILED = "Query job " + "status failed"; - - public static final String QUERY_JOB_STATUS_SUCCESS = "Query job " + "status is successful"; - - private StatusDesc() { - - } - } - - private CNfAdapterUtil() { - - } - - public static void assertObjectNotNull(Object object) throws ApplicationException { - if (null == object) { - LOGGER.error("Object is null."); - throw new ApplicationException(BAD_REQUEST, "An object is null."); - } - } - - public static T unMarshal(String jsonstr, Class type) throws ApplicationException { - try { - return MAPPER.readValue(jsonstr, type); - } catch (IOException e) { - LOGGER.error(THREE, RA_NS_EXC.toString(), ErrorCode.BusinessProcessError.getValue(), UNMARSHAL_FAIL_MSG, e); - throw new ApplicationException(BAD_REQUEST, UNMARSHAL_FAIL_MSG); - } - } - - public static String marshal(Object srcObj) throws ApplicationException { - try { - return MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(srcObj); - } catch (IOException e) { - LOGGER.error(THREE, RA_NS_EXC.toString(), ErrorCode.BusinessProcessError.getValue(), MARSHAL_FAIL_MSG, e); - throw new ApplicationException(BAD_REQUEST, MARSHAL_FAIL_MSG); - } - } - -} -- cgit 1.2.3-korg