summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormukesh.paliwal <mukesh.paliwal1@huawei.com>2021-02-05 12:44:04 +0530
committermukesh.paliwal <mukesh.paliwal1@huawei.com>2021-02-05 12:44:04 +0530
commit36e6d007799eb76a941c7ece38f35860baa8b303 (patch)
tree3cabb652d08674af6585838390f78726cf1c5b7a
parenta152547937fe212232120131d927156623c24425 (diff)
Split mso-cnf-adapter from the so
Issue-ID: SO-3517 Signed-off-by: mukesh.paliwal <mukesh.paliwal1@huawei.com> Change-Id: I99732559aa259c7a39854409819553d46aa0c080
-rwxr-xr-xDockerfile31
-rw-r--r--ca-certificates/onap-ca.crt31
-rw-r--r--configs/logging/logback-spring.xml203
-rwxr-xr-xonap-eclipse-format.xml313
-rwxr-xr-xpom-format.properties5
-rw-r--r--pom.xml245
-rw-r--r--scripts/.gitattributes5
-rwxr-xr-xscripts/start-app.sh89
-rwxr-xr-xscripts/wait-for.sh85
-rw-r--r--src/main/java/org/onap/so/adapters/cnf/MSOCnfApplication.java52
-rw-r--r--src/main/java/org/onap/so/adapters/cnf/WebSecurityConfig.java35
-rw-r--r--src/main/java/org/onap/so/adapters/cnf/exceptions/ApplicationException.java66
-rw-r--r--src/main/java/org/onap/so/adapters/cnf/model/BpmnInstanceRequest.java87
-rw-r--r--src/main/java/org/onap/so/adapters/cnf/model/Config.java31
-rw-r--r--src/main/java/org/onap/so/adapters/cnf/model/ConfigTemplateEntity.java42
-rw-r--r--src/main/java/org/onap/so/adapters/cnf/model/ConfigurationEntity.java54
-rw-r--r--src/main/java/org/onap/so/adapters/cnf/model/ConfigurationRollbackEntity.java22
-rw-r--r--src/main/java/org/onap/so/adapters/cnf/model/ConnectivityInfo.java53
-rw-r--r--src/main/java/org/onap/so/adapters/cnf/model/ConnectivityRecords.java23
-rw-r--r--src/main/java/org/onap/so/adapters/cnf/model/ErrorResponse.java63
-rw-r--r--src/main/java/org/onap/so/adapters/cnf/model/GroupVersionKind.java66
-rw-r--r--src/main/java/org/onap/so/adapters/cnf/model/InstanceMiniResponse.java62
-rw-r--r--src/main/java/org/onap/so/adapters/cnf/model/InstanceMiniResponseList.java45
-rw-r--r--src/main/java/org/onap/so/adapters/cnf/model/InstanceResponse.java99
-rw-r--r--src/main/java/org/onap/so/adapters/cnf/model/InstanceStatusResponse.java84
-rw-r--r--src/main/java/org/onap/so/adapters/cnf/model/MulticloudInstanceRequest.java87
-rw-r--r--src/main/java/org/onap/so/adapters/cnf/model/OtherConnectivityListEntity.java23
-rw-r--r--src/main/java/org/onap/so/adapters/cnf/model/PodStatus.java71
-rw-r--r--src/main/java/org/onap/so/adapters/cnf/model/ProfileEntity.java74
-rw-r--r--src/main/java/org/onap/so/adapters/cnf/model/Resource.java54
-rw-r--r--src/main/java/org/onap/so/adapters/cnf/model/ResourceBundleEntity.java65
-rw-r--r--src/main/java/org/onap/so/adapters/cnf/model/Response.java39
-rw-r--r--src/main/java/org/onap/so/adapters/cnf/model/Tag.java20
-rw-r--r--src/main/java/org/onap/so/adapters/cnf/rest/CnfAdapterRest.java677
-rw-r--r--src/main/java/org/onap/so/adapters/cnf/service/CnfAdapterService.java251
-rw-r--r--src/main/java/org/onap/so/adapters/cnf/util/CNfAdapterUtil.java94
-rw-r--r--src/main/resources/META-INF/services/org.onap.so.client.RestProperties1
-rw-r--r--src/main/resources/application.yaml61
-rw-r--r--src/test/java/org/onap/so/adapters/cnf/CnfAdapterRestTest.java63
-rw-r--r--src/test/java/org/onap/so/adapters/cnf/rest/CnfAdapterRestTest.java106
-rw-r--r--src/test/java/org/onap/so/adapters/cnf/service/CnfAdapterServiceTest.java104
41 files changed, 3681 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100755
index 0000000..c5460cd
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,31 @@
+FROM adoptopenjdk/openjdk11:jre-11.0.8_10-alpine
+
+ARG JAR_FILE
+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
+COPY target/mso-cnf-adapter-1.7.1-SNAPSHOT.jar /app/app.jar
+#COPY target/${JAR_FILE} /app/app.jar
+
+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"]
+
diff --git a/ca-certificates/onap-ca.crt b/ca-certificates/onap-ca.crt
new file mode 100644
index 0000000..e9a50d7
--- /dev/null
+++ b/ca-certificates/onap-ca.crt
@@ -0,0 +1,31 @@
+-----BEGIN CERTIFICATE-----
+MIIFPjCCAyagAwIBAgIJAJ6u7cCnzrWdMA0GCSqGSIb3DQEBCwUAMCwxDjAMBgNV
+BAsMBU9TQUFGMQ0wCwYDVQQKDARPTkFQMQswCQYDVQQGEwJVUzAeFw0xODA0MDUx
+NDE1MjhaFw0zODAzMzExNDE1MjhaMCwxDjAMBgNVBAsMBU9TQUFGMQ0wCwYDVQQK
+DARPTkFQMQswCQYDVQQGEwJVUzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
+ggIBAMA5pkgRs7NhGG4ew5JouhyYakgYUyFaG121+/h8qbSdt0hVQv56+EA41Yq7
+XGie7RYDQK9NmAFF3gruE+6X7wvJiChp+Cyd7sFMnb65uWhxEdxWTM2BJFrgfzUn
+H8ZCxgaCo3XH4PzlKRy2LQQJEJECwl/RZmRCXijMt5e9h8XoZY/fKkKcZZUsWNCM
+pTo266wjvA9MXLmdgReRj0+vrCjrNqy+htwJDztoiHWiYPqT6o8EvGcgjNqjlZx7
+NUNf8MfLDByqKF6+wRbHv1GKjn3/Vijd45Fv8riyRYROiFanvbV6jIfBkv8PZbXg
+2VDWsYsgp8NAvMxK+iV8cO+Ck3lBI2GOPZbCEqpPVTYbLUz6sczAlCXwQoPzDIZY
+wYa3eR/gYLY1gP2iEVHORag3bLPap9ZX5E8DZkzTNTjovvLk8KaCmfcaUMJsBtDd
+ApcUitz10cnRyZc1sX3gE1f3DpzQM6t9C5sOVyRhDcSrKqqwb9m0Ss04XAS9FsqM
+P3UWYQyqDXSxlUAYaX892u8mV1hxnt2gjb22RloXMM6TovM3sSrJS0wH+l1nznd6
+aFXftS/G4ZVIVZ/LfT1is4StoyPWZCwwwly1z8qJQ/zhip5NgZTxQw4mi7ww35DY
+PdAQOCoajfSvFjqslQ/cPRi/MRCu079heVb5fQnnzVtnpFQRAgMBAAGjYzBhMB0G
+A1UdDgQWBBRTVTPyS+vQUbHBeJrBKDF77+rtSTAfBgNVHSMEGDAWgBRTVTPyS+vQ
+UbHBeJrBKDF77+rtSTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAN
+BgkqhkiG9w0BAQsFAAOCAgEAPx/IaK94n02wPxpnYTy+LVLIxwdq/kawNd6IbiMz
+L87zmNMDmHcGbfoRCj8OkhuggX9Lx1/CkhpXimuYsZOFQi5blr/u+v4mIbsgbmi9
+7j+cUHDP0zLycvSvxKHty51LwmaX9a4wkJl5zBU4O1sd/H9tWcEmwJ39ltKoBKBx
+c94Zc3iMm5ytRWGj+0rKzLDAXEWpoZ5bE5PLJauA6UDCxDLfs3FwhbS7uDggxYvf
+jySF5FCNET94oJ+m8s7VeHvoa8iPGKvXrIqdd7XDHnqJJlVKr7m9S0fMbyEB8ci2
+RtOXDt93ifY1uhoEtEykn4dqBSp8ezvNMnwoXdYPDvTd9uCAFeWFLVreBAWxd25h
+PsBTkZA5hpa/rA+mKv6Af4VBViYr8cz4dZCsFChuioVebe9ighrfjB//qKepFjPF
+CyjzKN1u0JKm/2x/ORqxkTONG8p3uDwoIOyimUcTtTMv42bfYD88RKakqSFXE9G+
+Z0LlaKABqfjK49o/tsAp+c5LoNlYllKhnetO3QAdraHwdmC36BhoghzR1jpX751A
+cZn2VH3Q4XKyp01cJNCJIrua+A+bx6zh3RyW6zIIkbRCbET+UD+4mr8WIcSE3mtR
+ZVlnhUDO4z9//WKMVzwS9Rh8/kuszrGFI1KQozXCHLrce3YP6RYZfOed79LXaRwX
+dYY=
+-----END CERTIFICATE-----
diff --git a/configs/logging/logback-spring.xml b/configs/logging/logback-spring.xml
new file mode 100644
index 0000000..e4be709
--- /dev/null
+++ b/configs/logging/logback-spring.xml
@@ -0,0 +1,203 @@
+<!--
+ ============LICENSE_START=======================================================
+ ONAP - SO
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+-->
+<configuration scan="true" debug="false">
+ <contextListener class="org.onap.so.logger.LoggerStartupListener" />
+ <include resource="org/springframework/boot/logging/logback/defaults.xml" />
+
+ <property name="queueSize" value="256" />
+ <property name="maxFileSize" value="200MB" />
+ <property name="maxHistory" value="30" />
+ <property name="totalSizeCap" value="10GB" />
+
+ <!-- log file names -->
+ <property name="errorLogName" value="error" />
+ <property name="metricsLogName" value="metrics" />
+ <property name="auditLogName" value="audit" />
+ <property name="debugLogName" value="debug" />
+
+ <property name="currentTimeStamp" value="%d{&quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&quot;,UTC}" />
+
+ <property name="errorPattern"
+ value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%.-5level|%X{ErrorCode:-500}|%X{ErrorDesc}|%msg%n" />
+
+ <property name="debugPattern" value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}|%logger{50} - %msg%n" />
+
+ <property name="auditPattern"
+ value="%X{EntryTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}||||%marker|%mdc|||%msg%n" />
+
+ <property name="metricPattern"
+ value="%X{InvokeTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}||||%X{TargetVirtualEntity}|%marker|%mdc|||%msg%n" />
+
+ <property name="defaultPattern"
+ value="%nopexception%logger
+ \t%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}
+ \t%level
+ \t%replace(%replace(%message){'\t','\\\\t'}){'\n','\\\\n'}
+ \t%replace(%replace(%mdc){'\t','\\\\t'}){'\n','\\\\n'}
+ \t%replace(%replace(%rootException){'\t','\\\\t'}){'\n','\\\\n'}
+ \t%replace(%replace(%marker){'\t','\\\\t'}){'\n','\\\\n'}
+ \t%thread
+ \t%n" />
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>${errorPattern}</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="Audit" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <marker>EXIT</marker>
+ </evaluator>
+ <onMismatch>DENY</onMismatch>
+ <onMatch>ACCEPT</onMatch>
+ </filter>
+ <file>${logs_dir:-.}/${auditLogName}.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+ <fileNamePattern>${logs_dir:-.}/${auditLogName}.%d{yyyy-MM-dd}.%i.log.zip
+ </fileNamePattern>
+ <maxFileSize>${maxFileSize}</maxFileSize>
+ <maxHistory>${maxHistory}</maxHistory>
+ <totalSizeCap>${totalSizeCap}</totalSizeCap>
+ </rollingPolicy>
+ <encoder>
+ <pattern>${auditPattern}</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="asyncAudit" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="Audit" />
+ </appender>
+
+ <appender name="Metric" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <marker>INVOKE-RETURN</marker>
+ </evaluator>
+ <onMismatch>DENY</onMismatch>
+ <onMatch>ACCEPT</onMatch>
+ </filter>
+ <file>${logs_dir:-.}/${metricsLogName}.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+ <fileNamePattern>${logs_dir:-.}/${metricsLogName}.%d{yyyy-MM-dd}.%i.log.zip
+ </fileNamePattern>
+ <maxFileSize>${maxFileSize}</maxFileSize>
+ <maxHistory>${maxHistory}</maxHistory>
+ <totalSizeCap>${totalSizeCap}</totalSizeCap>
+ </rollingPolicy>
+ <encoder>
+ <pattern>${metricPattern}</pattern>
+ </encoder>
+ </appender>
+
+
+ <appender name="asyncMetric" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="Metric" />
+ </appender>
+
+ <appender name="Error" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <filter class="ch.qos.logback.classic.filter.LevelFilter">
+ <level>ERROR</level>
+ <onMatch>ACCEPT</onMatch>
+ <onMismatch>DENY</onMismatch>
+ </filter>
+ <file>${logs_dir:-.}/${errorLogName}.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+ <fileNamePattern>${logs_dir:-.}/${errorLogName}.%d{yyyy-MM-dd}.%i.log.zip
+ </fileNamePattern>
+ <maxFileSize>${maxFileSize}</maxFileSize>
+ <maxHistory>${maxHistory}</maxHistory>
+ <totalSizeCap>${totalSizeCap}</totalSizeCap>
+ </rollingPolicy>
+ <encoder>
+ <pattern>${errorPattern}</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="asyncError" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="Error" />
+ </appender>
+
+ <appender name="Debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <marker>INVOKE</marker>
+ <marker>INVOKE-RETURN</marker>
+ <marker>ENTRY</marker>
+ <marker>EXIT</marker>
+ </evaluator>
+ <onMismatch>ACCEPT</onMismatch>
+ <onMatch>DENY</onMatch>
+ </filter>
+ <file>${logs_dir:-.}/${debugLogName}.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+ <fileNamePattern>${logs_dir:-.}/${debugLogName}.%d{yyyy-MM-dd}.%i.log.zip
+ </fileNamePattern>
+ <maxFileSize>${maxFileSize}</maxFileSize>
+ <maxHistory>${maxHistory}</maxHistory>
+ <totalSizeCap>${totalSizeCap}</totalSizeCap>
+ </rollingPolicy>
+ <encoder>
+ <pattern>${debugPattern}</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="asyncDebug" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="Debug" />
+ <includeCallerData>true</includeCallerData>
+ </appender>
+
+ <!-- Spring related loggers -->
+ <logger name="org.springframework" level="WARN" />
+ <logger name="org.springframework.security.authentication.dao.DaoAuthenticationProvider" level="DEBUG" />
+
+ <!-- Camunda related loggers -->
+ <logger name="org.camunda.bpm.engine.jobexecutor.level" level="WARN" />
+ <logger name="org.camunda.bpm.engine.impl.persistence.entity.JobEntity.level" level="WARN" />
+
+ <logger name="org.apache.wire" level="DEBUG" />
+ <logger name="org.onap" level="DEBUG" />
+ <logger name="com.att.ecomp" level="DEBUG" />
+ <logger name="org.apache.cxf.interceptor" level="DEBUG" />
+ <logger name="com.att.commons" level="DEBUG" />
+ <logger name="org.reflections" level="ERROR" />
+
+ <logger name="AUDIT" level="INFO" additivity="false">
+ <appender-ref ref="asyncAudit" />
+ </logger>
+
+ <logger name="METRIC" level="INFO" additivity="false">
+ <appender-ref ref="asyncMetric" />
+ </logger>
+
+ <root level="INFO">
+ <appender-ref ref="asyncDebug" />
+ <appender-ref ref="asyncError" />
+ <appender-ref ref="asyncAudit" />
+ <appender-ref ref="asyncMetric" />
+ <appender-ref ref="STDOUT" />
+ </root>
+
+</configuration> \ No newline at end of file
diff --git a/onap-eclipse-format.xml b/onap-eclipse-format.xml
new file mode 100755
index 0000000..093866a
--- /dev/null
+++ b/onap-eclipse-format.xml
@@ -0,0 +1,313 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<profiles version="12">
+<profile kind="CodeFormatterProfile" name="ONAP Java Rule" version="12">
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" value="common_lines"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation" value="common_lines"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement" value="common_lines"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="2"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration" value="common_lines"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
+<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="48"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement" value="common_lines"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="2"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
+<setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="120"/>
+<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause" value="common_lines"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_parameters" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="3"/>
+<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation" value="common_lines"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
+<setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" value="enabled"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.wrap_before_conditional_operator" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines" value="2147483647"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/>
+<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause" value="common_lines"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
+<setting id="org.eclipse.jdt.core.compiler.source" value="1.8"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="48"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.wrap_before_assignment_operator" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.8"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration" value="common_lines"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_arguments" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.8"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration" value="common_lines"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
+</profile>
+</profiles> \ No newline at end of file
diff --git a/pom-format.properties b/pom-format.properties
new file mode 100755
index 0000000..4452c2a
--- /dev/null
+++ b/pom-format.properties
@@ -0,0 +1,5 @@
+maxLineLength=120
+wrapLongLines=true
+tabInsteadOfSpaces=false
+tabWidth=2
+splitMultiAttrs=false \ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..a1db782
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,245 @@
+<!--
+ ~*
+ ~============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.7.1-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>
+ <plugin>
+ <groupId>net.revelc.code.formatter</groupId>
+ <artifactId>formatter-maven-plugin</artifactId>
+ <version>2.9.0</version>
+ <executions>
+ <execution>
+ <id>format-java</id>
+ <goals>
+ <goal>format</goal>
+ </goals>
+ <phase>process-sources</phase>
+ <configuration>
+ <skip>${format.skipExecute}</skip>
+ <configFile>${project.basedir}/onap-eclipse-format.xml</configFile>
+ </configuration>
+ </execution>
+ <execution>
+ <id>format-xml</id>
+ <goals>
+ <goal>format</goal>
+ </goals>
+ <phase>process-sources</phase>
+ <configuration>
+ <skip>${format.skipExecute}</skip>
+ <sourceDirectory>${project.basedir}</sourceDirectory>
+ <configXmlFile>${project.basedir}/pom-format.properties</configXmlFile>
+ <includes>
+ <include>pom.xml</include>
+ </includes>
+ </configuration>
+ </execution>
+ <execution>
+ <id>validate-java</id>
+ <goals>
+ <goal>validate</goal>
+ </goals>
+ <configuration>
+ <skip>${format.skipValidate}</skip>
+ <configFile>${project.basedir}/onap-eclipse-format.xml</configFile>
+ </configuration>
+ </execution>
+ <execution>
+ <id>validate-poms</id>
+ <goals>
+ <goal>validate</goal>
+ </goals>
+ <configuration>
+ <skip>${format.skipValidate}</skip>
+ <configFile>${project.basedir}/pom-format.properties</configFile>
+ <includes>
+ <include>pom.xml</include>
+ </includes>
+ </configuration>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ <version>2.9.8</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.6.0</version>
+ <executions>
+ <execution>
+ <id>docker-build</id>
+ <phase>install</phase>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <configuration>
+ <dockerFile>Dockerfile.so-cnf-adapter</dockerFile>
+ <executable>docker</executable>
+ <workingDirectory>${project.basedir}</workingDirectory>
+ <arguments>
+ <argument>build</argument>
+ <argument>-t</argument>
+ <argument>onap/so/${project.artifactId}:${project.version}</argument>
+ <argument>.</argument>
+ </arguments>
+ <buildArgs>
+ <JAR_FILE>${project.artifactId}-${project.version}.jar</JAR_FILE>
+ <ARTIFACT_ID>${project.artifactId}</ARTIFACT_ID>
+ </buildArgs>
+ </configuration>
+ </execution>
+ </executions>
+ </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>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-spring-boot-starter-jaxrs</artifactId>
+ </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/scripts/.gitattributes b/scripts/.gitattributes
new file mode 100644
index 0000000..b905d1d
--- /dev/null
+++ b/scripts/.gitattributes
@@ -0,0 +1,5 @@
+# Default behavior
+* text=auto
+
+# Files to have unix style line endings on checkout
+*.sh text eol=lf \ No newline at end of file
diff --git a/scripts/start-app.sh b/scripts/start-app.sh
new file mode 100755
index 0000000..54ed9ed
--- /dev/null
+++ b/scripts/start-app.sh
@@ -0,0 +1,89 @@
+#!/bin/sh
+#temprary condition
+if [ `id -u` = 0 ]
+then
+ # Install certificates found in the /app/ca-certificates volume, if any.
+
+ needUpdate=FALSE
+
+ for certificate in `ls -1 /app/ca-certificates`; do
+ echo "Installing $certificate in /usr/local/share/ca-certificates"
+ # cp /app/ca-certificates/$certificate /usr/local/share/ca-certificates/$certificate
+ needUpdate=FALSE
+ done
+
+ # Re-exec this script as the 'onap' user.
+ this=`readlink -f $0`
+ # exec su so -c "$this"
+fi
+
+touch /app/app.jar
+
+if [ ! -z "$DB_HOST" -a -z "$DB_PORT" ]; then
+ export DB_PORT=3306
+fi
+
+if [ -z "${CONFIG_PATH}" ]; then
+ export CONFIG_PATH=/app/config/override.yaml
+fi
+
+if [ "${SSL_DEBUG}" = "log" ]; then
+ export SSL_DEBUG="-Djavax.net.debug=all"
+else
+ export SSL_DEBUG=
+fi
+
+# Set java keystore and truststore options, if specified in the environment.
+
+jksargs=
+
+if [ ! -z "${KEYSTORE}" ]; then
+ jksargs="$jksargs -Dmso.load.ssl.client.keystore=true"
+ jksargs="$jksargs -Djavax.net.ssl.keyStore=$KEYSTORE"
+ jksargs="$jksargs -Djavax.net.ssl.keyStorePassword=${KEYSTORE_PASSWORD}"
+fi
+
+if [ ! -z "${TRUSTSTORE}" ]; then
+ jksargs="$jksargs -Djavax.net.ssl.trustStore=${TRUSTSTORE}"
+ jksargs="$jksargs -Djavax.net.ssl.trustStorePassword=${TRUSTSTORE_PASSWORD}"
+fi
+
+if [ -z "${ACTIVE_PROFILE}" ]; then
+ export ACTIVE_PROFILE="basic"
+fi
+
+jvmargs="${JVM_ARGS} -Dspring.profiles.active=${ACTIVE_PROFILE} -Djava.security.egd=file:/dev/./urandom -Dlogs_dir=${LOG_PATH} -Dlogging.config=/app/logback-spring.xml $jksargs -Dspring.config.additional-location=$CONFIG_PATH ${SSL_DEBUG} ${DISABLE_SNI}"
+
+
+read_properties(){
+ while IFS="=" read -r key value; do
+ case "${key}" in
+ '#'*) ;;
+ *)
+ eKey=$(echo $key | tr '[:lower:]' '[:upper:]')
+ export "$eKey"="$value"
+ esac
+ done <<-EOF
+ $1
+ EOF
+}
+
+
+
+if [ -n "${AAF_SSL_CERTS_ENABLED}" ]; then
+read_properties "$(head -n 4 /app/certs/.passphrases)"
+fi
+
+echo "JVM Arguments: ${jvmargs}"
+
+java ${jvmargs} -jar app.jar
+rc=$?
+
+echo "Application exiting with status code $rc"
+
+if [ ! -z "${EXIT_DELAY}" -a "${EXIT_DELAY}" != 0 ]; then
+ echo "Delaying $APP exit for $EXIT_DELAY seconds"
+ sleep $EXIT_DELAY
+fi
+
+exit $rc
diff --git a/scripts/wait-for.sh b/scripts/wait-for.sh
new file mode 100755
index 0000000..2525821
--- /dev/null
+++ b/scripts/wait-for.sh
@@ -0,0 +1,85 @@
+#!/bin/sh
+# https://github.com/Eficode/wait-for.git
+# MIT License
+
+TIMEOUT=15
+QUIET=0
+
+echoerr() {
+ if [ "$QUIET" -ne 1 ]; then printf "%s\n" "$*" 1>&2; fi
+}
+
+usage() {
+ exitcode="$1"
+ cat << USAGE >&2
+Usage:
+ $cmdname host:port [-t timeout] [-- command args]
+ -q | --quiet Do not output any status messages
+ -t TIMEOUT | --timeout=timeout Timeout in seconds, zero for no timeout
+ -- COMMAND ARGS Execute command with args after the test finishes
+USAGE
+ exit "$exitcode"
+}
+
+wait_for() {
+ command="$*"
+ if [ "$QUIET" -ne 1 ]; then echo "$0: probing host $HOST port $PORT"; fi
+ for i in `seq $TIMEOUT` ; do
+ nc -z "$HOST" "$PORT" > /dev/null 2>&1
+ result=$?
+ if [ $result -eq 0 ] ; then
+ if [ "$QUIET" -ne 1 ]; then echo "$0: operation succeeded on try $i"; fi
+ if [ -n "$command" ] ; then
+ if [ "$QUIET" -ne 1 ]; then echo "$0: exec-ing command $command"; fi
+ exec $command
+ fi
+ exit 0
+ fi
+ if [ "$QUIET" -ne 1 ]; then echo "$0: sleeping after try $i"; fi
+ sleep 1
+ done
+ echo "$0: Operation timed out" >&2
+ exit 1
+}
+
+while [ $# -gt 0 ]
+do
+ case "$1" in
+ *:* )
+ HOST=$(printf "%s\n" "$1"| cut -d : -f 1)
+ PORT=$(printf "%s\n" "$1"| cut -d : -f 2)
+ shift 1
+ ;;
+ -q | --quiet)
+ QUIET=1
+ shift 1
+ ;;
+ -t)
+ TIMEOUT="$2"
+ if [ "$TIMEOUT" = "" ]; then break; fi
+ shift 2
+ ;;
+ --timeout=*)
+ TIMEOUT="${1#*=}"
+ shift 1
+ ;;
+ --)
+ shift
+ break
+ ;;
+ --help)
+ usage 0
+ ;;
+ *)
+ echoerr "Unknown argument: $1"
+ usage 1
+ ;;
+ esac
+done
+
+if [ "$HOST" = "" -o "$PORT" = "" ]; then
+ echoerr "Error: you need to provide a host and port to test."
+ usage 2
+fi
+
+wait_for "$@"
diff --git a/src/main/java/org/onap/so/adapters/cnf/MSOCnfApplication.java b/src/main/java/org/onap/so/adapters/cnf/MSOCnfApplication.java
new file mode 100644
index 0000000..0ba40e2
--- /dev/null
+++ b/src/main/java/org/onap/so/adapters/cnf/MSOCnfApplication.java
@@ -0,0 +1,52 @@
+/*-
+ * ============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/src/main/java/org/onap/so/adapters/cnf/WebSecurityConfig.java b/src/main/java/org/onap/so/adapters/cnf/WebSecurityConfig.java
new file mode 100644
index 0000000..03bfd54
--- /dev/null
+++ b/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/src/main/java/org/onap/so/adapters/cnf/exceptions/ApplicationException.java b/src/main/java/org/onap/so/adapters/cnf/exceptions/ApplicationException.java
new file mode 100644
index 0000000..c950cf6
--- /dev/null
+++ b/src/main/java/org/onap/so/adapters/cnf/exceptions/ApplicationException.java
@@ -0,0 +1,66 @@
+/*-
+ * ============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/src/main/java/org/onap/so/adapters/cnf/model/BpmnInstanceRequest.java b/src/main/java/org/onap/so/adapters/cnf/model/BpmnInstanceRequest.java
new file mode 100644
index 0000000..2e76d51
--- /dev/null
+++ b/src/main/java/org/onap/so/adapters/cnf/model/BpmnInstanceRequest.java
@@ -0,0 +1,87 @@
+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<String, String> labels;
+
+ @JsonProperty(value = "overrideValues")
+ private Map<String, String> 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<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/src/main/java/org/onap/so/adapters/cnf/model/Config.java b/src/main/java/org/onap/so/adapters/cnf/model/Config.java
new file mode 100644
index 0000000..b901a39
--- /dev/null
+++ b/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/src/main/java/org/onap/so/adapters/cnf/model/ConfigTemplateEntity.java b/src/main/java/org/onap/so/adapters/cnf/model/ConfigTemplateEntity.java
new file mode 100644
index 0000000..2ed35b8
--- /dev/null
+++ b/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/src/main/java/org/onap/so/adapters/cnf/model/ConfigurationEntity.java b/src/main/java/org/onap/so/adapters/cnf/model/ConfigurationEntity.java
new file mode 100644
index 0000000..7f6ae86
--- /dev/null
+++ b/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/src/main/java/org/onap/so/adapters/cnf/model/ConfigurationRollbackEntity.java b/src/main/java/org/onap/so/adapters/cnf/model/ConfigurationRollbackEntity.java
new file mode 100644
index 0000000..bf78d9c
--- /dev/null
+++ b/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/src/main/java/org/onap/so/adapters/cnf/model/ConnectivityInfo.java b/src/main/java/org/onap/so/adapters/cnf/model/ConnectivityInfo.java
new file mode 100644
index 0000000..a2554d1
--- /dev/null
+++ b/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/src/main/java/org/onap/so/adapters/cnf/model/ConnectivityRecords.java b/src/main/java/org/onap/so/adapters/cnf/model/ConnectivityRecords.java
new file mode 100644
index 0000000..06cfdf1
--- /dev/null
+++ b/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/src/main/java/org/onap/so/adapters/cnf/model/ErrorResponse.java b/src/main/java/org/onap/so/adapters/cnf/model/ErrorResponse.java
new file mode 100644
index 0000000..135adcc
--- /dev/null
+++ b/src/main/java/org/onap/so/adapters/cnf/model/ErrorResponse.java
@@ -0,0 +1,63 @@
+/*-
+ * ============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/src/main/java/org/onap/so/adapters/cnf/model/GroupVersionKind.java b/src/main/java/org/onap/so/adapters/cnf/model/GroupVersionKind.java
new file mode 100644
index 0000000..bfa5505
--- /dev/null
+++ b/src/main/java/org/onap/so/adapters/cnf/model/GroupVersionKind.java
@@ -0,0 +1,66 @@
+
+/*-
+ * ============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/src/main/java/org/onap/so/adapters/cnf/model/InstanceMiniResponse.java b/src/main/java/org/onap/so/adapters/cnf/model/InstanceMiniResponse.java
new file mode 100644
index 0000000..5804082
--- /dev/null
+++ b/src/main/java/org/onap/so/adapters/cnf/model/InstanceMiniResponse.java
@@ -0,0 +1,62 @@
+/*-
+ * ============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/src/main/java/org/onap/so/adapters/cnf/model/InstanceMiniResponseList.java b/src/main/java/org/onap/so/adapters/cnf/model/InstanceMiniResponseList.java
new file mode 100644
index 0000000..ad70fbb
--- /dev/null
+++ b/src/main/java/org/onap/so/adapters/cnf/model/InstanceMiniResponseList.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.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<InstanceMiniResponse> instancList;
+
+ public List<InstanceMiniResponse> getInstancList() {
+ return instancList;
+ }
+
+ public void setInstancList(List<InstanceMiniResponse> instancList) {
+ this.instancList = instancList;
+ }
+
+}
diff --git a/src/main/java/org/onap/so/adapters/cnf/model/InstanceResponse.java b/src/main/java/org/onap/so/adapters/cnf/model/InstanceResponse.java
new file mode 100644
index 0000000..ae63f86
--- /dev/null
+++ b/src/main/java/org/onap/so/adapters/cnf/model/InstanceResponse.java
@@ -0,0 +1,99 @@
+
+/*-
+ * ============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<Resource> 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<Resource> getResources() {
+ return resources;
+ }
+
+ @JsonProperty("resources")
+ public void setResources(List<Resource> 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/src/main/java/org/onap/so/adapters/cnf/model/InstanceStatusResponse.java b/src/main/java/org/onap/so/adapters/cnf/model/InstanceStatusResponse.java
new file mode 100644
index 0000000..2472684
--- /dev/null
+++ b/src/main/java/org/onap/so/adapters/cnf/model/InstanceStatusResponse.java
@@ -0,0 +1,84 @@
+/*-
+ * ============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<PodStatus> 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<PodStatus> getPodStatuses() {
+ return podStatuses;
+ }
+
+ public void setPodStatuses(List<PodStatus> podStatuses) {
+ this.podStatuses = podStatuses;
+ }
+
+ public List<?> getServicesStatuses() {
+ return servicesStatuses;
+ }
+
+ public void setServicesStatuses(List<?> servicesStatuses) {
+ this.servicesStatuses = servicesStatuses;
+ }
+
+}
diff --git a/src/main/java/org/onap/so/adapters/cnf/model/MulticloudInstanceRequest.java b/src/main/java/org/onap/so/adapters/cnf/model/MulticloudInstanceRequest.java
new file mode 100644
index 0000000..b1719cb
--- /dev/null
+++ b/src/main/java/org/onap/so/adapters/cnf/model/MulticloudInstanceRequest.java
@@ -0,0 +1,87 @@
+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<String, String> labels;
+
+ @JsonProperty(value = "override-values")
+ private Map<String, String> 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<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;
+ }
+
+ public String getVfModuleUuid() {
+ return vfModuleUuid;
+ }
+
+ public void setVfModuleUuid(String vfModuleUuid) {
+ this.vfModuleUuid = vfModuleUuid;
+ }
+
+}
diff --git a/src/main/java/org/onap/so/adapters/cnf/model/OtherConnectivityListEntity.java b/src/main/java/org/onap/so/adapters/cnf/model/OtherConnectivityListEntity.java
new file mode 100644
index 0000000..dd10252
--- /dev/null
+++ b/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/src/main/java/org/onap/so/adapters/cnf/model/PodStatus.java b/src/main/java/org/onap/so/adapters/cnf/model/PodStatus.java
new file mode 100644
index 0000000..ed04601
--- /dev/null
+++ b/src/main/java/org/onap/so/adapters/cnf/model/PodStatus.java
@@ -0,0 +1,71 @@
+/*-
+ * ============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/src/main/java/org/onap/so/adapters/cnf/model/ProfileEntity.java b/src/main/java/org/onap/so/adapters/cnf/model/ProfileEntity.java
new file mode 100644
index 0000000..875ef0d
--- /dev/null
+++ b/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/src/main/java/org/onap/so/adapters/cnf/model/Resource.java b/src/main/java/org/onap/so/adapters/cnf/model/Resource.java
new file mode 100644
index 0000000..d18cd76
--- /dev/null
+++ b/src/main/java/org/onap/so/adapters/cnf/model/Resource.java
@@ -0,0 +1,54 @@
+
+/*-
+ * ============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/src/main/java/org/onap/so/adapters/cnf/model/ResourceBundleEntity.java b/src/main/java/org/onap/so/adapters/cnf/model/ResourceBundleEntity.java
new file mode 100644
index 0000000..bc3a8ad
--- /dev/null
+++ b/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/src/main/java/org/onap/so/adapters/cnf/model/Response.java b/src/main/java/org/onap/so/adapters/cnf/model/Response.java
new file mode 100644
index 0000000..4230223
--- /dev/null
+++ b/src/main/java/org/onap/so/adapters/cnf/model/Response.java
@@ -0,0 +1,39 @@
+/*-
+ * ============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/src/main/java/org/onap/so/adapters/cnf/model/Tag.java b/src/main/java/org/onap/so/adapters/cnf/model/Tag.java
new file mode 100644
index 0000000..70faefa
--- /dev/null
+++ b/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/src/main/java/org/onap/so/adapters/cnf/rest/CnfAdapterRest.java b/src/main/java/org/onap/so/adapters/cnf/rest/CnfAdapterRest.java
new file mode 100644
index 0000000..c69b63f
--- /dev/null
+++ b/src/main/java/org/onap/so/adapters/cnf/rest/CnfAdapterRest.java
@@ -0,0 +1,677 @@
+/*-
+ * ============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/src/main/java/org/onap/so/adapters/cnf/service/CnfAdapterService.java b/src/main/java/org/onap/so/adapters/cnf/service/CnfAdapterService.java
new file mode 100644
index 0000000..a134bac
--- /dev/null
+++ b/src/main/java/org/onap/so/adapters/cnf/service/CnfAdapterService.java
@@ -0,0 +1,251 @@
+/*-
+ * ============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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<MediaType> 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/src/main/java/org/onap/so/adapters/cnf/util/CNfAdapterUtil.java b/src/main/java/org/onap/so/adapters/cnf/util/CNfAdapterUtil.java
new file mode 100644
index 0000000..25e506c
--- /dev/null
+++ b/src/main/java/org/onap/so/adapters/cnf/util/CNfAdapterUtil.java
@@ -0,0 +1,94 @@
+/*-
+ * ============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> T unMarshal(String jsonstr, Class<T> 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);
+ }
+ }
+
+}
diff --git a/src/main/resources/META-INF/services/org.onap.so.client.RestProperties b/src/main/resources/META-INF/services/org.onap.so.client.RestProperties
new file mode 100644
index 0000000..bccd43a
--- /dev/null
+++ b/src/main/resources/META-INF/services/org.onap.so.client.RestProperties
@@ -0,0 +1 @@
+org.onap.so.adapters.cnf.extclients.aai.AaiClientPropertiesImpl \ No newline at end of file
diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml
new file mode 100644
index 0000000..5a9adbf
--- /dev/null
+++ b/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: 9012
+ tomcat:
+ max-threads: 50
+
+#mso:
+ # key: 07a7159d3bf51a0e53be7a8f89699be7
+ # site-name: localSite
+# logPath: ./logs/cnf
+ # 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/src/test/java/org/onap/so/adapters/cnf/CnfAdapterRestTest.java b/src/test/java/org/onap/so/adapters/cnf/CnfAdapterRestTest.java
new file mode 100644
index 0000000..ee7a771
--- /dev/null
+++ b/src/test/java/org/onap/so/adapters/cnf/CnfAdapterRestTest.java
@@ -0,0 +1,63 @@
+/*-
+ * ============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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import java.util.HashMap;
+import java.util.Map;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.onap.so.adapters.cnf.model.BpmnInstanceRequest;
+import org.onap.so.adapters.cnf.rest.CnfAdapterRest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+public class CnfAdapterRestTest {
+
+ @InjectMocks
+ CnfAdapterRest cnfAdapterRest;
+
+ @Test
+ public void createInstanceTest() throws Exception {
+
+ Map<String, String> labels = new HashMap<String, String>();
+ labels.put("custom-label-1", "label1");
+ Map<String, String> overrideValues = new HashMap<String, String>();
+ labels.put("image.tag", "latest");
+ labels.put("dcae_collector_ip", "1.2.3.4");
+ BpmnInstanceRequest bpmnInstanceRequest = new BpmnInstanceRequest();
+ bpmnInstanceRequest.setCloudRegionId("v1");
+ bpmnInstanceRequest.setLabels(labels);
+ bpmnInstanceRequest.setModelInvariantId("krd");
+ bpmnInstanceRequest.setModelVersionId("p1");
+ bpmnInstanceRequest.setOverrideValues(overrideValues);
+ bpmnInstanceRequest.setVfModuleUUID("20200824");
+
+ String mockedResponse = "K8sRBProfileName is required";
+ String actualResponse = cnfAdapterRest.createInstance(bpmnInstanceRequest);
+ assertNotNull(actualResponse);
+ assertEquals(mockedResponse, actualResponse);
+ }
+
+}
+*/
diff --git a/src/test/java/org/onap/so/adapters/cnf/rest/CnfAdapterRestTest.java b/src/test/java/org/onap/so/adapters/cnf/rest/CnfAdapterRestTest.java
new file mode 100644
index 0000000..30197bc
--- /dev/null
+++ b/src/test/java/org/onap/so/adapters/cnf/rest/CnfAdapterRestTest.java
@@ -0,0 +1,106 @@
+// TODO
+/*
+ *
+ * ============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.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import
+ * org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import
+ * org.mockito.Mock; import org.mockito.Mockito; import org.onap.so.adapters.cnf.model.BpmnInstanceRequest; import
+ * org.onap.so.adapters.cnf.model.InstanceMiniResponse; import org.onap.so.adapters.cnf.model.InstanceMiniResponseList;
+ * import org.onap.so.adapters.cnf.model.InstanceResponse; import org.onap.so.adapters.cnf.model.InstanceStatusResponse;
+ * import org.onap.so.adapters.cnf.model.MulticloudInstanceRequest; import org.onap.so.adapters.cnf.model.Resource;
+ * import org.onap.so.adapters.cnf.service.CnfAdapterService; import org.springframework.http.HttpStatus; import
+ * org.springframework.http.ResponseEntity; import org.springframework.test.context.junit4.SpringRunner;
+ *
+ *
+ * @RunWith(SpringRunner.class) public class CnfAdapterRestTest {
+ *
+ * @InjectMocks CnfAdapterRest cnfAdapterRest;
+ *
+ * @Mock CnfAdapterService cnfAdapterService;
+ *
+ * @Mock ResponseEntity<InstanceMiniResponseList> instacneMiniResponseList;
+ *
+ * @Mock ResponseEntity<InstanceStatusResponse> instanceStatusResponse;
+ *
+ * @Test public void healthCheckTest() throws Exception {
+ *
+ * ResponseEntity<String> response = new ResponseEntity<String>(HttpStatus.OK); CnfAdapterService cnfAdapterService =
+ * Mockito.mock(CnfAdapterService.class); Mockito.when(cnfAdapterService.healthCheck()).thenReturn(response);
+ * cnfAdapterRest.healthCheck(); Assert.assertNotNull(response); Assert.assertEquals(HttpStatus.OK,
+ * response.getStatusCode()); }
+ *
+ * @Test public void createInstanceTest() throws Exception {
+ *
+ * Map<String, String> labels = new HashMap<String, String>(); labels.put("custom-label-1", "label1"); Map<String,
+ * String> overrideValues = new HashMap<String, String>(); labels.put("image.tag", "latest");
+ * labels.put("dcae_collector_ip", "1.2.3.4"); BpmnInstanceRequest bpmnInstanceRequest = new BpmnInstanceRequest();
+ * bpmnInstanceRequest.setCloudRegionId("v1"); bpmnInstanceRequest.setLabels(labels);
+ * bpmnInstanceRequest.setModelInvariantId("krd"); bpmnInstanceRequest.setModelVersionId("p1");
+ * bpmnInstanceRequest.setOverrideValues(overrideValues); bpmnInstanceRequest.setVfModuleUUID("20200824");
+ * List<Resource> resourceList = new ArrayList<Resource>(); InstanceResponse instanceResponse = new InstanceResponse();
+ * instanceResponse.setId("123"); instanceResponse.setNamespace("testNamespace"); instanceResponse.setRequest(new
+ * MulticloudInstanceRequest()); instanceResponse.setResources(resourceList); String createInstanceResponse = new
+ * ResponseEntity<InstanceResponse>(instanceResponse, HttpStatus.CREATED); CnfAdapterService cnfAdapterService =
+ * Mockito.mock(CnfAdapterService.class); Mockito.when(cnfAdapterService.createInstance(bpmnInstanceRequest)).
+ * thenReturn(createInstanceResponse); cnfAdapterRest.createInstance(bpmnInstanceRequest);
+ * Assert.assertNotNull(createInstanceResponse); Assert.assertEquals(HttpStatus.CREATED,
+ * createInstanceResponse.getStatusCode()); }
+ *
+ * @Test public void getInstanceByInstanceIdTest() throws Exception {
+ *
+ * String instanceId = "123"; String createInstanceResponse = new ResponseEntity<InstanceResponse>(HttpStatus.OK);
+ * CnfAdapterService cnfAdapterService = Mockito.mock(CnfAdapterService.class);
+ * Mockito.when(cnfAdapterService.getInstanceByInstanceId(instanceId)). thenReturn(createInstanceResponse);
+ * cnfAdapterRest.getInstanceByInstanceId(instanceId); Assert.assertNotNull(createInstanceResponse);
+ * Assert.assertEquals(HttpStatus.OK, createInstanceResponse.getStatusCode()); }
+ *
+ * @Test public void deleteInstanceByInstanceIdTest() throws Exception {
+ *
+ * String instanceId = "123"; ResponseEntity<String> response = new ResponseEntity<String>(HttpStatus.OK);
+ * CnfAdapterService cnfAdapterService = Mockito.mock(CnfAdapterService.class);
+ * Mockito.when(cnfAdapterService.deleteInstanceByInstanceId(instanceId)). thenReturn(response);
+ * cnfAdapterRest.deleteInstanceByInstanceId(instanceId); Assert.assertNotNull(response);
+ * Assert.assertEquals(HttpStatus.OK, response.getStatusCode()); }
+ *
+ * @Test public void getInstanceStatusByInstanceIdTest() throws Exception {
+ *
+ * String instanceId = "123"; instanceStatusResponse = new ResponseEntity<InstanceStatusResponse>(HttpStatus.OK);
+ * CnfAdapterService cnfAdapterService = Mockito.mock(CnfAdapterService.class);
+ * Mockito.when(cnfAdapterService.getInstanceStatusByInstanceId(instanceId)). thenReturn(instanceStatusResponse);
+ * cnfAdapterRest.getInstanceStatusByInstanceId(instanceId); Assert.assertNotNull(instanceStatusResponse);
+ * Assert.assertEquals(HttpStatus.OK, instanceStatusResponse.getStatusCode()); }
+ *
+ * @Test public void getInstanceByRBNameOrRBVersionOrProfileNameTest() throws Exception {
+ *
+ * String rbName = "xyz"; String rbVersion = "v1"; String profileName = "p1"; InstanceMiniResponse instanceMiniResponse
+ * = new InstanceMiniResponse(HttpStatus.OK.toString()); List<InstanceMiniResponse> instancList = new
+ * ArrayList<InstanceMiniResponse>(); instancList.add(instanceMiniResponse); InstanceMiniResponseList
+ * instanceMiniRespList = new InstanceMiniResponseList(HttpStatus.OK.toString());
+ * instanceMiniRespList.setInstancList(instancList); instanceMiniRespList.setErrorMsg(HttpStatus.OK.toString());
+ * ResponseEntity<InstanceMiniResponseList> respone = new ResponseEntity<InstanceMiniResponseList>(instanceMiniRespList,
+ * HttpStatus.OK); CnfAdapterService cnfAdapterService = Mockito.mock(CnfAdapterService.class);
+ * Mockito.when(cnfAdapterService.getInstanceByRBNameOrRBVersionOrProfileName( rbName, rbVersion, profileName))
+ * .thenReturn(instacneMiniResponseList); cnfAdapterRest.getInstanceByRBNameOrRBVersionOrProfileName(rbName, rbVersion,
+ * profileName); Assert.assertNotNull(instacneMiniResponseList); Assert.assertEquals(HttpStatus.OK.toString(),
+ * instanceMiniRespList.getErrorMsg()); }
+ *
+ * }
+ *
+ */
diff --git a/src/test/java/org/onap/so/adapters/cnf/service/CnfAdapterServiceTest.java b/src/test/java/org/onap/so/adapters/cnf/service/CnfAdapterServiceTest.java
new file mode 100644
index 0000000..e114f44
--- /dev/null
+++ b/src/test/java/org/onap/so/adapters/cnf/service/CnfAdapterServiceTest.java
@@ -0,0 +1,104 @@
+// TODO
+/*
+ * package org.onap.so.adapters.cnf.service;
+ *
+ * import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks;
+ * import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import
+ * org.onap.so.adapters.cnf.model.BpmnInstanceRequest; import org.onap.so.adapters.cnf.model.InstanceMiniResponseList;
+ * import org.onap.so.adapters.cnf.model.InstanceResponse; import org.onap.so.adapters.cnf.model.InstanceStatusResponse;
+ * import org.springframework.http.HttpEntity; import org.springframework.http.HttpMethod; import
+ * org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import
+ * org.springframework.test.context.junit4.SpringRunner; import org.springframework.web.client.RestTemplate;
+ *
+ * @RunWith(SpringRunner.class) public class CnfAdapterServiceTest {
+ *
+ * @InjectMocks CnfAdapterService cnfAdapterService;
+ *
+ * @Mock ResponseEntity<InstanceResponse> createInstanceResponse;
+ *
+ * @Mock ResponseEntity<InstanceMiniResponseList> instacneMiniResponseList;
+ *
+ * @Mock ResponseEntity<InstanceStatusResponse> instanceStatusResponse;
+ *
+ * @Mock private RestTemplate restTemplate;
+ *
+ * @Test public void healthCheckTest() throws Exception {
+ *
+ * ResponseEntity<String> response = new ResponseEntity<String>(HttpStatus.OK);
+ *
+ * Mockito.when(restTemplate.exchange(Matchers.anyString(), Matchers.any(HttpMethod.class),
+ * Matchers.<HttpEntity<?>>any(), Matchers.<Class<String>>any())).thenReturn(response);
+ *
+ * ResponseEntity<String> actualResponse = cnfAdapterService.healthCheck(); Assert.assertNotNull(actualResponse);
+ * Assert.assertEquals(HttpStatus.OK, actualResponse.getStatusCode());
+ *
+ * }
+ *
+ * @Test public void createInstanceTest() throws Exception {
+ *
+ * ResponseEntity<InstanceResponse> response = new ResponseEntity<InstanceResponse>(HttpStatus.OK); BpmnInstanceRequest
+ * bpmnInstanceRequest = new BpmnInstanceRequest(); bpmnInstanceRequest.setK8sRBProfileName("k8sRBProfileName");
+ * Mockito.when(restTemplate.exchange(Matchers.anyString(), Matchers.any(HttpMethod.class),
+ * Matchers.<HttpEntity<?>>any(), Matchers.<Class<InstanceResponse>>any())).thenReturn(response);
+ *
+ * ResponseEntity<InstanceResponse> actualResponse = cnfAdapterService.createInstance(bpmnInstanceRequest);
+ * Assert.assertNotNull(response); Assert.assertEquals(actualResponse.getStatusCode(), response.getStatusCode());
+ *
+ * }
+ *
+ * @Test public void createInstanceExceptionTest() throws Exception {
+ *
+ * BpmnInstanceRequest bpmnInstanceRequest = new BpmnInstanceRequest(); ResponseEntity<InstanceResponse> response =
+ * cnfAdapterService.createInstance(bpmnInstanceRequest); Assert.assertNull(response);
+ *
+ * }
+ *
+ * @Test public void getInstanceByInstanceIdTest() throws Exception {
+ *
+ * ResponseEntity<InstanceResponse> response = new ResponseEntity<InstanceResponse>(HttpStatus.OK); String instanceId =
+ * "123"; Mockito.when(restTemplate.exchange(Matchers.anyString(), Matchers.any(HttpMethod.class),
+ * Matchers.<HttpEntity<?>>any(), Matchers.<Class<InstanceResponse>>any())).thenReturn(response);
+ *
+ * ResponseEntity<InstanceResponse> actualResponse = cnfAdapterService.getInstanceByInstanceId(instanceId);
+ * Assert.assertNotNull(actualResponse); Assert.assertEquals(HttpStatus.OK, actualResponse.getStatusCode());
+ *
+ * }
+ *
+ * @Test public void getInstanceStatusByInstanceIdTest() throws Exception {
+ *
+ * ResponseEntity<InstanceStatusResponse> response = new ResponseEntity<InstanceStatusResponse>(HttpStatus.OK); String
+ * instanceId = "123"; Mockito.when(restTemplate.exchange(Matchers.anyString(), Matchers.any(HttpMethod.class),
+ * Matchers.<HttpEntity<?>>any(), Matchers.<Class<InstanceStatusResponse>>any())).thenReturn(response);
+ *
+ * ResponseEntity<InstanceStatusResponse> actualResponse = cnfAdapterService .getInstanceStatusByInstanceId(instanceId);
+ * Assert.assertNotNull(actualResponse); Assert.assertEquals(HttpStatus.OK, response.getStatusCode());
+ *
+ * }
+ *
+ * @Test public void getInstanceByRBNameOrRBVersionOrProfileNameTest() throws Exception {
+ *
+ * ResponseEntity<InstanceMiniResponseList> response = new ResponseEntity<InstanceMiniResponseList>(HttpStatus.OK);
+ * String rbName = "xyz"; String rbVersion = "v1"; String profileName = "p1";
+ *
+ * Mockito.when(restTemplate.exchange(Matchers.anyString(), Matchers.any(HttpMethod.class),
+ * Matchers.<HttpEntity<?>>any(), Matchers.<Class<InstanceMiniResponseList>>any())).thenReturn(response);
+ *
+ * ResponseEntity<InstanceMiniResponseList> actualResponse = cnfAdapterService
+ * .getInstanceByRBNameOrRBVersionOrProfileName(rbName, rbVersion, profileName); Assert.assertNotNull(actualResponse);
+ * Assert.assertEquals(HttpStatus.OK, actualResponse.getStatusCode());
+ *
+ * }
+ *
+ * @Test public void deleteInstanceByInstanceIdTest() throws Exception {
+ *
+ * ResponseEntity<String> response = new ResponseEntity<String>(HttpStatus.OK); String instanceId = "123";
+ * Mockito.when(restTemplate.exchange(Matchers.anyString(), Matchers.any(HttpMethod.class),
+ * Matchers.<HttpEntity<?>>any(), Matchers.<Class<String>>any())).thenReturn(response);
+ *
+ * ResponseEntity<String> actualResponse = cnfAdapterService.deleteInstanceByInstanceId(instanceId);
+ * Assert.assertNotNull(response); Assert.assertEquals(HttpStatus.OK, response.getStatusCode());
+ *
+ * }
+ *
+ * }
+ */