Merge "Distributing Blueprint to DCAE Dashboard Issue-ID: DCAEGEN2-2385>"
authorVijay Venkatesh Kumar <vv770d@att.com>
Tue, 9 Feb 2021 20:36:19 +0000 (20:36 +0000)
committerGerrit Code Review <gerrit@onap.org>
Tue, 9 Feb 2021 20:36:19 +0000 (20:36 +0000)
adapter/acumos-deployment/values.yaml
mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/BlueprintHelperService.java
mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/service/common/AppConfigServiceTest.java [new file with mode: 0644]
mod/onboardingapi/ChangeLog.md
mod/runtimeapi/pom.xml
mod/runtimeapi/runtime-core/pom.xml
mod/runtimeapi/runtime-web/pom.xml
releases/1.2.1-runtimeapi-container.yaml [new file with mode: 0644]
releases/1.7.2-blueprint-generator.yaml [new file with mode: 0644]
releases/2.12.4-onboardingapi-container.yaml [new file with mode: 0644]

index 78f4400..4b4a1b7 100644 (file)
@@ -28,7 +28,8 @@ global:
   ingress:
     enabled: true
     virtualhost:
-        enabled: false
+        enabled: true
+        baseurl: "simpledemo.onap.org"
 
 config:
   distributorAPIURL: /distributor
@@ -50,9 +51,10 @@ service:
 ingress:
   enabled: true
   service:
-    - baseaddr: "acumos-adapter"
+    - baseaddr: "dcaemod"
       name: "dcae-acumos-adapter"
       port: 9000
+      path: "/acumos-adapter"
   annotations:
     nginx.ingress.kubernetes.io/ssl-redirect: "false"
   # Adapter can take a long time to respond, since
