Merge "Remote AWX ansible playbook executor"
authorDan Timoney <dtimoney@att.com>
Thu, 30 May 2019 18:32:14 +0000 (18:32 +0000)
committerGerrit Code Review <gerrit@onap.org>
Thu, 30 May 2019 18:32:14 +0000 (18:32 +0000)
126 files changed:
cds-ui/client/src/app/common/core/store/models/blueprintState.model.ts
cds-ui/client/src/app/common/core/store/reducers/blueprint.reducer.ts
cds-ui/client/src/app/common/shared/pipes/sort.pipe.ts [new file with mode: 0644]
cds-ui/client/src/app/common/shared/shared.module.ts
cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts
cds-ui/client/src/app/feature-modules/blueprint/select-template/metadata/metadata.component.ts
cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts
components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json
components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json
components/model-catalog/blueprint-model/test-blueprint/capability_cli/Definitions/capability-cli-blueprint.json [new file with mode: 0644]
components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/CapabilityCli.cba.kts [new file with mode: 0644]
components/model-catalog/blueprint-model/test-blueprint/capability_cli/TOSCA-Metadata/TOSCA.meta [new file with mode: 0644]
components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/activation-blueprint.json
components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/resources_definition_types.json
components/model-catalog/blueprint-model/test-blueprint/capability_python/Environments/source-db.properties [new file with mode: 0644]
components/model-catalog/definition-type/starter-type/node_type/component-cli-executor.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/cloud_env.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/dcae_collector_ip.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/dcae_collector_port.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/demo_artifacts_version.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/gre_ipaddr.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/install_script_version.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/int_pktgen_private_net_id.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/int_pktgen_private_subnet_id.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/int_private_net_id.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/int_private_subnet_id.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/keypair.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/management-prefix-id.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/nb_api_version.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/nexus_artifact_repo.json
components/model-catalog/resource-dictionary/starter-dictionary/nfc-naming-code.json
components/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_cidr.json
components/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_id.json
components/model-catalog/resource-dictionary/starter-dictionary/onap_private_subnet_id.json
components/model-catalog/resource-dictionary/starter-dictionary/pg_int.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/pktgen_private_net_cidr.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/pktgen_private_net_id.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/private-prefix-id.json
components/model-catalog/resource-dictionary/starter-dictionary/private1-prefix-id.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/private2-prefix-id.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/pub_key.json
components/model-catalog/resource-dictionary/starter-dictionary/public_net_id.json
components/model-catalog/resource-dictionary/starter-dictionary/sec_group.json
components/model-catalog/resource-dictionary/starter-dictionary/vdns_flavor_name.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/vdns_image_name.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/vdns_int_private_ip_0.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/vdns_name_0.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/vdns_onap_private_ip_0.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/vf-module-label.json
components/model-catalog/resource-dictionary/starter-dictionary/vf-module-model-customization-uuid.json
components/model-catalog/resource-dictionary/starter-dictionary/vf-module-type.json
components/model-catalog/resource-dictionary/starter-dictionary/vf_module_id.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/vfccustomizationuuid.json
components/model-catalog/resource-dictionary/starter-dictionary/vip.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/vlb_0_int_pktgen_private_port_0_mac.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/vlb_flavor_name.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/vlb_image_name.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/vlb_int_pktgen_private_ip_0.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/vlb_int_private_ip_0.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/vlb_name_0.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/vlb_onap_private_ip_0.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/vlb_private_net_cidr.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/vlb_private_net_id.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/vm-type.json
components/model-catalog/resource-dictionary/starter-dictionary/vnf-id.json
components/model-catalog/resource-dictionary/starter-dictionary/vnf-name.json
components/model-catalog/resource-dictionary/starter-dictionary/vnf_id.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/vnfc-model-invariant-uuid.json
components/model-catalog/resource-dictionary/starter-dictionary/vnfc-model-version.json
components/model-catalog/resource-dictionary/starter-dictionary/vpg_flavor_name.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/vpg_image_name.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/vpg_int_pktgen_private_ip_0.json [new file with mode: 0644]
components/model-catalog/resource-dictionary/starter-dictionary/vpg_onap_private_ip_0.json [new file with mode: 0644]
ms/blueprintsprocessor/application/pom.xml
ms/blueprintsprocessor/application/src/main/resources/application-dev.properties
ms/blueprintsprocessor/application/src/main/resources/application.properties
ms/blueprintsprocessor/application/src/test/resources/application.properties
ms/blueprintsprocessor/functions/cli-executor/pom.xml
ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliComponentFunction.kt [new file with mode: 0644]
ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliExecutorConfiguration.kt
ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutor.kt [new file with mode: 0644]
ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/scripts/InternalSimpleCli.cba.kts [new file with mode: 0644]
ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutorTest.kt [new file with mode: 0644]
ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/service/CliExecutorServiceImplTest.kt [deleted file]
ms/blueprintsprocessor/functions/cli-executor/src/test/resources/application-test.properties [new file with mode: 0644]
ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfExecutorConfiguration.kt [new file with mode: 0644]
ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/application-test.properties
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/processor/DatabaseResourceAssignmentProcessor.kt
ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.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/mock/MockRestResourceResolutionProcessor.kt
ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt
ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/commons/message-lib/pom.xml [new file with mode: 0644]
ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibConfiguration.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibData.kt [moved from ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/api/CliExecutorService.kt with 68% similarity]
ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BluePrintMessageLibPropertyService.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerService.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaBasicAuthMessageProducerService.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerServiceTest.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/commons/message-lib/src/test/resources/logback-test.xml [new file with mode: 0644]
ms/blueprintsprocessor/modules/commons/pom.xml
ms/blueprintsprocessor/modules/commons/ssh-lib/pom.xml [new file with mode: 0644]
ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibConfiguration.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibData.kt [moved from ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/service/CliExecutorServiceImpl.kt with 63% similarity]
ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BasicAuthSshClientService.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BluePrintSshLibPropertyService.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BlueprintSshClientService.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BluePrintSshLibPropertyServiceTest.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BlueprintSshClientServiceTest.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/resources/logback-test.xml [new file with mode: 0644]
ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt
ms/blueprintsprocessor/parent/pom.xml
ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt
ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintTemplateService.kt
ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintImportService.kt
ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintJinjaTemplateService.kt
ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintVelocityTemplateService.kt
ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintTemplateService.kt
ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt
ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateServiceTest.kt
ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/default-variable-value-data.json [new file with mode: 0755]
ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/default-variable-value-velocity-template.vtl [new file with mode: 0755]
ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf-name.json
ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt

index 13d7d53..6d3aa8c 100644 (file)
@@ -29,6 +29,7 @@ export interface IBlueprintState {
     files?: any;
     filesData?: any;
     uploadedFileName?: string;
+    entryDefinition?: string;
     isLoadSuccess?: boolean;
     isUpdateSuccess?: boolean;
     isSaveSuccess?: boolean;
index b4347d4..da933ab 100644 (file)
@@ -56,7 +56,8 @@ export function blueprintReducer(state: IBlueprintState = initialBlueprintState,
                     name: action.payload.name,
                     files: action.payload.files,
                     filesData: action.payload.filesData,
-                    uploadedFileName: action.payload.uploadedFileName
+                    uploadedFileName: action.payload.uploadedFileName,
+                    entryDefinition: action.payload.entryDefinition
                     }
         default:
             return state;
diff --git a/cds-ui/client/src/app/common/shared/pipes/sort.pipe.ts b/cds-ui/client/src/app/common/shared/pipes/sort.pipe.ts
new file mode 100644 (file)
index 0000000..f878a22
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2019 IBM Intellectual propertyNameerty. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+============LICENSE_END============================================
+*/
+
+import { Pipe, PipeTransform } from '@angular/core';  
+  
+@Pipe({  
+  name: 'sort',  
+  pure:false,  
+})  
+export class SortPipe implements PipeTransform {  
+  
+  transform(arrayData: any[], direcion: string, propertyName?: string): any {  
+    if (!arrayData) {  
+      return [];  
+    }  
+    if (!direcion || !propertyName) {  
+      return arrayData  
+    }  
+    if (arrayData.length > 0) {  
+      const _direction = direcion === 'asc' ? -1 : 1,  
+        isArray = Array.isArray(arrayData),  
+        arrayDataType = typeof arrayData[0],  
+        flag = isArray && arrayDataType === 'object' ? true : isArray && arrayDataType !== 'object' ? false : true;  
+      arrayData.sort((a, b) => {  
+        a = flag ? a[propertyName] : a;  
+        b = flag ? b[propertyName] : b;  
+        if (typeof a === 'string') {  
+          return a.toLowerCase() > b.toLowerCase() ? -1 * _direction : 1 * _direction;  
+        } else if (typeof a === 'number') {  
+          return a - b > 0 ? -1 * _direction : 1 * _direction;  
+        }  
+      });  
+    }  
+    return arrayData;  
+  }
+}  
\ No newline at end of file
index 6ca5b13..b036f59 100644 (file)
@@ -29,20 +29,22 @@ import { RouterModule } from "@angular/router";
 import { SearchPipe } from './pipes/search.pipe';
 import { SearchDialog } from './components/search-dialog/search-dialog.component';
 import { AppMaterialModule }  from '../modules/app-material.module';
+import { SortPipe } from './pipes/sort.pipe';
 
 @NgModule({
   declarations: [
     HomeComponent,
     CBAWizardComponent,
     SearchPipe,
-    SearchDialog
-
+    SearchDialog,
+    SortPipe
   ],
   exports: [
     HomeComponent,
     CBAWizardComponent,
     SearchPipe,
-    SearchDialog
+    SearchDialog,
+    SortPipe
   ],
   imports: [
     AppMaterialModule,
index 09fa003..b982fa2 100644 (file)
@@ -38,6 +38,7 @@ import { LoadBlueprintSuccess, SetBlueprintState } from '../../../../common/core
 import { ApiService } from 'src/app/common/core/services/api.service';
 import { IMetaData } from 'src/app/common/core/store/models/metadata.model';
 import { EditorService } from './editor.service';
+import { SortPipe } from '../../../../common/shared/pipes/sort.pipe';
 
 interface Node {
   name: string;
@@ -390,6 +391,7 @@ export class EditorComponent implements OnInit {
         newFileNode.data = '';
         this.filesData.push(newFileNode);
       }
+      this.filesData = new SortPipe().transform(this.filesData, 'asc', 'name');
       this.arrangeTreeData(this.filesData);
     }
   }
@@ -431,7 +433,9 @@ export class EditorComponent implements OnInit {
 
     if (this.validfile) {
       this.fetchTOSACAMetadata();
+      this.paths = new SortPipe().transform(this.paths, 'asc', 'name');
       this.filesData = this.paths;
+      this.paths = new SortPipe().transform(this.paths, 'asc', 'name');
       this.tree = this.arrangeTreeData(this.paths);
     } else {
       alert('Please update proper file with TOSCA metadata');
@@ -505,6 +509,7 @@ export class EditorComponent implements OnInit {
         i = i - 1;
       }
     }
+    this.filesData = new SortPipe().transform(this.filesData, 'asc', 'name');
     this.arrangeTreeData(this.filesData);
   }
 
index 2327a58..609aaca 100644 (file)
@@ -23,13 +23,12 @@ import { Component, OnInit } from '@angular/core';
 import { FormBuilder, FormGroup, Validators } from '@angular/forms';
 import { Observable } from 'rxjs';
 import { Store } from '@ngrx/store';
-import { A11yModule } from '@angular/cdk/a11y';
 
 import { IAppState } from '../../../../common/core/store/state/app.state';
 import { IBlueprintState } from 'src/app/common/core/store/models/blueprintState.model';
 import { IBlueprint } from 'src/app/common/core/store/models/blueprint.model';
 import { IMetaData } from '../../../../common/core/store/models/metadata.model';
-import { LoadBlueprintSuccess } from 'src/app/common/core/store/actions/blueprint.action';
+import { SetBlueprintState } from 'src/app/common/core/store/actions/blueprint.action';
 
 @Component({
   selector: 'app-metadata',
@@ -41,6 +40,13 @@ export class MetadataComponent implements OnInit {
   metadata: IMetaData;
   bpState: Observable<IBlueprintState>;
   blueprint: IBlueprint;
+  filesTree: any = [];
+  filesData: any = [];
+  selectedFile: string;
+  zipFolder: any;
+  blueprintName: string;
+  uploadedFileName: string;
+  entryDefinition: string;
   
   constructor(private formBuilder: FormBuilder, private store: Store<IAppState>) {
     this.bpState = this.store.select('blueprint');
@@ -57,6 +63,16 @@ export class MetadataComponent implements OnInit {
   ngOnInit() {
     this.bpState.subscribe(
       blueprintdata => {
+        var blueprintState: IBlueprintState = { blueprint: blueprintdata.blueprint, isLoadSuccess: blueprintdata.isLoadSuccess, isSaveSuccess: blueprintdata.isSaveSuccess, isUpdateSuccess: blueprintdata.isUpdateSuccess };
+        this.blueprint = blueprintState.blueprint;
+        this.filesTree = blueprintdata.files;
+        this.filesData = blueprintdata.filesData;
+        this.blueprintName = blueprintdata.name;
+        this.uploadedFileName = blueprintdata.uploadedFileName;
+        this.entryDefinition = blueprintdata.entryDefinition;
+
+
+
         var blueprintState: IBlueprintState = { blueprint: blueprintdata.blueprint, isLoadSuccess: blueprintdata.isLoadSuccess, isSaveSuccess: blueprintdata.isSaveSuccess, isUpdateSuccess: blueprintdata.isUpdateSuccess };
         this.metadata = blueprintState.blueprint.metadata;
         this.blueprint = blueprintState.blueprint;
@@ -82,7 +98,21 @@ export class MetadataComponent implements OnInit {
   UploadMetadata() {
     this.metadata = Object.assign({}, this.CBAMetadataForm.value);
     this.blueprint.metadata = this.metadata;
-    this.store.dispatch(new LoadBlueprintSuccess(this.blueprint));
+
+    this.filesData.forEach((fileNode) => {
+      if (fileNode.name.includes(this.blueprintName) && fileNode.name == this.entryDefinition) {
+        fileNode.data = JSON.stringify(this.blueprint, null, "\t");
+      }
+    });
+    let blueprintState = {
+      blueprint: this.blueprint,
+      name: this.blueprintName,
+      files: this.filesTree,
+      filesData: this.filesData,
+      uploadedFileName: this.uploadedFileName,
+      entryDefinition: this.entryDefinition
+    }
+    this.store.dispatch(new SetBlueprintState(blueprintState));
   }
 
 }
\ No newline at end of file
index 1d0ba2c..92003c9 100644 (file)
@@ -29,6 +29,7 @@ import { IBlueprintState } from '../../../../common/core/store/models/blueprintS
 import { IAppState } from '../../../../common/core/store/state/app.state';
 import { LoadBlueprintSuccess, SET_BLUEPRINT_STATE, SetBlueprintState } from '../../../../common/core/store/actions/blueprint.action';
 import { json } from 'd3';
+import { SortPipe } from '../../../../common/shared/pipes/sort.pipe';
 
 @Component({
   selector: 'app-search-template',
@@ -53,6 +54,7 @@ export class SearchTemplateComponent implements OnInit {
   private activationBlueprint: any;
   private tocsaMetadaData: any;
   private blueprintName: string;
+  private entryDefinition: string;
 
   constructor(private store: Store<IAppState>) { }
 
@@ -79,7 +81,8 @@ export class SearchTemplateComponent implements OnInit {
       name: this.blueprintName,
       files: this.tree,
       filesData: this.paths,
-      uploadedFileName: this.uploadedFileName
+      uploadedFileName: this.uploadedFileName,
+      entryDefinition: this.entryDefinition
     }
     this.store.dispatch(new SetBlueprintState(blueprintState))
     // this.store.dispatch(new LoadBlueprintSuccess(data));
@@ -114,6 +117,7 @@ export class SearchTemplateComponent implements OnInit {
 
     if(this.validfile) {      
       this.fetchTOSACAMetadata();
+      this.paths = new SortPipe().transform(this.paths, 'asc', 'name');
       this.tree = this.arrangeTreeData(this.paths);
     } else {
       alert('Please update proper file with TOSCA metadata');
@@ -145,6 +149,7 @@ export class SearchTemplateComponent implements OnInit {
             this.activationBlueprint = path.data; 
             newPart.data = JSON.parse(this.activationBlueprint.toString());            
             console.log('newpart', newPart);
+            this.entryDefinition = path.name.trim();
           }
           if(newPart.name !== '') {            
               currentLevel.push(newPart);
index eae6924..5530b7c 100644 (file)
           }
         }
       },
+      "activate-cli": {
+        "type": "component-cli-executor",
+        "interfaces": {
+          "ComponentCliExecutor": {
+            "operations": {
+              "process": {
+                "implementation": {
+                  "primary": "component-script"
+                },
+                "inputs": {
+                  "script-type": "kotlin",
+                  "script-class-reference": "InternalSimpleCli_cba$TestCliScriptFunction",
+                  "instance-dependencies": []
+                },
+                "outputs": {
+                  "response-data": "",
+                  "status": "success"
+                }
+              }
+            }
+          }
+        }
+      },
       "sample-netconf-device": {
         "type": "vnf-netconf-device",
         "capabilities": {
           }
         }
       },
+      "activate-cli": {
+        "steps": {
+          "activate-process": {
+            "description": "Activate CLI flow",
+            "target": "activate-cli",
+            "activities": [
+              {
+                "call_operation": "ComponentCliExecutor.process"
+              }
+            ]
+          }
+        }
+      },
       "assign-activate": {
         "inputs": {
           "assign-activate-properties": {
index 8e9d13e..ceb18b2 100644 (file)
@@ -1,5 +1,70 @@
 {
   "node_types": {
+    "component-cli-executor": {
+      "description": "This is CLI Transaction Configuration Component API",
+      "version": "1.0.0",
+      "capabilities": {
+        "component-node": {
+          "type": "tosca.capabilities.Node"
+        }
+      },
+      "interfaces": {
+        "ComponentCliExecutor": {
+          "operations": {
+            "process": {
+              "inputs": {
+                "script-type": {
+                  "description": "Script type, kotlin type is supported",
+                  "required": true,
+                  "type": "string",
+                  "constraints": [
+                    {
+                      "valid_values": [
+                        "kotlin",
+                        "jython",
+                        "internal"
+                      ]
+                    }
+                  ],
+                  "default": "internal"
+                },
+                "script-class-reference": {
+                  "description": "Kotlin Script class name or jython script name.",
+                  "required": true,
+                  "type": "string"
+                },
+                "instance-dependencies": {
+                  "description": "Instance names to inject to Jython or Kotlin Script.",
+                  "required": true,
+                  "type": "list",
+                  "entry_schema": {
+                    "type": "string"
+                  }
+                },
+                "dynamic-properties": {
+                  "description": "Dynamic Json Content or DSL Json reference.",
+                  "required": false,
+                  "type": "json"
+                }
+              },
+              "outputs": {
+                "response-data": {
+                  "description": "Execution Response Data.",
+                  "required": false,
+                  "type": "string"
+                },
+                "status": {
+                  "description": "Status of the Component Execution ( success or failure )",
+                  "required": true,
+                  "type": "string"
+                }
+              }
+            }
+          }
+        }
+      },
+      "derived_from": "tosca.nodes.Component"
+    },
     "component-jython-executor": {
       "description": "This is Jython Execution Component.",
       "version": "1.0.0",
           }
         }
       },
-      "derived_from": "tosca.nodes.component.Jython"
+      "derived_from": "tosca.nodes.Component"
     },
     "component-netconf-executor": {
       "description": "This is Netconf Transaction Configuration Component API",
       },
       "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": {
-        "key": {
-          "required": false,
-          "type": "string"
-        },
-        "key-dependencies": {
-          "required": true,
-          "type": "list",
-          "entry_schema": {
-            "type": "string"
-          }
-        }
-      },
+      "properties": {},
       "derived_from": "tosca.nodes.ResourceSource"
     },
     "source-processor-db": {
       "version": "1.0.0",
       "properties": {
         "type": {
-          "required": false,
+          "required": true,
           "type": "string",
           "constraints": [
             {
           "default": "JSON"
         },
         "verb": {
-          "required": false,
+          "required": true,
           "type": "string",
           "constraints": [
             {
       "version": "1.0.0",
       "derived_from": "tosca.nodes.Root"
     },
-    "tosca.nodes.Workflow": {
-      "description": "This is Directed Graph Node Type",
-      "version": "1.0.0",
-      "derived_from": "tosca.nodes.Root"
-    },
     "tosca.nodes.ResourceSource": {
       "description": "TOSCA base type for Resource Sources",
       "version": "1.0.0",
       "version": "1.0.0",
       "derived_from": "tosca.nodes.Root"
     },
-    "tosca.nodes.component.Jython": {
-      "description": "This is Jython Component",
+    "tosca.nodes.Workflow": {
+      "description": "This is Directed Graph Node Type",
       "version": "1.0.0",
       "derived_from": "tosca.nodes.Root"
     },
diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Definitions/capability-cli-blueprint.json b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Definitions/capability-cli-blueprint.json
new file mode 100644 (file)
index 0000000..c66bb6e
--- /dev/null
@@ -0,0 +1,83 @@
+{
+  "tosca_definitions_version": "controller_blueprint_1_0_0",
+  "metadata": {
+    "template_author": "Brinda Santh Muthuramalingam",
+    "author-email": "brindasanth@in.ibm.com",
+    "user-groups": "ADMIN, OPERATION",
+    "template_name": "capability-cli",
+    "template_version": "1.0.0",
+    "template_tags": "brinda, tosca"
+  },
+  "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"
+    }
+  ],
+  "dsl_definitions": {
+    "config-deploy-properties": {
+      "resolution-key": {
+        "get_input": "resolution-key"
+      }
+    }
+  },
+  "topology_template": {
+    "workflows": {
+      "check": {
+        "steps": {
+          "activate-process": {
+            "description": "Check CLI",
+            "target": "check",
+            "activities": [
+              {
+                "call_operation": "ComponentCliExecutor.process"
+              }
+            ]
+          }
+        }
+      }
+    },
+    "node_templates": {
+      "check": {
+        "type": "component-cli-executor",
+        "interfaces": {
+          "ComponentCliExecutor": {
+            "operations": {
+              "process": {
+                "implementation": {
+                  "primary": "component-script"
+                },
+                "inputs": {
+                  "script-type": "kotlin",
+                  "script-class-reference": "InternalSimpleCli_cba$TestCliScriptFunction",
+                  "instance-dependencies": []
+                },
+                "outputs": {
+                  "response-data": "",
+                  "status": "success"
+                }
+              }
+            }
+          }
+        },
+        "artifacts": {
+          "command-template": {
+            "type": "artifact-template-velocity",
+            "file": "Templates/check-command-template.vtl"
+          }
+        }
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/CapabilityCli.cba.kts b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/CapabilityCli.cba.kts
new file mode 100644 (file)
index 0000000..e22fd7e
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ *  Copyright Â© 2019 IBM.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+
+
+open class Check : CliComponentFunction() {
+
+    private val log = LoggerFactory.getLogger(CliComponentFunction::class.java)!!
+
+    override fun getName(): String {
+        return "SimpleCliConfigure"
+    }
+
+    override suspend fun processNB(executionRequest: ExecutionServiceInput) {
+        log.info("Executing process")
+    }
+
+    override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
+        log.info("Executing Recovery")
+    }
+}
\ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/TOSCA-Metadata/TOSCA.meta b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/TOSCA-Metadata/TOSCA.meta
new file mode 100644 (file)
index 0000000..0018896
--- /dev/null
@@ -0,0 +1,5 @@
+TOSCA-Meta-File-Version: 1.0.0
+CSAR-Version: 1.0
+Created-By: Brinda Santh
+Entry-Definitions: Definitions/capability-cli-blueprint.json
+Template-Tags: capability-cli-blueprint
index b02397e..9ce89a9 100755 (executable)
   }, {
     "file" : "Definitions/policy_types.json"
   } ],
+  "dsl_definitions": {
+    "dynamic-db-source": {
+      "type": "maria-db",
+      "url": "jdbc:mysql://localhost:3306/sdnctl",
+      "username": "sdnctl",
+      "password": {
+        "get_attribute": [
+          "BPP",
+          "dynamic-db-source.password"
+        ]
+      }
+    }
+  },
   "topology_template" : {
     "inputs" : {
       "request-id" : {
index 265377b..3d10a7c 100755 (executable)
       "primary-db": {
         "type": "source-processor-db",
         "properties": {
-          "query": "SELECT artifact_name FROM BLUEPRINT_RUNTIME where artifact_version=\"1.0.0\"",
+          "endpoint-selector": "dynamic-db-source",
+          "query": "SELECT artifact_name FROM sdnctl.BLUEPRINT_RUNTIME where artifact_version=\"1.0.0\"",
           "input-key-mapping": {
           },
           "output-key-mapping": {
             "service-instance-id": "artifact_name"
-          }
+          },
+          "key-dependencies" : []
         }
       },
       "capability": {
diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Environments/source-db.properties b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Environments/source-db.properties
new file mode 100644 (file)
index 0000000..49a7eb4
--- /dev/null
@@ -0,0 +1 @@
+dynamic-db-source.password=sdnctl
\ No newline at end of file
diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-cli-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-cli-executor.json
new file mode 100644 (file)
index 0000000..4860dd4
--- /dev/null
@@ -0,0 +1,65 @@
+{
+  "description": "This is CLI Transaction Configuration Component API",
+  "version": "1.0.0",
+  "capabilities": {
+    "component-node": {
+      "type": "tosca.capabilities.Node"
+    }
+  },
+  "interfaces": {
+    "ComponentCliExecutor": {
+      "operations": {
+        "process": {
+          "inputs": {
+            "script-type": {
+              "description": "Script type, kotlin type is supported",
+              "required": true,
+              "type": "string",
+              "default": "internal",
+              "constraints": [
+                {
+                  "valid_values": [
+                    "kotlin",
+                    "jython",
+                    "internal"
+                  ]
+                }
+              ]
+            },
+            "script-class-reference": {
+              "description": "Kotlin Script class name or jython script name.",
+              "required": true,
+              "type": "string"
+            },
+            "instance-dependencies": {
+              "required": true,
+              "description": "Instance names to inject to Jython or Kotlin Script.",
+              "type": "list",
+              "entry_schema": {
+                "type": "string"
+              }
+            },
+            "dynamic-properties": {
+              "description": "Dynamic Json Content or DSL Json reference.",
+              "required": false,
+              "type": "json"
+            }
+          },
+          "outputs": {
+            "response-data": {
+              "description": "Execution Response Data.",
+              "required": false,
+              "type": "string"
+            },
+            "status": {
+              "description": "Status of the Component Execution ( success or failure )",
+              "required": true,
+              "type": "string"
+            }
+          }
+        }
+      }
+    }
+  },
+  "derived_from": "tosca.nodes.Component"
+}
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/cloud_env.json b/components/model-catalog/resource-dictionary/starter-dictionary/cloud_env.json
new file mode 100644 (file)
index 0000000..adb8bd4
--- /dev/null
@@ -0,0 +1,37 @@
+{\r
+  "tags": "cloud_env",\r
+  "name": "cloud_env",\r
+  "property": {\r
+    "description": "cloud_env",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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/cloud_env",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "cloud_env": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/dcae_collector_ip.json b/components/model-catalog/resource-dictionary/starter-dictionary/dcae_collector_ip.json
new file mode 100644 (file)
index 0000000..007dc53
--- /dev/null
@@ -0,0 +1,37 @@
+{\r
+  "tags": "dcae_collector_ip",\r
+  "name": "dcae_collector_ip",\r
+  "property": {\r
+    "description": "dcae_collector_ip",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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/dcae_collector_ip",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "dcae_collector_ip": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/dcae_collector_port.json b/components/model-catalog/resource-dictionary/starter-dictionary/dcae_collector_port.json
new file mode 100644 (file)
index 0000000..7b59861
--- /dev/null
@@ -0,0 +1,37 @@
+{\r
+  "tags": "dcae_collector_port",\r
+  "name": "dcae_collector_port",\r
+  "property": {\r
+    "description": "dcae_collector_port",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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/dcae_collector_port",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "dcae_collector_port": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/demo_artifacts_version.json b/components/model-catalog/resource-dictionary/starter-dictionary/demo_artifacts_version.json
new file mode 100644 (file)
index 0000000..83ee035
--- /dev/null
@@ -0,0 +1,37 @@
+{\r
+  "tags": "demo_artifacts_version",\r
+  "name": "demo_artifacts_version",\r
+  "property": {\r
+    "description": "demo_artifacts_version",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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/demo_artifacts_version",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "demo_artifacts_version": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/gre_ipaddr.json b/components/model-catalog/resource-dictionary/starter-dictionary/gre_ipaddr.json
new file mode 100644 (file)
index 0000000..7a57153
--- /dev/null
@@ -0,0 +1,37 @@
+{\r
+  "tags": "gre_ipaddr",\r
+  "name": "gre_ipaddr",\r
+  "property": {\r
+    "description": "gre_ipaddr",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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/gre_ipaddr",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "gre_ipaddr": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/install_script_version.json b/components/model-catalog/resource-dictionary/starter-dictionary/install_script_version.json
new file mode 100644 (file)
index 0000000..90bccfb
--- /dev/null
@@ -0,0 +1,37 @@
+{\r
+  "tags": "install_script_version",\r
+  "name": "install_script_version",\r
+  "property": {\r
+    "description": "install_script_version",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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/install_script_version",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "install_script_version": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/int_pktgen_private_net_id.json b/components/model-catalog/resource-dictionary/starter-dictionary/int_pktgen_private_net_id.json
new file mode 100644 (file)
index 0000000..6d65241
--- /dev/null
@@ -0,0 +1,37 @@
+{\r
+  "tags": "int_pktgen_private_net_id",\r
+  "name": "int_pktgen_private_net_id",\r
+  "property": {\r
+    "description": "int_pktgen_private_net_id",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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/int_pktgen_private_net_id",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "int_pktgen_private_net_id": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/int_pktgen_private_subnet_id.json b/components/model-catalog/resource-dictionary/starter-dictionary/int_pktgen_private_subnet_id.json
new file mode 100644 (file)
index 0000000..dc81034
--- /dev/null
@@ -0,0 +1,37 @@
+{\r
+  "tags": "int_pktgen_private_subnet_id",\r
+  "name": "int_pktgen_private_subnet_id",\r
+  "property": {\r
+    "description": "int_pktgen_private_subnet_id",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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/int_pktgen_private_subnet_id",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "int_pktgen_private_subnet_id": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/int_private_net_id.json b/components/model-catalog/resource-dictionary/starter-dictionary/int_private_net_id.json
new file mode 100644 (file)
index 0000000..9110f03
--- /dev/null
@@ -0,0 +1,37 @@
+{\r
+  "tags": "int_private_net_id",\r
+  "name": "int_private_net_id",\r
+  "property": {\r
+    "description": "int_private_net_id",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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/int_private_net_id",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "int_private_net_id": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/int_private_subnet_id.json b/components/model-catalog/resource-dictionary/starter-dictionary/int_private_subnet_id.json
new file mode 100644 (file)
index 0000000..202a555
--- /dev/null
@@ -0,0 +1,37 @@
+{\r
+  "tags": "int_private_subnet_id",\r
+  "name": "int_private_subnet_id",\r
+  "property": {\r
+    "description": "int_private_subnet_id",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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/int_private_subnet_id",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "int_private_subnet_id": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/keypair.json b/components/model-catalog/resource-dictionary/starter-dictionary/keypair.json
new file mode 100644 (file)
index 0000000..03109ab
--- /dev/null
@@ -0,0 +1,37 @@
+{\r
+  "tags": "keypair",\r
+  "name": "keypair",\r
+  "property": {\r
+    "description": "keypair",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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/keypair",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "keypair": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/management-prefix-id.json b/components/model-catalog/resource-dictionary/starter-dictionary/management-prefix-id.json
new file mode 100644 (file)
index 0000000..751e993
--- /dev/null
@@ -0,0 +1,49 @@
+{\r
+  "tags": "management-prefix-id",\r
+  "name": "management-prefix-id",\r
+  "property": {\r
+    "description": "management-prefix-id",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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/management-prefix-id",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "management-prefix-id": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    },\r
+    "processor-db": {\r
+      "type": "source-processor-db",\r
+      "properties": {\r
+        "endpoint-selector": "dynamic-db-source",\r
+        "type": "SQL",\r
+        "query": "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = \"management\"",\r
+        "input-key-mapping": {},\r
+        "output-key-mapping": {\r
+          "management-prefix-id": "prefix_id"\r
+        }\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/nb_api_version.json b/components/model-catalog/resource-dictionary/starter-dictionary/nb_api_version.json
new file mode 100644 (file)
index 0000000..a4e6c11
--- /dev/null
@@ -0,0 +1,37 @@
+{\r
+  "tags": "nb_api_version",\r
+  "name": "nb_api_version",\r
+  "property": {\r
+    "description": "nb_api_version",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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/nb_api_version",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "nb_api_version": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
index 8b88842..3709c0b 100755 (executable)
@@ -1,21 +1,37 @@
-{
-  "name" : "nexus_artifact_repo",
-  "tags" : "nexus_artifact_repo",
-  "updated-by" : "Singal, Kapil <ks220y@att.com>",
-  "property" : {
-    "description" : "nexus_artifact_repo",
-    "type" : "string"
-  },
-  "sources" : {
-    "default": {
-      "type": "source-default",
-      "properties": {
-      }
-    },
-    "input" : {
-      "type" : "source-input",
-      "properties" : {
-      }
-    }
-  }
+{\r
+  "tags": "nexus_artifact_repo",\r
+  "name": "nexus_artifact_repo",\r
+  "property": {\r
+    "description": "nexus_artifact_repo",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "nexus_artifact_repo": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    }\r
+  }\r
 }
\ No newline at end of file
index 710042d..4cc28dc 100755 (executable)
@@ -1,25 +1,35 @@
-{
-  "name" : "nfc-naming-code",
-  "tags" : "nfc-naming-code",
-  "updated-by" : "Singal, Kapil <ks220y@att.com>",
-  "property" : {
-    "description" : "nfc-naming-code",
-    "type" : "string"
-  },
-  "sources" : {
-    "processor-db" : {
-      "type" : "source-processor-db",
-      "properties" : {
-        "type" : "SQL",
-        "query" : "select nfc_naming_code as nfc_naming_code from sdnctl.VFC_MODEL where customization_uuid=:vfccustomizationuuid",
-        "input-key-mapping" : {
-          "vfccustomizationuuid" : "vfccustomizationuuid"
-        },
-        "output-key-mapping" : {
-          "nfc-naming-code" : "nfc_naming_code"
-        },
-        "key-dependencies" : [ "vfccustomizationuuid" ]
-      }
-    }
-  }
+{\r
+  "tags": "nfc-naming-code",\r
+  "name": "nfc-naming-code",\r
+  "property": {\r
+    "description": "nfc-naming-code",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "processor-db": {\r
+      "type": "source-processor-db",\r
+      "properties": {\r
+        "endpoint-selector": "dynamic-db-source",\r
+        "type": "SQL",\r
+        "query": "select nfc_naming_code as nfc_naming_code from sdnctl.VFC_MODEL where customization_uuid=:vfccustomizationuuid",\r
+        "input-key-mapping": {\r
+          "vfccustomizationuuid": "vfccustomizationuuid"\r
+        },\r
+        "output-key-mapping": {\r
+          "nfc-naming-code": "nfc_naming_code"\r
+        },\r
+        "key-dependencies": [\r
+          "vfccustomizationuuid"\r
+        ]\r
+      }\r
+    }\r
+  }\r
 }
\ No newline at end of file
index 559ec3e..90d674c 100755 (executable)
@@ -1,21 +1,49 @@
-{
-  "name" : "onap_private_net_cidr",
-  "tags" : "onap_private_net_cidr",
-  "updated-by" : "Singal, Kapil <ks220y@att.com>",
-  "property" : {
-    "description" : "onap_private_net_cidr",
-    "type" : "string"
-  },
-  "sources" : {
-    "processor-db" : {
-      "type" : "source-processor-db",
-      "properties" : {
-        "type" : "SQL",
-        "query" : "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = \"private\"",
-        "output-key-mapping" : {
-          "onap_private_net_cidr" : "prefix"
-        }      
-         }
-    }
-  }
+{\r
+  "tags": "onap_private_net_cidr",\r
+  "name": "onap_private_net_cidr",\r
+  "property": {\r
+    "description": "onap_private_net_cidr",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "onap_private_net_cidr": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    },\r
+    "processor-db": {\r
+      "type": "source-processor-db",\r
+      "properties": {\r
+        "endpoint-selector": "dynamic-db-source",\r
+        "type": "SQL",\r
+        "query": "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = \"management\"",\r
+        "input-key-mapping": {},\r
+        "output-key-mapping": {\r
+          "onap_private_net_cidr": "prefix"\r
+        }\r
+      }\r
+    }\r
+  }\r
 }
\ No newline at end of file
index 3dd74f7..c805e32 100755 (executable)
@@ -1,33 +1,38 @@
-{
-  "name": "onap_private_net_id",
-  "tags": "onap_private_net_id",
-  "updated-by": "Singal, Kapil <ks220y@att.com>",
-  "property": {
-    "type": "string",
-    "description": "onap_private_net_id"
-  },
-  "sources": {
-    "input": {
-      "type": "source-input"
-    },
-    "primary-config-data": {
-      "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_id",
-        "path": "/param/0/value",
-        "input-key-mapping": {
-          "service-instance-id": "service-instance-id",
-          "vnf-id": "vnf-id"
-        },
-        "output-key-mapping": {
-          "onap_private_net_id": "value"
-        },
-        "key-dependencies": [
-          "service-instance-id",
-          "vnf-id"
-        ]
-      }
-    }
-  }
-}
\ No newline at end of file
+{\r
+      "tags": "onap_private_net_id",\r
+      "name": "onap_private_net_id",\r
+      "property": {\r
+        "description": "onap_private_net_id",\r
+        "type": "string"\r
+      },\r
+      "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+      "sources": {\r
+        "input": {\r
+          "type": "source-input"\r
+        },\r
+        "default": {\r
+          "type": "source-default",\r
+          "properties": {}\r
+        },\r
+        "primary-config-data": {\r
+          "type": "source-rest",\r
+          "properties": {\r
+            "type": "JSON",\r
+            "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_id",\r
+            "path": "/param/0/value",\r
+            "input-key-mapping": {\r
+              "service-instance-id": "service-instance-id",\r
+              "vnf-id": "vnf-id"\r
+            },\r
+            "output-key-mapping": {\r
+              "onap_private_net_id": "value"\r
+            },\r
+            "key-dependencies": [\r
+              "service-instance-id",\r
+              "vnf-id"\r
+            ]\r
+          }\r
+        }\r
+      }\r
+    \r
+  }
\ No newline at end of file
index 6cb22c3..80f62ea 100755 (executable)
@@ -1,33 +1,37 @@
-{
-  "name": "onap_private_subnet_id",
-  "tags": "onap_private_subnet_id",
-  "updated-by": "Singal, Kapil <ks220y@att.com>",
-  "property": {
-    "type": "string",
-    "description": "onap_private_subnet_id"
-  },
-  "sources": {
-    "input": {
-      "type": "source-input"
-    },
-    "primary-config-data": {
-      "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_subnet_id",
-        "path": "/param/0/value",
-        "input-key-mapping": {
-          "service-instance-id": "service-instance-id",
-          "vnf-id": "vnf-id"
-        },
-        "output-key-mapping": {
-          "onap_private_subnet_id": "value"
-        },
-        "key-dependencies": [
-          "service-instance-id",
-          "vnf-id"
-        ]
-      }
-    }
-  }
+{\r
+  "tags": "onap_private_subnet_id",\r
+  "name": "onap_private_subnet_id",\r
+  "property": {\r
+    "description": "onap_private_subnet_id",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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_subnet_id",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "onap_private_subnet_id": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    }\r
+  }\r
 }
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/pg_int.json b/components/model-catalog/resource-dictionary/starter-dictionary/pg_int.json
new file mode 100644 (file)
index 0000000..d1a4b79
--- /dev/null
@@ -0,0 +1,37 @@
+{\r
+  "tags": "pg_int",\r
+  "name": "pg_int",\r
+  "property": {\r
+    "description": "pg_int",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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/pg_int",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "pg_int": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/pktgen_private_net_cidr.json b/components/model-catalog/resource-dictionary/starter-dictionary/pktgen_private_net_cidr.json
new file mode 100644 (file)
index 0000000..6210bf9
--- /dev/null
@@ -0,0 +1,51 @@
+ {\r
+      "tags": "pktgen_private_net_cidr",\r
+      "name": "pktgen_private_net_cidr",\r
+      "property": {\r
+        "description": "pktgen_private_net_cidr",\r
+        "type": "string"\r
+      },\r
+      "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+      "sources": {\r
+        "input": {\r
+          "type": "source-input"\r
+        },\r
+        "default": {\r
+          "type": "source-default",\r
+          "properties": {}\r
+        },\r
+        "primary-config-data": {\r
+          "type": "source-rest",\r
+          "properties": {\r
+            "type": "JSON",\r
+            "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/pktgen_private_net_cidr",\r
+            "path": "/param/0/value",\r
+            "input-key-mapping": {\r
+              "service-instance-id": "service-instance-id",\r
+              "vnf-id": "vnf-id"\r
+            },\r
+            "output-key-mapping": {\r
+              "pktgen_private_net_cidr": "value"\r
+            },\r
+            "key-dependencies": [\r
+              "service-instance-id",\r
+              "vnf-id"\r
+            ]\r
+          }\r
+        },\r
+      \r
+      "processor-db": {\r
+        "type": "source-processor-db",\r
+        "properties": {\r
+          "endpoint-selector": "dynamic-db-source",\r
+          "type": "SQL",\r
+          "query": "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = \"private2\"",\r
+          "input-key-mapping": {},\r
+          "output-key-mapping": {\r
+            "onap_private_net_cidr": "prefix"\r
+          }\r
+        }\r
+      }\r
+    }\r
+  }\r
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/pktgen_private_net_id.json b/components/model-catalog/resource-dictionary/starter-dictionary/pktgen_private_net_id.json
new file mode 100644 (file)
index 0000000..a819388
--- /dev/null
@@ -0,0 +1,38 @@
+  {\r
+      "tags": "pktgen_private_net_id",\r
+      "name": "pktgen_private_net_id",\r
+      "property": {\r
+        "description": "pktgen_private_net_id",\r
+        "type": "string"\r
+      },\r
+      "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+      "sources": {\r
+        "input": {\r
+          "type": "source-input"\r
+        },\r
+        "default": {\r
+          "type": "source-default",\r
+          "properties": {}\r
+        },\r
+        "primary-config-data": {\r
+          "type": "source-rest",\r
+          "properties": {\r
+            "type": "JSON",\r
+            "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/pktgen_private_net_id",\r
+            "path": "/param/0/value",\r
+            "input-key-mapping": {\r
+              "service-instance-id": "service-instance-id",\r
+              "vnf-id": "vnf-id"\r
+            },\r
+            "output-key-mapping": {\r
+              "pktgen_private_net_id": "value"\r
+            },\r
+            "key-dependencies": [\r
+              "service-instance-id",\r
+              "vnf-id"\r
+            ]\r
+          }\r
+        }\r
+      }\r
+    }\r
+  
\ No newline at end of file
index 3365d66..31ab6a9 100755 (executable)
@@ -1,21 +1,30 @@
-{
-  "name" : "private-prefix-id",
-  "tags" : "private-prefix-id",
-  "updated-by" : "Singal, Kapil <ks220y@att.com>",
-  "property" : {
-    "description" : "private-prefix-id",
-    "type" : "string"
-  },
-  "sources" : {
-    "processor-db" : {
-      "type" : "source-processor-db",
-      "properties" : {
-        "type" : "SQL",
-        "query" : "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = \"private\"",
-        "output-key-mapping" : {
-          "private-prefix-id" : "prefix_id"
-        }      
-         }
-    }
-  }
+{\r
+  "tags": "private-prefix-id",\r
+  "name": "private-prefix-id",\r
+  "property": {\r
+    "description": "private-prefix-id",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "processor-db": {\r
+      "type": "source-processor-db",\r
+      "properties": {\r
+        "endpoint-selector": "dynamic-db-source",\r
+        "type": "SQL",\r
+        "query": "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = \"private\"",\r
+        "input-key-mapping": {},\r
+        "output-key-mapping": {\r
+          "private-prefix-id": "prefix_id"\r
+        }\r
+      }\r
+    }\r
+  }\r
 }
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/private1-prefix-id.json b/components/model-catalog/resource-dictionary/starter-dictionary/private1-prefix-id.json
new file mode 100644 (file)
index 0000000..7eff98d
--- /dev/null
@@ -0,0 +1,49 @@
+{\r
+  "tags": "private1-prefix-id",\r
+  "name": "private1-prefix-id",\r
+  "property": {\r
+    "description": "private1-prefix-id",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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/private1-prefix-id",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "private1-prefix-id": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    },\r
+    "processor-db": {\r
+      "type": "source-processor-db",\r
+      "properties": {\r
+        "endpoint-selector": "dynamic-db-source",\r
+        "type": "SQL",\r
+        "query": "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = \"private1\"",\r
+        "input-key-mapping": {},\r
+        "output-key-mapping": {\r
+          "private1-prefix-id": "prefix_id"\r
+        }\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/private2-prefix-id.json b/components/model-catalog/resource-dictionary/starter-dictionary/private2-prefix-id.json
new file mode 100644 (file)
index 0000000..f3f0ae1
--- /dev/null
@@ -0,0 +1,49 @@
+{\r
+  "tags": "private2-prefix-id",\r
+  "name": "private2-prefix-id",\r
+  "property": {\r
+    "description": "private2-prefix-id",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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/private2-prefix-id",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "private2-prefix-id": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    },\r
+    "processor-db": {\r
+      "type": "source-processor-db",\r
+      "properties": {\r
+        "endpoint-selector": "dynamic-db-source",\r
+        "type": "SQL",\r
+        "query": "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = \"private2\"",\r
+        "input-key-mapping": {},\r
+        "output-key-mapping": {\r
+          "private2-prefix-id": "prefix_id"\r
+        }\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
index fe172ca..441a3c8 100755 (executable)
@@ -1,34 +1,37 @@
-{
-  "name": "pub_key",
-  "tags": "pub_key",
-  "updated-by": "Singal, Kapil <ks220y@att.com>",
-  "property": {
-    "type": "string",
-    "description": "pub_key"
-  },
-  "sources": {
-    "input": {
-      "type": "source-input"
-    },
-    "primary-config-data": {
-      "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/pub_key",
-        "path": "/param/0/value",
-        "input-key-mapping": {
-          "service-instance-id": "service-instance-id",
-          "vnf-id": "vnf-id"
-        },
-        "output-key-mapping": {
-          "pub_key": "value"
-        },
-        "key-dependencies": [
-          "service-instance-id",
-          "vnf-id"
-        ]
-      }
-    }
-  }
-}
-
+{\r
+  "tags": "pub_key",\r
+  "name": "pub_key",\r
+  "property": {\r
+    "description": "pub_key",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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/pub_key",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "pub_key": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
index a4fbc95..7c27413 100755 (executable)
@@ -1,19 +1,38 @@
-{
-               "name": "public_net_id",
-               "tags": "public_net_id",
-               "updated-by" : "Singal, Kapil <ks220y@att.com>",
-               "property": {
-                       "type": "string",
-                       "description" : "public_net_id"
-               },
-               "sources": {
-                       "default": {
-                               "type": "source-default",
-                               "properties": {
-                               }
-                       },
-                       "input": {
-                               "type": "source-input"
-                       }
-               }
-}
+  {\r
+      "tags": "public_net_id",\r
+      "name": "public_net_id",\r
+      "property": {\r
+        "description": "public_net_id",\r
+        "type": "string"\r
+      },\r
+      "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+      "sources": {\r
+        "input": {\r
+          "type": "source-input"\r
+        },\r
+        "default": {\r
+          "type": "source-default",\r
+          "properties": {}\r
+        },\r
+        "primary-config-data": {\r
+          "type": "source-rest",\r
+          "properties": {\r
+            "type": "JSON",\r
+            "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",\r
+            "path": "/param/0/value",\r
+            "input-key-mapping": {\r
+              "service-instance-id": "service-instance-id",\r
+              "vnf-id": "vnf-id"\r
+            },\r
+            "output-key-mapping": {\r
+              "public_net_id": "value"\r
+            },\r
+            "key-dependencies": [\r
+              "service-instance-id",\r
+              "vnf-id"\r
+            ]\r
+          }\r
+        }\r
+      }\r
+    \r
+  }
\ No newline at end of file
index 38f07e8..14437c9 100755 (executable)
@@ -1,21 +1,38 @@
-{
-  "name" : "sec_group",
-  "tags" : "sec_group",
-  "updated-by" : "Singal, Kapil <ks220y@att.com>",
-  "property" : {
-    "description" : "sec_group",
-    "type" : "string"
-  },
-  "sources" : {
-    "default": {
-      "type": "source-default",
-      "properties": {
-      }
-    },
-    "input" : {
-      "type" : "source-input",
-      "properties" : {
-      }
-    }
-  }
-}
\ No newline at end of file
+  {\r
+      "tags": "sec_group",\r
+      "name": "sec_group",\r
+      "property": {\r
+        "description": "sec_group",\r
+        "type": "string"\r
+      },\r
+      "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+      "sources": {\r
+        "input": {\r
+          "type": "source-input"\r
+        },\r
+        "default": {\r
+          "type": "source-default",\r
+          "properties": {}\r
+        },\r
+        "primary-config-data": {\r
+          "type": "source-rest",\r
+          "properties": {\r
+            "type": "JSON",\r
+            "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",\r
+            "path": "/param/0/value",\r
+            "input-key-mapping": {\r
+              "service-instance-id": "service-instance-id",\r
+              "vnf-id": "vnf-id"\r
+            },\r
+            "output-key-mapping": {\r
+              "sec_group": "value"\r
+            },\r
+            "key-dependencies": [\r
+              "service-instance-id",\r
+              "vnf-id"\r
+            ]\r
+          }\r
+        }\r
+      }\r
+    \r
+  }
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vdns_flavor_name.json b/components/model-catalog/resource-dictionary/starter-dictionary/vdns_flavor_name.json
new file mode 100644 (file)
index 0000000..323c33e
--- /dev/null
@@ -0,0 +1,39 @@
+  {\r
+  \r
+      "tags": "vdns_flavor_name",\r
+      "name": "vdns_flavor_name",\r
+      "property": {\r
+        "description": "vdns_flavor_name",\r
+        "type": "string"\r
+      },\r
+      "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+      "sources": {\r
+        "input": {\r
+          "type": "source-input"\r
+        },\r
+        "default": {\r
+          "type": "source-default",\r
+          "properties": {}\r
+        },\r
+        "primary-config-data": {\r
+          "type": "source-rest",\r
+          "properties": {\r
+            "type": "JSON",\r
+            "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/vdns_flavor_name",\r
+            "path": "/param/0/value",\r
+            "input-key-mapping": {\r
+              "service-instance-id": "service-instance-id",\r
+              "vnf-id": "vnf-id"\r
+            },\r
+            "output-key-mapping": {\r
+              "vdns_flavor_name": "value"\r
+            },\r
+            "key-dependencies": [\r
+              "service-instance-id",\r
+              "vnf-id"\r
+            ]\r
+          }\r
+        }\r
+      }\r
+    \r
+  }
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vdns_image_name.json b/components/model-catalog/resource-dictionary/starter-dictionary/vdns_image_name.json
new file mode 100644 (file)
index 0000000..bc70891
--- /dev/null
@@ -0,0 +1,37 @@
+{\r
+  "tags": "vdns_image_name",\r
+  "name": "vdns_image_name",\r
+  "property": {\r
+    "description": "vdns_image_name",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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/vdns_image_name",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "vdns_image_name": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vdns_int_private_ip_0.json b/components/model-catalog/resource-dictionary/starter-dictionary/vdns_int_private_ip_0.json
new file mode 100644 (file)
index 0000000..715cbc7
--- /dev/null
@@ -0,0 +1,37 @@
+{\r
+  "tags": "vdns_int_private_ip_0",\r
+  "name": "vdns_int_private_ip_0",\r
+  "property": {\r
+    "description": "vdns_int_private_ip_0",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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/vdns_int_private_ip_0",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "vdns_int_private_ip_0": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vdns_name_0.json b/components/model-catalog/resource-dictionary/starter-dictionary/vdns_name_0.json
new file mode 100644 (file)
index 0000000..c02e09d
--- /dev/null
@@ -0,0 +1,38 @@
+ {\r
+      "tags": "vdns_name_0",\r
+      "name": "vdns_name_0",\r
+      "property": {\r
+        "description": "vdns_name_0",\r
+        "type": "string"\r
+      },\r
+      "updated-by": "Singal, Kapil <ks220y@att.com>",\r
+      "sources": {\r
+        "input": {\r
+          "type": "source-input"\r
+        },\r
+        "default": {\r
+          "type": "source-default",\r
+          "properties": {}\r
+        },\r
+        "primary-config-data": {\r
+          "type": "source-rest",\r
+          "properties": {\r
+            "type": "JSON",\r
+            "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/vdns_name_0",\r
+            "path": "/param/0/value",\r
+            "input-key-mapping": {\r
+              "service-instance-id": "service-instance-id",\r
+              "vnf-id": "vnf-id"\r
+            },\r
+            "output-key-mapping": {\r
+              "vdns_name_0": "value"\r
+            },\r
+            "key-dependencies": [\r
+              "service-instance-id",\r
+              "vnf-id"\r
+            ]\r
+          }\r
+        }\r
+      }\r
+    \r
+  }
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vdns_onap_private_ip_0.json b/components/model-catalog/resource-dictionary/starter-dictionary/vdns_onap_private_ip_0.json
new file mode 100644 (file)
index 0000000..420df6a
--- /dev/null
@@ -0,0 +1,37 @@
+{\r
+  "tags": "vdns_onap_private_ip_0",\r
+  "name": "vdns_onap_private_ip_0",\r
+  "property": {\r
+    "description": "vdns_onap_private_ip_0",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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/vdns_onap_private_ip_0",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "vdns_onap_private_ip_0": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
index e17de2b..5e5f071 100755 (executable)
@@ -1,25 +1,35 @@
-{
-  "name" : "vf-module-label",
-  "tags" : "vf-module-label",
-  "updated-by" : "Singal, Kapil <ks220y@att.com>",
-  "property" : {
-    "description" : "vf-module-label",
-    "type" : "string"
-  },
-  "sources" : {
-    "processor-db" : {
-      "type" : "source-processor-db",
-      "properties" : {
-        "type" : "SQL",
-        "query" : "select sdnctl.VF_MODULE_MODEL.vf_module_label as vf_module_label from sdnctl.VF_MODULE_MODEL where sdnctl.VF_MODULE_MODEL.customization_uuid=:customizationid",
-        "input-key-mapping" : {
-          "customizationid" : "vf-module-model-customization-uuid"
-        },
-        "output-key-mapping" : {
-          "vf-module-label" : "vf_module_label"
-        },
-        "key-dependencies" : [ "vf-module-model-customization-uuid" ]
-      }
-    }
-  }
+{\r
+  "tags": "vf-module-label",\r
+  "name": "vf-module-label",\r
+  "property": {\r
+    "description": "vf-module-label",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "processor-db": {\r
+      "type": "source-processor-db",\r
+      "properties": {\r
+        "endpoint-selector": "dynamic-db-source",\r
+        "type": "SQL",\r
+        "query": "select sdnctl.VF_MODULE_MODEL.vf_module_label as vf_module_label from sdnctl.VF_MODULE_MODEL where sdnctl.VF_MODULE_MODEL.customization_uuid=:customizationid",\r
+        "input-key-mapping": {\r
+          "customizationid": "vf-module-model-customization-uuid"\r
+        },\r
+        "output-key-mapping": {\r
+          "vf-module-label": "vf_module_label"\r
+        },\r
+        "key-dependencies": [\r
+          "vf-module-model-customization-uuid"\r
+        ]\r
+      }\r
+    }\r
+  }\r
 }
\ No newline at end of file
index 6736e4f..25760c8 100755 (executable)
@@ -1,15 +1,18 @@
-{
-  "name" : "vf-module-model-customization-uuid",
-  "tags" : "vf-module-model-customization-uuid",
-  "updated-by" : "Singal, Kapil <ks220y@att.com>",
-  "property" : {
-    "description" : "vf-module-model-customization-uuid",
-    "type" : "string"
-  },
-  "sources" : {
-    "input" : {
-      "type" : "source-input",
-      "properties" : { }
-    }
-  }
+{\r
+  "tags": "vf-module-model-customization-uuid",\r
+  "name": "vf-module-model-customization-uuid",\r
+  "property": {\r
+    "description": "vf-module-model-customization-uuid",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    }\r
+  }\r
 }
\ No newline at end of file
index abbe817..f970682 100755 (executable)
@@ -1,25 +1,35 @@
-{
-  "name" : "vf-module-type",
-  "tags" : "vf-module-type",
-  "updated-by" : "Singal, Kapil <ks220y@att.com>",
-  "property" : {
-    "description" : "vf-module-type",
-    "type" : "string"
-  },
-  "sources" : {
-    "processor-db" : {
-      "type" : "source-processor-db",
-      "properties" : {
-        "type" : "SQL",
-        "query" : "select vf_module_type as vf_module_type from sdnctl.VF_MODULE_MODEL where customization_uuid=:customizationid",
-        "input-key-mapping" : {
-          "customizationid" : "vf-module-model-customization-uuid"
-        },
-        "output-key-mapping" : {
-          "vf-module-type" : "vf_module_type"
-        },
-        "key-dependencies" : [ "vf-module-model-customization-uuid" ]
-      }
-    }
-  }
+{\r
+  "tags": "vf-module-type",\r
+  "name": "vf-module-type",\r
+  "property": {\r
+    "description": "vf-module-type",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "processor-db": {\r
+      "type": "source-processor-db",\r
+      "properties": {\r
+        "endpoint-selector": "dynamic-db-source",\r
+        "type": "SQL",\r
+        "query": "select vf_module_type as vf_module_type from sdnctl.VF_MODULE_MODEL where customization_uuid=:customizationid",\r
+        "input-key-mapping": {\r
+          "customizationid": "vf-module-model-customization-uuid"\r
+        },\r
+        "output-key-mapping": {\r
+          "vf-module-type": "vf_module_type"\r
+        },\r
+        "key-dependencies": [\r
+          "vf-module-model-customization-uuid"\r
+        ]\r
+      }\r
+    }\r
+  }\r
 }
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vf_module_id.json b/components/model-catalog/resource-dictionary/starter-dictionary/vf_module_id.json
new file mode 100644 (file)
index 0000000..d78ba55
--- /dev/null
@@ -0,0 +1,19 @@
+  {\r
+      "tags": "vf_module_id",\r
+      "name": "vf_module_id",\r
+      "property": {\r
+        "description": "vf_module_id",\r
+        "type": "string"\r
+      },\r
+      "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+      "sources": {\r
+        "input": {\r
+          "type": "source-input"\r
+        },\r
+        "default": {\r
+          "type": "source-default",\r
+          "properties": {}\r
+        }\r
+      }\r
+    \r
+  }
\ No newline at end of file
index 7ed7674..1f8c1d2 100755 (executable)
@@ -1,25 +1,35 @@
-{
-  "name" : "vfccustomizationuuid",
-  "tags" : "vfccustomizationuuid, tosca.datatypes.Root, data_type",
-  "updated-by" : "Singal, Kapil <ks220y@att.com>",
-  "property" : {
-    "description" : "vfccustomizationuuid",
-    "type" : "string"
-  },
-  "sources" : {
-    "processor-db" : {
-      "type" : "source-processor-db",
-      "properties" : {
-        "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" : {
-          "vfmodulecustomizationuuid" : "vf-module-model-customization-uuid"
-        },
-        "output-key-mapping" : {
-          "vfccustomizationuuid" : "vnf_customid"
-        },
-        "key-dependencies" : [ "vf-module-model-customization-uuid" ]
-      }
-    }
-  }
+{\r
+  "tags": "vfccustomizationuuid",\r
+  "name": "vfccustomizationuuid",\r
+  "property": {\r
+    "description": "vfccustomizationuuid",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "processor-db": {\r
+      "type": "source-processor-db",\r
+      "properties": {\r
+        "endpoint-selector": "dynamic-db-source",\r
+        "type": "SQL",\r
+        "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",\r
+        "input-key-mapping": {\r
+          "vfmodulecustomizationuuid": "vf-module-model-customization-uuid"\r
+        },\r
+        "output-key-mapping": {\r
+          "vfccustomizationuuid": "vnf_customid"\r
+        },\r
+        "key-dependencies": [\r
+          "vf-module-model-customization-uuid"\r
+        ]\r
+      }\r
+    }\r
+  }\r
 }
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vip.json b/components/model-catalog/resource-dictionary/starter-dictionary/vip.json
new file mode 100644 (file)
index 0000000..cbc0c5b
--- /dev/null
@@ -0,0 +1,37 @@
+{\r
+  "tags": "vip",\r
+  "name": "vip",\r
+  "property": {\r
+    "description": "vip",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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/vip",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "vip": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vlb_0_int_pktgen_private_port_0_mac.json b/components/model-catalog/resource-dictionary/starter-dictionary/vlb_0_int_pktgen_private_port_0_mac.json
new file mode 100644 (file)
index 0000000..74fae46
--- /dev/null
@@ -0,0 +1,37 @@
+{\r
+  "tags": "vlb_0_int_pktgen_private_port_0_mac",\r
+  "name": "vlb_0_int_pktgen_private_port_0_mac",\r
+  "property": {\r
+    "description": "vlb_0_int_pktgen_private_port_0_mac",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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/vlb_0_int_pktgen_private_port_0_mac",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "vlb_0_int_pktgen_private_port_0_mac": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vlb_flavor_name.json b/components/model-catalog/resource-dictionary/starter-dictionary/vlb_flavor_name.json
new file mode 100644 (file)
index 0000000..c1bdb60
--- /dev/null
@@ -0,0 +1,37 @@
+{\r
+  "tags": "vlb_flavor_name",\r
+  "name": "vlb_flavor_name",\r
+  "property": {\r
+    "description": "vlb_flavor_name",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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/vlb_flavor_name",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "vlb_flavor_name": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vlb_image_name.json b/components/model-catalog/resource-dictionary/starter-dictionary/vlb_image_name.json
new file mode 100644 (file)
index 0000000..e04697f
--- /dev/null
@@ -0,0 +1,37 @@
+{\r
+  "tags": "vlb_image_name",\r
+  "name": "vlb_image_name",\r
+  "property": {\r
+    "description": "vlb_image_name",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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/vlb_image_name",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "vlb_image_name": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vlb_int_pktgen_private_ip_0.json b/components/model-catalog/resource-dictionary/starter-dictionary/vlb_int_pktgen_private_ip_0.json
new file mode 100644 (file)
index 0000000..99448b8
--- /dev/null
@@ -0,0 +1,38 @@
+  {\r
+      "tags": "vlb_int_pktgen_private_ip_0",\r
+      "name": "vlb_int_pktgen_private_ip_0",\r
+      "property": {\r
+        "description": "vlb_int_pktgen_private_ip_0",\r
+        "type": "string"\r
+      },\r
+      "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+      "sources": {\r
+        "input": {\r
+          "type": "source-input"\r
+        },\r
+        "default": {\r
+          "type": "source-default",\r
+          "properties": {}\r
+        },\r
+        "primary-config-data": {\r
+          "type": "source-rest",\r
+          "properties": {\r
+            "type": "JSON",\r
+            "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/vlb_int_pktgen_private_ip_0",\r
+            "path": "/param/0/value",\r
+            "input-key-mapping": {\r
+              "service-instance-id": "service-instance-id",\r
+              "vnf-id": "vnf-id"\r
+            },\r
+            "output-key-mapping": {\r
+              "vlb_int_pktgen_private_ip_0": "value"\r
+            },\r
+            "key-dependencies": [\r
+              "service-instance-id",\r
+              "vnf-id"\r
+            ]\r
+          }\r
+        }\r
+      }\r
+    }\r
+  
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vlb_int_private_ip_0.json b/components/model-catalog/resource-dictionary/starter-dictionary/vlb_int_private_ip_0.json
new file mode 100644 (file)
index 0000000..9c0855b
--- /dev/null
@@ -0,0 +1,38 @@
+ {\r
+      "tags": "vlb_int_private_ip_0",\r
+      "name": "vlb_int_private_ip_0",\r
+      "property": {\r
+        "description": "vlb_int_private_ip_0",\r
+        "type": "string"\r
+      },\r
+      "updated-by": "Singal, Kapil <ks220y@att.com>",\r
+      "sources": {\r
+        "input": {\r
+          "type": "source-input"\r
+        },\r
+        "default": {\r
+          "type": "source-default",\r
+          "properties": {}\r
+        },\r
+        "primary-config-data": {\r
+          "type": "source-rest",\r
+          "properties": {\r
+            "type": "JSON",\r
+            "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/vlb_int_private_ip_0",\r
+            "path": "/param/0/value",\r
+            "input-key-mapping": {\r
+              "service-instance-id": "service-instance-id",\r
+              "vnf-id": "vnf-id"\r
+            },\r
+            "output-key-mapping": {\r
+              "vlb_int_private_ip_0": "value"\r
+            },\r
+            "key-dependencies": [\r
+              "service-instance-id",\r
+              "vnf-id"\r
+            ]\r
+          }\r
+        }\r
+      }\r
+    \r
+  }
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vlb_name_0.json b/components/model-catalog/resource-dictionary/starter-dictionary/vlb_name_0.json
new file mode 100644 (file)
index 0000000..4be4c82
--- /dev/null
@@ -0,0 +1,37 @@
+{\r
+  "tags": "vlb_name_0",\r
+  "name": "vlb_name_0",\r
+  "property": {\r
+    "description": "vlb_name_0",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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/vlb_name_0",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "vlb_name_0": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vlb_onap_private_ip_0.json b/components/model-catalog/resource-dictionary/starter-dictionary/vlb_onap_private_ip_0.json
new file mode 100644 (file)
index 0000000..5a38f92
--- /dev/null
@@ -0,0 +1,37 @@
+{\r
+  "tags": "vlb_onap_private_ip_0",\r
+  "name": "vlb_onap_private_ip_0",\r
+  "property": {\r
+    "description": "vlb_onap_private_ip_0",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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/vlb_onap_private_ip_0",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "private2-prefix-id": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vlb_private_net_cidr.json b/components/model-catalog/resource-dictionary/starter-dictionary/vlb_private_net_cidr.json
new file mode 100644 (file)
index 0000000..3cda767
--- /dev/null
@@ -0,0 +1,49 @@
+{\r
+  "tags": "vlb_private_net_cidr",\r
+  "name": "vlb_private_net_cidr",\r
+  "property": {\r
+    "description": "vlb_private_net_cidr",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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/vlb_private_net_cidr",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "vlb_private_net_cidr": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    },\r
+    "processor-db": {\r
+      "type": "source-processor-db",\r
+      "properties": {\r
+        "endpoint-selector": "dynamic-db-source",\r
+        "type": "SQL",\r
+        "query": "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = \"private1\"",\r
+        "input-key-mapping": {},\r
+        "output-key-mapping": {\r
+          "vlb_private_net_cidr": "prefix"\r
+        }\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vlb_private_net_id.json b/components/model-catalog/resource-dictionary/starter-dictionary/vlb_private_net_id.json
new file mode 100644 (file)
index 0000000..563dd45
--- /dev/null
@@ -0,0 +1,37 @@
+{\r
+  "tags": "vlb_private_net_id",\r
+  "name": "vlb_private_net_id",\r
+  "property": {\r
+    "description": "vlb_private_net_id",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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/vlb_private_net_id",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "vlb_private_net_id": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
index a0bb607..58e7105 100755 (executable)
@@ -1,25 +1,35 @@
-{
-  "name" : "vm-type",
-  "tags" : "vm-type",
-  "updated-by" : "Singal, Kapil <ks220y@att.com>",
-  "property" : {
-    "description" : "vm-type",
-    "type" : "string"
-  },
-  "sources" : {
-    "processor-db" : {
-      "type" : "source-processor-db",
-      "properties" : {
-        "type" : "SQL",
-        "query" : "select VFC_MODEL.vm_type as vm_type from VFC_MODEL where customization_uuid=:vfccustomizationuuid",
-        "input-key-mapping" : {
-          "vfccustomizationuuid" : "vfccustomizationuuid"
-        },
-        "output-key-mapping" : {
-          "vm-type" : "vm_type"
-        },
-        "key-dependencies" : [ "vfccustomizationuuid" ]
-      }
-    }
-  }
+{\r
+  "tags": "vm-type",\r
+  "name": "vm-type",\r
+  "property": {\r
+    "description": "vm-type",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "processor-db": {\r
+      "type": "source-processor-db",\r
+      "properties": {\r
+        "endpoint-selector": "dynamic-db-source",\r
+        "type": "SQL",\r
+        "query": "select VFC_MODEL.vm_type as vm_type from VFC_MODEL where customization_uuid=:vfccustomizationuuid",\r
+        "input-key-mapping": {\r
+          "vfccustomizationuuid": "vfccustomizationuuid"\r
+        },\r
+        "output-key-mapping": {\r
+          "vm-type": "vm_type"\r
+        },\r
+        "key-dependencies": [\r
+          "vfccustomizationuuid"\r
+        ]\r
+      }\r
+    }\r
+  }\r
 }
\ No newline at end of file
index 7f3a18f..f179957 100755 (executable)
@@ -1,15 +1,38 @@
-{
-  "name" : "vnf-id",
-  "tags" : "vnf-id",
-  "updated-by" : "Singal, Kapil <ks220y@att.com>",
-  "property" : {
-    "description" : "vnf-id",
-    "type" : "string"
-  },
-  "sources" : {
-    "input" : {
-      "type" : "source-input",
-      "properties" : { }
-    }
-  }
-}
\ No newline at end of file
+  {\r
+      "tags": "vnf-id",\r
+      "name": "vnf-id",\r
+      "property": {\r
+        "description": "vnf-id",\r
+        "type": "string"\r
+      },\r
+      "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+      "sources": {\r
+        "input": {\r
+          "type": "source-input"\r
+        },\r
+        "default": {\r
+          "type": "source-default",\r
+          "properties": {}\r
+        },\r
+        "primary-config-data": {\r
+          "type": "source-rest",\r
+          "properties": {\r
+            "type": "JSON",\r
+            "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",\r
+            "path": "/param/0/value",\r
+            "input-key-mapping": {\r
+              "service-instance-id": "service-instance-id",\r
+              "vnf-id": "vnf-id"\r
+            },\r
+            "output-key-mapping": {\r
+              "vnf-id": "value"\r
+            },\r
+            "key-dependencies": [\r
+              "service-instance-id",\r
+              "vnf-id"\r
+            ]\r
+          }\r
+        }\r
+      }\r
+    }\r
+  
\ No newline at end of file
index 4c0320a..09b7380 100755 (executable)
@@ -1,28 +1,55 @@
-{
-  "name" : "vnf-name",
-  "tags" : "vnf-name, tosca.datatypes.Root, data_type",
-  "updated-by" : "Singal, Kapil <ks220y@att.com>",
-  "property" : {
-    "description" : "vnf-name",
-    "type" : "string"
-  },
-  "sources" : {
-    "primary-config-data" : {
-      "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",
-        "path" : "/param/0/value",
-        "expression-type" : "JSON_POINTER",
-        "input-key-mapping" : {
-          "service-instance-id" : "service-instance-id",
-          "vnf-id" : "vnf-id"
-        },
-        "output-key-mapping" : {
-          "vnf-name" : "value"
-        },
-        "key-dependencies" : [ "service-instance-id", "vnf-id" ]
-      }
-    }
-  }
+{\r
+  "tags": "vnf-name",\r
+  "name": "vnf-name",\r
+  "property": {\r
+    "description": "vnf-name",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-name": "vnf-name"\r
+        },\r
+        "output-key-mapping": {\r
+          "vnf-name": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-name"\r
+        ]\r
+      }\r
+    },\r
+    "primary-aai-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "verb": "GET",\r
+        "url-path": "/aai/v14/network/generic-vnfs/generic-vnf/$vnf-id",\r
+        "path": "",\r
+        "input-key-mapping": {\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "vnf-name": "vnf-name"\r
+        },\r
+        "key-dependencies": [\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    }\r
+  }\r
 }
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vnf_id.json b/components/model-catalog/resource-dictionary/starter-dictionary/vnf_id.json
new file mode 100644 (file)
index 0000000..7afb3bf
--- /dev/null
@@ -0,0 +1,19 @@
+ {\r
+      "tags": "vnf_id",\r
+      "name": "vnf_id",\r
+      "property": {\r
+        "description": "vnf_id",\r
+        "type": "string"\r
+      },\r
+      "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+      "sources": {\r
+        "input": {\r
+          "type": "source-input"\r
+        },\r
+        "default": {\r
+          "type": "source-default",\r
+          "properties": {}\r
+        }\r
+      }\r
+    \r
+  }
\ No newline at end of file
index 40604cc..855ca22 100755 (executable)
@@ -1,25 +1,35 @@
-{
-  "name" : "vnfc-model-invariant-uuid",
-  "tags" : "vnfc-model-invariant-uuid",
-  "updated-by" : "Singal, Kapil <ks220y@att.com>",
-  "property" : {
-    "description" : "vnfc-model-invariant-uuid for SRIOV VPE template",
-    "type" : "string"
-  },
-  "sources" : {
-    "processor-db" : {
-      "type" : "source-processor-db",
-      "properties" : {
-        "type" : "SQL",
-        "query" : "select VFC_MODEL.invariant_uuid as vfc_invariant_uuid from VFC_MODEL where customization_uuid=:vfccustomizationuuid",
-        "input-key-mapping" : {
-          "vfccustomizationuuid" : "vfccustomizationuuid"
-        },
-        "output-key-mapping" : {
-          "vnfc-model-invariant-uuid" : "vfc_invariant_uuid"
-        },
-        "key-dependencies" : [ "vfccustomizationuuid" ]
-      }
-    }
-  }
+{\r
+  "tags": "vnfc-model-invariant-uuid",\r
+  "name": "vnfc-model-invariant-uuid",\r
+  "property": {\r
+    "description": "vnfc-model-invariant-uuid",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "processor-db": {\r
+      "type": "source-processor-db",\r
+      "properties": {\r
+        "endpoint-selector": "dynamic-db-source",\r
+        "type": "SQL",\r
+        "query": "select VFC_MODEL.invariant_uuid as vfc_invariant_uuid from VFC_MODEL where customization_uuid=:vfccustomizationuuid",\r
+        "input-key-mapping": {\r
+          "vfccustomizationuuid": "vfccustomizationuuid"\r
+        },\r
+        "output-key-mapping": {\r
+          "vnfc-model-invariant-uuid": "vfc_invariant_uuid"\r
+        },\r
+        "key-dependencies": [\r
+          "vfccustomizationuuid"\r
+        ]\r
+      }\r
+    }\r
+  }\r
 }
\ No newline at end of file
index 75bb2e5..b6027fe 100755 (executable)
@@ -1,25 +1,35 @@
-{
-  "name" : "vnfc-model-version",
-  "tags" : "vnfc-model-version",
-  "updated-by" : "Singal, Kapil <ks220y@att.com>",
-  "property" : {
-    "description" : "vnfc-model-version for  SRIOV VPE template",
-    "type" : "string"
-  },
-  "sources" : {
-    "processor-db" : {
-      "type" : "source-processor-db",
-      "properties" : {
-        "type" : "SQL",
-        "query" : "select VFC_MODEL.version as vnfc_model_version from VFC_MODEL where customization_uuid=:vfccustomizationuuid",
-        "input-key-mapping" : {
-          "vfccustomizationuuid" : "vfccustomizationuuid"
-        },
-        "output-key-mapping" : {
-          "vnfc-model-version" : "vnfc_model_version"
-        },
-        "key-dependencies" : [ "vfccustomizationuuid" ]
-      }
-    }
-  }
+{\r
+  "tags": "vnfc-model-version",\r
+  "name": "vnfc-model-version",\r
+  "property": {\r
+    "description": "vnfc-model-version",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "processor-db": {\r
+      "type": "source-processor-db",\r
+      "properties": {\r
+        "endpoint-selector": "dynamic-db-source",\r
+        "type": "SQL",\r
+        "query": "select VFC_MODEL.version as vnfc_model_version from VFC_MODEL where customization_uuid=:vfccustomizationuuid",\r
+        "input-key-mapping": {\r
+          "vfccustomizationuuid": "vfccustomizationuuid"\r
+        },\r
+        "output-key-mapping": {\r
+          "vnfc-model-version": "vnfc_model_version"\r
+        },\r
+        "key-dependencies": [\r
+          "vfccustomizationuuid"\r
+        ]\r
+      }\r
+    }\r
+  }\r
 }
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vpg_flavor_name.json b/components/model-catalog/resource-dictionary/starter-dictionary/vpg_flavor_name.json
new file mode 100644 (file)
index 0000000..6a4b1bc
--- /dev/null
@@ -0,0 +1,37 @@
+{\r
+  "tags": "vpg_flavor_name",\r
+  "name": "vpg_flavor_name",\r
+  "property": {\r
+    "description": "vpg_flavor_name",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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/vpg_flavor_name",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "vpg_flavor_name": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vpg_image_name.json b/components/model-catalog/resource-dictionary/starter-dictionary/vpg_image_name.json
new file mode 100644 (file)
index 0000000..cfeab71
--- /dev/null
@@ -0,0 +1,37 @@
+{\r
+  "tags": "vpg_image_name",\r
+  "name": "vpg_image_name",\r
+  "property": {\r
+    "description": "vpg_image_name",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "MALAKOV, YURIY <yuriy.malakov@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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/vpg_image_name",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "vpg_image_name": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vpg_int_pktgen_private_ip_0.json b/components/model-catalog/resource-dictionary/starter-dictionary/vpg_int_pktgen_private_ip_0.json
new file mode 100644 (file)
index 0000000..d35cc1e
--- /dev/null
@@ -0,0 +1,37 @@
+{\r
+  "tags": "vpg_int_pktgen_private_ip_0",\r
+  "name": "vpg_int_pktgen_private_ip_0",\r
+  "property": {\r
+    "description": "vpg_int_pktgen_private_ip_0",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "Singal, Kapil <ks220y@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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/vpg_int_pktgen_private_ip_0",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "vpg_int_pktgen_private_ip_0": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vpg_onap_private_ip_0.json b/components/model-catalog/resource-dictionary/starter-dictionary/vpg_onap_private_ip_0.json
new file mode 100644 (file)
index 0000000..b6865ac
--- /dev/null
@@ -0,0 +1,37 @@
+{\r
+  "tags": "vpg_onap_private_ip_0",\r
+  "name": "vpg_onap_private_ip_0",\r
+  "property": {\r
+    "description": "vpg_onap_private_ip_0",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "Singal, Kapil <ks220y@att.com>",\r
+  "sources": {\r
+    "input": {\r
+      "type": "source-input"\r
+    },\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {}\r
+    },\r
+    "primary-config-data": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "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/vpg_onap_private_ip_0",\r
+        "path": "/param/0/value",\r
+        "input-key-mapping": {\r
+          "service-instance-id": "service-instance-id",\r
+          "vnf-id": "vnf-id"\r
+        },\r
+        "output-key-mapping": {\r
+          "vpg_onap_private_ip_0": "value"\r
+        },\r
+        "key-dependencies": [\r
+          "service-instance-id",\r
+          "vnf-id"\r
+        ]\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
index a2bb090..06726ad 100755 (executable)
             <groupId>org.onap.ccsdk.cds.blueprintsprocessor.functions</groupId>
             <artifactId>restconf-executor</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.onap.ccsdk.cds.blueprintsprocessor.functions</groupId>
+            <artifactId>cli-executor</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
             <artifactId>selfservice-api</artifactId>
index 2b90998..e34c024 100755 (executable)
@@ -47,10 +47,11 @@ blueprintsprocessor.restconfEnabled=true
 blueprintsprocessor.restclient.sdncodl.type=basic-auth\r
 blueprintsprocessor.restclient.sdncodl.url=http://localhost:8282/\r
 blueprintsprocessor.restclient.sdncodl.username=admin\r
-blueprintsprocessor.restclient.sdncodl.password=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U
-
-# Executor Options
-blueprintprocessor.resourceResolution.enabled=true
-blueprintprocessor.netconfExecutor.enabled=true
-blueprintprocessor.restConfExecutor.enabled=true
+blueprintsprocessor.restclient.sdncodl.password=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U\r
+\r
+# Executor Options\r
+blueprintprocessor.resourceResolution.enabled=true\r
+blueprintprocessor.netconfExecutor.enabled=true\r
+blueprintprocessor.restConfExecutor.enabled=true\r
+blueprintsprocessor.cliExecutor.enabled=true\r
 blueprintprocessor.remoteScriptCommand.enabled=false
\ No newline at end of file
index e5b1fe5..1e0b4b8 100755 (executable)
@@ -51,6 +51,7 @@ blueprintsprocessor.restclient.sdncodl.password=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84v
 blueprintprocessor.resourceResolution.enabled=true
 blueprintprocessor.netconfExecutor.enabled=true
 blueprintprocessor.restConfExecutor.enabled=true
+blueprintsprocessor.cliExecutor.enabled=true
 blueprintprocessor.remoteScriptCommand.enabled=true
 
 blueprintsprocessor.grpcclient.remote-python.type=token-auth
index 7e462f2..09ee651 100644 (file)
@@ -44,4 +44,5 @@ security.user.name:ccsdkapps
 blueprintprocessor.resourceResolution.enabled=true
 blueprintprocessor.netconfExecutor.enabled=true
 blueprintprocessor.restConfExecutor.enabled=true
+blueprintsprocessor.cliExecutor.enabled=true
 blueprintprocessor.remoteScriptCommand.enabled=false
index af76d12..0dd2737 100644 (file)
         <version>0.5.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
+    <groupId>org.onap.ccsdk.cds.blueprintsprocessor.functions</groupId>
     <artifactId>cli-executor</artifactId>
     <name>Blueprints Processor Function - CLI Executor</name>
     <description>Blueprints Processor Function - CLI Executor</description>
 
     <dependencies>
         <dependency>
-            <groupId>org.apache.sshd</groupId>
-            <artifactId>sshd-core</artifactId>
+            <groupId>org.onap.ccsdk.cds.blueprintsprocessor.functions</groupId>
+            <artifactId>resource-resolution</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+            <artifactId>ssh-lib</artifactId>
         </dependency>
-
     </dependencies>
 
 
diff --git a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliComponentFunction.kt b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliComponentFunction.kt
new file mode 100644 (file)
index 0000000..c7f35f7
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ *  Copyright Â© 2019 IBM.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor
+
+import kotlinx.coroutines.runBlocking
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionService
+import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction
+import org.onap.ccsdk.cds.blueprintsprocessor.ssh.SshLibConstants
+import org.onap.ccsdk.cds.blueprintsprocessor.ssh.service.BluePrintSshLibPropertyService
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
+import org.onap.ccsdk.cds.controllerblueprints.core.readNBLines
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintTemplateService
+
+abstract class CliComponentFunction : AbstractScriptComponentFunction() {
+
+    open fun bluePrintSshLibPropertyService(): BluePrintSshLibPropertyService =
+            functionDependencyInstanceAsType(SshLibConstants.SERVICE_BLUEPRINT_SSH_LIB_PROPERTY)
+
+    open fun resourceResolutionService(): ResourceResolutionService =
+            functionDependencyInstanceAsType(ResourceResolutionConstants.SERVICE_RESOURCE_RESOLUTION)
+
+
+    open suspend fun readCommandLinesFromArtifact(artifactName: String): List<String> {
+        val artifactDefinition = bluePrintRuntimeService.resolveNodeTemplateArtifactDefinition(nodeTemplateName, artifactName)
+        val file = normalizedFile(bluePrintRuntimeService.bluePrintContext().rootPath, artifactDefinition.file)
+        return file.readNBLines()
+    }
+
+    suspend fun generateMessage(artifactName: String, json: String): String {
+        val templateService = BluePrintTemplateService()
+        return templateService.generateContent(bluePrintRuntimeService, nodeTemplateName, artifactName, json, true)
+    }
+
+
+    fun generateMessage(artifactName: String): String {
+        return bluePrintRuntimeService.resolveNodeTemplateArtifact(nodeTemplateName, artifactName)
+    }
+
+    fun resolveFromDatabase(resolutionKey: String, artifactName: String): String = runBlocking {
+        resourceResolutionService().resolveFromDatabase(bluePrintRuntimeService, artifactName, resolutionKey)
+    }
+
+    fun resolveAndGenerateMessage(artifactMapping: String, artifactTemplate: String): String = runBlocking {
+        resourceResolutionService().resolveResources(bluePrintRuntimeService, nodeTemplateName,
+                artifactMapping, artifactTemplate)
+    }
+
+    fun resolveAndGenerateMessage(artifactPrefix: String): String = runBlocking {
+        resourceResolutionService().resolveResources(bluePrintRuntimeService, nodeTemplateName,
+                artifactPrefix, mapOf())
+    }
+}
\ No newline at end of file
index f930206..13afc58 100644 (file)
 
 package org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor
 
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
+import org.springframework.boot.context.properties.EnableConfigurationProperties
+import org.springframework.context.annotation.ComponentScan
 import org.springframework.context.annotation.Configuration
 
 @Configuration
+@ComponentScan
+@EnableConfigurationProperties
+@ConditionalOnProperty(name = ["blueprintsprocessor.cliExecutor.enabled"], havingValue = "true")
 open class CliExecutorConfiguration
\ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutor.kt b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutor.kt
new file mode 100644 (file)
index 0000000..0c1c523
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ *  Copyright Â© 2019 IBM.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor
+
+import com.fasterxml.jackson.databind.node.ArrayNode
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
+import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction
+import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentFunctionScriptingService
+import org.onap.ccsdk.cds.blueprintsprocessor.ssh.SshLibConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.getAsString
+import org.springframework.beans.factory.config.ConfigurableBeanFactory
+import org.springframework.context.annotation.Scope
+import org.springframework.stereotype.Component
+
+@Component("component-cli-executor")
+@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
+open class ComponentCliExecutor(private var componentFunctionScriptingService: ComponentFunctionScriptingService)
+    : AbstractComponentFunction() {
+
+    companion object {
+        const val SCRIPT_TYPE = "script-type"
+        const val SCRIPT_CLASS_REFERENCE = "script-class-reference"
+        const val INSTANCE_DEPENDENCIES = "instance-dependencies"
+        const val RESPONSE_DATA = "response-data"
+    }
+
+    private lateinit var scriptComponent: CliComponentFunction
+
+    override suspend fun processNB(executionRequest: ExecutionServiceInput) {
+
+        val scriptType = operationInputs.getAsString(SCRIPT_TYPE)
+        val scriptClassReference = operationInputs.getAsString(SCRIPT_CLASS_REFERENCE)
+        val instanceDependenciesNode = operationInputs[INSTANCE_DEPENDENCIES] as? ArrayNode
+
+        val scriptDependencies: MutableList<String> = arrayListOf()
+        scriptDependencies.add(SshLibConstants.SERVICE_BLUEPRINT_SSH_LIB_PROPERTY)
+        // May be injected from model, not by default
+        //scriptDependencies.add(ResourceResolutionConstants.SERVICE_RESOURCE_RESOLUTION)
+
+        instanceDependenciesNode?.forEach { instanceName ->
+            scriptDependencies.add(instanceName.textValue())
+        }
+
+        scriptComponent = componentFunctionScriptingService.scriptInstance(this, scriptType,
+                scriptClassReference, scriptDependencies)
+
+
+        // Handles both script processing and error handling
+        scriptComponent.executeScript(executionServiceInput)
+    }
+
+    override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
+        bluePrintRuntimeService.getBluePrintError()
+                .addError("Failed in ComponentCliExecutor : ${runtimeException.message}")
+
+    }
+}
\ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/scripts/InternalSimpleCli.cba.kts b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/scripts/InternalSimpleCli.cba.kts
new file mode 100644 (file)
index 0000000..18d4a47
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ *  Copyright Â© 2019 IBM.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+@file:Suppress("unused")
+
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor.CliComponentFunction
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor.ComponentCliExecutor
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.slf4j.LoggerFactory
+
+open class TestCliScriptFunction : CliComponentFunction() {
+
+    private val log = LoggerFactory.getLogger(CliComponentFunction::class.java)!!
+
+    override fun getName(): String {
+        return "SimpleCliConfigure"
+    }
+
+    override suspend fun processNB(executionRequest: ExecutionServiceInput) {
+        log.info("Executing process")
+    }
+
+    override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
+        log.info("Executing Recovery")
+    }
+}
+
+
+open class Check : CliComponentFunction() {
+
+    private val log = LoggerFactory.getLogger(CliComponentFunction::class.java)!!
+
+    override fun getName(): String {
+        return "Check"
+    }
+
+    override suspend fun processNB(executionRequest: ExecutionServiceInput) {
+        // Get the Device Information from the DSL Model
+        val deviceInformation = bluePrintRuntimeService.resolveDSLExpression("device-properties")
+
+        // Get the Client Service
+        val sshClientService = bluePrintSshLibPropertyService().blueprintSshClientService(deviceInformation)
+
+        sshClientService.startSessionNB()
+
+        // Read Commands
+        val commands = readCommandLinesFromArtifact("command-template")
+
+        // Execute multiple Commands
+        val responseLog = sshClientService.executeCommandsNB(commands, 5000)
+
+        // Close Session
+        sshClientService.closeSessionNB()
+
+        // Set the Response Data
+        setAttribute(ComponentCliExecutor.RESPONSE_DATA, responseLog.asJsonPrimitive())
+
+        log.info("Executing process")
+    }
+
+    override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
+        log.info("Executing Recovery")
+    }
+}
diff --git a/ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutorTest.kt b/ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutorTest.kt
new file mode 100644 (file)
index 0000000..6455513
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+ *  Copyright Â© 2019 IBM.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor
+
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.node.ArrayNode
+import com.fasterxml.jackson.databind.node.ObjectNode
+import io.mockk.every
+import io.mockk.mockk
+import kotlinx.coroutines.runBlocking
+import org.junit.Test
+import org.junit.runner.RunWith
+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.ActionIdentifiers
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.CommonHeader
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.StepData
+import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ExecutionServiceConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.ssh.BluePrintSshLibConfiguration
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
+import org.onap.ccsdk.cds.controllerblueprints.core.service.DefaultBluePrintRuntimeService
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
+import org.onap.ccsdk.cds.controllerblueprints.scripts.BluePrintScriptsServiceImpl
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.test.annotation.DirtiesContext
+import org.springframework.test.context.ContextConfiguration
+import org.springframework.test.context.TestPropertySource
+import org.springframework.test.context.junit4.SpringRunner
+import kotlin.test.assertNotNull
+
+@RunWith(SpringRunner::class)
+@ContextConfiguration(classes = [CliExecutorConfiguration::class,
+    ExecutionServiceConfiguration::class,
+    BluePrintSshLibConfiguration::class, BluePrintScriptsServiceImpl::class,
+    BlueprintPropertyConfiguration::class, BluePrintProperties::class])
+@DirtiesContext
+@TestPropertySource(properties = [], locations = ["classpath:application-test.properties"])
+class ComponentCliExecutorTest {
+
+    @Autowired
+    lateinit var componentCliExecutor: ComponentCliExecutor
+
+    @Test
+    fun `test CLI Component Instance`() {
+        runBlocking {
+            assertNotNull(componentCliExecutor, "failed to get ComponentCliExecutor instance")
+            val executionServiceInput = ExecutionServiceInput().apply {
+                commonHeader = CommonHeader().apply {
+                    requestId = "1234"
+                }
+                actionIdentifiers = ActionIdentifiers().apply {
+                    actionName = "activate"
+                }
+                payload = JacksonUtils.jsonNode("{}") as ObjectNode
+            }
+            val bluePrintRuntime = mockk<DefaultBluePrintRuntimeService>("1234")
+            componentCliExecutor.bluePrintRuntimeService = bluePrintRuntime
+            componentCliExecutor.stepName = "sample-step"
+
+            val operationInputs = hashMapOf<String, JsonNode>()
+            operationInputs[BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE] = "activate-cli".asJsonPrimitive()
+            operationInputs[BluePrintConstants.PROPERTY_CURRENT_INTERFACE] = "interfaceName".asJsonPrimitive()
+            operationInputs[BluePrintConstants.PROPERTY_CURRENT_OPERATION] = "operationName".asJsonPrimitive()
+            operationInputs[ComponentCliExecutor.SCRIPT_TYPE] = BluePrintConstants.SCRIPT_INTERNAL.asJsonPrimitive()
+            operationInputs[ComponentCliExecutor.SCRIPT_CLASS_REFERENCE] =
+                    "InternalSimpleCli_cba\$TestCliScriptFunction".asJsonPrimitive()
+            operationInputs[ComponentCliExecutor.INSTANCE_DEPENDENCIES] = JacksonUtils.jsonNode("[]") as ArrayNode
+
+            val stepInputData = StepData().apply {
+                name = "activate-cli"
+                properties = operationInputs
+            }
+            executionServiceInput.stepData = stepInputData
+
+            val blueprintContext = mockk<BluePrintContext>()
+            every { bluePrintRuntime.bluePrintContext() } returns blueprintContext
+            every {
+                bluePrintRuntime.resolveNodeTemplateInterfaceOperationInputs("activate-cli",
+                        "interfaceName", "operationName")
+            } returns operationInputs
+
+            val operationOutputs = hashMapOf<String, JsonNode>()
+            every {
+                bluePrintRuntime.resolveNodeTemplateInterfaceOperationOutputs("activate-cli",
+                        "interfaceName", "operationName")
+            } returns operationOutputs
+
+            componentCliExecutor.applyNB(executionServiceInput)
+        }
+    }
+}
\ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/service/CliExecutorServiceImplTest.kt b/ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/service/CliExecutorServiceImplTest.kt
deleted file mode 100644 (file)
index 51dd62c..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *  Copyright Â© 2019 IBM.
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor.service
-
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor.api.CliExecutorService
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.test.context.ContextConfiguration
-import org.springframework.test.context.junit4.SpringRunner
-import kotlin.test.assertNotNull
-
-@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [CliExecutorServiceImpl::class])
-class CliExecutorServiceImplTest {
-
-    @Autowired
-    lateinit var cliExecutorService: CliExecutorService
-
-    @Test
-    fun testCliExecutorService() {
-        assertNotNull(cliExecutorService, "failed to intilise cliExecutorService")
-    }
-}
\ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/cli-executor/src/test/resources/application-test.properties b/ms/blueprintsprocessor/functions/cli-executor/src/test/resources/application-test.properties
new file mode 100644 (file)
index 0000000..34e07e0
--- /dev/null
@@ -0,0 +1,18 @@
+#
+#  Copyright Â© 2019 IBM.
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+
+# Executor Options
+blueprintsprocessor.cliExecutor.enabled=true
\ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfExecutorConfiguration.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfExecutorConfiguration.kt
new file mode 100644 (file)
index 0000000..77a2d3b
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ *  Copyright Â© 2019 IBM.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor
+
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
+import org.springframework.boot.context.properties.EnableConfigurationProperties
+import org.springframework.context.annotation.ComponentScan
+import org.springframework.context.annotation.Configuration
+
+@Configuration
+@ComponentScan
+@EnableConfigurationProperties
+@ConditionalOnProperty(name = ["blueprintprocessor.netconfExecutor.enabled"], havingValue = "true")
+open class NetconfExecutorConfiguration
\ No newline at end of file
index 6d8b62f..527eb8a 100644 (file)
@@ -30,3 +30,6 @@ blueprintsprocessor.blueprintArchivePath=./target/blueprints/archive
 # Python executor
 blueprints.processor.functions.python.executor.executionPath=./../../../../components/scripts/python/ccsdk_blueprints
 blueprints.processor.functions.python.executor.modulePaths=./../../../../components/scripts/python/ccsdk_blueprints
+
+# Executor Options
+blueprintprocessor.netconfExecutor.enabled=true
\ No newline at end of file
index 5106225..ebff478 100644 (file)
@@ -46,10 +46,10 @@ interface ResourceResolutionService {
                                  artifactNames: List<String>, properties: Map<String, Any>): MutableMap<String, String>
 
     suspend fun resolveResources(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String,
-                                               artifactPrefix: String, properties: Map<String, Any>): String
+                                 artifactPrefix: String, properties: Map<String, Any>): String
 
     suspend fun resolveResources(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String,
-                                                  artifactMapping: String, artifactTemplate: String?): String
+                                 artifactMapping: String, artifactTemplate: String?): String
 
     suspend fun resolveResourceAssignments(blueprintRuntimeService: BluePrintRuntimeService<*>,
                                            resourceDefinitions: MutableMap<String, ResourceDefinition>,
@@ -89,7 +89,7 @@ open class ResourceResolutionServiceImpl(private var applicationContext: Applica
     }
 
     override suspend fun resolveResources(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String,
-                                                        artifactPrefix: String, properties: Map<String, Any>): String {
+                                          artifactPrefix: String, properties: Map<String, Any>): String {
 
         // Velocity Artifact Definition Name
         val artifactTemplate = "$artifactPrefix-template"
@@ -110,7 +110,7 @@ open class ResourceResolutionServiceImpl(private var applicationContext: Applica
 
 
     override suspend fun resolveResources(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String,
-                                                           artifactMapping: String, artifactTemplate: String?): String {
+                                          artifactMapping: String, artifactTemplate: String?): String {
 
         val resolvedContent: String
         log.info("Resolving resource for template artifact($artifactTemplate) with resource assignment artifact($artifactMapping)")
@@ -137,11 +137,9 @@ open class ResourceResolutionServiceImpl(private var applicationContext: Applica
 
         // Check Template is there
         if (artifactTemplate != null) {
-            val blueprintTemplateService = BluePrintTemplateService(bluePrintRuntimeService, nodeTemplateName, artifactTemplate)
-            val templateContent =
-                    bluePrintRuntimeService.resolveNodeTemplateArtifact(nodeTemplateName, artifactTemplate)
-
-            resolvedContent = blueprintTemplateService.generateContent(templateContent, resolvedParamJsonContent)
+            val blueprintTemplateService = BluePrintTemplateService()
+            resolvedContent = blueprintTemplateService.generateContent(bluePrintRuntimeService, nodeTemplateName,
+                    artifactTemplate, resolvedParamJsonContent)
 
         } else {
             resolvedContent = resolvedParamJsonContent
index e8b61a8..987390f 100644 (file)
@@ -124,7 +124,8 @@ open class DatabaseResourceAssignmentProcessor(private val bluePrintDBLibPropert
         checkNotEmpty(resourceAssignment.dictionaryName) {
             "resource assignment dictionary name is not defined for template key (${resourceAssignment.name})"
         }
-        checkEquals(ResourceDictionaryConstants.SOURCE_PROCESSOR_DB, resourceAssignment.dictionarySource) {
+        check(resourceAssignment.dictionarySource in arrayOf(ResourceDictionaryConstants.SOURCE_PROCESSOR_DB, ResourceDictionaryConstants.SOURCE_PRIMARY_DB))
+        {
             "resource assignment source is not ${ResourceDictionaryConstants.SOURCE_PROCESSOR_DB} but it is ${resourceAssignment.dictionarySource}"
         }
     }
index 8dbd47c..1cc44a2 100644 (file)
@@ -25,9 +25,9 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.util
 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonNode
 import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintFunctionNode
 import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintVelocityTemplateService
-import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
 import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
 import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
 import org.slf4j.LoggerFactory
@@ -67,25 +67,24 @@ abstract class ResourceAssignmentProcessor : BlueprintFunctionNode<ResourceAssig
                 ?: throw BluePrintProcessorException("couldn't get resource definition for ($name)")
     }
 
-    open fun resolveInputKeyMappingVariables(inputKeyMapping: Map<String, String>): Map<String, Any> {
-        val resolvedInputKeyMapping = HashMap<String, Any>()
+    open fun resolveInputKeyMappingVariables(inputKeyMapping: Map<String, String>): Map<String, JsonNode> {
+        val resolvedInputKeyMapping = HashMap<String, JsonNode>()
         if (MapUtils.isNotEmpty(inputKeyMapping)) {
             for ((key, value) in inputKeyMapping) {
                 val resultValue = raRuntimeService.getResolutionStore(value)
-                val expressionValue = JacksonUtils.getValue(resultValue)
-                log.trace("Reference dictionary key ({}), value ({})", key, expressionValue)
-                resolvedInputKeyMapping[key] = expressionValue
+                resolvedInputKeyMapping[key] = resultValue
             }
         }
         return resolvedInputKeyMapping
     }
 
-    open suspend fun resolveFromInputKeyMapping(valueToResolve: String, keyMapping: MutableMap<String, Any>):
+    open suspend fun resolveFromInputKeyMapping(valueToResolve: String, keyMapping: MutableMap<String, JsonNode>):
             String {
         if (valueToResolve.isEmpty() || !valueToResolve.contains("$")) {
             return valueToResolve
         }
-        return BluePrintVelocityTemplateService.generateContent(valueToResolve, additionalContext = keyMapping)
+        //TODO("Optimize to JSON Node directly without velocity").asJsonNode().toString()
+        return BluePrintVelocityTemplateService.generateContent(valueToResolve, keyMapping.asJsonNode().toString())
     }
 
     final override suspend fun applyNB(resourceAssignment: ResourceAssignment): Boolean {
index 656e861..1a943d1 100644 (file)
@@ -21,6 +21,7 @@ import com.fasterxml.jackson.databind.JsonNode
 import com.fasterxml.jackson.databind.ObjectMapper
 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
 import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants
 import org.onap.ccsdk.cds.controllerblueprints.core.*
@@ -122,7 +123,7 @@ class ResourceAssignmentUtils {
                     if (isNotEmpty(it.name) && it.property != null) {
                         val rName = it.name
                         val type = nullToEmpty(it.property?.type).toLowerCase()
-                        val value = it.property?.value
+                        val value = useDefaultValueIfNull(it, rName)
                         logger.info("Generating Resource name ($rName), type ($type), value ($value)")
                         root.set(rName, value)
                     }
@@ -136,6 +137,15 @@ class ResourceAssignmentUtils {
             return result
         }
 
+        private fun useDefaultValueIfNull(resourceAssignment: ResourceAssignment, resourceAssignmentName: String): JsonNode {
+            if (resourceAssignment.property?.value == null) {
+                val defaultValue = "\${$resourceAssignmentName}"
+                return TextNode(defaultValue)
+            } else {
+                return resourceAssignment.property!!.value!!
+            }
+        }
+
         fun transformToRARuntimeService(blueprintRuntimeService: BluePrintRuntimeService<*>,
                                         templateArtifactName: String): ResourceAssignmentRuntimeService {
 
index eb2a7a7..be02330 100644 (file)
@@ -15,6 +15,7 @@
  */
 package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.mock
 
+import com.fasterxml.jackson.databind.JsonNode
 import com.fasterxml.jackson.databind.node.ArrayNode
 import com.fasterxml.jackson.databind.node.MissingNode
 import org.apache.commons.collections.MapUtils
@@ -22,23 +23,27 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.Reso
 import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.RestResourceSource
 import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor
 import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils
-import org.onap.ccsdk.cds.controllerblueprints.core.*
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.nullToEmpty
 import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
 import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
 import org.slf4j.LoggerFactory
-import java.util.HashMap
+import java.util.*
 
 class MockRestResourceResolutionProcessor(private val blueprintRestLibPropertyService:
-                                          MockBluePrintRestLibPropertyService): ResourceAssignmentProcessor() {
+                                          MockBluePrintRestLibPropertyService) : ResourceAssignmentProcessor() {
 
     private val logger = LoggerFactory.getLogger(MockRestResourceResolutionProcessor::class.java)
 
-    override fun resolveInputKeyMappingVariables(inputKeyMapping: Map<String, String>): Map<String, Any> {
-        val resolvedInputKeyMapping = HashMap<String, Any>()
+    override fun resolveInputKeyMappingVariables(inputKeyMapping: Map<String, String>): Map<String, JsonNode> {
+        val resolvedInputKeyMapping = HashMap<String, JsonNode>()
         if (MapUtils.isNotEmpty(inputKeyMapping)) {
-            resolvedInputKeyMapping["service-instance-id"] = "10"
-            resolvedInputKeyMapping["vnf_name"] = "vnf1"
-            resolvedInputKeyMapping["vnf-id"] = "123456"
+
+            resolvedInputKeyMapping["service-instance-id"] = "10".asJsonPrimitive()
+            resolvedInputKeyMapping["vnf_name"] = "vnf1".asJsonPrimitive()
+            resolvedInputKeyMapping["vnf-id"] = "123456".asJsonPrimitive()
         }
         return resolvedInputKeyMapping
     }
index 89674ea..f73197e 100644 (file)
@@ -49,7 +49,7 @@ class DatabaseResourceResolutionProcessorTest {
     lateinit var databaseResourceAssignmentProcessor: DatabaseResourceAssignmentProcessor
 
     @Test
-    fun `test database resource resolution`() {
+    fun `test database resource resolution processor db`() {
         runBlocking {
             val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext(
                     "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
@@ -74,4 +74,31 @@ class DatabaseResourceResolutionProcessorTest {
             println(processorName)
         }
     }
+
+    @Test
+    fun `test database resource resolution primary db`() {
+        runBlocking {
+            val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext(
+                    "./../../../../components/model-catalog/blueprint-model/test-blueprint/capability_python")
+
+            val resourceAssignmentRuntimeService = ResourceAssignmentRuntimeService("1234", bluePrintContext)
+
+            databaseResourceAssignmentProcessor.raRuntimeService = resourceAssignmentRuntimeService
+            databaseResourceAssignmentProcessor.resourceDictionaries = ResourceAssignmentUtils
+                    .resourceDefinitions(bluePrintContext.rootPath)
+
+            val resourceAssignment = ResourceAssignment().apply {
+                name = "service-instance-id"
+                dictionaryName = "service-instance-id"
+                dictionarySource = "primary-db"
+                property = PropertyDefinition().apply {
+                    type = "string"
+                }
+            }
+
+            val processorName = databaseResourceAssignmentProcessor.applyNB(resourceAssignment)
+            assertNotNull(processorName, "couldn't get Database resource assignment processor name")
+            println(processorName)
+        }
+    }
 }
\ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt
new file mode 100644 (file)
index 0000000..9b87c12
--- /dev/null
@@ -0,0 +1,79 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+
+package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils
+
+import com.fasterxml.jackson.databind.node.TextNode
+import org.junit.Test
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
+import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
+import kotlin.test.assertEquals
+
+class ResourceAssignmentUtilsTest {
+
+    @Test
+    fun `generateResourceDataForAssignments - positive test`() {
+        //given a valid resource assignment
+        val validResourceAssignment = createResourceAssignmentForTest("valid_value")
+
+        //and a list containing that resource assignment
+        val resourceAssignmentList = listOf<ResourceAssignment>(validResourceAssignment)
+
+        //when the values of the resources are evaluated
+        val outcome = ResourceAssignmentUtils.generateResourceDataForAssignments(resourceAssignmentList)
+
+        //then the assignment should produce a valid result
+        val expected = "{\n" + "  \"pnf-id\" : \"valid_value\"\n" + "}"
+        assertEquals(expected, outcome, "unexpected outcome generated")
+
+    }
+
+    @Test
+    fun `generateResourceDataForAssignments - resource without value is not resolved as null`() {
+        //given a valid resource assignment
+        val resourceAssignmentWithNullValue = createResourceAssignmentForTest(null)
+
+        //and a list containing that resource assignment
+        val resourceAssignmentList = listOf<ResourceAssignment>(resourceAssignmentWithNullValue)
+
+        //when the values of the resources are evaluated
+        val outcome = ResourceAssignmentUtils.generateResourceDataForAssignments(resourceAssignmentList)
+
+        //then the assignment should produce a valid result
+        val expected = "{\n" + "  \"pnf-id\" : \"\${pnf-id}\"\n" + "}"
+        assertEquals(expected, outcome, "unexpected outcome generated")
+
+    }
+
+    private fun createResourceAssignmentForTest(resourceValue: String?): ResourceAssignment {
+        val valueForTest = if (resourceValue == null) null else TextNode(resourceValue)
+        val resourceAssignmentForTest = ResourceAssignment().apply {
+            name = "pnf-id"
+            dictionaryName = "pnf-id"
+            dictionarySource = "input"
+            property = PropertyDefinition().apply {
+                type = "string"
+                value = valueForTest
+            }
+        }
+        return resourceAssignmentForTest
+    }
+}
\ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/message-lib/pom.xml
new file mode 100644 (file)
index 0000000..d423dfd
--- /dev/null
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~  Copyright Â© 2019 IBM.
+  ~
+  ~  Licensed under the Apache License, Version 2.0 (the "License");
+  ~  you may not use this file except in compliance with the License.
+  ~  You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~  Unless required by applicable law or agreed to in writing, software
+  ~  distributed under the License is distributed on an "AS IS" BASIS,
+  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~  See the License for the specific language governing permissions and
+  ~  limitations under the License.
+  -->
+
+<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">
+    <parent>
+        <artifactId>commons</artifactId>
+        <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+        <version>0.5.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>message-lib</artifactId>
+    <name>Blueprints Processor Messaging Lib</name>
+    <description>Blueprints Processor Messaging Lib</description>
+    <dependencies>
+        <dependency>
+            <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
+            <artifactId>blueprint-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+            <artifactId>processor-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.kafka</groupId>
+            <artifactId>spring-kafka</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.kafka</groupId>
+            <artifactId>spring-kafka-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>
\ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibConfiguration.kt
new file mode 100644 (file)
index 0000000..644c518
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ *  Copyright Â© 2019 IBM.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.onap.ccsdk.cds.blueprintsprocessor.message
+
+
+import org.springframework.boot.context.properties.EnableConfigurationProperties
+import org.springframework.context.annotation.ComponentScan
+import org.springframework.context.annotation.Configuration
+
+@Configuration
+@ComponentScan
+@EnableConfigurationProperties
+open class BluePrintMessageLibConfiguration
+
+class MessageLibConstants {
+    companion object {
+        const val SERVICE_BLUEPRINT_MESSAGE_LIB_PROPERTY = "blueprint-message-lib-property-service"
+        const val PROPERTY_MESSAGE_CLIENT_PREFIX = "blueprintsprocessor.messageclient."
+        const val TYPE_KAFKA_BASIC_AUTH = "kafka-basic-auth"
+    }
+}
\ No newline at end of file
  *  limitations under the License.
  */
 
-package org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor.api
+package org.onap.ccsdk.cds.blueprintsprocessor.message
 
-interface CliExecutorService {
 
+open class MessageProducerProperties
 
+
+open class KafkaBasicAuthMessageProducerProperties : MessageProducerProperties() {
+    lateinit var bootstrapServers: String
+    var topic: String? = null
+    var clientId: String? = null
 }
\ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BluePrintMessageLibPropertyService.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BluePrintMessageLibPropertyService.kt
new file mode 100644 (file)
index 0000000..fb01ce1
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ *  Copyright Â© 2019 IBM.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.onap.ccsdk.cds.blueprintsprocessor.message.service
+
+import com.fasterxml.jackson.databind.JsonNode
+import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.message.KafkaBasicAuthMessageProducerProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.message.MessageLibConstants
+import org.onap.ccsdk.cds.blueprintsprocessor.message.MessageProducerProperties
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
+import org.springframework.stereotype.Service
+
+@Service(MessageLibConstants.SERVICE_BLUEPRINT_MESSAGE_LIB_PROPERTY)
+open class BluePrintMessageLibPropertyService(private var bluePrintProperties: BluePrintProperties) {
+
+    fun blueprintMessageClientService(jsonNode: JsonNode): BlueprintMessageProducerService {
+        val messageClientProperties = messageClientProperties(jsonNode)
+        return blueprintMessageClientService(messageClientProperties)
+    }
+
+    fun blueprintMessageClientService(selector: String): BlueprintMessageProducerService {
+        val prefix = "${MessageLibConstants.PROPERTY_MESSAGE_CLIENT_PREFIX}$selector"
+        val messageClientProperties = messageClientProperties(prefix)
+        return blueprintMessageClientService(messageClientProperties)
+    }
+
+    fun messageClientProperties(prefix: String): MessageProducerProperties {
+        val type = bluePrintProperties.propertyBeanType("$prefix.type", String::class.java)
+        return when (type) {
+            MessageLibConstants.TYPE_KAFKA_BASIC_AUTH -> {
+                kafkaBasicAuthMessageClientProperties(prefix)
+            }
+            else -> {
+                throw BluePrintProcessorException("Message adaptor($type) is not supported")
+            }
+        }
+    }
+
+    fun messageClientProperties(jsonNode: JsonNode): MessageProducerProperties {
+        val type = jsonNode.get("type").textValue()
+        return when (type) {
+            MessageLibConstants.TYPE_KAFKA_BASIC_AUTH -> {
+                JacksonUtils.readValue(jsonNode, KafkaBasicAuthMessageProducerProperties::class.java)!!
+            }
+            else -> {
+                throw BluePrintProcessorException("Message adaptor($type) is not supported")
+            }
+        }
+    }
+
+    private fun blueprintMessageClientService(MessageProducerProperties: MessageProducerProperties)
+            : BlueprintMessageProducerService {
+
+        when (MessageProducerProperties) {
+            is KafkaBasicAuthMessageProducerProperties -> {
+                return KafkaBasicAuthMessageProducerService(MessageProducerProperties)
+            }
+            else -> {
+                throw BluePrintProcessorException("couldn't get Message client service for")
+            }
+        }
+    }
+
+    private fun kafkaBasicAuthMessageClientProperties(prefix: String): KafkaBasicAuthMessageProducerProperties {
+        return bluePrintProperties.propertyBeanType(
+                prefix, KafkaBasicAuthMessageProducerProperties::class.java)
+    }
+
+}
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerService.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerService.kt
new file mode 100644 (file)
index 0000000..e33d41c
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ *  Copyright Â© 2019 IBM.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.onap.ccsdk.cds.blueprintsprocessor.message.service
+
+import kotlinx.coroutines.runBlocking
+
+interface BlueprintMessageProducerService {
+
+    fun sendMessage(message: Any): Boolean = runBlocking {
+        sendMessageNB(message)
+    }
+
+    fun sendMessage(topic: String, message: Any): Boolean = runBlocking {
+        sendMessageNB(topic, message)
+    }
+
+    suspend fun sendMessageNB(message: Any): Boolean
+
+    suspend fun sendMessageNB(topic: String, message: Any): Boolean
+}
\ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaBasicAuthMessageProducerService.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaBasicAuthMessageProducerService.kt
new file mode 100644 (file)
index 0000000..52ac346
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ *  Copyright Â© 2019 IBM.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.onap.ccsdk.cds.blueprintsprocessor.message.service
+
+import org.apache.kafka.clients.producer.ProducerConfig.*
+import org.apache.kafka.common.serialization.StringSerializer
+import org.onap.ccsdk.cds.blueprintsprocessor.message.KafkaBasicAuthMessageProducerProperties
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType
+import org.slf4j.LoggerFactory
+import org.springframework.kafka.core.DefaultKafkaProducerFactory
+import org.springframework.kafka.core.KafkaTemplate
+import org.springframework.kafka.core.ProducerFactory
+import org.springframework.kafka.support.SendResult
+import org.springframework.util.concurrent.ListenableFutureCallback
+
+
+class KafkaBasicAuthMessageProducerService(
+        private val messageProducerProperties: KafkaBasicAuthMessageProducerProperties)
+    : BlueprintMessageProducerService {
+
+    private val log = LoggerFactory.getLogger(KafkaBasicAuthMessageProducerService::class.java)!!
+
+    private var kafkaTemplate: KafkaTemplate<String, Any>? = null
+
+    override suspend fun sendMessageNB(message: Any): Boolean {
+        checkNotNull(messageProducerProperties.topic) { "default topic is not configured" }
+        return sendMessage(messageProducerProperties.topic!!, message)
+    }
+
+    override suspend fun sendMessageNB(topic: String, message: Any): Boolean {
+        val serializedMessage = when (message) {
+            is String -> {
+                message
+            }
+            else -> {
+                message.asJsonType().toString()
+            }
+        }
+        val future = messageTemplate().send(topic, serializedMessage)
+
+        future.addCallback(object : ListenableFutureCallback<SendResult<String, Any>> {
+            override fun onSuccess(result: SendResult<String, Any>) {
+                log.info("message sent successfully with offset=[${result.recordMetadata.offset()}]")
+            }
+
+            override fun onFailure(ex: Throwable) {
+                log.error("Unable to send message", ex)
+            }
+        })
+        return true
+    }
+
+
+    private fun producerFactory(additionalConfig: Map<String, Any>? = null): ProducerFactory<String, Any> {
+        log.info("Client Properties : $messageProducerProperties")
+        val configProps = hashMapOf<String, Any>()
+        configProps[BOOTSTRAP_SERVERS_CONFIG] = messageProducerProperties.bootstrapServers
+        configProps[KEY_SERIALIZER_CLASS_CONFIG] = StringSerializer::class.java
+        configProps[VALUE_SERIALIZER_CLASS_CONFIG] = StringSerializer::class.java
+        if (messageProducerProperties.clientId != null) {
+            configProps[CLIENT_ID_CONFIG] = messageProducerProperties.clientId!!
+        }
+        // TODO("Security Implementation based on type")
+
+        // Add additional Properties
+        if (additionalConfig != null) {
+            configProps.putAll(additionalConfig)
+        }
+        return DefaultKafkaProducerFactory(configProps)
+    }
+
+    fun messageTemplate(additionalConfig: Map<String, Any>? = null): KafkaTemplate<String, Any> {
+        log.info("Prepering templates")
+        if (kafkaTemplate == null) {
+            kafkaTemplate = KafkaTemplate(producerFactory(additionalConfig))
+        }
+        return kafkaTemplate!!
+    }
+}
+
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerServiceTest.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerServiceTest.kt
new file mode 100644 (file)
index 0000000..0f8367d
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ *  Copyright Â© 2019 IBM.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.onap.ccsdk.cds.blueprintsprocessor.message.service
+
+import io.mockk.every
+import io.mockk.mockk
+import io.mockk.spyk
+import kotlinx.coroutines.runBlocking
+import org.junit.runner.RunWith
+import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertyConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.message.BluePrintMessageLibConfiguration
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.kafka.core.KafkaTemplate
+import org.springframework.kafka.support.SendResult
+import org.springframework.test.annotation.DirtiesContext
+import org.springframework.test.context.ContextConfiguration
+import org.springframework.test.context.TestPropertySource
+import org.springframework.test.context.junit4.SpringRunner
+import org.springframework.util.concurrent.SettableListenableFuture
+import kotlin.test.Test
+import kotlin.test.assertTrue
+
+
+@RunWith(SpringRunner::class)
+@DirtiesContext
+@ContextConfiguration(classes = [BluePrintMessageLibConfiguration::class,
+    BlueprintPropertyConfiguration::class, BluePrintProperties::class])
+@TestPropertySource(properties =
+["blueprintsprocessor.messageclient.sample.type=kafka-basic-auth",
+    "blueprintsprocessor.messageclient.sample.bootstrapServers=127:0.0.1:9092",
+    "blueprintsprocessor.messageclient.sample.topic=default-topic",
+    "blueprintsprocessor.messageclient.sample.clientId=default-client-id"
+])
+open class BlueprintMessageProducerServiceTest {
+
+    @Autowired
+    lateinit var bluePrintMessageLibPropertyService: BluePrintMessageLibPropertyService
+
+    @Test
+    fun testKafkaBasicAuthClientService() {
+        runBlocking {
+            val bluePrintMessageClientService = bluePrintMessageLibPropertyService
+                    .blueprintMessageClientService("sample") as KafkaBasicAuthMessageProducerService
+
+            val mockKafkaTemplate = mockk<KafkaTemplate<String, Any>>()
+
+            val future = SettableListenableFuture<SendResult<String, Any>>()
+            //future.setException(BluePrintException("failed sending"))
+
+            every { mockKafkaTemplate.send(any(), any()) } returns future
+
+            val spyBluePrintMessageClientService = spyk(bluePrintMessageClientService, recordPrivateCalls = true)
+
+            every { spyBluePrintMessageClientService.messageTemplate(any()) } returns mockKafkaTemplate
+
+            val response = spyBluePrintMessageClientService.sendMessage("Testing message")
+            assertTrue(response, "failed to get command response")
+        }
+    }
+
+}
+
+
+
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/resources/logback-test.xml b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/resources/logback-test.xml
new file mode 100644 (file)
index 0000000..626b8f9
--- /dev/null
@@ -0,0 +1,35 @@
+<!--
+  ~  Copyright Â© 2019 IBM.
+  ~
+  ~  Licensed under the Apache License, Version 2.0 (the "License");
+  ~  you may not use this file except in compliance with the License.
+  ~  You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~  Unless required by applicable law or agreed to in writing, software
+  ~  distributed under the License is distributed on an "AS IS" BASIS,
+  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~  See the License for the specific language governing permissions and
+  ~  limitations under the License.
+  -->
+
+<configuration>
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <!-- encoders are assigned the type
+             ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} %-5level %logger{100} - %msg%n</pattern>
+        </encoder>
+    </appender>
+
+    <logger name="org.springframework.test" level="warn"/>
+    <logger name="org.springframework" level="warn"/>
+    <logger name="org.hibernate" level="info"/>
+    <logger name="org.onap.ccsdk.cds.blueprintsprocessor" level="info"/>
+
+    <root level="warn">
+        <appender-ref ref="STDOUT"/>
+    </root>
+
+</configuration>
index 5fdfb50..9284e0d 100755 (executable)
@@ -36,6 +36,8 @@
         <module>rest-lib</module>
         <module>dmaap-lib</module>
         <module>grpc-lib</module>
+        <module>message-lib</module>
+        <module>ssh-lib</module>
     </modules>
     <dependencies>
         <dependency>
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/ssh-lib/pom.xml
new file mode 100644 (file)
index 0000000..6949c4f
--- /dev/null
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~  Copyright Â© 2019 IBM.
+  ~
+  ~  Licensed under the Apache License, Version 2.0 (the "License");
+  ~  you may not use this file except in compliance with the License.
+  ~  You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~  Unless required by applicable law or agreed to in writing, software
+  ~  distributed under the License is distributed on an "AS IS" BASIS,
+  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~  See the License for the specific language governing permissions and
+  ~  limitations under the License.
+  -->
+
+<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">
+    <parent>
+        <artifactId>commons</artifactId>
+        <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+        <version>0.5.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>ssh-lib</artifactId>
+    <packaging>jar</packaging>
+    <name>Blueprints Processor SSH Lib</name>
+    <description>Blueprints Processor SSH Lib</description>
+    <dependencies>
+        <dependency>
+            <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
+            <artifactId>blueprint-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+            <artifactId>processor-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sshd</groupId>
+            <artifactId>sshd-core</artifactId>
+        </dependency>
+    </dependencies>
+</project>
\ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibConfiguration.kt
new file mode 100644 (file)
index 0000000..48e451f
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ *  Copyright Â© 2019 IBM.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.onap.ccsdk.cds.blueprintsprocessor.ssh
+
+import org.springframework.boot.context.properties.EnableConfigurationProperties
+import org.springframework.context.annotation.ComponentScan
+import org.springframework.context.annotation.Configuration
+
+@Configuration
+@ComponentScan
+@EnableConfigurationProperties
+open class BluePrintSshLibConfiguration
+
+class SshLibConstants {
+    companion object {
+        const val SERVICE_BLUEPRINT_SSH_LIB_PROPERTY = "blueprint-ssh-lib-property-service"
+        const val PROPERTY_SSH_CLIENT_PREFIX = "blueprintsprocessor.sshclient."
+        const val TYPE_BASIC_AUTH = "basic-auth"
+    }
+}
\ No newline at end of file
  *  limitations under the License.
  */
 
-package org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor.service
+package org.onap.ccsdk.cds.blueprintsprocessor.ssh
 
-import org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor.api.CliExecutorService
-import org.springframework.stereotype.Service
-
-@Service
-open class CliExecutorServiceImpl : CliExecutorService {
+open class SshClientProperties {
+    lateinit var type: String
+    lateinit var host: String
+    var port: Int = 22
+    var connectionTimeOut: Long = 3000
+}
 
+open class BasicAuthSshClientProperties : SshClientProperties() {
+    lateinit var password: String
+    lateinit var username: String
 }
\ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BasicAuthSshClientService.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BasicAuthSshClientService.kt
new file mode 100644 (file)
index 0000000..adbde0f
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ *  Copyright Â© 2019 IBM.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.onap.ccsdk.cds.blueprintsprocessor.ssh.service
+
+import org.apache.sshd.client.SshClient
+import org.apache.sshd.client.channel.ChannelExec
+import org.apache.sshd.client.channel.ClientChannel
+import org.apache.sshd.client.channel.ClientChannelEvent
+import org.apache.sshd.client.keyverifier.AcceptAllServerKeyVerifier
+import org.apache.sshd.client.session.ClientSession
+import org.onap.ccsdk.cds.blueprintsprocessor.ssh.BasicAuthSshClientProperties
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
+import org.slf4j.LoggerFactory
+import java.io.ByteArrayOutputStream
+import java.util.*
+
+
+open class BasicAuthSshClientService(private val basicAuthSshClientProperties: BasicAuthSshClientProperties)
+    : BlueprintSshClientService {
+
+    private val log = LoggerFactory.getLogger(BasicAuthSshClientService::class.java)!!
+
+    private lateinit var sshClient: SshClient
+    private lateinit var clientSession: ClientSession
+    var channel: ChannelExec? = null
+
+    override suspend fun startSessionNB(): ClientSession {
+        sshClient = SshClient.setUpDefaultClient()
+        sshClient.serverKeyVerifier = AcceptAllServerKeyVerifier.INSTANCE
+        sshClient.start()
+        log.debug("SSH Client Service started successfully")
+        clientSession = sshClient.connect(basicAuthSshClientProperties.username, basicAuthSshClientProperties.host,
+                basicAuthSshClientProperties.port)
+                .verify(basicAuthSshClientProperties.connectionTimeOut)
+                .session
+
+        clientSession.addPasswordIdentity(basicAuthSshClientProperties.password)
+        clientSession.auth().verify(basicAuthSshClientProperties.connectionTimeOut)
+        log.info("SSH client session($clientSession) created")
+        return clientSession
+    }
+
+    override suspend fun executeCommandsNB(commands: List<String>, timeOut: Long): String {
+        val buffer = StringBuffer()
+        try {
+            commands.forEach { command ->
+                buffer.append("\nCommand : $command")
+                buffer.append("\n" + executeCommandNB(command, timeOut))
+            }
+        } catch (e: Exception) {
+            throw BluePrintProcessorException("Failed to execute commands, below the output : $buffer")
+        }
+        return buffer.toString()
+    }
+
+    override suspend fun executeCommandNB(command: String, timeOut: Long): String {
+        log.debug("Executing host($clientSession) command($command)")
+
+        channel = clientSession.createExecChannel(command)
+        checkNotNull(channel) { "failed to create Channel for the command : $command" }
+
+        //TODO("Convert to streaming ")
+        val outputStream = ByteArrayOutputStream()
+        channel!!.out = outputStream
+        channel!!.err = outputStream
+        channel!!.open().await()
+        val waitMask = channel!!.waitFor(Collections.unmodifiableSet(EnumSet.of(ClientChannelEvent.CLOSED)), timeOut)
+        if (waitMask.contains(ClientChannelEvent.TIMEOUT)) {
+            throw BluePrintProcessorException("Failed to retrieve command result in time: $command")
+        }
+        val exitStatus = channel!!.exitStatus
+        ClientChannel.validateCommandExitStatusCode(command, exitStatus!!)
+        return outputStream.toString()
+    }
+
+    override suspend fun closeSessionNB() {
+        if (channel != null)
+            channel!!.close()
+        if (sshClient.isStarted) {
+            sshClient.stop()
+        }
+        log.debug("SSH Client Service stopped successfully")
+    }
+}
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BluePrintSshLibPropertyService.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BluePrintSshLibPropertyService.kt
new file mode 100644 (file)
index 0000000..1950b71
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ *  Copyright Â© 2019 IBM.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.onap.ccsdk.cds.blueprintsprocessor.ssh.service
+
+import com.fasterxml.jackson.databind.JsonNode
+import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.ssh.BasicAuthSshClientProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.ssh.SshClientProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.ssh.SshLibConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
+import org.springframework.stereotype.Service
+
+@Service(SshLibConstants.SERVICE_BLUEPRINT_SSH_LIB_PROPERTY)
+open class BluePrintSshLibPropertyService(private var bluePrintProperties: BluePrintProperties) {
+
+    fun blueprintSshClientService(jsonNode: JsonNode): BlueprintSshClientService {
+        val restClientProperties = sshClientProperties(jsonNode)
+        return blueprintSshClientService(restClientProperties)
+    }
+
+    fun blueprintSshClientService(selector: String): BlueprintSshClientService {
+        val prefix = "${SshLibConstants.PROPERTY_SSH_CLIENT_PREFIX}$selector"
+        val sshClientProperties = sshClientProperties(prefix)
+        return blueprintSshClientService(sshClientProperties)
+    }
+
+    fun sshClientProperties(prefix: String): SshClientProperties {
+        val type = bluePrintProperties.propertyBeanType("$prefix.type", String::class.java)
+        return when (type) {
+            SshLibConstants.TYPE_BASIC_AUTH -> {
+                basicAuthSshClientProperties(prefix)
+            }
+            else -> {
+                throw BluePrintProcessorException("SSH adaptor($type) is not supported")
+            }
+        }
+    }
+
+    fun sshClientProperties(jsonNode: JsonNode): SshClientProperties {
+        val type = jsonNode.get("type").textValue()
+        return when (type) {
+            SshLibConstants.TYPE_BASIC_AUTH -> {
+                JacksonUtils.readValue(jsonNode,
+                        BasicAuthSshClientProperties::class.java)!!
+            }
+            else -> {
+                throw BluePrintProcessorException("SSH adaptor($type) is not supported")
+            }
+        }
+    }
+
+    private fun blueprintSshClientService(sshClientProperties: SshClientProperties): BlueprintSshClientService {
+
+        when (sshClientProperties) {
+            is BasicAuthSshClientProperties -> {
+                return BasicAuthSshClientService(sshClientProperties)
+            }
+            else -> {
+                throw BluePrintProcessorException("couldn't get SSH client service for")
+            }
+        }
+    }
+
+    private fun basicAuthSshClientProperties(prefix: String): BasicAuthSshClientProperties {
+        return bluePrintProperties.propertyBeanType(
+                prefix, BasicAuthSshClientProperties::class.java)
+    }
+
+}
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BlueprintSshClientService.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BlueprintSshClientService.kt
new file mode 100644 (file)
index 0000000..279e437
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ *  Copyright Â© 2019 IBM.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.onap.ccsdk.cds.blueprintsprocessor.ssh.service
+
+import kotlinx.coroutines.runBlocking
+import org.apache.sshd.client.session.ClientSession
+
+interface BlueprintSshClientService {
+
+    fun startSession(): ClientSession = runBlocking {
+        startSessionNB()
+    }
+
+    fun executeCommands(commands: List<String>, timeOut: Long): String = runBlocking {
+        executeCommandsNB(commands, timeOut)
+    }
+
+    fun executeCommand(command: String, timeOut: Long): String = runBlocking {
+        executeCommandNB(command, timeOut)
+    }
+
+    fun closeSession() = runBlocking {
+        closeSessionNB()
+    }
+
+    suspend fun startSessionNB(): ClientSession
+
+    suspend fun executeCommandsNB(commands: List<String>, timeOut: Long): String
+
+    suspend fun executeCommandNB(command: String, timeOut: Long): String
+
+    suspend fun closeSessionNB()
+}
\ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BluePrintSshLibPropertyServiceTest.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BluePrintSshLibPropertyServiceTest.kt
new file mode 100644 (file)
index 0000000..d5c9993
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ *  Copyright Â© 2019 IBM.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.onap.ccsdk.cds.blueprintsprocessor.ssh.service
+
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertyConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.ssh.BasicAuthSshClientProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.ssh.BluePrintSshLibConfiguration
+import org.springframework.beans.factory.annotation.Autowired
+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.assertNotNull
+
+
+@RunWith(SpringRunner::class)
+@ContextConfiguration(classes = [BluePrintSshLibConfiguration::class,
+    BlueprintPropertyConfiguration::class, BluePrintProperties::class])
+@TestPropertySource(properties =
+["blueprintsprocessor.sshclient.sample.type=basic-auth",
+    "blueprintsprocessor.sshclient.sample.host=127.0.0.1",
+    "blueprintsprocessor.sshclient.sample.port=22",
+    "blueprintsprocessor.sshclient.sample.password=1234",
+    "blueprintsprocessor.sshclient.sample.username=dummy"
+])
+class BluePrintSshLibPropertyServiceTest {
+
+    @Autowired
+    lateinit var bluePrintSshLibPropertyService: BluePrintSshLibPropertyService
+
+    @Test
+    fun testRestClientProperties() {
+        val properties = bluePrintSshLibPropertyService
+                .sshClientProperties("blueprintsprocessor.sshclient.sample") as BasicAuthSshClientProperties
+        assertNotNull(properties, "failed to create property bean")
+        assertEquals(properties.host, "127.0.0.1", "failed to match host property")
+        assertEquals(properties.port, 22, "failed to match port property")
+        assertEquals(properties.password, "1234", "failed to match host property")
+        assertEquals(properties.username, "dummy", "failed to match host property")
+    }
+}
\ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BlueprintSshClientServiceTest.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BlueprintSshClientServiceTest.kt
new file mode 100644 (file)
index 0000000..d612192
--- /dev/null
@@ -0,0 +1,100 @@
+/*
+ *  Copyright Â© 2019 IBM.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.onap.ccsdk.cds.blueprintsprocessor.ssh.service
+
+import kotlinx.coroutines.runBlocking
+import org.apache.sshd.common.config.keys.KeyUtils.RSA_ALGORITHM
+import org.apache.sshd.common.keyprovider.KeyPairProvider
+import org.apache.sshd.server.SshServer
+import org.apache.sshd.server.auth.password.PasswordAuthenticator
+import org.apache.sshd.server.auth.pubkey.AcceptAllPublickeyAuthenticator
+import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider
+import org.apache.sshd.server.session.ServerSession
+import org.apache.sshd.server.shell.ProcessShellCommandFactory
+import org.junit.runner.RunWith
+import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertyConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.ssh.BluePrintSshLibConfiguration
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.test.context.ContextConfiguration
+import org.springframework.test.context.TestPropertySource
+import org.springframework.test.context.junit4.SpringRunner
+import java.nio.file.Paths
+import kotlin.test.Test
+import kotlin.test.assertEquals
+import kotlin.test.assertNotNull
+
+
+@RunWith(SpringRunner::class)
+@ContextConfiguration(classes = [BluePrintSshLibConfiguration::class,
+    BlueprintPropertyConfiguration::class, BluePrintProperties::class])
+@TestPropertySource(properties =
+["blueprintsprocessor.sshclient.sample.type=basic-auth",
+    "blueprintsprocessor.sshclient.sample.host=localhost",
+    "blueprintsprocessor.sshclient.sample.port=52815",
+    "blueprintsprocessor.sshclient.sample.username=root",
+    "blueprintsprocessor.sshclient.sample.password=dummyps"
+])
+class BlueprintSshClientServiceTest {
+
+    @Autowired
+    lateinit var bluePrintSshLibPropertyService: BluePrintSshLibPropertyService
+
+    @Test
+    fun testBasicAuthSshClientService() {
+        runBlocking {
+            val sshServer = setupTestServer("localhost", 52815, "root", "dummyps")
+            sshServer.start()
+            println(sshServer)
+            val bluePrintSshLibPropertyService = bluePrintSshLibPropertyService.blueprintSshClientService("sample")
+            val sshSession = bluePrintSshLibPropertyService.startSession()
+            val response = bluePrintSshLibPropertyService.executeCommandsNB(arrayListOf("echo '1'", "echo '2'"), 2000)
+            assertNotNull(response, "failed to get command response")
+            bluePrintSshLibPropertyService.closeSession()
+            sshServer.stop(true)
+        }
+    }
+
+    private fun setupTestServer(host: String, port: Int, userName: String, password: String): SshServer {
+        val sshd = SshServer.setUpDefaultServer()
+        sshd.port = port
+        sshd.host = host
+        sshd.keyPairProvider = createTestHostKeyProvider()
+        sshd.passwordAuthenticator = BogusPasswordAuthenticator(userName, password)
+        sshd.publickeyAuthenticator = AcceptAllPublickeyAuthenticator.INSTANCE
+        //sshd.shellFactory = EchoShellFactory()
+        sshd.commandFactory = ProcessShellCommandFactory.INSTANCE
+        return sshd
+    }
+
+    private fun createTestHostKeyProvider(): KeyPairProvider {
+        val keyProvider = SimpleGeneratorHostKeyProvider()
+        keyProvider.path = Paths.get("target").resolve("hostkey." + RSA_ALGORITHM.toLowerCase())
+        keyProvider.algorithm = RSA_ALGORITHM
+        return keyProvider
+    }
+}
+
+class BogusPasswordAuthenticator(userName: String, password: String) : PasswordAuthenticator {
+    override fun authenticate(username: String, password: String, serverSession: ServerSession): Boolean {
+        assertEquals(username, "root", "failed to match username")
+        assertEquals(password, "dummyps", "failed to match password")
+        return true
+    }
+}
+
+
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/resources/logback-test.xml b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/resources/logback-test.xml
new file mode 100644 (file)
index 0000000..626b8f9
--- /dev/null
@@ -0,0 +1,35 @@
+<!--
+  ~  Copyright Â© 2019 IBM.
+  ~
+  ~  Licensed under the Apache License, Version 2.0 (the "License");
+  ~  you may not use this file except in compliance with the License.
+  ~  You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~  Unless required by applicable law or agreed to in writing, software
+  ~  distributed under the License is distributed on an "AS IS" BASIS,
+  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~  See the License for the specific language governing permissions and
+  ~  limitations under the License.
+  -->
+
+<configuration>
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <!-- encoders are assigned the type
+             ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} %-5level %logger{100} - %msg%n</pattern>
+        </encoder>
+    </appender>
+
+    <logger name="org.springframework.test" level="warn"/>
+    <logger name="org.springframework" level="warn"/>
+    <logger name="org.hibernate" level="info"/>
+    <logger name="org.onap.ccsdk.cds.blueprintsprocessor" level="info"/>
+
+    <root level="warn">
+        <appender-ref ref="STDOUT"/>
+    </root>
+
+</configuration>
index 1e09bee..5a4f3de 100644 (file)
@@ -140,10 +140,10 @@ class ExecutionServiceHandler(private val bluePrintPathConfiguration: BluePrintP
         val executionServiceOutput = ExecutionServiceOutput()
         executionServiceOutput.commonHeader = executionServiceInput.commonHeader
         executionServiceOutput.actionIdentifiers = executionServiceInput.actionIdentifiers
+        executionServiceOutput.payload = executionServiceInput.payload
 
         val status = Status()
         if (failure) {
-            executionServiceOutput.payload = JsonNodeFactory.instance.objectNode()
             setErrorStatus(errorMessage, status)
         } else {
             status.eventType = EventType.EVENT_COMPONENT_PROCESSING.name
index cbc19ad..82c2e61 100755 (executable)
         <sshd.version>2.2.0</sshd.version>
         <jsch.version>0.1.55</jsch.version>
         <protobuff.java.utils.version>3.6.1</protobuff.java.utils.version>
+        <spring.kafka.version>2.2.6.RELEASE</spring.kafka.version>
+        <kafka.version>2.2.0</kafka.version>
         <eelf.version>1.0.0</eelf.version>
+        <sli.version>${ccsdk.sli.core.version}</sli.version>
         <guava.version>27.0.1-jre</guava.version>
         <jython.version>2.7.1</jython.version>
         <springfox.swagger2.version>2.9.2</springfox.swagger2.version>
                 <scope>import</scope>
             </dependency>
 
+            <dependency>
+                <groupId>org.springframework.kafka</groupId>
+                <artifactId>spring-kafka</artifactId>
+                <version>${spring.kafka.version}</version>
+            </dependency>
+
             <!--Swagger Dependencies -->
             <dependency>
                 <groupId>io.springfox</groupId>
                 <version>${jsch.version}</version>
             </dependency>
 
+            <dependency>
+                <groupId>org.apache.kafka</groupId>
+                <artifactId>kafka-clients</artifactId>
+                <version>${kafka.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.kafka</groupId>
+                <artifactId>kafka-streams</artifactId>
+                <version>${kafka.version}</version>
+            </dependency>
+
             <!-- SLI Version -->
             <dependency>
                 <groupId>org.onap.ccsdk.sli.core</groupId>
                 <artifactId>sli-provider</artifactId>
-                <version>${ccsdk.sli.core.version}</version>
+                <version>${sli.version}</version>
                 <exclusions>
                     <exclusion>
                         <groupId>commons-lang</groupId>
                 <artifactId>rest-lib</artifactId>
                 <version>${project.version}</version>
             </dependency>
+            <dependency>
+                <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+                <artifactId>ssh-lib</artifactId>
+                <version>${project.version}</version>
+            </dependency>
             <dependency>
                 <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
                 <artifactId>dmaap-lib</artifactId>
                 <artifactId>restconf-executor</artifactId>
                 <version>${project.version}</version>
             </dependency>
+            <dependency>
+                <groupId>org.onap.ccsdk.cds.blueprintsprocessor.functions</groupId>
+                <artifactId>cli-executor</artifactId>
+                <version>${project.version}</version>
+            </dependency>
 
             <!-- Controller Blueprints Application Dependency -->
             <dependency>
                 <version>${grpc.version}</version>
                 <scope>test</scope>
             </dependency>
+
+            <!-- Spring Kafka -->
+            <dependency>
+                <groupId>org.springframework.kafka</groupId>
+                <artifactId>spring-kafka-test</artifactId>
+                <version>${spring.kafka.version}</version>
+                <scope>test</scope>
+            </dependency>
+
         </dependencies>
     </dependencyManagement>
 
index 0e45232..583fc9d 100644 (file)
@@ -122,6 +122,18 @@ fun JsonNode.rootFieldsToMap(): MutableMap<String, JsonNode> {
     }
 }
 
+fun JsonNode.removeNullNode() {
+    val it = this.iterator()
+    while (it.hasNext()) {
+        val child = it.next()
+        if (child.isNull) {
+            it.remove()
+        } else {
+            child.removeNullNode()
+        }
+    }
+}
+
 
 fun MutableMap<String, JsonNode>.putJsonElement(key: String, value: Any) {
     val convertedValue = value.asJsonType()
index ec1542c..86bf3ff 100644 (file)
@@ -18,21 +18,43 @@ package org.onap.ccsdk.cds.controllerblueprints.core.interfaces
 import com.fasterxml.jackson.core.io.CharTypes
 import com.fasterxml.jackson.databind.node.JsonNodeFactory
 import com.fasterxml.jackson.databind.node.TextNode
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
 
 interface BlueprintTemplateService {
 
+    /**
+     * Generate dynamique content using Velocity Template or Jinja template
+     *
+     * @param bluePrintRuntimeService blueprint runtime
+     * @param nodeTemplateName node template
+     * @param artifactName Artifact Name
+     * @param jsonData json string data content to mash
+     * @param ignoreJsonNull Ignore Null value in the JSON content
+     * @param additionalContext (Key, value) mutable map for additional variables
+     * @return Content result
+     *
+     **/
+    suspend fun generateContent(bluePrintRuntimeService: BluePrintRuntimeService<*>,
+                                nodeTemplateName: String,
+                                artifactName: String,
+                                jsonData: String = "",
+                                ignoreJsonNull: Boolean = false,
+                                additionalContext: MutableMap<String, Any> = mutableMapOf()): String
+
+
     /**
      * Generate dynamique content using Velocity Template or Jinja template
      *
      * @param template template string content
-     * @param json json string content
+     * @param templateType template type
+     * @param jsonData json string data content to mash
      * @param ignoreJsonNull Ignore Null value in the JSON content
      * @param additionalContext (Key, value) mutable map for additional variables
      * @return Content result
      *
      **/
-    suspend fun generateContent(template: String, json: String = "", ignoreJsonNull: Boolean = false,
-                        additionalContext: MutableMap<String, Any> = mutableMapOf()): String
+    suspend fun generateContent(template: String, templateType: String, jsonData: String = "", ignoreJsonNull: Boolean = false,
+                                additionalContext: MutableMap<String, Any> = mutableMapOf()): String
 }
 
 /**
index a3e9cd1..5f65053 100644 (file)
@@ -85,7 +85,7 @@ class BluePrintImportService(private val parentServiceTemplate: ServiceTemplate,
                 serviceTemplate = ServiceTemplateUtils.getServiceTemplate(importDefinition.file)
             }
         } catch (e: Exception) {
-            throw BluePrintException("failed to populate service template for ${importDefinition.file}", e)
+            throw BluePrintException("failed to populate service template for ${importDefinition.file} original error: ${e.message}", e)
         }
         if (serviceTemplate == null) {
             throw BluePrintException("failed to populate service template for :  ${importDefinition.file}")
@@ -94,4 +94,4 @@ class BluePrintImportService(private val parentServiceTemplate: ServiceTemplate,
     }
 
 
-}
\ No newline at end of file
+}
index f835cbe..912667e 100644 (file)
@@ -21,14 +21,13 @@ import com.fasterxml.jackson.databind.ObjectMapper
 import com.hubspot.jinjava.Jinjava
 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
 import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintJsonNodeFactory
-import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintTemplateService
-import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
+import org.onap.ccsdk.cds.controllerblueprints.core.removeNullNode
 
 
-object BluePrintJinjaTemplateService: BlueprintTemplateService {
+object BluePrintJinjaTemplateService {
 
-    override suspend fun generateContent(template: String, json: String, ignoreJsonNull: Boolean,
-                                 additionalContext: MutableMap<String, Any>): String {
+    fun generateContent(template: String, json: String, ignoreJsonNull: Boolean,
+                                additionalContext: MutableMap<String, Any>): String {
         // Load template
         val jinJava = Jinjava()
         val mapper = ObjectMapper()
@@ -40,7 +39,7 @@ object BluePrintJinjaTemplateService: BlueprintTemplateService {
             val jsonNode = mapper.readValue<JsonNode>(json, JsonNode::class.java)
                     ?: throw BluePrintProcessorException("couldn't get json node from json")
             if (ignoreJsonNull)
-                JacksonUtils.removeJsonNullNode(jsonNode)
+                jsonNode.removeNullNode()
             jsonNode.fields().forEach { entry ->
                 additionalContext[entry.key] = entry.value
             }
index 4b6905b..43e6d22 100644 (file)
@@ -26,35 +26,50 @@ import org.apache.velocity.VelocityContext
 import org.apache.velocity.app.Velocity
 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
 import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintJsonNodeFactory
-import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintTemplateService
-import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
+import org.onap.ccsdk.cds.controllerblueprints.core.removeNullNode
 import java.io.StringWriter
 
-object BluePrintVelocityTemplateService: BlueprintTemplateService {
+object BluePrintVelocityTemplateService {
 
     /**
-     * Generate Content from Velocity Template and JSON Content or property map.
+     * Generate Content from Velocity Template and JSON Content with injected API
      */
-    override suspend fun generateContent(template: String, json: String, ignoreJsonNull: Boolean, additionalContext:
-    MutableMap<String, Any>): String {
-        Velocity.init()
+    fun generateContent(template: String, json: String, ignoreJsonNull: Boolean = false,
+                        additionalContext: MutableMap<String, Any> = mutableMapOf()): String {
+
+        // Customized Object Mapper to remove String double quotes
         val mapper = ObjectMapper()
         val nodeFactory = BluePrintJsonNodeFactory()
         mapper.nodeFactory = nodeFactory
 
+        val jsonNode: JsonNode? = if (json.isNotEmpty()) {
+            mapper.readValue(json, JsonNode::class.java)
+                    ?: throw BluePrintProcessorException("couldn't get json node from json")
+        } else {
+            null
+        }
+        return generateContent(template, jsonNode, ignoreJsonNull, additionalContext)
+    }
+
+    /**
+     * Generate Content from Velocity Template and JSON Node with injected API
+     */
+    fun generateContent(template: String, jsonNode: JsonNode?, ignoreJsonNull: Boolean = false,
+                        additionalContext: MutableMap<String, Any> = mutableMapOf()): String {
+
+        Velocity.init()
+
         val velocityContext = VelocityContext()
         velocityContext.put("StringUtils", StringUtils::class.java)
         velocityContext.put("BooleanUtils", BooleanUtils::class.java)
 
         // Add the Custom Velocity Context API
-        additionalContext.forEach { name, value -> velocityContext.put(name, value) }
+        additionalContext.forEach { (name, value) -> velocityContext.put(name, value) }
 
         // Add the JSON Data to the context
-        if (json.isNotEmpty()) {
-            val jsonNode = mapper.readValue<JsonNode>(json, JsonNode::class.java)
-                    ?: throw BluePrintProcessorException("couldn't get json node from json")
+        if (jsonNode != null) {
             if (ignoreJsonNull)
-                JacksonUtils.removeJsonNullNode(jsonNode)
+                jsonNode.removeNullNode()
             jsonNode.fields().forEach { entry ->
                 velocityContext.put(entry.key, entry.value)
             }
@@ -64,6 +79,6 @@ object BluePrintVelocityTemplateService: BlueprintTemplateService {
         Velocity.evaluate(velocityContext, stringWriter, "TemplateData", template)
         stringWriter.flush()
         return stringWriter.toString()
+
     }
 }
-
index 73457b9..45e2678 100644 (file)
@@ -20,19 +20,26 @@ import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
 import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintTemplateService
 import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
 
-class BluePrintTemplateService(val bluePrintRuntimeService: BluePrintRuntimeService<*>,
-                               val nodeTemplateName: String, val artifactName: String):
-        BlueprintTemplateService {
+class BluePrintTemplateService : BlueprintTemplateService {
+
+    override suspend fun generateContent(bluePrintRuntimeService: BluePrintRuntimeService<*>,
+                                         nodeTemplateName: String, artifactName: String, jsonData: String,
+                                         ignoreJsonNull: Boolean, additionalContext: MutableMap<String, Any>): String {
 
-    override suspend fun generateContent(template: String, json: String, ignoreJsonNull: Boolean, additionalContext: MutableMap<String, Any>): String {
         val artifactDefinition = bluePrintRuntimeService.resolveNodeTemplateArtifactDefinition(nodeTemplateName, artifactName)
         val templateType = artifactDefinition.type
+        val template = bluePrintRuntimeService.resolveNodeTemplateArtifact(nodeTemplateName, artifactName)
+        return generateContent(template, templateType, jsonData, ignoreJsonNull, additionalContext)
+    }
+
+    override suspend fun generateContent(template: String, templateType: String, jsonData: String, ignoreJsonNull: Boolean,
+                                         additionalContext: MutableMap<String, Any>): String {
         return when (templateType) {
             BluePrintConstants.ARTIFACT_JINJA_TYPE_NAME -> {
-                BluePrintJinjaTemplateService.generateContent(template, json, ignoreJsonNull, additionalContext)
+                BluePrintJinjaTemplateService.generateContent(template, jsonData, ignoreJsonNull, additionalContext)
             }
             BluePrintConstants.ARTIFACT_VELOCITY_TYPE_NAME -> {
-                BluePrintVelocityTemplateService.generateContent(template, json, ignoreJsonNull, additionalContext)
+                BluePrintVelocityTemplateService.generateContent(template, jsonData, ignoreJsonNull, additionalContext)
             }
             else -> {
                 throw BluePrintProcessorException("Unknown Artifact type, expecting ${BluePrintConstants.ARTIFACT_JINJA_TYPE_NAME}" +
@@ -41,9 +48,11 @@ class BluePrintTemplateService(val bluePrintRuntimeService: BluePrintRuntimeServ
         }
     }
 
-    suspend fun generateContentFromFiles(templatePath: String, jsonPath: String, ignoreJsonNull: Boolean, additionalContext: MutableMap<String, Any>): String {
+    suspend fun generateContentFromFiles(templatePath: String, templateType: String, jsonPath: String,
+                                         ignoreJsonNull: Boolean,
+                                         additionalContext: MutableMap<String, Any>): String {
         val json = JacksonUtils.getClassPathFileContent(jsonPath)
         val template = JacksonUtils.getClassPathFileContent(templatePath)
-        return generateContent(template, json, ignoreJsonNull, additionalContext)
+        return generateContent(template, templateType, json, ignoreJsonNull, additionalContext)
     }
 }
\ No newline at end of file
index 7b5f181..5e9fd62 100644 (file)
@@ -58,19 +58,6 @@ class JacksonUtils {
             return objectMapper.treeToValue(node, valueType)
         }
 
-        fun removeJsonNullNode(node: JsonNode) {
-            val it = node.iterator()
-            while (it.hasNext()) {
-                val child = it.next()
-                if (child.isNull) {
-                    it.remove()
-                } else {
-                    removeJsonNullNode(child)
-                }
-            }
-        }
-
-
         fun getContent(fileName: String): String = runBlocking {
             try {
                 normalizedFile(fileName).readNBText()
index e422718..6f961c8 100644 (file)
@@ -21,10 +21,12 @@ package org.onap.ccsdk.cds.controllerblueprints.core.service
 import kotlinx.coroutines.runBlocking
 import org.junit.Test
 import org.junit.runner.RunWith
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
 import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
 import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
 import org.springframework.test.context.junit4.SpringRunner
 import kotlin.test.BeforeTest
+import kotlin.test.assertEquals
 import kotlin.test.assertNotNull
 
 @RunWith(SpringRunner::class)
@@ -40,13 +42,13 @@ class BluePrintTemplateServiceTest {
 
     @Test
     fun testVelocityGeneratedContent() {
-       runBlocking {
-           val template = JacksonUtils.getClassPathFileContent("templates/base-config-velocity-template.vtl")
-           val json = JacksonUtils.getClassPathFileContent("templates/base-config-data-velocity.json")
+        runBlocking {
+            val template = JacksonUtils.getClassPathFileContent("templates/base-config-velocity-template.vtl")
+            val json = JacksonUtils.getClassPathFileContent("templates/base-config-data-velocity.json")
 
-           val content = BluePrintVelocityTemplateService.generateContent(template, json)
-           assertNotNull(content, "failed to generate content for velocity template")
-       }
+            val content = BluePrintVelocityTemplateService.generateContent(template, json)
+            assertNotNull(content, "failed to generate content for velocity template")
+        }
 
     }
 
@@ -68,13 +70,12 @@ class BluePrintTemplateServiceTest {
     @Test
     fun testVelocityGeneratedContentFromFiles() {
         runBlocking {
-            val bluePrintTemplateService = BluePrintTemplateService(blueprintRuntime,
-                    "resource-assignment", "baseconfig-template")
+            val bluePrintTemplateService = BluePrintTemplateService()
             val templateFile = "templates/base-config-velocity-template.vtl"
             val jsonFile = "templates/base-config-data-velocity.json"
 
             val content = bluePrintTemplateService.generateContentFromFiles(
-                    templateFile, jsonFile, false, mutableMapOf())
+                    templateFile, BluePrintConstants.ARTIFACT_VELOCITY_TYPE_NAME, jsonFile, false, mutableMapOf())
             assertNotNull(content, "failed to generate content for velocity template")
         }
 
@@ -86,17 +87,50 @@ class BluePrintTemplateServiceTest {
             var element: MutableMap<String, Any> = mutableMapOf()
             element["additional_array"] = arrayListOf(hashMapOf("name" to "Element1", "location" to "Region0"), hashMapOf("name" to "Element2", "location" to "Region1"))
 
-            val bluePrintTemplateService = BluePrintTemplateService(blueprintRuntime,
-                    "resource-assignment", "another-template")
+            val bluePrintTemplateService = BluePrintTemplateService()
 
             val templateFile = "templates/base-config-jinja-template.jinja"
             val jsonFile = "templates/base-config-data-jinja.json"
 
             val content = bluePrintTemplateService.generateContentFromFiles(
-                    templateFile,
+                    templateFile, BluePrintConstants.ARTIFACT_JINJA_TYPE_NAME,
                     jsonFile, false, element)
             assertNotNull(content, "failed to generate content for velocity template")
         }
     }
+
+    @Test
+    fun `no value variable should evaluate to default value - standalone template mesh test`() {
+        runBlocking {
+            val template = JacksonUtils.getClassPathFileContent("templates/default-variable-value-velocity-template.vtl")
+            val json = JacksonUtils.getClassPathFileContent("templates/default-variable-value-data.json")
+
+            val content = BluePrintVelocityTemplateService.generateContent(template, json)
+            //first line represents a variable whose value was successfully retrieved, second line contains a variable
+            // whose value could not be evaluated
+            val expected = "sample-hostname\n\${node0_backup_router_address}"
+            assertEquals(expected, content, "No value variable should use default value")
+        }
+    }
+
+    @Test
+    fun `no value variable should evaluate to default value - blueprint processing test`() {
+        runBlocking {
+            val bluePrintTemplateService = BluePrintTemplateService()
+
+            val templateFile = "templates/default-variable-value-velocity-template.vtl"
+            val jsonFile = "templates/default-variable-value-data.json"
+
+            val content = bluePrintTemplateService.generateContentFromFiles(templateFile,
+                    BluePrintConstants.ARTIFACT_VELOCITY_TYPE_NAME, jsonFile, false, mutableMapOf())
+
+            //first line represents a variable whose value was successfully retrieved, second line contains a variable
+            // whose value could not be evaluated
+            val expected = "sample-hostname\n\${node0_backup_router_address}"
+            assertEquals(expected, content, "No value variable should use default value")
+        }
+
+    }
+
 }
 
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/default-variable-value-data.json b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/default-variable-value-data.json
new file mode 100755 (executable)
index 0000000..940ca8d
--- /dev/null
@@ -0,0 +1,3 @@
+{
+  "node0_hostname": "sample-hostname"
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/default-variable-value-velocity-template.vtl b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/default-variable-value-velocity-template.vtl
new file mode 100755 (executable)
index 0000000..ce2458e
--- /dev/null
@@ -0,0 +1,2 @@
+$node0_hostname
+${node0_backup_router_address}
\ No newline at end of file
index 4c0320a..bcfea9f 100644 (file)
@@ -7,21 +7,41 @@
     "type" : "string"
   },
   "sources" : {
-    "primary-config-data" : {
-      "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",
-        "path" : "/param/0/value",
-        "expression-type" : "JSON_POINTER",
-        "input-key-mapping" : {
-          "service-instance-id" : "service-instance-id",
-          "vnf-id" : "vnf-id"
+    "primary-config-data": {
+      "type": "source-rest",
+      "properties": {
+        "type": "JSON",
+        "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",
+        "input-key-mapping": {
+          "service-instance-id": "service-instance-id",
+          "vnf-name": "vnf-name"
         },
-        "output-key-mapping" : {
-          "vnf-name" : "value"
+        "output-key-mapping": {
+          "vnf-name": "value"
         },
-        "key-dependencies" : [ "service-instance-id", "vnf-id" ]
+        "key-dependencies": [
+          "service-instance-id",
+          "vnf-name"
+        ]
+      }
+    },
+    "primary-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"
+        ]
       }
     }
   }
index d06d5db..b4c29de 100644 (file)
@@ -23,9 +23,11 @@ import org.junit.Before
 import org.junit.Test
 import org.junit.runner.RunWith
 import org.onap.ccsdk.cds.controllerblueprints.TestApplication
+import org.onap.ccsdk.cds.controllerblueprints.core.compress
 import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir
 import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintEnhancerService
 import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintValidatorService
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
 import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName
 import org.onap.ccsdk.cds.controllerblueprints.service.load.ModelTypeLoadService
 import org.onap.ccsdk.cds.controllerblueprints.service.load.ResourceDictionaryLoadService
@@ -113,6 +115,10 @@ class BluePrintEnhancerServiceImplTest {
             val valid = bluePrintValidatorService.validateBluePrints(targetPath)
             Assert.assertTrue("blueprint($basePath) validation failed ", valid)
 
+            // Enable this to get the enhanced zip file
+//            val compressFile = normalizedFile("target/blueprints/enrichment", "$targetDirName.zip")
+//            normalizedFile(targetPath).compress(compressFile)
+
             deleteDir(targetPath)
         }
     }