diff options
22 files changed, 1830 insertions, 4 deletions
diff --git a/adapters/mso-cnf-adapter/pom.xml b/adapters/mso-cnf-adapter/pom.xml new file mode 100644 index 0000000000..fd757641f4 --- /dev/null +++ b/adapters/mso-cnf-adapter/pom.xml @@ -0,0 +1,155 @@ +<!-- + ~* + ~============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========================================================= + ~*/ + --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.so</groupId> + <artifactId>adapters</artifactId> + <version>1.6.0-SNAPSHOT</version> + </parent> + <groupId>org.onap.so.adapters</groupId> + <artifactId>mso-cnf-adapter</artifactId> + <packaging>jar</packaging> + <name>mso-cnf-adapter</name> + <description>Web service endpoint for cnf operations</description> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-dependencies</artifactId> + <version>${springboot.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <build> + <finalName>${project.artifactId}-${project.version}</finalName> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <configuration> + <mainClass>org.onap.so.adapters.cnf.MSOCnfApplication</mainClass> + </configuration> + <executions> + <execution> + <goals> + <goal>repackage</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.jacoco</groupId> + <artifactId>jacoco-maven-plugin</artifactId> + </plugin> + </plugins> + </build> + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-actuator</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-jdbc</artifactId> + <exclusions> + <exclusion> + <groupId>org.apache.tomcat</groupId> + <artifactId>tomcat-jdbc</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-spring-boot-starter-jaxws</artifactId> + <version>${cxf.version}</version> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-spring-boot-starter-jaxrs</artifactId> + <version>${cxf.version}</version> + </dependency> + <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpmime --> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpmime</artifactId> + </dependency> + <!-- <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-rs-service-description-swagger</artifactId> + <version>${cxf.version}</version> + </dependency> --> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-data-jpa</artifactId> + </dependency> + <!-- <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> --> + <!-- <dependency> + <groupId>org.onap.so</groupId> + <artifactId>mso-requests-db</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.so</groupId> + <artifactId>mso-requests-db-repositories</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.mariadb.jdbc</groupId> + <artifactId>mariadb-java-client</artifactId> + </dependency> + <dependency> + <groupId>ch.vorburger.mariaDB4j</groupId> + <artifactId>mariaDB4j</artifactId> + <version>2.2.3</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-configuration-processor</artifactId> + <optional>true</optional> + </dependency> + <dependency> + <groupId>com.squareup.okhttp3</groupId> + <artifactId>okhttp</artifactId> + <version>3.14.0</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + <version>1.18.2</version> + </dependency> --> + </dependencies> +</project> 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 new file mode 100644 index 0000000000..e94c283a98 --- /dev/null +++ b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/MSOCnfApplication.java @@ -0,0 +1,45 @@ +/*- + * ============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.ComponentScan; +import org.springframework.context.annotation.Configuration; + +@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); + } +} 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 new file mode 100644 index 0000000000..03bfd54eef --- /dev/null +++ b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/WebSecurityConfig.java @@ -0,0 +1,35 @@ + +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/model/Config.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/Config.java new file mode 100644 index 0000000000..b901a39706 --- /dev/null +++ b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/Config.java @@ -0,0 +1,31 @@ +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 new file mode 100644 index 0000000000..2ed35b865f --- /dev/null +++ b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ConfigTemplateEntity.java @@ -0,0 +1,42 @@ +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 new file mode 100644 index 0000000000..7f6ae865e2 --- /dev/null +++ b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ConfigurationEntity.java @@ -0,0 +1,54 @@ +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<String, Object> 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<String, Object> getValues() { + return values; + } + + public void setValues(Map<String, Object> 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 new file mode 100644 index 0000000000..bf78d9c049 --- /dev/null +++ b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ConfigurationRollbackEntity.java @@ -0,0 +1,22 @@ +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<Config> anyOf; + + public List<Config> getAnyOf() { + return anyOf; + } + + public void setAnyOf(List<Config> 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 new file mode 100644 index 0000000000..a2554d1618 --- /dev/null +++ b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ConnectivityInfo.java @@ -0,0 +1,53 @@ +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 new file mode 100644 index 0000000000..06cfdf1602 --- /dev/null +++ b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ConnectivityRecords.java @@ -0,0 +1,23 @@ +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<String, String> records; + + public Map<String, String> getRecords() { + return records; + } + + public void setRecords(Map<String, String> records) { + this.records = records; + } + +} diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceEntity.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceEntity.java new file mode 100644 index 0000000000..04f2f9d030 --- /dev/null +++ b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceEntity.java @@ -0,0 +1,76 @@ +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 InstanceEntity { + + @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<String, String> labels; + + @JsonProperty(value = "override-values") + private Map<String, String> overrideValues; + + 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<String, String> getLabels() { + return labels; + } + + public void setLabels(Map<String, String> labels) { + this.labels = labels; + } + + public Map<String, String> getOverrideValues() { + return overrideValues; + } + + public void setOverrideValues(Map<String, String> overrideValues) { + this.overrideValues = overrideValues; + } + +} 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 new file mode 100644 index 0000000000..dd10252a0b --- /dev/null +++ b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/OtherConnectivityListEntity.java @@ -0,0 +1,23 @@ +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<Map<String, String>> connectivityRecordsList; + + public List<Map<String, String>> getConnectivityRecordsList() { + return connectivityRecordsList; + } + + public void setConnectivityRecordsList(List<Map<String, String>> connectivityRecordsList) { + this.connectivityRecordsList = connectivityRecordsList; + } + + +} 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 new file mode 100644 index 0000000000..875ef0d9a1 --- /dev/null +++ b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ProfileEntity.java @@ -0,0 +1,74 @@ +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/ResourceBundleEntity.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ResourceBundleEntity.java new file mode 100644 index 0000000000..bc3a8ad34b --- /dev/null +++ b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/ResourceBundleEntity.java @@ -0,0 +1,65 @@ +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<String, String> 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<String, String> getLabels() { + return labels; + } + + public void setLabels(Map<String, String> labels) { + this.labels = labels; + } + +} 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 new file mode 100644 index 0000000000..70faefa150 --- /dev/null +++ b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/Tag.java @@ -0,0 +1,20 @@ +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 new file mode 100644 index 0000000000..952edef7f6 --- /dev/null +++ b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/rest/CnfAdapterRest.java @@ -0,0 +1,301 @@ +package org.onap.so.adapters.cnf.rest; + +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +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.ConfigTemplateEntity; +import org.onap.so.adapters.cnf.model.ConfigurationEntity; +import org.onap.so.adapters.cnf.model.ConnectivityInfo; +import org.onap.so.adapters.cnf.model.InstanceEntity; +import org.onap.so.adapters.cnf.model.ProfileEntity; +import org.onap.so.adapters.cnf.model.ResourceBundleEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +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.ResponseBody; +import org.springframework.web.bind.annotation.RestController; +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(); + + @ResponseBody + @RequestMapping(value = {"/api/multicloud-k8s/v1/healthcheck"}, method = RequestMethod.GET, + produces = "application/json") + public String healthCheck() throws Exception { + + logger.info("health check called."); + + // TODO + HttpGet req = new HttpGet("https://localhost:32780/api/multicloud-k8s/v1/healthcheck"); + try (CloseableHttpResponse response = httpClient.execute(req)) { + logger.info("response:" + response.getEntity()); + return EntityUtils.toString(response.getEntity()); + } + } + + @ResponseBody + @RequestMapping(value = {"/api/multicloud-k8s/v1/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("https://localhost:32780/api/multicloud-k8s/v1/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/multicloud-k8s/v1/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( + "https://localhost:32780/api/multicloud-k8s/v1/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/multicloud-k8s/v1/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://localhost:32780/api/multicloud-k8s/v1/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/multicloud-k8s/v1/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("https://localhost:32780/api/multicloud-k8s/v1/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/multicloud-k8s/v1/v1/instance"}, method = RequestMethod.POST, + produces = "application/json") + public String createInstance(@RequestBody InstanceEntity iE) throws Exception { + + logger.info("create Instance called."); + + // TODO + // Below URL should be changed as appropriate multicloud URL. + HttpPost post = new HttpPost("https://localhost:32780/api/multicloud-k8s/v1/v1/instance"); + ObjectMapper objectMapper = new ObjectMapper(); + + objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); + String requestBody = objectMapper.writeValueAsString(iE); + 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/multicloud-k8s/v1/v1/instance/{instID}"}, method = RequestMethod.GET, + produces = "application/json") + public String getInstance(@PathVariable("instID") String instanceId) throws Exception { + + logger.info("get Instance called."); + // TODO + // Below URL should be changed as appropriate multicloud URL. + HttpGet req = new HttpGet("https://localhost:32780/api/multicloud-k8s/v1/v1/instance/" + instanceId); + + try (CloseableHttpResponse response = httpClient.execute(req)) { + logger.info("response:" + response.getEntity()); + return EntityUtils.toString(response.getEntity()); + } + } + + @ResponseBody + @RequestMapping( + value = {"/api/multicloud-k8s/v1/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("https://localhost:32780/api/multicloud-k8s/v1/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/multicloud-k8s/v1/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("https://localhost:32780/api/multicloud-k8s/v1/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/multicloud-k8s/v1/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("https://localhost:32780/api/multicloud-k8s/v1/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/multicloud-k8s/v1/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("https://localhost:32780/api/multicloud-k8s/v1/v1/connectivity-info/" + connName); + + try (CloseableHttpResponse response = httpClient.execute(req)) { + logger.info("response:" + response.getEntity()); + return EntityUtils.toString(response.getEntity()); + } + } + + @ResponseBody + @RequestMapping(value = {"/api/multicloud-k8s/v1/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://localhost:32780/api/multicloud-k8s/v1/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/multicloud-k8s/v1/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("https://localhost:32780/api/multicloud-k8s/v1/v1/rb/definition/" + rbName + "/" + + rbVersion + "/config-template/" + tName); + + try (CloseableHttpResponse response = httpClient.execute(req)) { + logger.info("response:" + response.getEntity()); + return EntityUtils.toString(response.getEntity()); + } + } + +} diff --git a/adapters/mso-cnf-adapter/src/main/resources/META-INF/services/org.onap.so.client.RestProperties b/adapters/mso-cnf-adapter/src/main/resources/META-INF/services/org.onap.so.client.RestProperties new file mode 100644 index 0000000000..f93ec63f37 --- /dev/null +++ b/adapters/mso-cnf-adapter/src/main/resources/META-INF/services/org.onap.so.client.RestProperties @@ -0,0 +1 @@ +org.onap.so.adapters.nssmf.extclients.aai.AaiClientPropertiesImpl
\ No newline at end of file diff --git a/adapters/mso-cnf-adapter/src/main/resources/application.yaml b/adapters/mso-cnf-adapter/src/main/resources/application.yaml new file mode 100644 index 0000000000..30b1b626a5 --- /dev/null +++ b/adapters/mso-cnf-adapter/src/main/resources/application.yaml @@ -0,0 +1,61 @@ +# +# ============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========================================================= +#/ +#aai: +# auth: 2A11B07DB6214A839394AA1EC5844695F5114FC407FF5422625FB00175A3DCB8A1FF745F22867EFA72D5369D599BBD88DA8BED4233CF5586 +# endpoint: https://aai.onap:30233 +#logging: +# path: logs + +#spring: +# datasource: + # driver-class-name: org.mariadb.jdbc.Driver +# jdbcUrl: jdbc:mariadb://192.168.235.44:30444/requestdb + # username: root + # password: secretpassword + + # jpa: + # show-sql: false + # hibernate: + # dialect: org.hibernate.dialect.MySQL5Dialect + # ddl-auto: validate + # naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy + # enable-lazy-load-no-trans: true +server: + port: 9013 + tomcat: + max-threads: 50 + +#mso: + # key: 07a7159d3bf51a0e53be7a8f89699be7 + # site-name: localSite +# logPath: ./logs/nssmf + # msb-ip: msb-iag.{{ include "common.namespace" . }} + # msb-port: 80 + # adapters: + # requestDb: + # endpoint: https://so-request-db-adapter.{{ include "common.namespace" . }}:8083 + # auth: Basic YnBlbDpwYXNzd29yZDEk + +#Actuator +#management: +# security: + # enabled: false + # basic: +# enabled: false
\ No newline at end of file diff --git a/adapters/pom.xml b/adapters/pom.xml index 05d8b38dac..3c71b3c031 100644 --- a/adapters/pom.xml +++ b/adapters/pom.xml @@ -20,6 +20,7 @@ <module>mso-requests-db-adapter</module> <module>mso-catalog-db-adapter</module> <module>mso-vfc-adapter</module> + <module>mso-cnf-adapter</module> <module>mso-openstack-adapters</module> <module>etsi-sol003-adapter</module> <module>mso-nssmf-adapter</module> diff --git a/docs/api/swagger/swagger.json b/docs/api/swagger/swagger.json index 6ba8380a5f..5051ba19e9 100644 --- a/docs/api/swagger/swagger.json +++ b/docs/api/swagger/swagger.json @@ -2,13 +2,16 @@ "swagger": "2.0", "info": { "version": "3.1.2", - "title": "SO Casablanca APIs" + "title": "SO Guilin APIs" }, "tags": [ { "name": "e2eServiceInstances" }, { + "name": "3gppservices" + }, + { "name": "globalhealthcheck" }, { @@ -288,6 +291,252 @@ } } }, + "/onap/so/infra/3gppservices/{version}/allocate": { + "post": { + "tags": [ + "3gppservices" + ], + "summary": "Create a 3GPP Service Instance on a version provided", + "description": "", + "operationId": "allocate3gppService", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/Allocate3gppService" + } + }, + { + "name": "version", + "in": "path", + "required": true, + "type": "string", + "pattern": "[vV][1]" + } + ], + "responses": { + "default": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/3gppServiceResponse" + } + } + } + } + }, + "/onap/so/infra/3gppservices/{version}/deAllocate": { + "delete": { + "tags": [ + "3gppservices" + ], + "summary": "Terminate/Deallocate a 3GPP Service Instance on a version provided", + "description": "", + "operationId": "deallocate3gppService", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/DeAllocate3gppService" + } + }, + { + "name": "version", + "in": "path", + "required": true, + "type": "string", + "pattern": "[vV][1]" + } + ], + "responses": { + "default": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/3gppServiceResponse" + } + } + } + } + }, + "/onap/so/infra/3gppservices/{version}/modify": { + "put": { + "tags": [ + "3gppservices" + ], + "summary": "Modify a 3GPP Service Instance on a version provided", + "description": "", + "operationId": "modify3gppService", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/Modify3gppService" + } + }, + { + "name": "version", + "in": "path", + "required": true, + "type": "string", + "pattern": "[vV][1]" + } + ], + "responses": { + "default": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/3gppServiceResponse" + } + } + } + } + }, + "/onap/so/infra/3gppservices/{version}/activate": { + "post": { + "tags": [ + "3gppservices" + ], + "summary": "Activate a 3GPP Service Instance on a version provided", + "description": "", + "operationId": "activate3gppService", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/3gppServiceActivation" + } + }, + { + "name": "version", + "in": "path", + "required": true, + "type": "string", + "pattern": "[vV][1]" + } + ], + "responses": { + "default": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/3gppServiceResponse" + } + } + } + } + }, + "/onap/so/infra/3gppservices/{version}/deActivate": { + "post": { + "tags": [ + "3gppservices" + ], + "summary": "Deactivate a 3GPP Service Instance on a version provided", + "description": "", + "operationId": "deactivate3gppService", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/3gppServiceActivation" + } + }, + { + "name": "version", + "in": "path", + "required": true, + "type": "string", + "pattern": "[vV][1]" + } + ], + "responses": { + "default": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/3gppServiceResponse" + } + } + } + } + }, + "/onap/so/infra/3gppservices/{version}/subnetCapabilityQuery": { + "get": { + "tags": [ + "3gppservices" + ], + "summary": "Provides subnet capability based on subnet types", + "description": "", + "operationId": "querySubnetCapability", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/QuerySubnetCapability" + } + }, + { + "name": "version", + "in": "path", + "required": true, + "type": "string", + "pattern": "[vV][1]" + } + ], + "responses": { + "default": { + "description": "successful operation with capabilities for the queried subnetTypes", + "schema": { + "type": "object" + } + } + } + } + }, "/globalhealthcheck": { "get": { "tags": [ @@ -2298,5 +2547,161 @@ } } } + }, + "definitions": { + "Allocate3gppService": { + "description": "This describes the request body for 3gpp service allocation", + "type": "object", + "properties": { + "name": { + "description": "Name of the service to allocate", + "type": "string" + }, + "modelInvariantUuid": { + "description": "Model Invariant UUID corresponding to the service. For E.g : NSST Model invariant uuid in case of NSSI creation", + "type": "string" + }, + "modelUuid": { + "description": "Model UUID corresponding to the service. For E.g : NSST Model uuid in case of NSSI creation", + "type": "string" + }, + "globalSubscriberId": { + "type": "string" + }, + "subscriptionServiceType": { + "description": "Service type for the subscription. For E.G :5G", + "type": "string" + }, + "networkType": { + "description": "Network type. For E.G :AN/CN/TN", + "type": "string" + }, + "additionalProperties": { + "description": "Map of additional properties required for service allocation", + "type": "object" + } + } + }, + "DeAllocate3gppService": { + "description": "This describes the request body for 3gpp service Termination/Deallocation", + "type": "object", + "properties": { + "serviceInstanceID": { + "description": "ID of the service to terminate", + "type": "string" + }, + "globalSubscriberId": { + "type": "string" + }, + "subscriptionServiceType": { + "description": "Service type for the subscription. For E.G :5G", + "type": "string" + }, + "networkType": { + "description": "Network type. For E.G :AN/CN/TN", + "type": "string" + }, + "additionalProperties": { + "description": "Map of additional properties required for service deallocation", + "type": "object" + } + } + }, + "Modify3gppService": { + "description": "This describes the request body for 3gpp service modification", + "type": "object", + "properties": { + "name": { + "description": "Name of the service to modify", + "type": "string" + }, + "serviceInstanceID": { + "description": "ID of the service to modify", + "type": "string" + }, + "globalSubscriberId": { + "type": "string" + }, + "subscriptionServiceType": { + "description": "Service type for the subscription. For E.G :5G", + "type": "string" + }, + "networkType": { + "description": "Network type. For E.G :AN/CN/TN", + "type": "string" + }, + "additionalProperties": { + "description": "Map of additional properties required for service modification", + "type": "object" + } + } + }, + "3gppServiceActivation": { + "description": "This describes the request body for 3gpp service activation/deactivation", + "type": "object", + "properties": { + "serviceInstanceID": { + "description": "ID of the service to be activated/deactivated", + "type": "string" + }, + "globalSubscriberId": { + "type": "string" + }, + "subscriptionServiceType": { + "description": "Service type for the subscription. For E.G :5G", + "type": "string" + }, + "networkType": { + "description": "Network type. For E.G :AN/CN/TN", + "type": "string" + }, + "additionalProperties": { + "description": "Map of additional properties required for service activation/deactivation", + "type": "object" + } + } + }, + "QuerySubnetCapability": { + "description": "This describes the subnet capabilities that can be queried", + "type": "object", + "properties": { + "subnetTypes": { + "type": "array", + "items": { + "$ref": "#/definitions/SubnetTypes" + } + } + } + }, + "SubnetTypes": { + "description": "This describes allowed subnet types", + "type": "string", + "enum": [ + "AN", + "AN-NF", + "CN", + "TN-FH", + "TN-MH", + "TN-BH" + ] + }, + "3gppServiceResponse": { + "description": "This describes the response for 3gpp services", + "type": "object", + "properties": { + "jobId": { + "description": "Job ID to be used to identify the status of the job", + "type": "string" + }, + "status": { + "description": "status of the job", + "type": "string" + }, + "statusDescription": { + "description": "Description on status in case of erroneous response", + "type": "string" + } + } + } } -}
\ No newline at end of file +} diff --git a/docs/api/swagger/swagger.yaml b/docs/api/swagger/swagger.yaml index 11c72b612c..049436f954 100644 --- a/docs/api/swagger/swagger.yaml +++ b/docs/api/swagger/swagger.yaml @@ -1,9 +1,10 @@ swagger: '2.0' info: version: 3.1.2 - title: SO Casablanca APIs + title: SO Guilin APIs tags: - name: e2eServiceInstances + - name: 3gppservices - name: globalhealthcheck - name: nodehealthcheck - name: onapsoinfraorchestrationRequests @@ -183,6 +184,168 @@ paths: responses: default: description: successful operation + '/onap/so/infra/3gppservices/{version}/allocate': + post: + tags: + - 3gppservices + summary: Create a 3GPP Service Instance on a version provided + description: '' + operationId: allocate3gppService + consumes: + - application/json + produces: + - application/json + parameters: + - in: body + name: body + required: true + schema: + $ref: '#/definitions/Allocate3gppService' + - name: version + in: path + required: true + type: string + pattern: '[vV][1]' + responses: + default: + description: successful operation + schema: + $ref: '#/definitions/3gppServiceResponse' + '/onap/so/infra/3gppservices/{version}/deAllocate': + delete: + tags: + - 3gppservices + summary: Terminate/Deallocate a 3GPP Service Instance on a version provided + description: '' + operationId: deallocate3gppService + consumes: + - application/json + produces: + - application/json + parameters: + - in: body + name: body + required: true + schema: + $ref: '#/definitions/DeAllocate3gppService' + - name: version + in: path + required: true + type: string + pattern: '[vV][1]' + responses: + default: + description: successful operation + schema: + $ref: '#/definitions/3gppServiceResponse' + '/onap/so/infra/3gppservices/{version}/modify': + put: + tags: + - 3gppservices + summary: Modify a 3GPP Service Instance on a version provided + description: '' + operationId: modify3gppService + consumes: + - application/json + produces: + - application/json + parameters: + - in: body + name: body + required: true + schema: + $ref: '#/definitions/Modify3gppService' + - name: version + in: path + required: true + type: string + pattern: '[vV][1]' + responses: + default: + description: successful operation + schema: + $ref: '#/definitions/3gppServiceResponse' + '/onap/so/infra/3gppservices/{version}/activate': + post: + tags: + - 3gppservices + summary: Activate a 3GPP Service Instance on a version provided + description: '' + operationId: activate3gppService + consumes: + - application/json + produces: + - application/json + parameters: + - in: body + name: body + required: true + schema: + $ref: '#/definitions/3gppServiceActivation' + - name: version + in: path + required: true + type: string + pattern: '[vV][1]' + responses: + default: + description: successful operation + schema: + $ref: '#/definitions/3gppServiceResponse' + '/onap/so/infra/3gppservices/{version}/deActivate': + post: + tags: + - 3gppservices + summary: Deactivate a 3GPP Service Instance on a version provided + description: '' + operationId: deactivate3gppService + consumes: + - application/json + produces: + - application/json + parameters: + - in: body + name: body + required: true + schema: + $ref: '#/definitions/3gppServiceActivation' + - name: version + in: path + required: true + type: string + pattern: '[vV][1]' + responses: + default: + description: successful operation + schema: + $ref: '#/definitions/3gppServiceResponse' + '/onap/so/infra/3gppservices/{version}/subnetCapabilityQuery': + get: + tags: + - 3gppservices + summary: Provides subnet capability based on subnet types + description: '' + operationId: querySubnetCapability + consumes: + - application/json + produces: + - application/json + parameters: + - in: body + name: body + required: true + schema: + $ref: '#/definitions/QuerySubnetCapability' + - name: version + in: path + required: true + type: string + pattern: '[vV][1]' + responses: + default: + description: successful operation with capabilities for the queried subnetTypes + schema: + type: object /globalhealthcheck: get: tags: @@ -1518,3 +1681,122 @@ paths: responses: default: description: successful operation +definitions: + Allocate3gppService: + description: This describes the request body for 3gpp service allocation + type: object + properties: + name: + description: Name of the service to allocate + type: string + modelInvariantUuid: + description: >- + Model Invariant UUID corresponding to the service. For E.g : NSST + Model invariant uuid in case of NSSI creation + type: string + modelUuid: + description: >- + Model UUID corresponding to the service. For E.g : NSST Model uuid in + case of NSSI creation + type: string + globalSubscriberId: + type: string + subscriptionServiceType: + description: 'Service type for the subscription. For E.G :5G' + type: string + networkType: + description: 'Network type. For E.G :AN/CN/TN' + type: string + additionalProperties: + description: Map of additional properties required for service allocation + type: object + DeAllocate3gppService: + description: This describes the request body for 3gpp service Termination/Deallocation + type: object + properties: + serviceInstanceID: + description: ID of the service to terminate + type: string + globalSubscriberId: + type: string + subscriptionServiceType: + description: 'Service type for the subscription. For E.G :5G' + type: string + networkType: + description: 'Network type. For E.G :AN/CN/TN' + type: string + additionalProperties: + description: Map of additional properties required for service deallocation + type: object + Modify3gppService: + description: This describes the request body for 3gpp service modification + type: object + properties: + name: + description: Name of the service to modify + type: string + serviceInstanceID: + description: ID of the service to modify + type: string + globalSubscriberId: + type: string + subscriptionServiceType: + description: 'Service type for the subscription. For E.G :5G' + type: string + networkType: + description: 'Network type. For E.G :AN/CN/TN' + type: string + additionalProperties: + description: Map of additional properties required for service modification + type: object + 3gppServiceActivation: + description: This describes the request body for 3gpp service activation/deactivation + type: object + properties: + serviceInstanceID: + description: ID of the service to be activated/deactivated + type: string + globalSubscriberId: + type: string + subscriptionServiceType: + description: 'Service type for the subscription. For E.G :5G' + type: string + networkType: + description: 'Network type. For E.G :AN/CN/TN' + type: string + additionalProperties: + description: >- + Map of additional properties required for service + activation/deactivation + type: object + QuerySubnetCapability: + description: This describes the subnet capabilities that can be queried + type: object + properties: + subnetTypes: + type: array + items: + $ref: '#/definitions/SubnetTypes' + SubnetTypes: + description: This describes allowed subnet types + type: string + enum: + - AN + - AN-NF + - CN + - TN-FH + - TN-MH + - TN-BH + 3gppServiceResponse: + description: This describes the response for 3gpp services + type: object + properties: + jobId: + description: Job ID to be used to identify the status of the job + type: string + status: + description: status of the job + type: string + statusDescription: + description: Description on status in case of erroneous response + type: string diff --git a/packages/docker/pom.xml b/packages/docker/pom.xml index c260e12123..d6fa44048d 100644 --- a/packages/docker/pom.xml +++ b/packages/docker/pom.xml @@ -102,6 +102,30 @@ </assembly> </build> </image> + <image> + <name>${docker.image.prefix}/mso-cnf-adapter</name> + <build> + <cleanup>try</cleanup> + <dockerFile>docker-files/Dockerfile.mso-cnf-adapter</dockerFile> + <tags> + <tag>${project.version}</tag> + <tag>${project.version}-${maven.build.timestamp}</tag> + <tag>${project.docker.latesttag.version}</tag> + </tags> + <assembly> + <inline> + <dependencySets> + <dependencySet> + <includes> + <include>org.onap.so.adapters:mso-cnf-adapter</include> + </includes> + <outputFileNameMapping>app.jar</outputFileNameMapping> + </dependencySet> + </dependencySets> + </inline> + </assembly> + </build> + </image> <image> <name>${docker.image.prefix}/catalog-db-adapter</name> <build> @@ -421,7 +445,7 @@ <goal>push</goal> </goals> <configuration> - <image>${docker.image.prefix}/catalog-db-adapter,${docker.image.prefix}/request-db-adapter,${docker.image.prefix}/sdnc-adapter,${docker.image.prefix}/openstack-adapter,${docker.image.prefix}/vfc-adapter,${docker.image.prefix}/sdc-controller,${docker.image.prefix}/bpmn-infra,${docker.image.prefix}/api-handler-infra,${docker.image.prefix}/so-monitoring,${docker.image.prefix}/so-simulator,${docker.image.prefix}/mso-nssmf-adapter</image> + <image>${docker.image.prefix}/catalog-db-adapter,${docker.image.prefix}/request-db-adapter,${docker.image.prefix}/sdnc-adapter,${docker.image.prefix}/openstack-adapter,${docker.image.prefix}/vfc-adapter,${docker.image.prefix}/sdc-controller,${docker.image.prefix}/bpmn-infra,${docker.image.prefix}/api-handler-infra,${docker.image.prefix}/so-monitoring,${docker.image.prefix}/so-simulator,${docker.image.prefix}/mso-nssmf-adapter,${docker.image.prefix}/mso-cnf-adapter</image> </configuration> </execution> </executions> @@ -451,6 +475,11 @@ </dependency> <dependency> <groupId>org.onap.so.adapters</groupId> + <artifactId>mso-cnf-adapter</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.so.adapters</groupId> <artifactId>mso-requests-db-adapter</artifactId> <version>${project.version}</version> </dependency> diff --git a/packages/docker/src/main/docker/docker-files/Dockerfile.mso-cnf-adapter b/packages/docker/src/main/docker/docker-files/Dockerfile.mso-cnf-adapter new file mode 100644 index 0000000000..57c1791c91 --- /dev/null +++ b/packages/docker/src/main/docker/docker-files/Dockerfile.mso-cnf-adapter @@ -0,0 +1,28 @@ + +FROM onap/so/base-image:1.0 +ARG http_proxy +ENV HTTP_PROXY=$http_proxy +ENV http_proxy=$HTTP_PROXY +ARG https_proxy +ENV HTTPS_PROXY=$https_proxy +ENV https_proxy=$HTTPS_PROXY +USER root +RUN mkdir -p /app/config +RUN mkdir -p /app/certificates +RUN mkdir -p /app/logs +RUN mkdir -p /app/ca-certificates +RUN apk update && apk add apache2-utils -y +COPY maven/app.jar /app +COPY configs/logging/logback-spring.xml /app +COPY scripts/start-app.sh /app +COPY scripts/wait-for.sh /app +COPY ca-certificates/onap-ca.crt /app/ca-certificates/onap-ca.crt +RUN chown -R so:so /app +USER so +# Springboot configuration (required) +VOLUME /app/config +# Root certificates (optional) +VOLUME /app/ca-certificates +WORKDIR /app +ENTRYPOINT ["/app/start-app.sh"] + |