index 0526f48..a84afb6 100644 (file)
@@ -178,7 +178,7 @@ public class BlueprintHelperService {
      * <p>
      * Default input type: "string".
      *
-     * @param inputType    Input type, supported: "boolean", "integer"
+     * @param inputType    Input type, supported: "boolean", "integer", "number"
      * @param defaultValue Default value of Type
      * @return
      */
@@ -187,6 +187,7 @@ public class BlueprintHelperService {
             case "boolean":
                 return createBooleanInput(defaultValue);
             case "integer":
+            case "number":
                 return createIntegerInput(defaultValue);
             default:
                 return createStringInput(defaultValue);
diff --git a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/service/common/AppConfigServiceTest.java b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/service/common/AppConfigServiceTest.java
new file mode 100644 (file)
index 0000000..61f9353
--- /dev/null
@@ -0,0 +1,175 @@
+/*
+ *
+ *  * ============LICENSE_START=======================================================
+ *  *  org.onap.dcae
+ *  *  ================================================================================
+ *  *  Copyright (c) 2021 Nokia Intellectual Property. All rights reserved.
+ *  *  ================================================================================
+ *  *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  *  you may not use this file except in compliance with the License.
+ *  *  You may obtain a copy of the License at
+ *  *
+ *  *       http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  *  Unless required by applicable law or agreed to in writing, software
+ *  *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  *  See the License for the specific language governing permissions and
+ *  *  limitations under the License.
+ *  *  ============LICENSE_END=========================================================
+ *
+ *
+ */
+
+package org.onap.blueprintgenerator.service.common;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.when;
+
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.onap.blueprintgenerator.model.common.Appconfig;
+import org.onap.blueprintgenerator.model.common.GetInput;
+import org.onap.blueprintgenerator.model.componentspec.OnapComponentSpec;
+import org.onap.blueprintgenerator.model.componentspec.common.Parameters;
+import org.onap.blueprintgenerator.service.InfoService;
+import org.onap.blueprintgenerator.service.base.BlueprintHelperService;
+import org.onap.blueprintgenerator.service.common.kafka.KafkaStreamService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.ConfigFileApplicationContextInitializer;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = {AppConfigService.class, BlueprintHelperService.class, DmaapService.class,
+    InfoService.class, StreamService.class, KafkaStreamService.class},
+    initializers = ConfigFileApplicationContextInitializer.class)
+public class AppConfigServiceTest {
+
+    private static final String TEST_PARAMETER_NAME = "testParameter";
+    private static final String INPUTS = "inputs";
+    private static final String TYPE = "type";
+    private static final String DEFAULT = "default";
+
+    private static final String PARAMETERS_TYPE_STRING = "string";
+    private static final String PARAMETERS_TYPE_INTEGER = "integer";
+    private static final String PARAMETERS_TYPE_BOOLEAN = "boolean";
+    private static final String PARAMETERS_TYPE_NUMBER = "number";
+
+    private static final String STRING_INPUT_TYPE = "string";
+    private static final String INTEGER_INPUT_TYPE = "integer";
+    private static final String BOOLEAN_INPUT_TYPE = "boolean";
+    private static final String UNKNOWN_TYPE = "test_unknown_type";
+
+    private static final boolean BOOLEAN_TEST_VALUE = true;
+    private static final String TEST_STRING_VALUE = "testValue";
+    private static final String APP_CONFIG = "appconfig";
+
+    @Autowired
+    private AppConfigService appConfigService;
+
+    private OnapComponentSpec componentSpec;
+
+    @Before
+    public void setUp() {
+        componentSpec = Mockito.mock(OnapComponentSpec.class);
+    }
+
+    @Test
+    public void shouldCreateStringInputForStringParameter() {
+
+        mockParameters(PARAMETERS_TYPE_STRING, TEST_STRING_VALUE);
+        Map<String, LinkedHashMap<String, Object>> inputs = new HashMap<>();
+        
+        Map<String, Object> appConfig = appConfigService.createAppconfig(inputs, componentSpec, false);
+        Map<String, Object> createdInputs = (Map<String, Object>) appConfig.get(INPUTS);
+        Map<String, Object> createdParameters = (Map<String, Object>) createdInputs.get(TEST_PARAMETER_NAME);
+
+        assertAppConfigContainsParameterWithCorrectInputName(appConfig);
+        assertEquals(STRING_INPUT_TYPE, createdParameters.get(TYPE));
+        assertEquals(TEST_STRING_VALUE, createdParameters.get(DEFAULT));
+    }
+
+    @Test
+    public void shouldCreateStringInputForUnknownParameter() {
+
+        mockParameters(UNKNOWN_TYPE, TEST_STRING_VALUE);
+        Map<String, LinkedHashMap<String, Object>> inputs = new HashMap<>();
+        
+        Map<String, Object> appConfig = appConfigService.createAppconfig(inputs, componentSpec, false);
+        Map<String, Object> createdInputs = (Map<String, Object>) appConfig.get(INPUTS);
+        Map<String, Object> createdParameters = (Map<String, Object>) createdInputs.get(TEST_PARAMETER_NAME);
+
+        assertAppConfigContainsParameterWithCorrectInputName(appConfig);
+        assertEquals(STRING_INPUT_TYPE, createdParameters.get(TYPE));
+        assertEquals(TEST_STRING_VALUE, createdParameters.get(DEFAULT));
+    }
+
+    @Test
+    public void shouldCreateBooleanInputForBooleanParameter() {
+
+        mockParameters(PARAMETERS_TYPE_BOOLEAN, BOOLEAN_TEST_VALUE);
+        Map<String, LinkedHashMap<String, Object>> inputs = new HashMap<>();
+        
+        Map<String, Object> appConfig = appConfigService.createAppconfig(inputs, componentSpec, false);
+        Map<String, Object> createdInputs = (Map<String, Object>) appConfig.get(INPUTS);
+        Map<String, Object> createdParameters = (Map<String, Object>) createdInputs.get(TEST_PARAMETER_NAME);
+
+        assertAppConfigContainsParameterWithCorrectInputName(appConfig);
+        assertEquals(BOOLEAN_INPUT_TYPE, createdParameters.get(TYPE));
+        assertEquals(BOOLEAN_TEST_VALUE, createdParameters.get(DEFAULT));
+    }
+
+    @Test
+    public void shouldCreateIntegerInputForIntegerParameter() {
+
+        mockParameters(PARAMETERS_TYPE_INTEGER, 123);
+        Map<String, LinkedHashMap<String, Object>> inputs = new HashMap<>();
+        
+        Map<String, Object> appConfig = appConfigService.createAppconfig(inputs, componentSpec, false);
+        Map<String, Object> createdInputs = (Map<String, Object>) appConfig.get(INPUTS);
+        Map<String, Object> createdParameters = (Map<String, Object>) createdInputs.get(TEST_PARAMETER_NAME);
+
+        assertAppConfigContainsParameterWithCorrectInputName(appConfig);
+        assertEquals(INTEGER_INPUT_TYPE, createdParameters.get(TYPE));
+        assertEquals(123, createdParameters.get(DEFAULT));
+    }
+
+    @Test
+    public void shouldCreateIntegerInputForNumberParameter() {
+
+        mockParameters(PARAMETERS_TYPE_NUMBER, 123);
+        Map<String, LinkedHashMap<String, Object>> inputs = new HashMap<>();
+        
+        Map<String, Object> appConfig = appConfigService.createAppconfig(inputs, componentSpec, false);
+        Map<String, Object> createdInputs = (Map<String, Object>) appConfig.get(INPUTS);
+        Map<String, Object> createdParameters = (Map<String, Object>) createdInputs.get(TEST_PARAMETER_NAME);
+
+
+        assertAppConfigContainsParameterWithCorrectInputName(appConfig);
+        assertEquals(INTEGER_INPUT_TYPE, createdParameters.get(TYPE));
+        assertEquals(123, createdParameters.get(DEFAULT));
+    }
+
+    private void assertAppConfigContainsParameterWithCorrectInputName(Map<String, Object> appConfig) {
+        Appconfig appConfigModel = (Appconfig) appConfig.get(APP_CONFIG);
+        Object bpInputName = ((GetInput) appConfigModel.getParams().get(TEST_PARAMETER_NAME)).getBpInputName();
+        assertEquals(bpInputName, TEST_PARAMETER_NAME);
+    }
+
+    private void mockParameters(String type, Object value) {
+        Parameters testParameter = new Parameters();
+        testParameter.setName(TEST_PARAMETER_NAME);
+        testParameter.setType(type);
+        testParameter.setSourced_at_deployment(true);
+        testParameter.setValue(value);
+        Parameters[] parametersArray = new Parameters[1];
+        parametersArray[0] = testParameter;
+        when(componentSpec.getParameters()).thenReturn(parametersArray);
+    }
+}
index 28578d2..4413ded 100644 (file)
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
 The format is based on [Keep a Changelog](http://keepachangelog.com/) 
 and this project adheres to [Semantic Versioning](http://semver.org/).
 
+## [2.12.4]
+
+* Update component-spec-schema to support: kafka stream subscribes and publishes, config maps as volumes
+
+## [2.12.3]
+
+* Add Python 3.8 support
+* Use Integration base image
 
 ## [2.12.1]
 
index 61f6558..f3d72da 100644 (file)
@@ -34,7 +34,7 @@ limitations under the License.
        </parent>
        <groupId>org.onap.dcaegen2.platform.mod</groupId>
        <artifactId>runtimeapi</artifactId>
-       <version>1.2.0</version>
+       <version>1.2.1</version>
        <name>dcaegen2-platform-mod-runtimeapi</name>
        <description>MOD Runtime API</description>
        <properties>
index 7031714..9310bd3 100644 (file)
@@ -25,12 +25,12 @@ limitations under the License.
     <parent>
         <artifactId>runtimeapi</artifactId>
         <groupId>org.onap.dcaegen2.platform.mod</groupId>
-        <version>1.2.0</version>
+        <version>1.2.1</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>runtime-core</artifactId>
-    <version>1.2.0</version>
+    <version>1.2.1</version>
 
     <dependencies>
         <dependency>
@@ -46,7 +46,7 @@ limitations under the License.
         <dependency>
             <groupId>org.onap.dcaegen2.platform.mod</groupId>
             <artifactId>blueprint-generator-onap</artifactId>
-            <version>1.7.1</version>
+            <version>1.7.2</version>
         </dependency>
        <dependency>
                <groupId>org.json</groupId>
index 4c1a7c4..44a1fd4 100644 (file)
@@ -24,10 +24,10 @@ limitations under the License.
        <parent>
                <groupId>org.onap.dcaegen2.platform.mod</groupId>
                <artifactId>runtimeapi</artifactId>
-               <version>1.2.0</version>
+               <version>1.2.1</version>
        </parent>
        <artifactId>runtime-web</artifactId>
-       <version>1.2.0-SNAPSHOT</version>
+       <version>1.2.1-SNAPSHOT</version>
        <packaging>jar</packaging>
        <name>runtime-web</name>
        <description>MOD Runtime Web Module</description>
@@ -35,7 +35,7 @@ limitations under the License.
                <dependency>
                        <groupId>org.onap.dcaegen2.platform.mod</groupId>
                        <artifactId>runtime-core</artifactId>
-                       <version>1.2.0</version>
+                       <version>1.2.1</version>
                </dependency>
                <dependency>
                        <groupId>org.springframework.boot</groupId>
diff --git a/releases/1.2.1-runtimeapi-container.yaml b/releases/1.2.1-runtimeapi-container.yaml
new file mode 100644 (file)
index 0000000..c6e04fc
--- /dev/null
@@ -0,0 +1,9 @@
+distribution_type: 'container'
+container_release_tag: '1.2.1'
+project: 'dcaegen2-platform'
+log_dir: 'dcaegen2-platform-mod-master-runtimeapi-merge-java/26'
+ref: 898cf07d59c3586180b43bc4b1289d5c20d019fd
+containers:
+  - name: 'org.onap.dcaegen2.platform.mod.runtime-web'
+    version: '1.2.1-SNAPSHOT-20210129T134650Z'
+git_tag: '1.2.1-mod-runtimeapi'
diff --git a/releases/1.7.2-blueprint-generator.yaml b/releases/1.7.2-blueprint-generator.yaml
new file mode 100644 (file)
index 0000000..7d979a9
--- /dev/null
@@ -0,0 +1,4 @@
+distribution_type: 'maven'
+version: '1.7.2'
+project: 'dcaegen2/platform'
+log_dir: 'dcaegen2-platform-mod-bpgenerator-maven-stage-master/362'
diff --git a/releases/2.12.4-onboardingapi-container.yaml b/releases/2.12.4-onboardingapi-container.yaml
new file mode 100644 (file)
index 0000000..67e33d8
--- /dev/null
@@ -0,0 +1,9 @@
+distribution_type: 'container'
+container_release_tag: '2.12.4'
+project: 'dcaegen2-platform'
+log_dir: 'dcaegen2-platform-mod-onboardingapi-docker-merge-master/53'
+ref: 59a85d1e280b011d05416ac3dbe6d823f60834f6
+containers:
+  - name: 'org.onap.dcaegen2.platform.mod.onboardingapi'
+    version: '2.12.4-SNAPSHOT-20210128T161153Z'
+git_tag: '2.12.4-mod-onboardingapi'