Merge "Move GRPC management api to designer api."
authorDan Timoney <dtimoney@att.com>
Wed, 11 Sep 2019 19:54:09 +0000 (19:54 +0000)
committerGerrit Code Review <gerrit@onap.org>
Wed, 11 Sep 2019 19:54:09 +0000 (19:54 +0000)
88 files changed:
INFO.yaml
cds-ui/application/pom.xml
cds-ui/client/pom.xml
cds-ui/client/src/app/common/constants/app-constants.ts
cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.service.ts
cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.html
cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.ts
cds-ui/pom.xml
cds-ui/server/pom.xml
cds-ui/server/src/controllers/data-dictionary.controller.ts
cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts
cds-ui/server/src/services/resource-dictionary.service.ts
components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/data_types.json
components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/node_types.json
components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/resources_definition_types.json
components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json
components/model-catalog/blueprint-model/uat-blueprints/echo/Tests/uat.yaml
components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Tests/uat.yaml
components/model-catalog/proto-definition/pom.xml
components/parent/pom.xml
components/pom.xml
ms/blueprintsprocessor/application/pom.xml
ms/blueprintsprocessor/cba-parent/pom.xml
ms/blueprintsprocessor/distribution/pom.xml
ms/blueprintsprocessor/functions/ansible-awx-executor/pom.xml
ms/blueprintsprocessor/functions/cli-executor/pom.xml
ms/blueprintsprocessor/functions/config-snapshots/pom.xml
ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutor.kt
ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotService.kt
ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutorTest.kt
ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotServiceTest.kt
ms/blueprintsprocessor/functions/netconf-executor/pom.xml
ms/blueprintsprocessor/functions/pom.xml
ms/blueprintsprocessor/functions/python-executor/pom.xml
ms/blueprintsprocessor/functions/resource-resolution/pom.xml
ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionConstants.kt
ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt
ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt
ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt
ms/blueprintsprocessor/functions/restconf-executor/pom.xml
ms/blueprintsprocessor/modules/commons/db-lib/pom.xml
ms/blueprintsprocessor/modules/commons/dmaap-lib/pom.xml
ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml
ms/blueprintsprocessor/modules/commons/message-lib/pom.xml
ms/blueprintsprocessor/modules/commons/pom.xml
ms/blueprintsprocessor/modules/commons/processor-core/pom.xml
ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt
ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml
ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibData.kt
ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BasicAuthRestClientService.kt
ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt
ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BlueprintWebClientService.kt
ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/SSLRestClientService.kt
ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/TokenAuthRestClientService.kt
ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyServiceTest.kt
ms/blueprintsprocessor/modules/commons/ssh-lib/pom.xml
ms/blueprintsprocessor/modules/inbounds/configs-api/pom.xml
ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotControllerTest.kt
ms/blueprintsprocessor/modules/inbounds/designer-api/pom.xml
ms/blueprintsprocessor/modules/inbounds/pom.xml
ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml
ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml
ms/blueprintsprocessor/modules/outbounds/pom.xml
ms/blueprintsprocessor/modules/pom.xml
ms/blueprintsprocessor/modules/services/execution-service/pom.xml
ms/blueprintsprocessor/modules/services/pom.xml
ms/blueprintsprocessor/modules/services/workflow-service/pom.xml
ms/blueprintsprocessor/parent/pom.xml
ms/blueprintsprocessor/pom.xml
ms/command-executor/pom.xml
ms/command-executor/src/main/python/command_executor_handler.py
ms/command-executor/src/main/python/server.py
ms/command-executor/src/main/python/utils.py
ms/controllerblueprints/modules/blueprint-core/pom.xml
ms/controllerblueprints/modules/blueprint-validation/pom.xml
ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/utils/PropertyAssignmentValidationUtils.kt
ms/controllerblueprints/modules/pom.xml
ms/controllerblueprints/modules/resource-dict/pom.xml
ms/controllerblueprints/parent/pom.xml
ms/controllerblueprints/pom.xml
ms/pom.xml
ms/sdclistener/application/pom.xml
ms/sdclistener/distribution/pom.xml
ms/sdclistener/parent/pom.xml
ms/sdclistener/pom.xml
pom.xml
releases/0.6.1.yaml [new file with mode: 0644]
version.properties

index 89c7c13..d07760a 100644 (file)
--- a/INFO.yaml
+++ b/INFO.yaml
@@ -8,7 +8,7 @@ project_lead: &onap_releng_ptl
     email: 'dtimoney@att.com'
     id: 'djtimoney'
     company: 'ATT'
-    timezone: 'America/New York'
+    timezone: 'America/New_York'
 primary_contact: *onap_releng_ptl
 issue_tracking:
     type: 'jira'
@@ -33,12 +33,12 @@ committers:
       email: 'jflucas@research.att.com'
       company: 'ATT'
       id: 'jackl'
-      timezone: 'America/New York'
+      timezone: 'America/New_York'
     - name: 'Jun (Nicolas) Hu'
       email: 'jh245g@att.com'
       company: 'ATT'
       id: 'jh245g'
-      timezone: 'America/New York'
+      timezone: 'America/New_York'
     - name: 'Gaurav Agrawal'
       email: 'gaurav.agrawal@huawei.com'
       company: 'Huawei'
@@ -48,21 +48,9 @@ committers:
       email: 'brindasanth@in.ibm.com'
       company: 'IBM'
       id: 'brindasanthm'
-      timezone: 'America/New York'
+      timezone: 'America/New_York'
 repositories:
-    - ccsdk-apps
-    - ccsdk-cds
-    - ccsdk-distribution
-    - ccsdk-features
-    - ccsdk-parent
-    - ccsdk-platform-blueprints
-    - ccsdk-platform-plugins
-    - ccsdk-sli-adaptors
-    - ccsdk-sli-core
-    - ccsdk-sli-northbound
-    - ccsdk-sli-plugins
-    - ccsdk-storage-esaas
-    - ccsdk-utils
+    - ccsdk/cds
 tsc:
     approval: 'https://lists.onap.org/pipermail/onap-tsc'
     changes:
index 752275a..87cb4f2 100644 (file)
@@ -24,12 +24,12 @@ limitations under the License.
     <parent>
         <groupId>org.onap.ccsdk.cds</groupId>
         <artifactId>ui</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
         <relativePath>..</relativePath>
     </parent>
 
     <artifactId>application</artifactId>
-    <version>0.6.1-SNAPSHOT</version>
+    <version>0.7.0-SNAPSHOT</version>
     <packaging>pom</packaging>
 
     <name>cds-ui-application</name>
index 44c7a89..f25e782 100644 (file)
@@ -24,12 +24,12 @@ limitations under the License.
   <parent>
     <groupId>org.onap.ccsdk.cds</groupId>
     <artifactId>ui</artifactId>
-    <version>0.6.1-SNAPSHOT</version>
+    <version>0.7.0-SNAPSHOT</version>
     <relativePath>..</relativePath>
   </parent>
 
   <artifactId>ui-client</artifactId>
-  <version>0.6.1-SNAPSHOT</version>
+  <version>0.7.0-SNAPSHOT</version>
   <packaging>pom</packaging>
 
   <name>cds-ui-client</name>
index 5ebde91..78fefd8 100644 (file)
@@ -108,5 +108,6 @@ export const ResourceDictionaryURLs = {
     searchResourceDictionaryByTags: '/resourcedictionary/search',
     searchResourceDictionaryByName: '',
     getSources: '/resourcedictionary/source-mapping',
-    getModelType: '/resourcedictionary/model-type'
+    getModelType: '/resourcedictionary/model-type',
+    getDataType: '/resourcedictionary/model-type/by-definition/data_type'
 }
\ No newline at end of file
index ed1ef6f..f66a1c9 100644 (file)
@@ -44,4 +44,8 @@ export class ResourceEditService {
     getModelType(name) {
         return this.api.get(ResourceDictionaryURLs.getModelType + '/' + name);
     }
+
+    getDataTypes() {
+        return this.api.get(ResourceDictionaryURLs.getDataType);
+    }
 }
\ No newline at end of file
index d40dbd9..24bee27 100644 (file)
@@ -28,8 +28,9 @@
     </mat-form-field>
     <mat-form-field class="form-field">
       <mat-select matInput placeholder="Data Type" formControlName="_type">
-       <mat-option value="string">string</mat-option>
-       <mat-option value="list">list</mat-option>
+       <!-- <mat-option value="string">string</mat-option> -->
+        <!-- <mat-option value="list">list</mat-option> -->
+        <mat-option value="string" *ngFor="let item of dataTypeList">{{item.modelName}}</mat-option>
       </mat-select>
     </mat-form-field>
     <mat-form-field class="form-field" >
index e155ec1..473b200 100644 (file)
@@ -24,13 +24,15 @@ import { Component, OnInit, EventEmitter, Output  } from '@angular/core';
 import {FormBuilder, FormGroup, Validators} from '@angular/forms';
 import { IResources } from 'src/app/common/core/store/models/resources.model';
 import { IResourcesState } from 'src/app/common/core/store/models/resourcesState.model';
-import { Observable } from 'rxjs';
+import { Observable, from } from 'rxjs';
 import { Store } from '@ngrx/store';
 import { IAppState } from '../../../../common/core/store/state/app.state';
 import { A11yModule } from '@angular/cdk/a11y';
+
 import { LoadResourcesSuccess } from 'src/app/common/core/store/actions/resources.action';
 import { IPropertyData } from 'src/app/common/core/store/models/propertyData.model';
 import { IEntrySchema } from 'src/app/common/core/store/models/entrySchema.model';
+import { ResourceEditService } from '../resource-edit.service';
 
 @Component({
   selector: 'app-resource-metadata',
@@ -48,8 +50,13 @@ export class ResourceMetadataComponent implements OnInit {
     propertyValues = [];
     property = [];   
     @Output() resourcesData = new EventEmitter();
+    dataTypeList: any[] = [
+       {modelName: 'String'}, {modelName: 'Boolean'}, {modelName: 'Integer'}, {modelName: 'Float'}, {modelName: 'Double'}
+    ];
      
- constructor(private formBuilder: FormBuilder, private store: Store<IAppState>) { 
+ constructor(private formBuilder: FormBuilder, 
+             private store: Store<IAppState>, 
+             private resourceEditService: ResourceEditService) { 
     this.rdState = this.store.select('resources');
     this.ResourceMetadata = this.formBuilder.group({
         Resource_Name: ['', Validators.required],
@@ -62,6 +69,17 @@ export class ResourceMetadataComponent implements OnInit {
  }
 
  ngOnInit() {
+    this.resourceEditService.getDataTypes()
+    .subscribe(data=>{
+      console.log(data);
+      if(data) {
+         data.forEach(element => {
+            this.dataTypeList.push(element);
+         });
+      }
+    }, (error)=>{
+       console.log("There is an error");
+    });
     this.rdState.subscribe(
       resourcesdata => {
         var resourcesState: IResourcesState = { resources: resourcesdata.resources, isLoadSuccess: resourcesdata.isLoadSuccess, isSaveSuccess: resourcesdata.isSaveSuccess, isUpdateSuccess: resourcesdata.isUpdateSuccess };
index 8c4d241..de2be35 100644 (file)
@@ -24,13 +24,13 @@ limitations under the License.
     <parent>
         <groupId>org.onap.ccsdk.parent</groupId>
         <artifactId>spring-boot-starter-parent</artifactId>
-        <version>1.4.1-SNAPSHOT</version>
+        <version>1.5.0-SNAPSHOT</version>
         <relativePath/>
     </parent>
 
     <groupId>org.onap.ccsdk.cds</groupId>
     <artifactId>ui</artifactId>
-    <version>0.6.1-SNAPSHOT</version>
+    <version>0.7.0-SNAPSHOT</version>
     <packaging>pom</packaging>
 
     <name>cds-ui-parent</name>
index 32f68de..2d6d646 100644 (file)
@@ -24,12 +24,12 @@ limitations under the License.
     <parent>
         <groupId>org.onap.ccsdk.cds</groupId>
         <artifactId>ui</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
         <relativePath>..</relativePath>
     </parent>
 
     <artifactId>ui-server</artifactId>
-    <version>0.6.1-SNAPSHOT</version>
+    <version>0.7.0-SNAPSHOT</version>
     <packaging>pom</packaging>
 
     <name>cds-ui-server</name>
index 63587e6..eab0bc5 100644 (file)
@@ -95,4 +95,15 @@ export class DataDictionaryController {
   async getmodelType(@param.path.string('source') source: string) {
     return await this.rdservice.getModelType(source);
   }
+
+  @get('/resourcedictionary/model-type/by-definition/data_type', {
+    responses: {
+      '200': {
+        content: { 'application/json': {} },
+      },
+    },
+  })
+  async getDataTypes() {
+    return await this.rdservice.getDataTypes();
+  }
 }
index af96aca..9f9d754 100644 (file)
@@ -88,7 +88,6 @@ export default {
 
             }
         },
-        ,
         {
             "template": {
                 "method": "GET",
@@ -103,6 +102,22 @@ export default {
             "functions": {
                 "getModelType": ["source"]
 
+            }
+        },
+        {
+            "template": {
+                "method": "GET",
+                "url": controllerApiConfig.http.url + "/model-type/by-definition/data_type",
+                "headers": {
+                    "accepts": "application/json",
+                    "content-type": "application/json",
+                    "authorization": controllerApiConfig.http.authToken
+                },
+                "responsePath": "$.*"
+            },
+            "functions": {
+                "getDataTypes": []
+
             }
         }
     ]
index 9a781d6..8df2208 100644 (file)
@@ -9,6 +9,7 @@ export interface ResourceDictionaryService {
   save(resourceDictionary: JSON): Promise<JSON>;
   searchbyNames(resourceDictionaryList: JSON): Promise<JSON>;  
   getModelType(source: string): Promise<JSON>;
+  getDataTypes(): Promise<JSON>;
 }
 
 export class ResourceDictionaryServiceProvider implements Provider<ResourceDictionaryService> {
index 8c304c4..b710925 100644 (file)
@@ -1,3 +1,448 @@
 {
-  "data_types" : { }
+  "data_types" : {
+    "dt-resource-assignment-properties" : {
+      "description" : "Dynamic DataType definition for workflow(resource-assignment).",
+      "version" : "1.0.0",
+      "properties" : {
+        "nf-role" : {
+          "description" : "",
+          "required" : true,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "default" : "vSN",
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "vm-type" : {
+          "description" : "",
+          "required" : false,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "vnf-id" : {
+          "description" : "",
+          "required" : true,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "public_net_id" : {
+          "description" : "",
+          "required" : true,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "value" : "public_net_id",
+          "default" : "public_net_id",
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "vnf_name" : {
+          "description" : "",
+          "required" : false,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "vfw_private_ip_1" : {
+          "description" : "",
+          "required" : false,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "unprotected-prefix-id" : {
+          "description" : "",
+          "required" : false,
+          "type" : "integer",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "onap_private_subnet_id" : {
+          "description" : "",
+          "required" : false,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "vfw_private_ip_0" : {
+          "description" : "",
+          "required" : false,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "aic-cloud-region" : {
+          "description" : "",
+          "required" : true,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "sec_group" : {
+          "description" : "",
+          "required" : true,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "default" : "onap_sg_PUhf",
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "vfw_private_ip_2" : {
+          "description" : "",
+          "required" : false,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "vnfc-model-invariant-uuid" : {
+          "description" : "",
+          "required" : true,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "nfc-naming-code" : {
+          "description" : "",
+          "required" : true,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "private-prefix-id" : {
+          "description" : "",
+          "required" : false,
+          "type" : "integer",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "vf-module-model-customization-uuid" : {
+          "description" : "",
+          "required" : true,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "vfw_name_0" : {
+          "description" : "",
+          "required" : false,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "vf_module_name" : {
+          "description" : "",
+          "required" : false,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "nexus_artifact_repo" : {
+          "description" : "",
+          "required" : true,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "value" : "nexus_artifact_repo",
+          "default" : "nexus_artifact_repo",
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "onap_private_net_cidr" : {
+          "description" : "",
+          "required" : true,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "image_name" : {
+          "description" : "",
+          "required" : false,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "vf-nf-code" : {
+          "description" : "",
+          "required" : true,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "vf-module-id" : {
+          "description" : "",
+          "required" : true,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "vf-module-label" : {
+          "description" : "",
+          "required" : true,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "vsn_private_ip_0" : {
+          "description" : "",
+          "required" : false,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "vpg_name_0" : {
+          "description" : "",
+          "required" : false,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "vpg_private_ip_1" : {
+          "description" : "",
+          "required" : false,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "protected_private_net_cidr" : {
+          "description" : "",
+          "required" : true,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "vf-naming-policy" : {
+          "description" : "",
+          "required" : true,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "default" : "SDNC_Policy.Config_MS_ONAP_VSN_NAMING_TIMESTAMP",
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "vpg_private_ip_0" : {
+          "description" : "",
+          "required" : false,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "vsn_private_ip_1" : {
+          "description" : "",
+          "required" : false,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "vfccustomizationuuid" : {
+          "description" : "",
+          "required" : true,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "unprotected_private_net_cidr" : {
+          "description" : "",
+          "required" : true,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "vsn_name_0" : {
+          "description" : "",
+          "required" : false,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "onap_private_net_id" : {
+          "description" : "",
+          "required" : false,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "vnfc-model-version" : {
+          "description" : "",
+          "required" : true,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "service-instance-id" : {
+          "description" : "",
+          "required" : true,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "vf-module-type" : {
+          "description" : "",
+          "required" : true,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "vnf-model-customization-uuid" : {
+          "description" : "",
+          "required" : true,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "pub_key" : {
+          "description" : "",
+          "required" : false,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "key_name" : {
+          "description" : "",
+          "required" : false,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "protected-prefix-id" : {
+          "description" : "",
+          "required" : false,
+          "type" : "integer",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        },
+        "vnf-name" : {
+          "description" : "",
+          "required" : true,
+          "type" : "string",
+          "status" : "",
+          "constraints" : [ { } ],
+          "entry_schema" : {
+            "type" : ""
+          }
+        }
+      },
+      "derived_from" : "tosca.datatypes.Dynamic"
+    }
+  }
 }
\ No newline at end of file
index 599e377..e812db1 100644 (file)
                   "required" : false,
                   "type" : "string"
                 },
+                "occurrence" : {
+                  "description" : "Number of time to perform the resolution.",
+                  "required" : false,
+                  "type" : "integer",
+                  "default" : 1
+                },
                 "store-result" : {
                   "description" : "Whether or not to store the output.",
                   "required" : false,
       },
       "derived_from" : "tosca.nodes.ResourceSource"
     },
-    "source-default" : {
-      "description" : "This is Default Resource Source Node Type",
-      "version" : "1.0.0",
-      "properties" : { },
-      "derived_from" : "tosca.nodes.ResourceSource"
-    },
-    "source-input" : {
-      "description" : "This is Input Resource Source Node Type",
-      "version" : "1.0.0",
-      "properties" : { },
-      "derived_from" : "tosca.nodes.ResourceSource"
-    },
     "source-db" : {
       "description" : "This is Database Resource Source Node Type",
       "version" : "1.0.0",
           "type" : "string",
           "constraints" : [ {
             "valid_values" : [ "SQL", "PLSQL" ]
-          } ]
+          } ],
+          "default" : "SQL"
         },
         "endpoint-selector" : {
           "required" : false,
       },
       "derived_from" : "tosca.nodes.ResourceSource"
     },
+    "source-default" : {
+      "description" : "This is Default Resource Source Node Type",
+      "version" : "1.0.0",
+      "properties" : { },
+      "derived_from" : "tosca.nodes.ResourceSource"
+    },
+    "source-input" : {
+      "description" : "This is Input Resource Source Node Type",
+      "version" : "1.0.0",
+      "properties" : { },
+      "derived_from" : "tosca.nodes.ResourceSource"
+    },
     "source-rest" : {
       "description" : "This is Rest Resource Source Node Type",
       "version" : "1.0.0",
       "derived_from" : "tosca.nodes.Root"
     }
   }
-}
+}
\ No newline at end of file
index 1a62972..2406240 100644 (file)
       "description" : "nexus_artifact_repo",
       "type" : "string"
     },
-    "updated-by" : "Singal, Kapil <ks220y@att.com>",
+    "updated-by" : "MALAKOV, YURIY <yuriy.malakov@att.com>",
     "sources" : {
+      "input" : {
+        "type" : "source-input"
+      },
       "default" : {
         "type" : "source-default",
         "properties" : { }
       },
-      "input" : {
-        "type" : "source-input",
-        "properties" : { }
+      "sdnc" : {
+        "type" : "source-rest",
+        "properties" : {
+          "type" : "JSON",
+          "url-path" : "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/nexus_artifact_repo",
+          "path" : "/param/0/value",
+          "input-key-mapping" : {
+            "service-instance-id" : "service-instance-id",
+            "vnf-id" : "vnf-id"
+          },
+          "output-key-mapping" : {
+            "nexus_artifact_repo" : "value"
+          },
+          "key-dependencies" : [ "service-instance-id", "vnf-id" ]
+        }
       }
     }
   },
       "description" : "nfc-naming-code",
       "type" : "string"
     },
-    "updated-by" : "Singal, Kapil <ks220y@att.com>",
+    "updated-by" : "MALAKOV, YURIY <yuriy.malakov@att.com>",
     "sources" : {
+      "input" : {
+        "type" : "source-input"
+      },
+      "default" : {
+        "type" : "source-default",
+        "properties" : { }
+      },
       "processor-db" : {
         "type" : "source-db",
         "properties" : {
+          "endpoint-selector" : "dynamic-db-source",
           "type" : "SQL",
           "query" : "select nfc_naming_code as nfc_naming_code from sdnctl.VFC_MODEL where customization_uuid=:vfccustomizationuuid",
           "input-key-mapping" : {
       "description" : "onap_private_net_cidr",
       "type" : "string"
     },
-    "updated-by" : "Singal, Kapil <ks220y@att.com>",
+    "updated-by" : "MALAKOV, YURIY <yuriy.malakov@att.com>",
     "sources" : {
+      "input" : {
+        "type" : "source-input"
+      },
+      "default" : {
+        "type" : "source-default",
+        "properties" : { }
+      },
+      "sdnc" : {
+        "type" : "source-rest",
+        "properties" : {
+          "type" : "JSON",
+          "url-path" : "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/onap_private_net_cidr",
+          "path" : "/param/0/value",
+          "input-key-mapping" : {
+            "service-instance-id" : "service-instance-id",
+            "vnf-id" : "vnf-id"
+          },
+          "output-key-mapping" : {
+            "onap_private_net_cidr" : "value"
+          },
+          "key-dependencies" : [ "service-instance-id", "vnf-id" ]
+        }
+      },
       "processor-db" : {
         "type" : "source-db",
         "properties" : {
+          "endpoint-selector" : "dynamic-db-source",
           "type" : "SQL",
-          "query" : "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = \"private\"",
+          "query" : "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = \"management\"",
+          "input-key-mapping" : { },
           "output-key-mapping" : {
             "onap_private_net_cidr" : "prefix"
           }
       "description" : "onap_private_net_id",
       "type" : "string"
     },
-    "updated-by" : "Singal, Kapil <ks220y@att.com>",
+    "updated-by" : "MALAKOV, YURIY <yuriy.malakov@att.com>",
     "sources" : {
       "input" : {
         "type" : "source-input"
       },
+      "default" : {
+        "type" : "source-default",
+        "properties" : { }
+      },
       "sdnc" : {
         "type" : "source-rest",
         "properties" : {
       "description" : "onap_private_subnet_id",
       "type" : "string"
     },
-    "updated-by" : "Singal, Kapil <ks220y@att.com>",
+    "updated-by" : "MALAKOV, YURIY <yuriy.malakov@att.com>",
     "sources" : {
       "input" : {
         "type" : "source-input"
       },
+      "default" : {
+        "type" : "source-default",
+        "properties" : { }
+      },
       "sdnc" : {
         "type" : "source-rest",
         "properties" : {
       "description" : "private-prefix-id",
       "type" : "string"
     },
-    "updated-by" : "Singal, Kapil <ks220y@att.com>",
+    "updated-by" : "MALAKOV, YURIY <yuriy.malakov@att.com>",
     "sources" : {
+      "input" : {
+        "type" : "source-input"
+      },
+      "default" : {
+        "type" : "source-default",
+        "properties" : { }
+      },
       "processor-db" : {
         "type" : "source-db",
         "properties" : {
+          "endpoint-selector" : "dynamic-db-source",
           "type" : "SQL",
           "query" : "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = \"private\"",
+          "input-key-mapping" : { },
           "output-key-mapping" : {
             "private-prefix-id" : "prefix_id"
           }
       "description" : "pub_key",
       "type" : "string"
     },
-    "updated-by" : "Singal, Kapil <ks220y@att.com>",
+    "updated-by" : "MALAKOV, YURIY <yuriy.malakov@att.com>",
     "sources" : {
       "input" : {
         "type" : "source-input"
       },
+      "default" : {
+        "type" : "source-default",
+        "properties" : { }
+      },
       "sdnc" : {
         "type" : "source-rest",
         "properties" : {
       "description" : "public_net_id",
       "type" : "string"
     },
-    "updated-by" : "Singal, Kapil <ks220y@att.com>",
+    "updated-by" : "MALAKOV, YURIY <yuriy.malakov@att.com>",
     "sources" : {
+      "input" : {
+        "type" : "source-input"
+      },
       "default" : {
         "type" : "source-default",
         "properties" : { }
       },
-      "input" : {
-        "type" : "source-input"
+      "sdnc" : {
+        "type" : "source-rest",
+        "properties" : {
+          "type" : "JSON",
+          "url-path" : "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/public_net_id",
+          "path" : "/param/0/value",
+          "input-key-mapping" : {
+            "service-instance-id" : "service-instance-id",
+            "vnf-id" : "vnf-id"
+          },
+          "output-key-mapping" : {
+            "public_net_id" : "value"
+          },
+          "key-dependencies" : [ "service-instance-id", "vnf-id" ]
+        }
       }
     }
   },
       "description" : "sec_group",
       "type" : "string"
     },
-    "updated-by" : "Singal, Kapil <ks220y@att.com>",
+    "updated-by" : "MALAKOV, YURIY <yuriy.malakov@att.com>",
     "sources" : {
+      "input" : {
+        "type" : "source-input"
+      },
       "default" : {
         "type" : "source-default",
         "properties" : { }
       },
-      "input" : {
-        "type" : "source-input",
-        "properties" : { }
+      "sdnc" : {
+        "type" : "source-rest",
+        "properties" : {
+          "type" : "JSON",
+          "url-path" : "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/sec_group",
+          "path" : "/param/0/value",
+          "input-key-mapping" : {
+            "service-instance-id" : "service-instance-id",
+            "vnf-id" : "vnf-id"
+          },
+          "output-key-mapping" : {
+            "sec_group" : "value"
+          },
+          "key-dependencies" : [ "service-instance-id", "vnf-id" ]
+        }
       }
     }
   },
       "description" : "vf-module-label",
       "type" : "string"
     },
-    "updated-by" : "Singal, Kapil <ks220y@att.com>",
+    "updated-by" : "MALAKOV, YURIY <yuriy.malakov@att.com>",
     "sources" : {
+      "input" : {
+        "type" : "source-input"
+      },
+      "default" : {
+        "type" : "source-default",
+        "properties" : { }
+      },
       "processor-db" : {
         "type" : "source-db",
         "properties" : {
       "description" : "vf-module-model-customization-uuid",
       "type" : "string"
     },
-    "updated-by" : "Singal, Kapil <ks220y@att.com>",
+    "updated-by" : "MALAKOV, YURIY <yuriy.malakov@att.com>",
     "sources" : {
       "input" : {
-        "type" : "source-input",
+        "type" : "source-input"
+      },
+      "default" : {
+        "type" : "source-default",
         "properties" : { }
       }
     }
     }
   },
   "vfccustomizationuuid" : {
-    "tags" : "vfccustomizationuuid, tosca.datatypes.Root, data_type",
+    "tags" : "vfccustomizationuuid",
     "name" : "vfccustomizationuuid",
     "property" : {
       "description" : "vfccustomizationuuid",
       "type" : "string"
     },
-    "updated-by" : "Singal, Kapil <ks220y@att.com>",
+    "updated-by" : "MALAKOV, YURIY <yuriy.malakov@att.com>",
     "sources" : {
+      "input" : {
+        "type" : "source-input"
+      },
+      "default" : {
+        "type" : "source-default",
+        "properties" : { }
+      },
       "processor-db" : {
         "type" : "source-db",
         "properties" : {
+          "endpoint-selector" : "dynamic-db-source",
           "type" : "SQL",
           "query" : "select sdnctl.VF_MODULE_TO_VFC_MAPPING.vfc_customization_uuid as vnf_customid from sdnctl.VF_MODULE_TO_VFC_MAPPING where vm_count = 1 and sdnctl.VF_MODULE_TO_VFC_MAPPING.vf_module_customization_uuid=:vfmodulecustomizationuuid",
           "input-key-mapping" : {
       "description" : "vm-type",
       "type" : "string"
     },
-    "updated-by" : "Singal, Kapil <ks220y@att.com>",
+    "updated-by" : "MALAKOV, YURIY <yuriy.malakov@att.com>",
     "sources" : {
+      "input" : {
+        "type" : "source-input"
+      },
+      "default" : {
+        "type" : "source-default",
+        "properties" : { }
+      },
       "processor-db" : {
         "type" : "source-db",
         "properties" : {
+          "endpoint-selector" : "dynamic-db-source",
           "type" : "SQL",
           "query" : "select VFC_MODEL.vm_type as vm_type from VFC_MODEL where customization_uuid=:vfccustomizationuuid",
           "input-key-mapping" : {
       "description" : "vnf-id",
       "type" : "string"
     },
-    "updated-by" : "Singal, Kapil <ks220y@att.com>",
+    "updated-by" : "MALAKOV, YURIY <yuriy.malakov@att.com>",
     "sources" : {
       "input" : {
-        "type" : "source-input",
+        "type" : "source-input"
+      },
+      "default" : {
+        "type" : "source-default",
         "properties" : { }
+      },
+      "sdnc" : {
+        "type" : "source-rest",
+        "properties" : {
+          "type" : "JSON",
+          "url-path" : "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/vnf-id",
+          "path" : "/param/0/value",
+          "input-key-mapping" : {
+            "service-instance-id" : "service-instance-id",
+            "vnf-id" : "vnf-id"
+          },
+          "output-key-mapping" : {
+            "vnf-id" : "value"
+          },
+          "key-dependencies" : [ "service-instance-id", "vnf-id" ]
+        }
       }
     }
   },
     }
   },
   "vnf-name" : {
-    "tags" : "vnf-name, tosca.datatypes.Root, data_type",
+    "tags" : "vnf-name",
     "name" : "vnf-name",
     "property" : {
       "description" : "vnf-name",
       "type" : "string"
     },
-    "updated-by" : "Singal, Kapil <ks220y@att.com>",
+    "updated-by" : "MALAKOV, YURIY <yuriy.malakov@att.com>",
     "sources" : {
+      "input" : {
+        "type" : "source-input"
+      },
+      "default" : {
+        "type" : "source-default",
+        "properties" : { }
+      },
       "sdnc" : {
         "type" : "source-rest",
         "properties" : {
           "type" : "JSON",
-          "url-path" : "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/vnf_name",
+          "url-path" : "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-name/vnf-data/vnf-topology/vnf-parameters-data/param/vnf-name",
           "path" : "/param/0/value",
-          "expression-type" : "JSON_POINTER",
           "input-key-mapping" : {
             "service-instance-id" : "service-instance-id",
-            "vnf-id" : "vnf-id"
+            "vnf-name" : "vnf-name"
           },
           "output-key-mapping" : {
             "vnf-name" : "value"
           },
-          "key-dependencies" : [ "service-instance-id", "vnf-id" ]
+          "key-dependencies" : [ "service-instance-id", "vnf-name" ]
+        }
+      },
+      "aai-data" : {
+        "type" : "source-rest",
+        "properties" : {
+          "type" : "JSON",
+          "verb" : "GET",
+          "url-path" : "/aai/v14/network/generic-vnfs/generic-vnf/$vnf-id",
+          "path" : "",
+          "input-key-mapping" : {
+            "vnf-id" : "vnf-id"
+          },
+          "output-key-mapping" : {
+            "vnf-name" : "vnf-name"
+          },
+          "key-dependencies" : [ "vnf-id" ]
         }
       }
     }
     "tags" : "vnfc-model-invariant-uuid",
     "name" : "vnfc-model-invariant-uuid",
     "property" : {
-      "description" : "vnfc-model-invariant-uuid for SRIOV VPE template",
+      "description" : "vnfc-model-invariant-uuid",
       "type" : "string"
     },
-    "updated-by" : "Singal, Kapil <ks220y@att.com>",
+    "updated-by" : "MALAKOV, YURIY <yuriy.malakov@att.com>",
     "sources" : {
+      "input" : {
+        "type" : "source-input"
+      },
+      "default" : {
+        "type" : "source-default",
+        "properties" : { }
+      },
       "processor-db" : {
         "type" : "source-db",
         "properties" : {
+          "endpoint-selector" : "dynamic-db-source",
           "type" : "SQL",
           "query" : "select VFC_MODEL.invariant_uuid as vfc_invariant_uuid from VFC_MODEL where customization_uuid=:vfccustomizationuuid",
           "input-key-mapping" : {
     "tags" : "vnfc-model-version",
     "name" : "vnfc-model-version",
     "property" : {
-      "description" : "vnfc-model-version for  SRIOV VPE template",
+      "description" : "vnfc-model-version",
       "type" : "string"
     },
-    "updated-by" : "Singal, Kapil <ks220y@att.com>",
+    "updated-by" : "MALAKOV, YURIY <yuriy.malakov@att.com>",
     "sources" : {
+      "input" : {
+        "type" : "source-input"
+      },
+      "default" : {
+        "type" : "source-default",
+        "properties" : { }
+      },
       "processor-db" : {
         "type" : "source-db",
         "properties" : {
+          "endpoint-selector" : "dynamic-db-source",
           "type" : "SQL",
           "query" : "select VFC_MODEL.version as vnfc_model_version from VFC_MODEL where customization_uuid=:vfccustomizationuuid",
           "input-key-mapping" : {
       }
     }
   }
-}
+}
\ No newline at end of file
index a4d90ad..9ff4f3a 100644 (file)
@@ -1,19 +1,31 @@
 {
-  "metadata": {
-    "template_author": "Alexis de Talhouët",
-    "author-email": "adetalhouet89@gmail.com",
-    "user-groups": "ADMIN, OPERATION",
-    "template_name": "vFW_spinup",
-    "template_version": "1.0.0",
-    "template_tags": "vFW"
+  "tosca_definitions_version" : "controller_blueprint_1_0_0",
+  "metadata" : {
+    "template_author" : "Alexis de Talhouët",
+    "author-email" : "adetalhouet89@gmail.com",
+    "user-groups" : "ADMIN, OPERATION",
+    "template_name" : "vFW_spinup",
+    "template_version" : "1.0.0",
+    "template_tags" : "vFW"
   },
-  "topology_template": {
-    "workflows": {
-      "resource-assignment": {
-        "steps": {
-          "resource-assignment": {
-            "description": "Resource Assign Workflow",
-            "target": "resource-assignment"
+  "imports" : [ {
+    "file" : "Definitions/data_types.json"
+  }, {
+    "file" : "Definitions/relationship_types.json"
+  }, {
+    "file" : "Definitions/artifact_types.json"
+  }, {
+    "file" : "Definitions/node_types.json"
+  }, {
+    "file" : "Definitions/policy_types.json"
+  } ],
+  "topology_template" : {
+    "workflows" : {
+      "resource-assignment" : {
+        "steps" : {
+          "resource-assignment" : {
+            "description" : "Resource Assign Workflow",
+            "target" : "resource-assignment"
           }
         },
         "inputs" : {
             "entry_schema" : {
               "type" : "string"
             }
+          },
+          "resource-assignment-properties" : {
+            "description" : "Dynamic PropertyDefinition for workflow(resource-assignment).",
+            "required" : true,
+            "type" : "dt-resource-assignment-properties"
           }
         },
-        "outputs": {
-          "meshed-template": {
-            "type": "json",
-            "value": {
-              "get_attribute": [
-                "resource-assignment",
-                "assignment-params"
-              ]
+        "outputs" : {
+          "meshed-template" : {
+            "type" : "json",
+            "value" : {
+              "get_attribute" : [ "resource-assignment", "assignment-params" ]
             }
           }
         }
       }
     },
-    "node_templates": {
+    "node_templates" : {
       "resource-assignment" : {
         "type" : "component-resource-resolution",
         "interfaces" : {
             }
           }
         },
-        "artifacts": {
-          "base-template": {
-            "type": "artifact-template-velocity",
-            "file": "Templates/base-template.vtl"
+        "artifacts" : {
+          "base-template" : {
+            "type" : "artifact-template-velocity",
+            "file" : "Templates/base-template.vtl"
           },
-          "base-mapping": {
-            "type": "artifact-mapping-resource",
-            "file": "Templates/base-mapping.json"
+          "base-mapping" : {
+            "type" : "artifact-mapping-resource",
+            "file" : "Templates/base-mapping.json"
           },
-          "vfw-template": {
-            "type": "artifact-template-velocity",
-            "file": "Templates/vfw-template.vtl"
+          "vfw-template" : {
+            "type" : "artifact-template-velocity",
+            "file" : "Templates/vfw-template.vtl"
           },
-          "vfw-mapping": {
-            "type": "artifact-mapping-resource",
-            "file": "Templates/vfw-mapping.json"
+          "vfw-mapping" : {
+            "type" : "artifact-mapping-resource",
+            "file" : "Templates/vfw-mapping.json"
           },
-          "vfw-vnf-template": {
-            "type": "artifact-template-velocity",
-            "file": "Templates/vfw-vnf-template.vtl"
+          "vfw-vnf-template" : {
+            "type" : "artifact-template-velocity",
+            "file" : "Templates/vfw-vnf-template.vtl"
           },
-          "vfw-vnf-mapping": {
-            "type": "artifact-mapping-resource",
-            "file": "Templates/vfw-vnf-mapping.json"
+          "vfw-vnf-mapping" : {
+            "type" : "artifact-mapping-resource",
+            "file" : "Templates/vfw-vnf-mapping.json"
           },
-          "vpg-template": {
-            "type": "artifact-template-velocity",
-            "file": "Templates/vpg-template.vtl"
+          "vpg-template" : {
+            "type" : "artifact-template-velocity",
+            "file" : "Templates/vpg-template.vtl"
           },
-          "vpg-mapping": {
-            "type": "artifact-mapping-resource",
-            "file": "Templates/vpg-mapping.json"
+          "vpg-mapping" : {
+            "type" : "artifact-mapping-resource",
+            "file" : "Templates/vpg-mapping.json"
           },
-          "vsn-template": {
-            "type": "artifact-template-velocity",
-            "file": "Templates/vsn-template.vtl"
+          "vsn-template" : {
+            "type" : "artifact-template-velocity",
+            "file" : "Templates/vsn-template.vtl"
           },
-          "vsn-mapping": {
-            "type": "artifact-mapping-resource",
-            "file": "Templates/vsn-mapping.json"
+          "vsn-mapping" : {
+            "type" : "artifact-mapping-resource",
+            "file" : "Templates/vsn-mapping.json"
           }
         }
       }
index 1162309..5036a6f 100644 (file)
@@ -26,9 +26,3 @@ processes:
         message: success
       payload:
         echo-response: {}
-      stepData:
-        name: echo
-        properties:
-          resource-assignment-params:
-            echo: *message
-          status: success
index 3a5903c..fbdb2ee 100644 (file)
@@ -31,32 +31,6 @@ processes:
         message: success
       payload:
         config-assign-response: {}
-      stepData:
-        name: config-assign
-        properties:
-          resource-assignment-params:
-            config-assign: &assignPatch
-              ietf-restconf:yang-patch:
-                patch-id: patch-1
-                edit:
-                  - edit-id: edit1
-                    operation: merge
-                    target: /
-                    value: { netconflist: { netconf: [ { netconf-id: "10", netconf-param: "1000" }]}}
-                  - edit-id: edit2
-                    operation: merge
-                    target: /
-                    value: { netconflist: { netconf: [ { netconf-id: "20", netconf-param: "2000" }]}}
-                  - edit-id: edit3
-                    operation: merge
-                    target: /
-                    value: { netconflist: { netconf: [ { netconf-id: "30", netconf-param: "3000" }]}}
-          status: success
-    responseNormalizerSpec:
-      stepData:
-        properties:
-          resource-assignment-params:
-            config-assign: ?from-json(.stepData.properties.resource-assignment-params.config-assign)
   - name: config-deploy
     request:
       commonHeader: *commonHeader
@@ -84,11 +58,6 @@ processes:
         errorMessage: null
         eventType: EVENT_COMPONENT_EXECUTED
         message: success
-      stepData:
-        name: config-deploy
-        properties:
-          response-data: ""
-          status: success
 
 external-services:
   - selector: sdncodl
@@ -127,7 +96,22 @@ external-services:
           path: [*configUri, *configletResourcePath]
           headers:
             Content-Type: application/yang.patch+json
-          body: *assignPatch
+          body:
+            ietf-restconf:yang-patch:
+              patch-id: patch-1
+              edit:
+                - edit-id: edit1
+                  operation: merge
+                  target: /
+                  value: { netconflist: { netconf: [ { netconf-id: "10", netconf-param: "1000" }]}}
+                - edit-id: edit2
+                  operation: merge
+                  target: /
+                  value: { netconflist: { netconf: [ { netconf-id: "20", netconf-param: "2000" }]}}
+                - edit-id: edit3
+                  operation: merge
+                  target: /
+                  value: { netconflist: { netconf: [ { netconf-id: "30", netconf-param: "3000" }]}}
       - request:
           method: DELETE
           path: *configUri
index e358240..9c6d802 100644 (file)
     <parent>
         <groupId>org.onap.ccsdk.cds</groupId>
         <artifactId>parent</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
         <relativePath>../../../</relativePath>
     </parent>
 
     <groupId>org.onap.ccsdk.cds.components</groupId>
     <artifactId>proto-definition</artifactId>
-    <version>0.6.1-SNAPSHOT</version>
+    <version>0.7.0-SNAPSHOT</version>
     <packaging>jar</packaging>
 
     <name>Controller Blueprints Proto Definition</name>
index 4ce7e8c..6f33118 100644 (file)
@@ -21,7 +21,7 @@
     <parent>
         <groupId>org.onap.ccsdk.cds</groupId>
         <artifactId>components</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
     </parent>
     <groupId>org.onap.ccsdk.cds.components</groupId>
     <artifactId>parent</artifactId>
index 26d609f..060cf4e 100644 (file)
@@ -19,7 +19,7 @@
     <parent>
         <groupId>org.onap.ccsdk.cds</groupId>
         <artifactId>parent</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <artifactId>components</artifactId>
index a4f60f1..64452a0 100755 (executable)
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
         <artifactId>parent</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
         <relativePath>../parent</relativePath>
     </parent>
     <artifactId>application</artifactId>
index 0ee0da4..a1b6bef 100644 (file)
@@ -19,7 +19,7 @@
     <parent>
         <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
         <artifactId>parent</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
         <relativePath>../parent</relativePath>
     </parent>
     <artifactId>cba-parent</artifactId>
index d6d9c56..4037c98 100755 (executable)
@@ -19,7 +19,7 @@
     <parent>
         <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
         <artifactId>parent</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
         <relativePath>../parent</relativePath>
     </parent>
     <artifactId>distribution</artifactId>
index 96254b7..8b59b17 100644 (file)
@@ -18,7 +18,7 @@
     <parent>
         <artifactId>functions</artifactId>
         <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
index 53882b0..89f409a 100644 (file)
@@ -18,7 +18,7 @@
     <parent>
         <artifactId>functions</artifactId>
         <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.onap.ccsdk.cds.blueprintsprocessor.functions</groupId>
index 0867135..0ad9796 100644 (file)
     <parent>
         <artifactId>functions</artifactId>
         <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
     <groupId>org.onap.ccsdk.cds.blueprintsprocessor.functions</groupId>
     <artifactId>config-snapshots</artifactId>
-    <version>0.6.1-SNAPSHOT</version>
+    <version>0.7.0-SNAPSHOT</version>
     <name>Blueprints Processor Function - Config Snapshots</name>
     <description>Blueprints Processor Function - Config Snapshots</description>
 
index eafcaf4..180ad7b 100644 (file)
  *  limitations under the License.
  */
 
-package org.onap.ccsdk.cds.blueprintsprocessor.functions.ansible.executor
+package org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots
 
 import com.github.fge.jsonpatch.diff.JsonDiff
+import org.apache.logging.log4j.util.Strings
 import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
 import org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.db.ResourceConfigSnapshot
 import org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.db.ResourceConfigSnapshot.Status.RUNNING
@@ -144,18 +145,20 @@ open class ComponentConfigSnapshotsExecutor(private val cfgSnapshotService: Reso
      */
     private suspend fun compareConfigurationSnapshot(resourceId: String, resourceType: String, contentType : String) {
 
+        val cfgRunning = cfgSnapshotService.findByResourceIdAndResourceTypeAndStatus(resourceId, resourceType, RUNNING)
+        val cfgCandidate = cfgSnapshotService.findByResourceIdAndResourceTypeAndStatus(resourceId, resourceType, CANDIDATE)
+
+        if (cfgRunning.isEmpty() || cfgCandidate.isEmpty()) {
+            setNodeOutputProperties(OUTPUT_STATUS_SUCCESS, Strings.EMPTY)
+            return
+        }
+
         when (contentType.toUpperCase()) {
             DIFF_JSON -> {
-                val cfgRunning = cfgSnapshotService.findByResourceIdAndResourceTypeAndStatus(resourceId, resourceType, RUNNING)
-                val cfgCandidate = cfgSnapshotService.findByResourceIdAndResourceTypeAndStatus(resourceId, resourceType, CANDIDATE)
-
                 val patchNode = JsonDiff.asJson(cfgRunning.jsonAsJsonType(), cfgCandidate.jsonAsJsonType())
                 setNodeOutputProperties(OUTPUT_STATUS_SUCCESS, patchNode.toString())
             }
             DIFF_XML -> {
-                val cfgRunning = cfgSnapshotService.findByResourceIdAndResourceTypeAndStatus(resourceId, resourceType, RUNNING)
-                val cfgCandidate = cfgSnapshotService.findByResourceIdAndResourceTypeAndStatus(resourceId, resourceType, CANDIDATE)
-
                 val myDiff = DiffBuilder
                         .compare(Input.fromString(cfgRunning))
                         .withTest(Input.fromString(cfgCandidate))
index 50c90f3..5fcba5b 100644 (file)
@@ -17,6 +17,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.db
 
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.withContext
+import org.apache.logging.log4j.util.Strings
 import org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.db.ResourceConfigSnapshot.Status.RUNNING
 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
 import org.slf4j.LoggerFactory
@@ -40,7 +41,7 @@ class ResourceConfigSnapshotService(private val repository: ResourceConfigSnapsh
                                                          status : ResourceConfigSnapshot.Status = RUNNING): String =
             withContext(Dispatchers.IO) {
                 repository.findByResourceIdAndResourceTypeAndStatus(resourceId, resourceType, status)
-                        ?.config_snapshot ?: throw NoSuchElementException()
+                        ?.config_snapshot ?: Strings.EMPTY
             }
 
     suspend fun write(snapshot: String, resId: String, resType: String,
index 79dd930..c212908 100644 (file)
@@ -14,7 +14,7 @@
  *  limitations under the License.
  */
 
-package org.onap.ccsdk.cds.blueprintsprocessor.functions.ansible.executor
+package org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots
 
 import com.fasterxml.jackson.databind.JsonNode
 import kotlinx.coroutines.runBlocking
@@ -27,11 +27,12 @@ import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties
 import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertyConfiguration
 import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
 import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
-import org.onap.ccsdk.cds.blueprintsprocessor.functions.ansible.executor.ComponentConfigSnapshotsExecutor.Companion.DIFF_JSON
-import org.onap.ccsdk.cds.blueprintsprocessor.functions.ansible.executor.ComponentConfigSnapshotsExecutor.Companion.DIFF_XML
-import org.onap.ccsdk.cds.blueprintsprocessor.functions.ansible.executor.ComponentConfigSnapshotsExecutor.Companion.OPERATION_DIFF
-import org.onap.ccsdk.cds.blueprintsprocessor.functions.ansible.executor.ComponentConfigSnapshotsExecutor.Companion.OPERATION_FETCH
-import org.onap.ccsdk.cds.blueprintsprocessor.functions.ansible.executor.ComponentConfigSnapshotsExecutor.Companion.OPERATION_STORE
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.ComponentConfigSnapshotsExecutor
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.ComponentConfigSnapshotsExecutor.Companion.DIFF_JSON
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.ComponentConfigSnapshotsExecutor.Companion.DIFF_XML
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.ComponentConfigSnapshotsExecutor.Companion.OPERATION_DIFF
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.ComponentConfigSnapshotsExecutor.Companion.OPERATION_FETCH
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.ComponentConfigSnapshotsExecutor.Companion.OPERATION_STORE
 import org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.db.ResourceConfigSnapshot
 import org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.db.ResourceConfigSnapshotService
 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
@@ -192,9 +193,7 @@ class ComponentConfigSnapshotsExecutorTest {
                 return@runBlocking
             }
 
-            // then; we should get error and the PAYLOAD payload in our output properties
-            assertTrue( bluePrintRuntimeService.getBluePrintError().errors.size > 0 )
-            assertEquals(ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_ERROR.asJsonPrimitive(),
+            assertEquals(ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_SUCCESS.asJsonPrimitive(),
                     bluePrintRuntimeService.getNodeTemplateAttributeValue(nodeTemplateName,
                             ComponentConfigSnapshotsExecutor.OUTPUT_STATUS))
         }
@@ -234,7 +233,10 @@ class ComponentConfigSnapshotsExecutorTest {
         runBlocking {
             // when; asking for unknown content type diff operation; should get an error response
             try {
-                prepareRequestProperties(OPERATION_DIFF, "asdasd",  "PNF", "YANG")
+                val resId = "121111"
+                val resType = "PNF"
+                cfgSnapshotService.write("snapshotConfig", resId, resType,  ResourceConfigSnapshot.Status.CANDIDATE)
+                prepareRequestProperties(OPERATION_DIFF, resId,  resType, "YANG")
 
                 cfgSnapshotComponent.processNB(executionRequest)
 
@@ -245,7 +247,6 @@ class ComponentConfigSnapshotsExecutorTest {
             }
 
             // then; we should get error in our output properties
-            assertTrue( bluePrintRuntimeService.getBluePrintError().errors.size == 1 )
             assertEquals(ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_ERROR.asJsonPrimitive(),
                     bluePrintRuntimeService.getNodeTemplateAttributeValue(nodeTemplateName,
                             ComponentConfigSnapshotsExecutor.OUTPUT_STATUS))
index 2830cb5..3c989c1 100644 (file)
@@ -48,18 +48,6 @@ class ResourceConfigSnapshotServiceTest {
         }
     }
 
-    @Test(expected = NoSuchElementException::class)
-    fun notFoundEntryReturnsExceptionTest() {
-        val tr = ResourceConfigSnapshot()
-        runBlocking {
-            every {
-                cfgRepository.findByResourceIdAndResourceTypeAndStatus(any(), any(), any())
-            } returns tr
-            val snap = cfgService.findByResourceIdAndResourceTypeAndStatus("MISSING_ID", "UNKNOWN_TYPE")
-            assertTrue ( snap.isBlank(), "Not found but returned a non empty string" )
-        }
-    }
-
     @Test
     fun createNewResourceConfigSnapshotTest() {
         val tr = ResourceConfigSnapshot()
index ff9d0f7..f163c0e 100644 (file)
@@ -18,7 +18,7 @@
     <parent>
         <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
         <artifactId>functions</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.onap.ccsdk.cds.blueprintsprocessor.functions</groupId>
index c2ac510..73daf22 100755 (executable)
@@ -19,7 +19,7 @@
     <parent>
         <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
         <artifactId>parent</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
         <relativePath>../parent</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>
index 68ba95e..872e5a6 100644 (file)
@@ -18,7 +18,7 @@
     <parent>
         <artifactId>functions</artifactId>
         <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
index 6f2d349..be524fe 100644 (file)
@@ -19,7 +19,7 @@
     <parent>
         <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
         <artifactId>functions</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
     </parent>
     <groupId>org.onap.ccsdk.cds.blueprintsprocessor.functions</groupId>
     <artifactId>resource-resolution</artifactId>
index 2a9218d..7696442 100644 (file)
@@ -29,5 +29,4 @@ object ResourceResolutionConstants {
         const val RESOURCE_RESOLUTION_INPUT_OCCURRENCE = "occurrence"
         const val RESOURCE_RESOLUTION_INPUT_RESOURCE_ID = "resource-id"
         const val RESOURCE_RESOLUTION_INPUT_RESOURCE_TYPE = "resource-type"
-        val DATA_DICTIONARY_SECRET_SOURCE_TYPES = arrayOf("vault-data") //Add more secret data dictionary source type here
 }
\ No newline at end of file
index 641175c..51170a9 100644 (file)
@@ -28,6 +28,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.proc
 import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils
 import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceDefinitionUtils.createResourceAssignments
 import org.onap.ccsdk.cds.controllerblueprints.core.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
 import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
 import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintTemplateService
 import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
@@ -151,7 +152,9 @@ open class ResourceResolutionServiceImpl(private var applicationContext: Applica
                 ResourceAssignmentUtils.generateResourceDataForAssignments(resourceAssignments.toList())
 
         resolvedContent = blueprintTemplateService.generateContent(bluePrintRuntimeService, nodeTemplateName,
-                artifactTemplate, resolvedParamJsonContent)
+                artifactTemplate, resolvedParamJsonContent, false,
+                mutableMapOf(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE to
+                    properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE].asJsonPrimitive()))
 
         if (isToStore(properties)) {
             templateResolutionDBService.write(properties, resolvedContent, bluePrintRuntimeService, artifactPrefix)
@@ -330,7 +333,9 @@ open class ResourceResolutionServiceImpl(private var applicationContext: Applica
                 resourceAssignmentList.forEach {
                     if (compareOne(resourceResolution, it)) {
                         log.info("Resource ({}) already resolve: value=({})", it.name, resourceResolution.value)
-                        val value = resourceResolution.value!!.asJsonPrimitive()
+
+                        // Make sure to recreate value as per the defined type.
+                        val value = resourceResolution.value!!.asJsonType(it.property!!.type)
                         it.property!!.value = value
                         it.status = resourceResolution.status
                         ResourceAssignmentUtils.setResourceDataValue(it, raRuntimeService, value)
index 01cfd72..117df1e 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 IBM.
+ * Modifications Copyright (c) 2019 IBM, Bell Canada.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.uti
 import com.fasterxml.jackson.databind.JsonNode
 import com.fasterxml.jackson.databind.ObjectMapper
 import com.fasterxml.jackson.databind.node.ArrayNode
+import com.fasterxml.jackson.databind.node.NullNode
 import com.fasterxml.jackson.databind.node.ObjectNode
 import com.fasterxml.jackson.databind.node.TextNode
 import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceAssignmentRuntimeService
@@ -194,85 +195,214 @@ class ResourceAssignmentUtils {
         @Throws(BluePrintProcessorException::class)
         fun parseResponseNode(responseNode: JsonNode, resourceAssignment: ResourceAssignment,
                               raRuntimeService: ResourceAssignmentRuntimeService, outputKeyMapping: MutableMap<String, String>): JsonNode {
+            try {
+                if ((resourceAssignment.property?.type).isNullOrEmpty()) {
+                    throw BluePrintProcessorException("Couldn't get data dictionary type for dictionary name (${resourceAssignment.name})")
+                }
+                val type = resourceAssignment.property!!.type
+                return when (type) {
+                    in BluePrintTypes.validPrimitiveTypes() -> {
+                        parseResponseNodeForPrimitiveTypes(responseNode, resourceAssignment, outputKeyMapping)
+                    }
+                    in BluePrintTypes.validCollectionTypes() -> {
+                        // Array Types
+                        parseResponseNodeForCollection(responseNode, resourceAssignment, raRuntimeService, outputKeyMapping)
+                    }
+                    else -> {
+                        // Complex Types
+                        parseResponseNodeForComplexType(responseNode, resourceAssignment, raRuntimeService, outputKeyMapping)
+                    }
+                }
+            } catch (e: Exception) {
+                logger.error("Fail to parse response data, error message $e")
+                throw BluePrintProcessorException("${e.message}", e)
+            }
+        }
+
+        private fun parseResponseNodeForPrimitiveTypes(responseNode: JsonNode, resourceAssignment: ResourceAssignment,
+                                                       outputKeyMapping: MutableMap<String, String>): JsonNode {
             val dName = resourceAssignment.dictionaryName
-            val dSource = resourceAssignment.dictionarySource
-            val type = nullToEmpty(resourceAssignment.property?.type)
-            lateinit var entrySchemaType: String
-            when (type) {
-                in BluePrintTypes.validPrimitiveTypes() -> {
-                    if (dSource !in ResourceResolutionConstants.DATA_DICTIONARY_SECRET_SOURCE_TYPES)
-                        logger.info("For template key (${resourceAssignment.name}) setting value as ($responseNode)")
-                    val result = if (responseNode is ArrayNode)
-                        responseNode.get(0)
-                    else
-                        responseNode
-                    return if (result.isComplexType()) {
-                        check(result.has(outputKeyMapping[dName])) {
-                            "Fail to find output key mapping ($dName) in result."
+            logger.info("For template key (${resourceAssignment.name}) setting value as ($responseNode)")
+
+            var result: JsonNode? = responseNode
+            if (responseNode.isComplexType()) {
+                val key = outputKeyMapping.keys.firstOrNull()
+                var returnNode: JsonNode? = responseNode
+                if (responseNode is ArrayNode) {
+                    val arrayNode = responseNode.toList()
+                    val firstElement = if (key.isNullOrEmpty()) {
+                        arrayNode.first()
+                    }
+                    else{
+                        arrayNode.firstOrNull { element ->
+                            element.isComplexType() && element.has(outputKeyMapping[key])
+                        }
+                    }
+
+                    if (firstElement.isNull() || (firstElement!!.isComplexType() && !firstElement!!.has(outputKeyMapping[key]))
+                            || (!result!!.isComplexType() && result is NullNode)) {
+                        if (key.isNullOrEmpty()) {
+                            throw BluePrintProcessorException("Fail to find mapping in the responseNode.")
+                        }
+                        else {
+                            throw BluePrintProcessorException("Fail to find response with output key mapping ($key) in result.")
                         }
-                        result[outputKeyMapping[dName]]
-                    } else {
-                        result
                     }
+                    returnNode = firstElement
                 }
-                in BluePrintTypes.validCollectionTypes() -> {
-                    // Array Types
-                    entrySchemaType = checkNotEmpty(resourceAssignment.property?.entrySchema?.type) {
-                        "Entry schema is not defined for dictionary ($dName) info"
+                result = if (returnNode!!.isComplexType()) {
+                    returnNode[outputKeyMapping[key]]
+                }
+                else {
+                    returnNode
+                }
+            }
+            return result!!
+        }
+
+        private fun parseResponseNodeForCollection(responseNode: JsonNode, resourceAssignment: ResourceAssignment,
+                                                   raRuntimeService: ResourceAssignmentRuntimeService,
+                                                   outputKeyMapping: MutableMap<String, String>): JsonNode {
+            val dName = resourceAssignment.dictionaryName
+            if ((resourceAssignment.property?.entrySchema?.type).isNullOrEmpty()) {
+                throw BluePrintProcessorException("Couldn't get data type for dictionary type " +
+                        "(${resourceAssignment.property!!.type}) and dictionary name ($dName)")
+            }
+            val entrySchemaType = resourceAssignment.property!!.entrySchema!!.type
+
+            var arrayNode = JacksonUtils.objectMapper.createArrayNode()
+
+            if (outputKeyMapping.isNotEmpty()) {
+                when (responseNode) {
+                    is ArrayNode -> {
+                        val responseArrayNode = responseNode.toList()
+                        for (responseSingleJsonNode in responseArrayNode) {
+                            val arrayChildNode = parseArrayNodeElementWithOutputKeyMapping(raRuntimeService, responseSingleJsonNode,
+                                    outputKeyMapping, entrySchemaType)
+                            arrayNode.add(arrayChildNode)
+                        }
                     }
-                    val arrayNode = JacksonUtils.objectMapper.createArrayNode()
-                    lateinit var responseValueNode: JsonNode
-                    lateinit var propertyType: String
-                    outputKeyMapping.map {
-                        val arrayChildNode = JacksonUtils.objectMapper.createObjectNode()
+                    is ObjectNode -> {
                         val responseArrayNode = responseNode.rootFieldsToMap()
-                        outer@ for ((key, responseSingleJsonNode) in responseArrayNode) {
-                            if (key == it.key) {
-                                if (entrySchemaType in BluePrintTypes.validPrimitiveTypes()) {
-                                    responseValueNode = responseSingleJsonNode
-                                    propertyType = entrySchemaType
-
-                                } else {
-                                    responseValueNode = responseSingleJsonNode.get(it.key)
-                                    propertyType = getPropertyType(raRuntimeService, entrySchemaType, it.key)
-                                }
-                                if (resourceAssignment.dictionarySource !in ResourceResolutionConstants.DATA_DICTIONARY_SECRET_SOURCE_TYPES)
-                                    logger.info("For List Type Resource: key (${it.key}), value ($responseValueNode), " +
-                                            "type  ({$propertyType})")
-                                JacksonUtils.populateJsonNodeValues(it.value,
-                                        responseValueNode, propertyType, arrayChildNode)
-                                arrayNode.add(arrayChildNode)
-                                break@outer
-                            }
-                        }
+                        val arrayNodeResult = parseObjectNodeWithOutputKeyMapping(responseArrayNode, outputKeyMapping, entrySchemaType)
+                        arrayNode.addAll(arrayNodeResult)
+                    }
+                    else -> {
+                        throw BluePrintProcessorException("Key-value response expected to match the responseNode.")
                     }
-                    if (resourceAssignment.dictionarySource !in ResourceResolutionConstants.DATA_DICTIONARY_SECRET_SOURCE_TYPES)
-                        logger.info("For template key (${resourceAssignment.name}) setting value as ($arrayNode)")
-
-                    return arrayNode
                 }
-                else -> {
-                    // Complex Types
-                    entrySchemaType = checkNotEmpty(resourceAssignment.property?.type) {
-                        "Entry schema is not defined for dictionary ($dName) info"
+            }
+            else {
+                when (responseNode) {
+                    is ArrayNode -> {
+                        responseNode.forEach { elementNode ->
+                            arrayNode.add(elementNode)
+                        }
                     }
-                    val objectNode = JacksonUtils.objectMapper.createObjectNode()
+                    is ObjectNode -> {
+                        val responseArrayNode = responseNode.rootFieldsToMap()
+                        for ((key, responseSingleJsonNode) in responseArrayNode) {
+                            val arrayChildNode = JacksonUtils.objectMapper.createObjectNode()
+                            JacksonUtils.populateJsonNodeValues(key, responseSingleJsonNode, entrySchemaType, arrayChildNode)
+                            arrayNode.add(arrayChildNode)
+                        }
+                    }
+                    else -> {
+                        arrayNode.add(responseNode)
+                    }
+                }
+            }
+
+            logger.info("For template key (${resourceAssignment.name}) setting value as ($arrayNode)")
+
+            return arrayNode
+        }
+
+        private fun parseResponseNodeForComplexType(responseNode: JsonNode, resourceAssignment: ResourceAssignment,
+                                                    raRuntimeService: ResourceAssignmentRuntimeService,
+                                                    outputKeyMapping: MutableMap<String, String>): JsonNode {
+            val entrySchemaType = resourceAssignment.property!!.type
+            val dictionaryName = resourceAssignment.dictionaryName!!
+
+            var result: ObjectNode
+            if (checkOutputKeyMappingInDataTypeProperties(entrySchemaType, outputKeyMapping, raRuntimeService))
+            {
+                result = parseArrayNodeElementWithOutputKeyMapping(raRuntimeService, responseNode, outputKeyMapping, entrySchemaType)
+            }
+            else {
+                val childNode = JacksonUtils.objectMapper.createObjectNode()
+                if (outputKeyMapping.isNotEmpty()) {
                     outputKeyMapping.map {
-                        val responseKeyValue = responseNode.get(it.key)
-                        val propertyTypeForDataType = ResourceAssignmentUtils
-                                .getPropertyType(raRuntimeService, entrySchemaType, it.key)
+                        val responseKeyValue = if (responseNode.has(it.key)) {
+                            responseNode.get(it.key)
+                        }
+                        else {
+                            NullNode.getInstance()
+                        }
 
-                        if (resourceAssignment.dictionarySource !in ResourceResolutionConstants.DATA_DICTIONARY_SECRET_SOURCE_TYPES)
-                            logger.info("For List Type Resource: key (${it.key}), value ($responseKeyValue), type  ({$propertyTypeForDataType})")
-                        JacksonUtils.populateJsonNodeValues(it.value, responseKeyValue, propertyTypeForDataType, objectNode)
+                        JacksonUtils.populateJsonNodeValues(it.value,
+                                responseKeyValue, entrySchemaType, childNode)
                     }
+                }
+                else {
+                    JacksonUtils.populateJsonNodeValues(dictionaryName, responseNode, entrySchemaType, childNode)
+                }
+                result = childNode
+            }
+            return result
+        }
+
+        private fun parseArrayNodeElementWithOutputKeyMapping(raRuntimeService: ResourceAssignmentRuntimeService,
+                                                              responseSingleJsonNode: JsonNode, outputKeyMapping:
+                                                              MutableMap<String, String>, entrySchemaType: String): ObjectNode {
+            val arrayChildNode = JacksonUtils.objectMapper.createObjectNode()
+
+            outputKeyMapping.map {
+                val responseKeyValue = if (responseSingleJsonNode.has(it.key)) {
+                    responseSingleJsonNode.get(it.key)
+                }
+                else {
+                    NullNode.getInstance()
+                }
+                val propertyTypeForDataType = ResourceAssignmentUtils
+                        .getPropertyType(raRuntimeService, entrySchemaType, it.key)
+
+                logger.info("For List Type Resource: key (${it.key}), value ($responseKeyValue), " +
+                        "type  ({$propertyTypeForDataType})")
 
-                    if (resourceAssignment.dictionarySource !in ResourceResolutionConstants.DATA_DICTIONARY_SECRET_SOURCE_TYPES)
-                        logger.info("For template key (${resourceAssignment.name}) setting value as ($objectNode)")
+                JacksonUtils.populateJsonNodeValues(it.value,
+                        responseKeyValue, propertyTypeForDataType, arrayChildNode)
+            }
+
+            return arrayChildNode
+        }
+
+        private fun parseObjectNodeWithOutputKeyMapping(responseArrayNode: MutableMap<String, JsonNode>,
+                                                        outputKeyMapping: MutableMap<String, String>,
+                                                        entrySchemaType: String): ArrayNode {
+            val arrayNode = JacksonUtils.objectMapper.createArrayNode()
+            outputKeyMapping.map {
+                val objectNode = JacksonUtils.objectMapper.createObjectNode()
+                val responseSingleJsonNode = responseArrayNode.filterKeys { key -> key == it.key }.entries.firstOrNull()
 
-                    return objectNode
+                if (responseSingleJsonNode == null) {
+                    JacksonUtils.populateJsonNodeValues(it.value, NullNode.getInstance(), entrySchemaType, objectNode)
                 }
+                else
+                {
+                    JacksonUtils.populateJsonNodeValues(it.value, responseSingleJsonNode.value, entrySchemaType, objectNode)
+                }
+                arrayNode.add(objectNode)
             }
+
+            return arrayNode
+        }
+
+        private fun checkOutputKeyMappingInDataTypeProperties(dataTypeName: String, outputKeyMapping: MutableMap<String, String>,
+                                                              raRuntimeService: ResourceAssignmentRuntimeService): Boolean {
+            val dataTypeProps = raRuntimeService.bluePrintContext().dataTypeByName(dataTypeName)?.properties
+            val result = outputKeyMapping.filterKeys { !dataTypeProps!!.containsKey(it) }.keys.firstOrNull()
+            return result == null
         }
     }
 }
\ No newline at end of file
index 9b87c12..9365c3e 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (c) 2019 IBM, Bell Canada.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * ============LICENSE_END=========================================================
  */
 
-
 package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils
 
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.node.NullNode
 import com.fasterxml.jackson.databind.node.TextNode
+import io.mockk.every
+import io.mockk.spyk
+import org.junit.Before
 import org.junit.Test
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceAssignmentRuntimeService
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.EntrySchema
 import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
 import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
 import kotlin.test.assertEquals
 
+data class IpAddress(val port: String, val ip: String)
+data class Host(val name: String, val ipAddress: IpAddress)
+data class ExpectedResponseIp(val ip: String)
+data class ExpectedResponsePort(val port: String)
+
 class ResourceAssignmentUtilsTest {
+    private lateinit var resourceAssignmentRuntimeService: ResourceAssignmentRuntimeService
+
+    @Before
+    fun setup() {
+
+        val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext(
+                "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
+
+        resourceAssignmentRuntimeService = spyk(ResourceAssignmentRuntimeService("1234", bluePrintContext))
+
+        val propertiesDefinition1 = PropertyDefinition().apply {
+            type = "string"
+            id = "port"
+        }
+
+        val propertiesDefinition2 = PropertyDefinition().apply {
+            type = "string"
+            id = "ip"
+        }
+
+        val propertiesDefinition3 = PropertyDefinition().apply {
+            type = "string"
+            id = "name"
+        }
+
+        val propertiesDefinition4 = PropertyDefinition().apply {
+            type = "ip-address"
+            id = "ipAddress"
+        }
+
+        var mapOfPropertiesIpAddress = mutableMapOf<String, PropertyDefinition>()
+        mapOfPropertiesIpAddress["port"] = propertiesDefinition1
+        mapOfPropertiesIpAddress["ip"] = propertiesDefinition2
+
+        var mapOfPropertiesHost = mutableMapOf<String, PropertyDefinition>()
+        mapOfPropertiesHost["name"] = propertiesDefinition3
+        mapOfPropertiesHost["ipAddress"] = propertiesDefinition4
+
+        val myDataTypeIpaddress = DataType().apply {
+            id = "ip-address"
+            properties = mapOfPropertiesIpAddress
+        }
+
+        val myDataTypeHost = DataType().apply {
+            id = "host"
+            properties = mapOfPropertiesHost
+        }
+
+        every { resourceAssignmentRuntimeService.bluePrintContext().dataTypeByName("ip-address") } returns myDataTypeIpaddress
+
+        every { resourceAssignmentRuntimeService.bluePrintContext().dataTypeByName("host") } returns myDataTypeHost
+
+        every { resourceAssignmentRuntimeService.setNodeTemplateAttributeValue(any(), any(), any()) } returns Unit
+    }
 
     @Test
     fun `generateResourceDataForAssignments - positive test`() {
@@ -43,7 +114,6 @@ class ResourceAssignmentUtilsTest {
         //then the assignment should produce a valid result
         val expected = "{\n" + "  \"pnf-id\" : \"valid_value\"\n" + "}"
         assertEquals(expected, outcome, "unexpected outcome generated")
-
     }
 
     @Test
@@ -76,4 +146,243 @@ class ResourceAssignmentUtilsTest {
         }
         return resourceAssignmentForTest
     }
+
+    @Test
+    fun parseResponseNodeTestForPrimitivesTypes(){
+        // Input values for primitive type
+        val keyValue = mutableMapOf<String, String>()
+        keyValue["value"]= "1.2.3.1"
+        val expectedPrimitiveType = TextNode("1.2.3.1")
+
+        var outcome = prepareResponseNodeForTest("sample-value", "string",
+                "", "1.2.3.1".asJsonPrimitive())
+        assertEquals(expectedPrimitiveType, outcome, "Unexpected outcome returned for primitive type of simple String")
+        outcome = prepareResponseNodeForTest("sample-key-value", "string", "", keyValue)
+        assertEquals(expectedPrimitiveType, outcome, "Unexpected outcome returned for primitive type of key-value String")
+    }
+
+    @Test
+    fun parseResponseNodeTestForCollectionsOfString(){
+        // Input values for collection type
+        val mapOfString = mutableMapOf<String, String>()
+        mapOfString["value1"] = "1.2.3.1"
+        mapOfString["port"] = "8888"
+        mapOfString["value2"] = "1.2.3.2"
+        val arrayOfKeyValue = arrayListOf(ExpectedResponseIp("1.2.3.1"),
+                ExpectedResponsePort( "8888"), ExpectedResponseIp("1.2.3.2"))
+
+        val mutableMapKeyValue = mutableMapOf<String, String>()
+        mutableMapKeyValue["value1"] = "1.2.3.1"
+        mutableMapKeyValue["port"] = "8888"
+
+        //List
+        val expectedListOfString = arrayOfKeyValue.asJsonType()
+        var outcome = prepareResponseNodeForTest("listOfString", "list",
+                "string", mapOfString.asJsonType())
+        assertEquals(expectedListOfString, outcome, "unexpected outcome returned for list of String")
+
+        //Map
+        val expectedMapOfString = mutableMapOf<String, JsonNode>()
+        expectedMapOfString["ip"] = "1.2.3.1".asJsonPrimitive()
+        expectedMapOfString["port"] = "8888".asJsonPrimitive()
+
+        val arrayNode = JacksonUtils.objectMapper.createArrayNode()
+        expectedMapOfString.map {
+            val arrayChildNode = JacksonUtils.objectMapper.createObjectNode()
+            arrayChildNode.set(it.key, it.value)
+            arrayNode.add(arrayChildNode)
+        }
+        val arrayChildNode1 = JacksonUtils.objectMapper.createObjectNode()
+        arrayChildNode1.set("ip", NullNode.getInstance())
+        arrayNode.add(arrayChildNode1)
+        outcome = prepareResponseNodeForTest("mapOfString", "map", "string",
+                mutableMapKeyValue.asJsonType())
+        assertEquals(arrayNode, outcome, "unexpected outcome returned for map of String")
+    }
+
+    @Test
+    fun parseResponseNodeTestForCollectionsOfJsonNode(){
+        // Input values for collection type
+        val mapOfString = mutableMapOf<String, JsonNode>()
+        mapOfString["value1"] = "1.2.3.1".asJsonPrimitive()
+        mapOfString["port"] = "8888".asJsonPrimitive()
+        mapOfString["value2"] = "1.2.3.2".asJsonPrimitive()
+        val arrayOfKeyValue = arrayListOf(ExpectedResponseIp("1.2.3.1"),
+                ExpectedResponsePort( "8888"), ExpectedResponseIp("1.2.3.2"))
+
+        val mutableMapKeyValue = mutableMapOf<String, JsonNode>()
+        mutableMapKeyValue["value1"] = "1.2.3.1".asJsonPrimitive()
+        mutableMapKeyValue["port"] = "8888".asJsonPrimitive()
+
+        //List
+        val expectedListOfString = arrayOfKeyValue.asJsonType()
+        var outcome = prepareResponseNodeForTest("listOfString", "list",
+                "string", mapOfString.asJsonType())
+        assertEquals(expectedListOfString, outcome, "unexpected outcome returned for list of String")
+
+        //Map
+        val expectedMapOfString = mutableMapOf<String, JsonNode>()
+        expectedMapOfString["ip"] = "1.2.3.1".asJsonPrimitive()
+        expectedMapOfString["port"] = "8888".asJsonPrimitive()
+        val arrayNode = JacksonUtils.objectMapper.createArrayNode()
+        expectedMapOfString.map {
+            val arrayChildNode = JacksonUtils.objectMapper.createObjectNode()
+            arrayChildNode.set(it.key, it.value)
+            arrayNode.add(arrayChildNode)
+        }
+        val arrayChildNode1 = JacksonUtils.objectMapper.createObjectNode()
+        arrayChildNode1.set("ip", NullNode.getInstance())
+        arrayNode.add(arrayChildNode1)
+        outcome = prepareResponseNodeForTest("mapOfString", "map",
+                "string", mutableMapKeyValue.asJsonType())
+        assertEquals(arrayNode, outcome, "unexpected outcome returned for map of String")
+    }
+
+    @Test
+    fun parseResponseNodeTestForCollectionsOfComplexType(){
+        // Input values for collection type
+        val mapOfComplexType = mutableMapOf<String, JsonNode>()
+        mapOfComplexType["value1"] = IpAddress("1111", "1.2.3.1").asJsonType()
+        mapOfComplexType["value2"] = IpAddress("2222", "1.2.3.2").asJsonType()
+        mapOfComplexType["value3"] = IpAddress("3333", "1.2.3.3").asJsonType()
+
+        //List
+        val arrayNode = JacksonUtils.objectMapper.createArrayNode()
+        mapOfComplexType.map {
+            val arrayChildNode = JacksonUtils.objectMapper.createObjectNode()
+            arrayChildNode.set("ipAddress", it.value)
+            arrayNode.add(arrayChildNode)
+        }
+        var outcome = prepareResponseNodeForTest("listOfMyDataType", "list",
+                "ip-address", mapOfComplexType.asJsonType())
+        assertEquals(arrayNode, outcome, "unexpected outcome returned for list of String")
+    }
+
+    @Test
+    fun `parseResponseNodeTestForComplexType find one output key mapping`(){
+        // Input values for complex type
+        val objectNode = JacksonUtils.objectMapper.createObjectNode()
+
+        // Input values for collection type
+        val mapOfComplexType = mutableMapOf<String, JsonNode>()
+        mapOfComplexType["value"] = Host("my-ipAddress", IpAddress("1111", "1.2.3.1")).asJsonType()
+        mapOfComplexType["port"] = "8888".asJsonType()
+        mapOfComplexType["something"] = "1.2.3.2".asJsonType()
+
+        val expectedComplexType = objectNode.set("ipAddress", Host("my-ipAddress", IpAddress("1111", "1.2.3.1")).asJsonType())
+        val outcome = prepareResponseNodeForTest("complexTypeOneKeys", "host",
+                "", mapOfComplexType.asJsonType())
+        assertEquals(expectedComplexType, outcome, "Unexpected outcome returned for complex type")
+    }
+
+    @Test
+    fun `parseResponseNodeTestForComplexType find all output key mapping`(){
+        // Input values for complex type
+        val objectNode = JacksonUtils.objectMapper.createObjectNode()
+
+        // Input values for collection type
+        val mapOfComplexType = mutableMapOf<String, JsonNode>()
+        mapOfComplexType["name"] = "my-ipAddress".asJsonType()
+        mapOfComplexType["ipAddress"] = IpAddress("1111", "1.2.3.1").asJsonType()
+
+        val expectedComplexType = Host("my-ipAddress", IpAddress("1111", "1.2.3.1")).asJsonType()
+        val outcome = prepareResponseNodeForTest("complexTypeAllKeys", "host",
+                "", mapOfComplexType.asJsonType())
+        assertEquals(expectedComplexType, outcome, "Unexpected outcome returned for complex type")
+    }
+
+    private fun prepareResponseNodeForTest(dictionary_source: String, sourceType: String, entrySchema: String,
+                                           response: Any): JsonNode {
+
+        val resourceAssignment = when (sourceType) {
+            "list", "map" -> {
+                prepareRADataDictionaryCollection(dictionary_source, sourceType, entrySchema)
+            }
+            "string" -> {
+                prepareRADataDictionaryOfPrimaryType(dictionary_source)
+            }
+            else -> {
+                prepareRADataDictionaryComplexType(dictionary_source, sourceType, entrySchema)
+            }
+        }
+
+        val responseNode = checkNotNull(JacksonUtils.getJsonNode(response)) {
+            "Failed to get database query result into Json node."
+        }
+
+        val outputKeyMapping = prepareOutputKeyMapping(dictionary_source)
+
+        return ResourceAssignmentUtils.parseResponseNode(responseNode, resourceAssignment, resourceAssignmentRuntimeService, outputKeyMapping)
+    }
+
+    private fun prepareRADataDictionaryOfPrimaryType(dictionary_source: String): ResourceAssignment {
+        return ResourceAssignment().apply {
+            name = "ipAddress"
+            dictionaryName = "sample-ip"
+            dictionarySource = "$dictionary_source"
+            property = PropertyDefinition().apply {
+                type = "string"
+            }
+        }
+    }
+
+    private fun prepareRADataDictionaryCollection(dictionary_source: String, sourceType: String, schema: String): ResourceAssignment {
+        return ResourceAssignment().apply {
+            name = "ipAddress-list"
+            dictionaryName = "sample-licenses"
+            dictionarySource = "$dictionary_source"
+            property = PropertyDefinition().apply {
+                type = "$sourceType"
+                entrySchema = EntrySchema().apply {
+                    type = "$schema"
+                }
+            }
+        }
+    }
+
+    private fun prepareRADataDictionaryComplexType(dictionary_source: String, sourceType: String, schema: String): ResourceAssignment {
+        return ResourceAssignment().apply {
+            name = "ipAddress-complexType"
+            dictionaryName = "sample-licenses"
+            dictionarySource = "$dictionary_source"
+            property = PropertyDefinition().apply {
+                type = "$sourceType"
+            }
+        }
+    }
+
+    private fun prepareOutputKeyMapping(dictionary_source: String): MutableMap<String, String> {
+        val outputMapping = mutableMapOf<String, String>()
+
+        when (dictionary_source) {
+            "listOfString", "mapOfString" -> {
+                //List of string
+                outputMapping["value1"] = "ip"
+                outputMapping["port"] = "port"
+                outputMapping["value2"] = "ip"
+            }
+            "listOfMyDataType", "mapOfMyDataType" -> {
+                //List or map of complex Type
+                outputMapping["value1"] = "ipAddress"
+                outputMapping["value2"] = "ipAddress"
+                outputMapping["value3"] = "ipAddress"
+            }
+            "sample-key-value", "sample-value" -> {
+                //Primary Type
+                if (dictionary_source=="sample-key-value")
+                    outputMapping["sample-ip"] = "value"
+            }
+            else -> {
+                //Complex Type
+                if (dictionary_source == "complexTypeOneKeys")
+                    outputMapping["value"] = "ipAddress"
+                else {
+                    outputMapping["name"] = "name"
+                    outputMapping["ipAddress"] = "ipAddress"
+                }
+
+            }
+        }
+        return outputMapping
+    }
 }
\ No newline at end of file
index 53f0f4e..c1dd501 100644 (file)
@@ -18,7 +18,7 @@
     <parent>
         <artifactId>functions</artifactId>
         <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.onap.ccsdk.cds.blueprintsprocessor.functions</groupId>
index 783d8ef..67b8424 100644 (file)
@@ -20,7 +20,7 @@
     <parent>
         <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
         <artifactId>commons</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
     </parent>
 
     <artifactId>db-lib</artifactId>
index b8d418f..3ed0424 100644 (file)
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
         <artifactId>commons</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
     </parent>
 
     <artifactId>dmaap-lib</artifactId>
index ad16eb9..e5214e1 100644 (file)
@@ -18,7 +18,7 @@
     <parent>
         <artifactId>commons</artifactId>
         <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
index 2a67da1..b5b8c46 100644 (file)
@@ -18,7 +18,7 @@
     <parent>
         <artifactId>commons</artifactId>
         <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
index 8c88db4..37dd5d7 100755 (executable)
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
         <artifactId>modules</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
     </parent>
 
     <artifactId>commons</artifactId>
index 8ebbc67..673d127 100644 (file)
@@ -21,7 +21,7 @@
     <parent>
         <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
         <artifactId>commons</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
     </parent>
 
     <artifactId>processor-core</artifactId>
index c45ebc1..5a6ba06 100644 (file)
@@ -18,6 +18,7 @@
 package org.onap.ccsdk.cds.blueprintsprocessor.core.api.data
 
 import com.fasterxml.jackson.annotation.JsonFormat
+import com.fasterxml.jackson.annotation.JsonIgnore
 import com.fasterxml.jackson.databind.JsonNode
 import com.fasterxml.jackson.databind.node.ObjectNode
 import io.swagger.annotations.ApiModelProperty
@@ -40,6 +41,7 @@ open class ExecutionServiceInput {
                 " and the input for resource resolution located within the xxx-request block, contained within xxx-properties")
     lateinit var payload: ObjectNode
     @get:ApiModelProperty(hidden = true)
+    @get:JsonIgnore
     var stepData: StepData? = null
 }
 
@@ -56,6 +58,7 @@ open class ExecutionServiceOutput {
                 " and the input for resource resolution located within the xxx-request block, contained within xxx-properties")
     lateinit var payload: ObjectNode
     @get:ApiModelProperty(hidden = true)
+    @get:JsonIgnore
     var stepData: StepData? = null
 }
 
index 7602853..7c6cceb 100644 (file)
@@ -21,7 +21,7 @@
     <parent>
         <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
         <artifactId>commons</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
     </parent>
 
     <artifactId>rest-lib</artifactId>
index 75a9409..68672f2 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * Copyright © 2017-2018 AT&T Intellectual Property.
  * Modifications Copyright © 2019 Huawei.
+ * Modifications Copyright © 2019 Bell Canada.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,6 +21,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.rest
 open class RestClientProperties {
     lateinit var type: String
     lateinit var url: String
+    var additionalHeaders: Map<String, String>? = null
 }
 
 open class SSLRestClientProperties : RestClientProperties() {
@@ -63,4 +65,4 @@ open class PolicyManagerRestClientProperties : RestClientProperties() {
     lateinit var env: String
     lateinit var clientAuth: String
     lateinit var authorisation: String
-}
\ No newline at end of file
+}
index 3190cd1..bb6937d 100644 (file)
@@ -18,6 +18,10 @@ package org.onap.ccsdk.cds.blueprintsprocessor.rest.service
 
 import org.apache.http.message.BasicHeader
 import org.onap.ccsdk.cds.blueprintsprocessor.rest.BasicAuthRestClientProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.RestClientProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.RestLibConstants
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.utils.WebClientUtils
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
 import org.springframework.http.HttpHeaders
 import org.springframework.http.MediaType
 import java.nio.charset.Charset
@@ -25,42 +29,43 @@ import java.util.*
 
 class BasicAuthRestClientService(private val restClientProperties:
                                  BasicAuthRestClientProperties) :
-        BlueprintWebClientService {
+    BlueprintWebClientService {
 
     override fun defaultHeaders(): Map<String, String> {
 
         val encodedCredentials = setBasicAuth(restClientProperties.username,
-                restClientProperties.password)
+            restClientProperties.password)
         return mapOf(
-                HttpHeaders.CONTENT_TYPE to MediaType.APPLICATION_JSON_VALUE,
-                HttpHeaders.ACCEPT to MediaType.APPLICATION_JSON_VALUE,
-                HttpHeaders.AUTHORIZATION to "Basic $encodedCredentials")
+            HttpHeaders.CONTENT_TYPE to MediaType.APPLICATION_JSON_VALUE,
+            HttpHeaders.ACCEPT to MediaType.APPLICATION_JSON_VALUE,
+            HttpHeaders.AUTHORIZATION to "Basic $encodedCredentials")
     }
 
     override fun host(uri: String): String {
         return restClientProperties.url + uri
     }
 
-    override fun convertToBasicHeaders(headers: Map<String, String>):
-            Array<BasicHeader> {
 
+    override fun convertToBasicHeaders(headers: Map<String, String>):
+        Array<BasicHeader> {
         val customHeaders: MutableMap<String, String> = headers.toMutableMap()
+        //inject additionalHeaders
+        customHeaders.putAll(verifyAdditionalHeaders(restClientProperties))
+
         if (!headers.containsKey(HttpHeaders.AUTHORIZATION)) {
             val encodedCredentials = setBasicAuth(
-                    restClientProperties.username,
-                    restClientProperties.password)
+                restClientProperties.username,
+                restClientProperties.password)
             customHeaders[HttpHeaders.AUTHORIZATION] =
-                    "Basic $encodedCredentials"
+                "Basic $encodedCredentials"
         }
         return super.convertToBasicHeaders(customHeaders)
     }
 
     private fun setBasicAuth(username: String, password: String): String {
-
         val credentialsString = "$username:$password"
         return Base64.getEncoder().encodeToString(
-                credentialsString.toByteArray(Charset.defaultCharset()))
+            credentialsString.toByteArray(Charset.defaultCharset()))
     }
 
-
-}
\ No newline at end of file
+}
index 4f68657..8d4f0ca 100644 (file)
@@ -38,7 +38,7 @@ open class BluePrintRestLibPropertyService(private var bluePrintProperties:
                                            BluePrintProperties) {
 
     open fun blueprintWebClientService(jsonNode: JsonNode):
-            BlueprintWebClientService {
+        BlueprintWebClientService {
         val restClientProperties = restClientProperties(jsonNode)
         return blueprintWebClientService(restClientProperties)
     }
@@ -51,7 +51,7 @@ open class BluePrintRestLibPropertyService(private var bluePrintProperties:
 
     fun restClientProperties(prefix: String): RestClientProperties {
         val type = bluePrintProperties.propertyBeanType(
-                "$prefix.type", String::class.java)
+            "$prefix.type", String::class.java)
         return when (type) {
             RestLibConstants.TYPE_BASIC_AUTH -> {
                 basicAuthRestClientProperties(prefix)
@@ -76,7 +76,7 @@ open class BluePrintRestLibPropertyService(private var bluePrintProperties:
             }
             else -> {
                 throw BluePrintProcessorException("Rest adaptor($type) is" +
-                        " not supported")
+                    " not supported")
             }
         }
     }
@@ -86,43 +86,35 @@ open class BluePrintRestLibPropertyService(private var bluePrintProperties:
         val type = jsonNode.get("type").textValue()
         return when (type) {
             RestLibConstants.TYPE_TOKEN_AUTH -> {
-                JacksonUtils.readValue(jsonNode,
-                        TokenAuthRestClientProperties::class.java)!!
+                JacksonUtils.readValue(jsonNode, TokenAuthRestClientProperties::class.java)!!
             }
             RestLibConstants.TYPE_BASIC_AUTH -> {
-                JacksonUtils.readValue(jsonNode,
-                        BasicAuthRestClientProperties::class.java)!!
+                JacksonUtils.readValue(jsonNode, BasicAuthRestClientProperties::class.java)!!
             }
             RestLibConstants.TYPE_DME2_PROXY -> {
-                JacksonUtils.readValue(jsonNode,
-                        DME2RestClientProperties::class.java)!!
+                JacksonUtils.readValue(jsonNode, DME2RestClientProperties::class.java)!!
             }
             RestLibConstants.TYPE_POLICY_MANAGER -> {
-                JacksonUtils.readValue(jsonNode,
-                        PolicyManagerRestClientProperties::class.java)!!
+                JacksonUtils.readValue(jsonNode, PolicyManagerRestClientProperties::class.java)!!
             }
             RestLibConstants.TYPE_SSL_BASIC_AUTH -> {
-                JacksonUtils.readValue(jsonNode,
-                        SSLBasicAuthRestClientProperties::class.java)!!
+                JacksonUtils.readValue(jsonNode, SSLBasicAuthRestClientProperties::class.java)!!
             }
             RestLibConstants.TYPE_SSL_TOKEN_AUTH -> {
-                JacksonUtils.readValue(jsonNode,
-                        SSLTokenAuthRestClientProperties::class.java)!!
+                JacksonUtils.readValue(jsonNode, SSLTokenAuthRestClientProperties::class.java)!!
             }
             RestLibConstants.TYPE_SSL_NO_AUTH -> {
-                JacksonUtils.readValue(
-                        jsonNode, SSLRestClientProperties::class.java)!!
+                JacksonUtils.readValue(jsonNode, SSLRestClientProperties::class.java)!!
             }
             else -> {
-                throw BluePrintProcessorException("Rest adaptor($type) is" +
-                        " not supported")
+                throw BluePrintProcessorException(
+                    "Rest adaptor($type) is not supported")
             }
         }
     }
-    
-    private fun blueprintWebClientService(
-            restClientProperties: RestClientProperties):
-            BlueprintWebClientService {
+
+    private fun blueprintWebClientService(restClientProperties: RestClientProperties):
+        BlueprintWebClientService {
 
         when (restClientProperties) {
             is SSLRestClientProperties -> {
@@ -138,66 +130,65 @@ open class BluePrintRestLibPropertyService(private var bluePrintProperties:
                 return DME2ProxyRestClientService(restClientProperties)
             }
             else -> {
-                throw BluePrintProcessorException("couldn't get rest " +
-                        "service for")
+                throw BluePrintProcessorException("couldn't get rest service for type:${restClientProperties.type}  uri: ${restClientProperties.url}")
             }
         }
     }
 
     private fun tokenRestClientProperties(prefix: String):
-            TokenAuthRestClientProperties {
+        TokenAuthRestClientProperties {
         return bluePrintProperties.propertyBeanType(
-                prefix, TokenAuthRestClientProperties::class.java)
+            prefix, TokenAuthRestClientProperties::class.java)
     }
 
     private fun basicAuthRestClientProperties(prefix: String):
-            BasicAuthRestClientProperties {
+        BasicAuthRestClientProperties {
         return bluePrintProperties.propertyBeanType(
-                prefix, BasicAuthRestClientProperties::class.java)
+            prefix, BasicAuthRestClientProperties::class.java)
     }
 
     private fun sslBasicAuthRestClientProperties(prefix: String):
-            SSLRestClientProperties {
+        SSLRestClientProperties {
 
         val sslProps: SSLBasicAuthRestClientProperties =
-                bluePrintProperties.propertyBeanType(
-                        prefix, SSLBasicAuthRestClientProperties::class.java)
-        val basicProps : BasicAuthRestClientProperties =
-                bluePrintProperties.propertyBeanType(
-                        prefix, BasicAuthRestClientProperties::class.java)
+            bluePrintProperties.propertyBeanType(
+                prefix, SSLBasicAuthRestClientProperties::class.java)
+        val basicProps: BasicAuthRestClientProperties =
+            bluePrintProperties.propertyBeanType(
+                prefix, BasicAuthRestClientProperties::class.java)
         sslProps.basicAuth = basicProps
         return sslProps
     }
 
     private fun sslTokenAuthRestClientProperties(prefix: String):
-            SSLRestClientProperties {
+        SSLRestClientProperties {
 
         val sslProps: SSLTokenAuthRestClientProperties =
-                bluePrintProperties.propertyBeanType(prefix,
-                        SSLTokenAuthRestClientProperties::class.java)
-        val basicProps : TokenAuthRestClientProperties =
-                bluePrintProperties.propertyBeanType(prefix,
-                        TokenAuthRestClientProperties::class.java)
+            bluePrintProperties.propertyBeanType(prefix,
+                SSLTokenAuthRestClientProperties::class.java)
+        val basicProps: TokenAuthRestClientProperties =
+            bluePrintProperties.propertyBeanType(prefix,
+                TokenAuthRestClientProperties::class.java)
         sslProps.tokenAuth = basicProps
         return sslProps
     }
 
     private fun sslNoAuthRestClientProperties(prefix: String):
-            SSLRestClientProperties {
+        SSLRestClientProperties {
         return bluePrintProperties.propertyBeanType(
-                prefix, SSLRestClientProperties::class.java)
+            prefix, SSLRestClientProperties::class.java)
     }
 
     private fun dme2ProxyClientProperties(prefix: String):
-            DME2RestClientProperties {
+        DME2RestClientProperties {
         return bluePrintProperties.propertyBeanType(
-                prefix, DME2RestClientProperties::class.java)
+            prefix, DME2RestClientProperties::class.java)
     }
 
     private fun policyManagerRestClientProperties(prefix: String):
-            PolicyManagerRestClientProperties {
+        PolicyManagerRestClientProperties {
         return bluePrintProperties.propertyBeanType(
-                prefix, PolicyManagerRestClientProperties::class.java)
+            prefix, PolicyManagerRestClientProperties::class.java)
     }
 }
 
index 1acd07b..26c8088 100644 (file)
@@ -28,11 +28,14 @@ import org.apache.http.entity.StringEntity
 import org.apache.http.impl.client.CloseableHttpClient
 import org.apache.http.impl.client.HttpClients
 import org.apache.http.message.BasicHeader
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.RestClientProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.RestLibConstants
 import org.onap.ccsdk.cds.blueprintsprocessor.rest.utils.WebClientUtils
 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintRetryException
 import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintIOUtils
 import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
+import org.springframework.http.HttpHeaders
 import org.springframework.http.HttpMethod
 import java.io.IOException
 import java.io.InputStream
@@ -46,9 +49,9 @@ interface BlueprintWebClientService {
 
     fun httpClient(): CloseableHttpClient {
         return HttpClients.custom()
-                .addInterceptorFirst(WebClientUtils.logRequest())
-                .addInterceptorLast(WebClientUtils.logResponse())
-                .build()
+            .addInterceptorFirst(WebClientUtils.logRequest())
+            .addInterceptorLast(WebClientUtils.logResponse())
+            .build()
     }
 
     /** High performance non blocking Retry function, If execution block [block] throws BluePrintRetryException
@@ -82,10 +85,12 @@ interface BlueprintWebClientService {
             HttpMethod.POST -> post(path, request, convertedHeaders, String::class.java)
             HttpMethod.PUT -> put(path, request, convertedHeaders, String::class.java)
             HttpMethod.PATCH -> patch(path, request, convertedHeaders, String::class.java)
-            else -> throw BluePrintProcessorException("Unsupported methodType($methodType)")
+            else -> throw BluePrintProcessorException(
+                "Unsupported methodType($methodType) attempted on path($path)")
         }
     }
 
+    //TODO: convert to multi-map
     fun convertToBasicHeaders(headers: Map<String, String>): Array<BasicHeader> {
         return headers.map { BasicHeader(it.key, it.value) }.toTypedArray()
     }
@@ -135,8 +140,8 @@ interface BlueprintWebClientService {
 
     @Throws(IOException::class, ClientProtocolException::class)
     private fun <T> performCallAndExtractTypedWebClientResponse(
-            httpUriRequest: HttpUriRequest, responseType: Class<T>):
-            WebClientResponse<T> {
+        httpUriRequest: HttpUriRequest, responseType: Class<T>):
+        WebClientResponse<T> {
         val httpResponse = httpClient().execute(httpUriRequest)
         val statusCode = httpResponse.statusLine.statusCode
         httpResponse.entity.content.use {
@@ -154,7 +159,7 @@ interface BlueprintWebClientService {
     }
 
     suspend fun <T> getNB(path: String, additionalHeaders: Array<BasicHeader>?, responseType: Class<T>):
-            WebClientResponse<T> = withContext(Dispatchers.IO) {
+        WebClientResponse<T> = withContext(Dispatchers.IO) {
         get(path, additionalHeaders!!, responseType)
     }
 
@@ -191,27 +196,27 @@ interface BlueprintWebClientService {
     }
 
     suspend fun <T> deleteNB(path: String, additionalHeaders: Array<BasicHeader>?):
-            WebClientResponse<String> {
+        WebClientResponse<String> {
         return deleteNB(path, additionalHeaders, String::class.java)
     }
 
     suspend fun <T> deleteNB(path: String, additionalHeaders: Array<BasicHeader>?, responseType: Class<T>):
-            WebClientResponse<T> = withContext(Dispatchers.IO) {
+        WebClientResponse<T> = withContext(Dispatchers.IO) {
         delete(path, additionalHeaders!!, responseType)
     }
 
     suspend fun <T> patchNB(path: String, request: Any, additionalHeaders: Array<BasicHeader>?, responseType: Class<T>):
-            WebClientResponse<T> = withContext(Dispatchers.IO) {
+        WebClientResponse<T> = withContext(Dispatchers.IO) {
         patch(path, request, additionalHeaders!!, responseType)
     }
 
     suspend fun exchangeNB(methodType: String, path: String, request: Any): WebClientResponse<String> {
         return exchangeNB(methodType, path, request, hashMapOf(),
-                String::class.java)
+            String::class.java)
     }
 
     suspend fun exchangeNB(methodType: String, path: String, request: Any, additionalHeaders: Map<String, String>?):
-            WebClientResponse<String> {
+        WebClientResponse<String> {
         return exchangeNB(methodType, path, request, additionalHeaders, String::class.java)
     }
 
@@ -249,7 +254,7 @@ interface BlueprintWebClientService {
     }
 
     private fun basicHeaders(headers: Map<String, String>?):
-            Array<BasicHeader> {
+        Array<BasicHeader> {
         val basicHeaders = mutableListOf<BasicHeader>()
         defaultHeaders().forEach { (name, value) ->
             basicHeaders.add(BasicHeader(name, value))
@@ -263,11 +268,29 @@ interface BlueprintWebClientService {
     // Non Blocking Rest Implementation
     suspend fun httpClientNB(): CloseableHttpClient {
         return HttpClients.custom()
-                .addInterceptorFirst(WebClientUtils.logRequest())
-                .addInterceptorLast(WebClientUtils.logResponse())
-                .build()
+            .addInterceptorFirst(WebClientUtils.logRequest())
+            .addInterceptorLast(WebClientUtils.logResponse())
+            .build()
     }
 
     //TODO maybe there could be cases where we care about return headers?
     data class WebClientResponse<T>(val status: Int, val body: T)
+
+    fun verifyAdditionalHeaders(restClientProperties: RestClientProperties): Map<String, String> {
+        val customHeaders: MutableMap<String, String> = mutableMapOf()
+        //Extract additionalHeaders from the requestProperties and
+        //throw an error if HttpHeaders.AUTHORIZATION key (headers are case-insensitive)
+        restClientProperties.additionalHeaders?.let {
+            if (it.keys.map { k -> k.toLowerCase().trim() }.contains(HttpHeaders.AUTHORIZATION.toLowerCase())) {
+                val errMsg = "Error in definition of endpoint ${restClientProperties.url}." +
+                    " User-supplied \"additionalHeaders\" cannot contain AUTHORIZATION header with" +
+                    " auth-type \"${RestLibConstants.TYPE_BASIC_AUTH}\""
+                WebClientUtils.log.error(errMsg)
+                throw BluePrintProcessorException(errMsg)
+            } else {
+                customHeaders.putAll(it)
+            }
+        }
+        return customHeaders
+    }
 }
index 30dd490..2acf776 100644 (file)
@@ -33,25 +33,31 @@ import java.io.FileInputStream
 import java.security.KeyStore
 import java.security.cert.X509Certificate
 
-class SSLRestClientService(private val restClientProperties:
-                           SSLRestClientProperties) :
-        BlueprintWebClientService {
+class SSLRestClientService(private val restClientProperties: SSLRestClientProperties) :
+    BlueprintWebClientService {
 
     var auth: BlueprintWebClientService? = null
 
     init {
-         auth = getAuthService()
+        auth = getAuthService()
     }
 
-    private fun getAuthService() : BlueprintWebClientService? {
-
-        return when(restClientProperties) {
+    private fun getAuthService(): BlueprintWebClientService? {
+        //type,url and additional headers don't get carried over to TokenAuthRestClientProperties from SSLTokenAuthRestClientProperties
+        //set them in auth obj to be consistent. TODO: refactor
+        return when (restClientProperties) {
             is SSLBasicAuthRestClientProperties -> {
-                val basic =  restClientProperties.basicAuth!!
-                BasicAuthRestClientService(basic)
+                val basicAuthProps = restClientProperties.basicAuth!!
+                basicAuthProps.additionalHeaders = restClientProperties.additionalHeaders
+                basicAuthProps.url = restClientProperties.url
+                basicAuthProps.type = restClientProperties.type
+                BasicAuthRestClientService(basicAuthProps)
             }
             is SSLTokenAuthRestClientProperties -> {
-                val token =  restClientProperties.tokenAuth!!
+                val token = restClientProperties.tokenAuth!!
+                token.additionalHeaders = restClientProperties.additionalHeaders
+                token.url = restClientProperties.url
+                token.type = restClientProperties.type
                 TokenAuthRestClientService(token)
             }
             else -> {
@@ -61,19 +67,16 @@ class SSLRestClientService(private val restClientProperties:
         }
     }
 
-
     override fun defaultHeaders(): Map<String, String> {
-
         if (auth != null) {
             return auth!!.defaultHeaders()
         }
         return mapOf(
-                HttpHeaders.CONTENT_TYPE to MediaType.APPLICATION_JSON_VALUE,
-                HttpHeaders.ACCEPT to MediaType.APPLICATION_JSON_VALUE)
+            HttpHeaders.CONTENT_TYPE to MediaType.APPLICATION_JSON_VALUE,
+            HttpHeaders.ACCEPT to MediaType.APPLICATION_JSON_VALUE)
     }
 
     override fun host(uri: String): String {
-
         return restClientProperties.url + uri
     }
 
@@ -85,8 +88,9 @@ class SSLRestClientService(private val restClientProperties:
         val sslTrust = restClientProperties.sslTrust
         val sslTrustPwd = restClientProperties.sslTrustPassword
 
-        val acceptingTrustStrategy = { chain: Array<X509Certificate>,
-                                       authType: String -> true }
+        val acceptingTrustStrategy = { _: Array<X509Certificate>, _: String ->
+            true
+        }
         val sslContext = SSLContextBuilder.create()
 
         if (sslKey != null && sslKeyPwd != null) {
@@ -98,13 +102,12 @@ class SSLRestClientService(private val restClientProperties:
         }
 
         sslContext.loadTrustMaterial(File(sslTrust), sslTrustPwd.toCharArray(),
-                acceptingTrustStrategy)
+            acceptingTrustStrategy)
         val csf = SSLConnectionSocketFactory(sslContext.build())
         return HttpClients.custom()
-                .addInterceptorFirst(WebClientUtils.logRequest())
-                .addInterceptorLast(WebClientUtils.logResponse())
-                .setSSLSocketFactory(csf).build()
-
+            .addInterceptorFirst(WebClientUtils.logRequest())
+            .addInterceptorLast(WebClientUtils.logResponse())
+            .setSSLSocketFactory(csf).build()
     }
 
     // Non Blocking Rest Implementation
@@ -113,13 +116,15 @@ class SSLRestClientService(private val restClientProperties:
     }
 
     override fun convertToBasicHeaders(headers: Map<String, String>): Array<BasicHeader> {
-        var head1: Map<String, String> = defaultHeaders()
-        var head2: MutableMap<String, String> = head1.toMutableMap()
-        head2.putAll(headers)
+        val mergedDefaultAndSuppliedHeaders = defaultHeaders().plus(headers)
+        //During the initialization, getAuthService() sets the auth variable.
+        //If it's not null, then we have an authentication mechanism.
+        //If null - indicates no-auth used
         if (auth != null) {
-            return auth!!.convertToBasicHeaders(head2)
+            return auth!!.convertToBasicHeaders(mergedDefaultAndSuppliedHeaders)
         }
-        return super.convertToBasicHeaders(head2)
+        //inject additionalHeaders
+        return super.convertToBasicHeaders(mergedDefaultAndSuppliedHeaders
+            .plus(verifyAdditionalHeaders(restClientProperties)))
     }
-
-}
\ No newline at end of file
+}
index 8244699..73b5341 100644 (file)
@@ -23,20 +23,20 @@ import org.springframework.http.MediaType
 
 class TokenAuthRestClientService(private val restClientProperties:
                                  TokenAuthRestClientProperties) :
-        BlueprintWebClientService {
+    BlueprintWebClientService {
 
     override fun defaultHeaders(): Map<String, String> {
-
         return mapOf(
-                HttpHeaders.CONTENT_TYPE to MediaType.APPLICATION_JSON_VALUE,
-                HttpHeaders.ACCEPT to MediaType.APPLICATION_JSON_VALUE,
-                HttpHeaders.AUTHORIZATION to restClientProperties.token!!)
+            HttpHeaders.CONTENT_TYPE to MediaType.APPLICATION_JSON_VALUE,
+            HttpHeaders.ACCEPT to MediaType.APPLICATION_JSON_VALUE,
+            HttpHeaders.AUTHORIZATION to restClientProperties.token!!)
     }
 
     override fun convertToBasicHeaders(headers: Map<String, String>):
-            Array<BasicHeader> {
-
+        Array<BasicHeader> {
         val customHeaders: MutableMap<String, String> = headers.toMutableMap()
+        //inject additionalHeaders
+        customHeaders.putAll(verifyAdditionalHeaders(restClientProperties))
         if (!headers.containsKey(HttpHeaders.AUTHORIZATION)) {
             customHeaders[HttpHeaders.AUTHORIZATION] = restClientProperties.token!!
         }
index 37a797f..b617dab 100644 (file)
@@ -2,6 +2,7 @@
  * Copyright © 2017-2018 AT&T Intellectual Property.
  * Modifications Copyright © 2018 IBM.
  * Modifications Copyright © 2019 Huawei.
+ * Modifications Copyright © 2019 Bell Canada.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -28,11 +29,15 @@ import org.onap.ccsdk.cds.blueprintsprocessor.rest.BluePrintRestLibConfiguration
 import org.onap.ccsdk.cds.blueprintsprocessor.rest.SSLBasicAuthRestClientProperties
 import org.onap.ccsdk.cds.blueprintsprocessor.rest.SSLRestClientProperties
 import org.onap.ccsdk.cds.blueprintsprocessor.rest.SSLTokenAuthRestClientProperties
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
 import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.http.HttpHeaders
+import org.springframework.http.MediaType
 import org.springframework.test.context.ContextConfiguration
 import org.springframework.test.context.TestPropertySource
 import org.springframework.test.context.junit4.SpringRunner
 import kotlin.test.assertEquals
+import kotlin.test.assertFailsWith
 import kotlin.test.assertNotNull
 
 @RunWith(SpringRunner::class)
@@ -63,26 +68,25 @@ import kotlin.test.assertNotNull
     "blueprintsprocessor.restclient.ssl.sslKeyPassword=changeit"
 ])
 class BluePrintRestLibPropertyServiceTest {
-
     @Autowired
     lateinit var bluePrintRestLibPropertyService: BluePrintRestLibPropertyService
 
     @Test
     fun testRestClientProperties() {
         val properties = bluePrintRestLibPropertyService.restClientProperties(
-                "blueprintsprocessor.restclient.sample")
+            "blueprintsprocessor.restclient.sample")
         assertNotNull(properties, "failed to create property bean")
         assertNotNull(properties.url, "failed to get url property in" +
-                " property bean")
+            " property bean")
     }
 
     @Test
     fun testSSLBasicProperties() {
         val properties = bluePrintRestLibPropertyService.restClientProperties(
-                "blueprintsprocessor.restclient.sslbasic")
+            "blueprintsprocessor.restclient.sslbasic")
         assertNotNull(properties, "failed to create property bean")
         val p: SSLBasicAuthRestClientProperties =
-                properties as SSLBasicAuthRestClientProperties
+            properties as SSLBasicAuthRestClientProperties
 
         assertEquals(p.basicAuth!!.username, "admin")
         assertEquals(p.basicAuth!!.password, "cds")
@@ -94,11 +98,11 @@ class BluePrintRestLibPropertyServiceTest {
     @Test
     fun testSSLTokenProperties() {
         val properties = bluePrintRestLibPropertyService.restClientProperties(
-                "blueprintsprocessor.restclient.ssltoken")
+            "blueprintsprocessor.restclient.ssltoken")
         assertNotNull(properties, "failed to create property bean")
 
         val p: SSLTokenAuthRestClientProperties =
-                properties as SSLTokenAuthRestClientProperties
+            properties as SSLTokenAuthRestClientProperties
 
         assertEquals(p.tokenAuth!!.token!!, "72178473kjshdkjgvbsdkjv903274908")
         assertEquals(p.sslTrust, "src/test/resources/keystore.p12")
@@ -109,11 +113,11 @@ class BluePrintRestLibPropertyServiceTest {
     @Test
     fun testSSLNoAuthProperties() {
         val properties = bluePrintRestLibPropertyService.restClientProperties(
-                "blueprintsprocessor.restclient.ssl")
+            "blueprintsprocessor.restclient.ssl")
         assertNotNull(properties, "failed to create property bean")
 
         val p: SSLRestClientProperties =
-                properties as SSLRestClientProperties
+            properties as SSLRestClientProperties
 
         assertEquals(p.sslTrust, "src/test/resources/keystore.p12")
         assertEquals(p.sslTrustPassword, "changeit")
@@ -125,113 +129,370 @@ class BluePrintRestLibPropertyServiceTest {
 
     @Test
     fun testSSLBasicPropertiesAsJson() {
-        val json: String = "{\n" +
-                "  \"type\" : \"ssl-basic-auth\",\n" +
-                "  \"url\" : \"https://localhost:8443\",\n" +
-                "  \"keyStoreInstance\" : \"PKCS12\",\n" +
-                "  \"sslTrust\" : \"src/test/resources/keystore.p12\",\n" +
-                "  \"sslTrustPassword\" : \"changeit\",\n" +
-                "  \"basicAuth\" : {\n" +
-                "    \"username\" : \"admin\",\n" +
-                "    \"password\" : \"cds\"\n" +
-                "  }\n" +
-                "}"
-        val mapper = ObjectMapper()
-        val actualObj: JsonNode = mapper.readTree(json)
+        val actualObj: JsonNode = defaultMapper.readTree(sslBasicAuthEndpointWithHeadersField())
         val properties = bluePrintRestLibPropertyService.restClientProperties(
-                actualObj)
+            actualObj)
         assertNotNull(properties, "failed to create property bean")
-        val p: SSLBasicAuthRestClientProperties =
-                properties as SSLBasicAuthRestClientProperties
+        val p: SSLBasicAuthRestClientProperties = properties as SSLBasicAuthRestClientProperties
 
-        assertEquals(p.basicAuth!!.username, "admin")
-        assertEquals(p.basicAuth!!.password, "cds")
-        assertEquals(p.sslTrust, "src/test/resources/keystore.p12")
-        assertEquals(p.sslTrustPassword, "changeit")
-        assertEquals(p.keyStoreInstance, "PKCS12")
+        assertEquals("admin", p.basicAuth!!.username)
+        assertEquals("cds", p.basicAuth!!.password)
+        assertEquals("src/test/resources/keystore.p12", p.sslTrust)
+        assertEquals("changeit", p.sslTrustPassword)
+        assertEquals("PKCS12", p.keyStoreInstance)
+        assertEquals("ssl-basic-auth", p.type)
+        assertEquals("https://localhost:8443", p.url)
     }
 
     @Test
     fun testSSLTokenPropertiesAsJson() {
-        val json: String = "{\n" +
-                "  \"type\" : \"ssl-token-auth\",\n" +
-                "  \"url\" : \"https://localhost:8443\",\n" +
-                "  \"keyStoreInstance\" : \"PKCS12\",\n" +
-                "  \"sslTrust\" : \"src/test/resources/keystore.p12\",\n" +
-                "  \"sslTrustPassword\" : \"changeit\",\n" +
-                "  \"tokenAuth\" : {\n" +
-                "    \"token\" : \"72178473kjshdkjgvbsdkjv903274908\"\n" +
-                "  }\n" +
-                "}"
-        val mapper = ObjectMapper()
-        val actualObj: JsonNode = mapper.readTree(json)
-        val properties = bluePrintRestLibPropertyService.restClientProperties(
-                actualObj)
+        val actualObj: JsonNode = defaultMapper.readTree(sslTokenAuthEndpointWithHeadersField())
+        val properties =
+            bluePrintRestLibPropertyService.restClientProperties(actualObj)
         assertNotNull(properties, "failed to create property bean")
 
-        val p: SSLTokenAuthRestClientProperties =
-                properties as SSLTokenAuthRestClientProperties
+        val p: SSLTokenAuthRestClientProperties = properties as SSLTokenAuthRestClientProperties
 
-        assertEquals(p.tokenAuth!!.token!!, "72178473kjshdkjgvbsdkjv903274908")
-        assertEquals(p.sslTrust, "src/test/resources/keystore.p12")
-        assertEquals(p.sslTrustPassword, "changeit")
-        assertEquals(p.keyStoreInstance, "PKCS12")
+        assertEquals("72178473kjshdkjgvbsdkjv903274908", p.tokenAuth!!.token!!)
+        assertEquals("src/test/resources/keystore.p12", p.sslTrust)
+        assertEquals("changeit", p.sslTrustPassword)
+        assertEquals("PKCS12", p.keyStoreInstance)
+        assertEquals("ssl-token-auth", p.type)
+        assertEquals("https://localhost:8443", p.url)
     }
 
     @Test
     fun testSSLNoAuthPropertiesAsJson() {
-        val json: String = "{\n" +
-                "  \"type\" : \"ssl-basic-auth\",\n" +
-                "  \"url\" : \"https://localhost:8443\",\n" +
-                "  \"keyStoreInstance\" : \"PKCS12\",\n" +
-                "  \"sslTrust\" : \"src/test/resources/keystore.p12\",\n" +
-                "  \"sslTrustPassword\" : \"changeit\",\n" +
-                "  \"sslKey\" : \"src/test/resources/keystore.p12\",\n" +
-                "  \"sslKeyPassword\" : \"changeit\"\n" +
-                "}"
-        val mapper = ObjectMapper()
-        val actualObj: JsonNode = mapper.readTree(json)
+        val actualObj: JsonNode = defaultMapper.readTree(sslNoAuthEndpointWithHeadersField())
         val properties = bluePrintRestLibPropertyService.restClientProperties(
-                actualObj)
+            actualObj)
         assertNotNull(properties, "failed to create property bean")
 
         val p: SSLRestClientProperties =
-                properties as SSLRestClientProperties
+            properties as SSLRestClientProperties
 
-        assertEquals(p.sslTrust, "src/test/resources/keystore.p12")
-        assertEquals(p.sslTrustPassword, "changeit")
-        assertEquals(p.keyStoreInstance, "PKCS12")
-        assertEquals(p.sslKey, "src/test/resources/keystore.p12")
-        assertEquals(p.sslKeyPassword, "changeit")
+        assertEquals("src/test/resources/keystore.p12", p.sslTrust)
+        assertEquals("changeit", p.sslTrustPassword)
+        assertEquals("PKCS12", p.keyStoreInstance)
+        assertEquals("src/test/resources/keystore.p12", p.sslKey)
+        assertEquals("changeit", p.sslKeyPassword)
+        assertEquals("ssl-no-auth", p.type)
+        assertEquals("https://localhost:8443", p.url)
     }
 
     @Test
     fun testBlueprintWebClientService() {
         val blueprintWebClientService = bluePrintRestLibPropertyService
-                .blueprintWebClientService("sample")
-        assertNotNull(blueprintWebClientService, "failed to create blu" +
-                "eprintWebClientService")
+            .blueprintWebClientService("sample")
+        assertNotNull(blueprintWebClientService,
+            "failed to create blueprintWebClientService")
     }
 
     @Test
     fun testBlueprintWebClientServiceWithJsonNode() {
-        val json: String = "{\n" +
-                "  \"type\" : \"ssl-basic-auth\",\n" +
-                "  \"url\" : \"https://localhost:8443\",\n" +
-                "  \"keyStoreInstance\" : \"PKCS12\",\n" +
-                "  \"sslTrust\" : \"src/test/resources/keystore.p12\",\n" +
-                "  \"sslTrustPassword\" : \"changeit\",\n" +
-                "  \"basicAuth\" : {\n" +
-                "    \"username\" : \"admin\",\n" +
-                "    \"password\" : \"cds\"\n" +
-                "  }\n" +
-                "}"
-        val mapper = ObjectMapper()
-        val actualObj: JsonNode = mapper.readTree(json)
+        val actualObj: JsonNode = defaultMapper.readTree(sslBasicAuthEndpointWithHeadersField())
         val blueprintWebClientService = bluePrintRestLibPropertyService
-                .blueprintWebClientService(actualObj)
-        assertNotNull(blueprintWebClientService, "failed to create blu" +
-                "eprintWebClientService")
+            .blueprintWebClientService(actualObj)
+        assertNotNull(blueprintWebClientService, "failed to create blueprintWebClientService")
+    }
+
+    //pass the result of $typeEndpointWithHeadersField() output with and without headers to compare.
+    private fun validateHeadersDidNotChangeWithEmptyAdditionalHeaders(noHeaders: String, withHeaders: String) {
+        val parsedObj: JsonNode = defaultMapper.readTree(noHeaders)
+        val bpWebClientService =
+            bluePrintRestLibPropertyService.blueprintWebClientService(parsedObj)
+        val extractedHeaders = bpWebClientService.convertToBasicHeaders(mapOf())
+
+        val parsedObjWithHeaders: JsonNode = defaultMapper.readTree(withHeaders)
+        val bpWebClientServiceWithHeaders =
+            bluePrintRestLibPropertyService.blueprintWebClientService(parsedObjWithHeaders)
+        val extractedHeadersWithAdditionalHeaders = bpWebClientServiceWithHeaders.convertToBasicHeaders(mapOf())
+        //Array<BasicHeader<>> -> Map<String,String>
+        val headersMap = extractedHeaders.map { it.name to it.value }.toMap()
+        val additionalHeadersMap = extractedHeadersWithAdditionalHeaders.map { it.name to it.value }.toMap()
+        assertEquals(headersMap, additionalHeadersMap)
+    }
+
+    @Test
+    fun `BasicAuth WebClientService with empty additionalHeaders does not modify headers`() {
+        val endPointJson = basicAuthEndpointWithHeadersField()
+        val endPointWithHeadersJson = basicAuthEndpointWithHeadersField(emptyAdditionalHeaders)
+        validateHeadersDidNotChangeWithEmptyAdditionalHeaders(endPointJson, endPointWithHeadersJson)
+    }
+
+    private fun acceptsOneAdditionalHeadersTest(endPointWithHeadersJson: String) {
+        val parsedObj: JsonNode = defaultMapper.readTree(endPointWithHeadersJson)
+        val bpWebClientService =
+            bluePrintRestLibPropertyService.blueprintWebClientService(parsedObj)
+        val extractedHeaders = bpWebClientService.convertToBasicHeaders(mapOf())
+        assertEquals(1, extractedHeaders.filter { it.name == "key1" }.count())
+    }
+
+    @Test
+    fun `BasicAuth WebClientService accepts one additionalHeaders`() {
+        val endPointWithHeadersJson = basicAuthEndpointWithHeadersField(oneAdditionalParameter)
+        acceptsOneAdditionalHeadersTest(endPointWithHeadersJson)
+    }
+
+    private fun acceptsMultipleAdditionalHeaders(endPointWithHeadersJson: String) {
+        val parsedObj: JsonNode = defaultMapper.readTree(endPointWithHeadersJson)
+        val bpWebClientService =
+            bluePrintRestLibPropertyService.blueprintWebClientService(parsedObj)
+        val extractedHeaders = bpWebClientService.convertToBasicHeaders(mapOf())
+        assertEquals(1, extractedHeaders.filter { it.name == "key1" }.count())
+        assertEquals(1, extractedHeaders.filter { it.name == "key2" }.count())
+        assertEquals(1, extractedHeaders.filter { it.name == "key3" }.count())
+    }
+
+    @Test
+    fun `BasicAuth WebClientService accepts multiple additionalHeaders`() {
+        val endPointWithHeadersJson = basicAuthEndpointWithHeadersField(threeAdditionalHeaders)
+        acceptsMultipleAdditionalHeaders(endPointWithHeadersJson)
+    }
+
+    private fun additionalHeadersChangedContentTypeToAPPLICATION_XML(endPointWithHeadersJson: String) {
+        val parsedObj: JsonNode = defaultMapper.readTree(endPointWithHeadersJson)
+        val bpWebClientService =
+            bluePrintRestLibPropertyService.blueprintWebClientService(parsedObj)
+        val extractedHeaders = bpWebClientService.convertToBasicHeaders(mapOf())
+        assertEquals(MediaType.APPLICATION_XML.toString(),
+            extractedHeaders.filter { it.name == HttpHeaders.CONTENT_TYPE }[0].value!!)
+    }
+
+    @Test
+    fun `BasicAuth WebClientService additionalHeaders can overwrite default Content-Type`() {
+        //default content type is application/json
+        val endPointWithHeadersJson = basicAuthEndpointWithHeadersField(contentTypeAdditionalHeader)
+        additionalHeadersChangedContentTypeToAPPLICATION_XML(endPointWithHeadersJson)
+    }
+
+    //called from within "assertFailsWith(exceptionClass = BluePrintProcessorException::class) {"
+    private fun attemptToPutAuthorizationHeaderIntoAdditionalHeaders(endPointWithHeadersJson: String) {
+        val parsedObj: JsonNode = defaultMapper.readTree(endPointWithHeadersJson)
+        val bpWebClientService =
+            bluePrintRestLibPropertyService.blueprintWebClientService(parsedObj)
+        bpWebClientService.convertToBasicHeaders(mapOf())
+    }
+
+    @Test
+    fun `BasicAuth WebClientService throws BlueprintProcessorException if additionalHeaders contain Authorization`() {
+        assertFailsWith(exceptionClass = BluePrintProcessorException::class) {
+            val endPointWithHeadersJson = basicAuthEndpointWithHeadersField(additionalHeadersWithAuth)
+            attemptToPutAuthorizationHeaderIntoAdditionalHeaders(endPointWithHeadersJson)
+        }
+        //spec says headers are case insensitive...
+        assertFailsWith(exceptionClass = BluePrintProcessorException::class) {
+            val endPointWithHeadersJson = basicAuthEndpointWithHeadersField(additionalHeadersWithAuthLowercased)
+            attemptToPutAuthorizationHeaderIntoAdditionalHeaders(endPointWithHeadersJson)
+        }
+    }
+
+    @Test
+    fun `TokenAuth WebClientService with empty additionalHeaders does not modify headers`() {
+        val endPointJson = sslTokenAuthEndpointWithHeadersField()
+        val endPointWithHeadersJson = sslTokenAuthEndpointWithHeadersField(emptyAdditionalHeaders)
+        validateHeadersDidNotChangeWithEmptyAdditionalHeaders(endPointJson, endPointWithHeadersJson)
+    }
+
+    @Test
+    fun `TokenAuth WebClientService accepts one additionalHeaders`() {
+        val endPointWithHeadersJson = sslTokenAuthEndpointWithHeadersField(oneAdditionalParameter)
+        acceptsOneAdditionalHeadersTest(endPointWithHeadersJson)
+    }
+
+    @Test
+    fun `TokenAuth WebClientService accepts multiple additionalHeaders`() {
+        val endPointWithHeadersJson = sslTokenAuthEndpointWithHeadersField(threeAdditionalHeaders)
+        acceptsMultipleAdditionalHeaders(endPointWithHeadersJson)
+    }
+
+    @Test
+    fun `TokenAuth WebClientService additionalHeaders can overwrite default Content-Type`() {
+        //default content type is application/json
+        val endPointWithHeadersJson = sslTokenAuthEndpointWithHeadersField(contentTypeAdditionalHeader)
+        additionalHeadersChangedContentTypeToAPPLICATION_XML(endPointWithHeadersJson)
+    }
+
+    @Test
+    fun `TokenAuth WebClientService throws BlueprintProcessorException if additionalHeaders contain Authorization`() {
+        assertFailsWith(exceptionClass = BluePrintProcessorException::class) {
+            val endPointWithHeadersJson = sslTokenAuthEndpointWithHeadersField(additionalHeadersWithAuth)
+            attemptToPutAuthorizationHeaderIntoAdditionalHeaders(endPointWithHeadersJson)
+        }
+        //spec says headers are case insensitive...
+        assertFailsWith(exceptionClass = BluePrintProcessorException::class) {
+            val endPointWithHeadersJson = sslTokenAuthEndpointWithHeadersField(additionalHeadersWithAuthLowercased)
+            attemptToPutAuthorizationHeaderIntoAdditionalHeaders(endPointWithHeadersJson)
+        }
+    }
+
+    //TESTS FOR SSL BASIC AUTH headers
+    @Test
+    fun `SSLBasicAuth WebClientService with empty additionalHeaders does not modify headers`() {
+        val endPointJson = sslBasicAuthEndpointWithHeadersField()
+        val endPointWithHeadersJson = sslBasicAuthEndpointWithHeadersField(emptyAdditionalHeaders)
+        validateHeadersDidNotChangeWithEmptyAdditionalHeaders(endPointJson, endPointWithHeadersJson)
+    }
+
+    @Test
+    fun `SSLBasicAuth WebClientService accepts one additionalHeaders`() {
+        val endPointWithHeadersJson = sslBasicAuthEndpointWithHeadersField(oneAdditionalParameter)
+        acceptsOneAdditionalHeadersTest(endPointWithHeadersJson)
+    }
+
+    @Test
+    fun `SSLBasicAuth WebClientService accepts multiple additionalHeaders`() {
+        val endPointWithHeadersJson = sslBasicAuthEndpointWithHeadersField(threeAdditionalHeaders)
+        acceptsMultipleAdditionalHeaders(endPointWithHeadersJson)
+    }
+
+    @Test
+    fun `SSLBasicAuth WebClientService additionalHeaders can overwrite default Content-Type`() {
+        //default content type is application/json
+        val endPointWithHeadersJson = sslBasicAuthEndpointWithHeadersField(contentTypeAdditionalHeader)
+        additionalHeadersChangedContentTypeToAPPLICATION_XML(endPointWithHeadersJson)
+    }
+
+    @Test
+    fun `SSLBasicAuth WebClientService throws BlueprintProcessorException if additionalHeaders contain Authorization`() {
+        assertFailsWith(exceptionClass = BluePrintProcessorException::class) {
+            val endPointWithHeadersJson = sslBasicAuthEndpointWithHeadersField(additionalHeadersWithAuth)
+            attemptToPutAuthorizationHeaderIntoAdditionalHeaders(endPointWithHeadersJson)
+        }
+        //spec says headers are case insensitive...
+        assertFailsWith(exceptionClass = BluePrintProcessorException::class) {
+            val endPointWithHeadersJson = sslBasicAuthEndpointWithHeadersField(additionalHeadersWithAuthLowercased)
+            attemptToPutAuthorizationHeaderIntoAdditionalHeaders(endPointWithHeadersJson)
+        }
+    }
+
+    //SSL-NO-AUTH headers tests
+    @Test
+    fun `SSLNoAuth WebClientService with empty additionalHeaders does not modify headers`() {
+        val endPointJson = sslNoAuthEndpointWithHeadersField()
+        val endPointWithHeadersJson = sslNoAuthEndpointWithHeadersField(emptyAdditionalHeaders)
+        validateHeadersDidNotChangeWithEmptyAdditionalHeaders(endPointJson, endPointWithHeadersJson)
+    }
+
+    @Test
+    fun `SSLNoAuth WebClientService accepts one additionalHeaders`() {
+        val endPointWithHeadersJson = sslNoAuthEndpointWithHeadersField(oneAdditionalParameter)
+        acceptsOneAdditionalHeadersTest(endPointWithHeadersJson)
+    }
+
+    @Test
+    fun `SSLNoAuth WebClientService accepts multiple additionalHeaders`() {
+        val endPointWithHeadersJson = sslNoAuthEndpointWithHeadersField(threeAdditionalHeaders)
+        acceptsMultipleAdditionalHeaders(endPointWithHeadersJson)
+    }
+
+    @Test
+    fun `SSLNoAuth WebClientService additionalHeaders can overwrite default Content-Type`() {
+        //default content type is application/json
+        val endPointWithHeadersJson = sslNoAuthEndpointWithHeadersField(contentTypeAdditionalHeader)
+        additionalHeadersChangedContentTypeToAPPLICATION_XML(endPointWithHeadersJson)
+    }
+
+    @Test
+    fun `SSLNoAuth WebClientService throws BlueprintProcessorException if additionalHeaders contain Authorization`() {
+        assertFailsWith(exceptionClass = BluePrintProcessorException::class) {
+            val endPointWithHeadersJson = sslNoAuthEndpointWithHeadersField(additionalHeadersWithAuth)
+            attemptToPutAuthorizationHeaderIntoAdditionalHeaders(endPointWithHeadersJson)
+        }
+        //spec says headers are case insensitive...
+        assertFailsWith(exceptionClass = BluePrintProcessorException::class) {
+            val endPointWithHeadersJson = sslNoAuthEndpointWithHeadersField(additionalHeadersWithAuthLowercased)
+            attemptToPutAuthorizationHeaderIntoAdditionalHeaders(endPointWithHeadersJson)
+        }
+    }
+
+    companion object BluePrintRestLibPropertyServiceTest {
+        val defaultMapper = ObjectMapper()
+        val expectedTokenAuthDefaultHeaders = mapOf<String, String>(
+            "Content-Type" to "application/json",
+            "Accept" to "application/json",
+            "Authorization" to "72178473kjshdkjgvbsdkjv903274908")
+
+        val endPointWithHeadersJsonWithBasicAuthHeader = basicAuthEndpointWithHeadersField(""",
+              "additionalHeaders" : {
+                 "authorization": "Basic aGF2ZTphbmljZWRheQo="
+              }""".trimIndent())
+
+        private fun sslTokenAuthEndpointWithHeadersField(headers: String = ""): String =
+            """{
+            "type" : "ssl-token-auth",
+            "url" : "https://localhost:8443",
+            "keyStoreInstance" : "PKCS12",
+            "sslTrust" : "src/test/resources/keystore.p12",
+            "sslTrustPassword" : "changeit",
+              "tokenAuth" : {
+                "token" : "72178473kjshdkjgvbsdkjv903274908"
+              }$headers
+            }
+            """.trimIndent()
+
+        private fun sslBasicAuthEndpointWithHeadersField(headers: String = ""): String =
+            """{
+          "type" : "ssl-basic-auth",
+          "url" : "https://localhost:8443",
+          "keyStoreInstance" : "PKCS12",
+          "sslTrust" : "src/test/resources/keystore.p12",
+          "sslTrustPassword" : "changeit",
+          "basicAuth" : {
+            "username" : "admin",
+            "password" : "cds"
+          }$headers
+        }""".trimIndent()
+
+        private fun sslNoAuthEndpointWithHeadersField(headers: String = ""): String = """{
+          "type" : "ssl-no-auth",
+          "url" : "https://localhost:8443",
+          "keyStoreInstance" : "PKCS12",
+          "sslTrust" : "src/test/resources/keystore.p12",
+          "sslTrustPassword" : "changeit",
+          "sslKey" : "src/test/resources/keystore.p12",
+          "sslKeyPassword" : "changeit"$headers
+        }""".trimIndent()
+
+        //Don't forget to supply "," as the first char to make valid JSON
+        private fun basicAuthEndpointWithHeadersField(headers: String = ""): String =
+            """{
+              "type": "basic-auth",
+              "url": "http://127.0.0.1:8000",
+              "username": "user",
+              "password": "pass"$headers
+            }""".trimIndent()
+
+        private val emptyAdditionalHeaders = """,
+          "additionalHeaders" : {
+          }""".trimIndent()
+
+        private val oneAdditionalParameter = """,
+          "additionalHeaders" : {
+            "key1": "value1"
+          }""".trimIndent()
+
+        private val threeAdditionalHeaders = """,
+          "additionalHeaders" : {
+            "key1": "value1",
+            "key2": "value2",
+            "key3": "value3"
+          }""".trimIndent()
+
+        private val contentTypeAdditionalHeader = """,
+          "additionalHeaders" : {
+            "${HttpHeaders.CONTENT_TYPE}": "${MediaType.APPLICATION_XML}"
+          }""".trimIndent()
+
+        private val additionalHeadersWithAuth = """,
+          "additionalHeaders" : {
+             "Authorization": "Basic aGF2ZTphbmljZWRheQo="
+          }""".trimIndent()
+
+        private val additionalHeadersWithAuthLowercased = """,
+          "additionalHeaders" : {
+             "authorization": "Basic aGF2ZTphbmljZWRheQo="
+          }""".trimIndent()
     }
 }
 
index a13d0cc..ff09b83 100644 (file)
@@ -18,7 +18,7 @@
     <parent>
         <artifactId>commons</artifactId>
         <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
index f34a1ec..b09a8ac 100644 (file)
     <parent>
         <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
         <artifactId>inbounds</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
     </parent>
 
     <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
     <artifactId>configs-api</artifactId>
-    <version>0.6.1-SNAPSHOT</version>
+    <version>0.7.0-SNAPSHOT</version>
     <packaging>jar</packaging>
     <name>Blueprints Processor Resource Configurations API</name>
     <description>Blueprints Processor Resource Configurations API</description>
index c3f18fc..b4c1ad0 100644 (file)
@@ -129,14 +129,15 @@ class ResourceConfigSnapshotControllerTest {
     }
 
     @Test
-    fun `get returns 404 if entry not found`() {
+    fun `get returns 200 if entry not found`() {
         runBlocking {
 
             webTestClient
                 .get()
                 .uri("/api/v1/configs?resourceId=MISSING&resourceType=PNF")
                 .exchange()
-                .expectStatus().isNotFound
+                .expectStatus().is2xxSuccessful
+                .expectBody()
         }
     }
 
index 8f6d32e..12cb8ae 100644 (file)
@@ -18,7 +18,7 @@
     <parent>
         <artifactId>inbounds</artifactId>
         <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <artifactId>designer-api</artifactId>
index ba1bbd1..0542fe3 100644 (file)
@@ -20,7 +20,7 @@
     <parent>
         <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
         <artifactId>modules</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
     </parent>
 
     <artifactId>inbounds</artifactId>
index cf8c61a..da233b8 100644 (file)
@@ -19,7 +19,7 @@
     <parent>
         <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
         <artifactId>inbounds</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
     </parent>
 
     <artifactId>resource-api</artifactId>
index 7abcfea..7c53e1c 100755 (executable)
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
         <artifactId>inbounds</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
     </parent>
 
     <artifactId>selfservice-api</artifactId>
index 34b6912..34eba83 100644 (file)
@@ -19,7 +19,7 @@
     <parent>
         <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
         <artifactId>modules</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
     </parent>
 
     <artifactId>outbounds</artifactId>
index 86a5814..ea39e2a 100644 (file)
@@ -21,7 +21,7 @@
     <parent>
         <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
         <artifactId>parent</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
         <relativePath>../parent</relativePath>
     </parent>
 
index c232f05..4acc224 100644 (file)
@@ -20,7 +20,7 @@
     <parent>
         <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
         <artifactId>services</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
     </parent>
 
     <artifactId>execution-service</artifactId>
index 6b9cb2e..0a5f9b6 100755 (executable)
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
         <artifactId>modules</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
     </parent>
 
     <artifactId>services</artifactId>
index 1a621f4..c3effa5 100644 (file)
@@ -19,7 +19,7 @@
     <parent>
         <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
         <artifactId>services</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
index e79c497..5a54a77 100755 (executable)
@@ -19,7 +19,7 @@
     <parent>
         <groupId>org.onap.ccsdk.cds</groupId>
         <artifactId>blueprintsprocessor</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
     </parent>
     <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
     <artifactId>parent</artifactId>
index abe737f..7714d85 100755 (executable)
@@ -20,7 +20,7 @@
     <parent>
         <groupId>org.onap.ccsdk.cds</groupId>
         <artifactId>ms</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
         <relativePath>..</relativePath>
     </parent>
     <artifactId>blueprintsprocessor</artifactId>
index e99c4ec..5861912 100755 (executable)
   ~  See the License for the specific language governing permissions and
   ~  limitations under the License.
   -->
-<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">
+<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.ccsdk.cds</groupId>
         <artifactId>ms</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
         <relativePath>..</relativePath>
     </parent>
     <artifactId>command-executor</artifactId>
@@ -35,7 +34,7 @@
         <docker.verbose>true</docker.verbose>
         <ccsdk.project.version>${project.version}</ccsdk.project.version>
         <ccsdk.build.timestamp>${maven.build.timestamp}</ccsdk.build.timestamp>
-        <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
+               <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
     </properties>
 
     <build>
index abea4d4..972dad6 100644 (file)
@@ -35,7 +35,6 @@ class CommandExecutorHandler():
         self.request = request
         self.logger = logging.getLogger(self.__class__.__name__)
         self.blueprint_id = utils.get_blueprint_id(request)
-        # FIXME parameterize path
         self.venv_home = '/opt/app/onap/blueprints/deploy/' + self.blueprint_id
         self.installed = self.venv_home + '/.installed'
 
@@ -61,6 +60,7 @@ class CommandExecutorHandler():
             results.append(f.read())
             f.close()
 
+        # deactivate_venv(blueprint_id)
         return True
 
     def execute_command(self, request, results):
@@ -73,7 +73,6 @@ class CommandExecutorHandler():
         if "ansible-playbook" in request.command:
             cmd = cmd + "; " + request.command + " -e 'ansible_python_interpreter=" + self.venv_home + "/bin/python'"
         else:
-            # we append the properties as last agr to the script
             cmd = cmd + "; " + request.command + " " + re.escape(MessageToJson(request.properties))
 
         try:
@@ -171,8 +170,8 @@ class CommandExecutorHandler():
 
         path = "%s/bin/activate_this.py" % self.venv_home
         try:
-            exec(open(path).read(), {'__file__': path})
-            exec(fixpathenvvar)
+            exec (open(path).read(), {'__file__': path})
+            exec (fixpathenvvar)
             self.logger.info("Running with PATH : {}".format(os.environ['PATH']))
             return True
         except Exception as err:
index 0ed3d32..453d751 100644 (file)
@@ -1,4 +1,5 @@
-# !/usr/bin/python
+
+#!/usr/bin/python
 
 #
 # Copyright (C) 2019 Bell Canada.
@@ -42,7 +43,7 @@ def serve():
         'Access denied!')
 
     server = grpc.server(
-        futures.ProcessPoolExecutor(),
+        futures.ThreadPoolExecutor(max_workers=10),
         interceptors=(header_validator,))
 
     CommandExecutor_pb2_grpc.add_CommandExecutorServiceServicer_to_server(
index 4314b28..dc5d008 100644 (file)
@@ -17,7 +17,6 @@ from google.protobuf.timestamp_pb2 import Timestamp
 
 import proto.CommandExecutor_pb2 as CommandExecutor_pb2
 
-
 def get_blueprint_id(request):
     blueprint_name = request.identifiers.blueprintName
     blueprint_version = request.identifiers.blueprintVersion
index 1c1385b..1cb912c 100644 (file)
@@ -20,7 +20,7 @@
     <parent>
         <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
         <artifactId>modules</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
     </parent>
     <artifactId>blueprint-core</artifactId>
     <name>Controller Blueprints Core</name>
index 57865fc..04c7511 100644 (file)
@@ -21,7 +21,7 @@
     <parent>
         <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
         <artifactId>modules</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
     </parent>
     <artifactId>blueprint-validation</artifactId>
     <name>Controller Blueprints Validation Service</name>
index 2ef7016..d493481 100644 (file)
@@ -1,5 +1,6 @@
 /*
  *  Copyright © 2019 IBM.
+ *  Modifications Copyright © 2019 Bell Canada.
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -51,7 +52,7 @@ open class PropertyAssignmentValidationUtils(private val bluePrintContext: BlueP
                                          properties: MutableMap<String, JsonNode>) {
         properties.forEach { propertyName, propertyAssignment ->
             val propertyDefinition: PropertyDefinition = nodeTypeProperties[propertyName]
-                    ?: throw BluePrintException("failed to get definition for the property ($propertyName)")
+                    ?: throw BluePrintException("validatePropertyAssignments failed to get definition for the property ($propertyName)")
 
             validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
 
@@ -91,7 +92,7 @@ open class PropertyAssignmentValidationUtils(private val bluePrintContext: BlueP
         }
 
         check(isValid) {
-            throw BluePrintException("property($propertyName) defined of type($propertyType) is not comptable with the value ($propertyAssignment)")
+            throw BluePrintException("property($propertyName) defined of type($propertyType) is not compatible with the value ($propertyAssignment)")
         }
     }
 
index 4bc962f..73b2313 100644 (file)
@@ -20,7 +20,7 @@
     <parent>
         <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
         <artifactId>parent</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
         <relativePath>../parent</relativePath>
     </parent>
     <artifactId>modules</artifactId>
index b210b10..4ee4f91 100644 (file)
@@ -21,7 +21,7 @@
     <parent>
         <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
         <artifactId>modules</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
     </parent>
     <artifactId>resource-dict</artifactId>
     <name>Controller Blueprints Resource Dictionary</name>
index 3021c40..925b167 100644 (file)
@@ -21,7 +21,7 @@
     <parent>
         <groupId>org.onap.ccsdk.cds</groupId>
         <artifactId>controllerblueprints</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
     </parent>
     <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
     <artifactId>parent</artifactId>
index 909dfa4..8abb36e 100644 (file)
     <parent>
         <groupId>org.onap.ccsdk.cds</groupId>
         <artifactId>ms</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
         <relativePath>..</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <artifactId>controllerblueprints</artifactId>
     <name>Controller Blueprints Root</name>
-    <version>0.6.1-SNAPSHOT</version>
+    <version>0.7.0-SNAPSHOT</version>
     <properties>
         <service.name>ControllerBlueprints</service.name>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
index 973222c..ba5a5b0 100644 (file)
     <parent>
         <groupId>org.onap.ccsdk.cds</groupId>
         <artifactId>parent</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
         <relativePath>..</relativePath>
     </parent>
 
     <artifactId>ms</artifactId>
-    <version>0.6.1-SNAPSHOT</version>
+    <version>0.7.0-SNAPSHOT</version>
     <packaging>pom</packaging>
 
     <name>Micro-services Root</name>
index eb0323b..da24e97 100644 (file)
   <parent>
     <groupId>org.onap.ccsdk.cds.sdclistener</groupId>
     <artifactId>parent</artifactId>
-    <version>0.6.1-SNAPSHOT</version>
+    <version>0.7.0-SNAPSHOT</version>
     <relativePath>../parent</relativePath>
   </parent>
 
   <artifactId>application</artifactId>
   <packaging>jar</packaging>
-  <version>0.6.1-SNAPSHOT</version>
+  <version>0.7.0-SNAPSHOT</version>
   <name>SDC Listener Application</name>
 
   <properties>
index be68cd2..8f0120f 100755 (executable)
@@ -19,7 +19,7 @@
     <parent>
         <groupId>org.onap.ccsdk.cds.sdclistener</groupId>
         <artifactId>parent</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
         <relativePath>../parent</relativePath>
     </parent>
     <artifactId>distribution</artifactId>
index 0648ed7..cfdfc9b 100755 (executable)
@@ -21,7 +21,7 @@
     <parent>
         <groupId>org.onap.ccsdk.cds</groupId>
         <artifactId>sdclistener</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
     </parent>
     <groupId>org.onap.ccsdk.cds.sdclistener</groupId>
     <artifactId>parent</artifactId>
index b311388..42c6a1a 100644 (file)
@@ -19,7 +19,7 @@
     <parent>
         <groupId>org.onap.ccsdk.cds</groupId>
         <artifactId>ms</artifactId>
-        <version>0.6.1-SNAPSHOT</version>
+        <version>0.7.0-SNAPSHOT</version>
         <relativePath>..</relativePath>
     </parent>
 
diff --git a/pom.xml b/pom.xml
index 12cabac..ddeb8c8 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -20,7 +20,7 @@ limitations under the License.
     <parent>
         <groupId>org.onap.ccsdk.parent</groupId>
         <artifactId>spring-boot-starter-parent</artifactId>
-        <version>1.4.1-SNAPSHOT</version>
+        <version>1.5.0-SNAPSHOT</version>
         <relativePath/>
     </parent>
 
@@ -28,7 +28,7 @@ limitations under the License.
 
     <groupId>org.onap.ccsdk.cds</groupId>
     <artifactId>parent</artifactId>
-    <version>0.6.1-SNAPSHOT</version>
+    <version>0.7.0-SNAPSHOT</version>
     <packaging>pom</packaging>
 
     <name>cds-parent</name>
diff --git a/releases/0.6.1.yaml b/releases/0.6.1.yaml
new file mode 100644 (file)
index 0000000..46921af
--- /dev/null
@@ -0,0 +1,5 @@
+---
+distribution_type: 'maven'
+version: '0.6.1'
+project: 'ccsdk-cds'
+log_dir: 'ccsdk-cds-maven-stage-master/208/'
index 5d94f48..fc68f02 100644 (file)
@@ -5,8 +5,8 @@
 
 
 release_name=0
-sprint_number=6
-feature_revision=1
+sprint_number=7
+feature_revision=0
 
 base_version=${release_name}.${sprint_number}.${feature_revision}