aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cds-ui/client/src/app/common/shared/components/home/home.component.html13
-rw-r--r--cds-ui/client/src/app/common/shared/components/home/home.component.scss29
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/blueprint.module.ts5
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/search-edit-cba/search-edit-cba.component.html16
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/search-edit-cba/search-edit-cba.component.scss0
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/search-edit-cba/search-edit-cba.component.spec.ts25
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/search-edit-cba/search-edit-cba.component.ts67
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.html23
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts31
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.service.spec.ts12
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.service.ts16
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/select-template/select-template.component.html6
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/select-template/select-template.component.ts8
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/select-template/template-options/template-options.component.html6
-rw-r--r--cds-ui/server/config/app-config.ts9
-rw-r--r--cds-ui/server/index.js4
-rw-r--r--cds-ui/server/package.json9
-rw-r--r--cds-ui/server/pom.xml29
-rw-r--r--cds-ui/server/server.cert23
-rw-r--r--cds-ui/server/server.key28
-rw-r--r--cds-ui/server/src/clients/blueprint-management-service-grpc-client.ts86
-rw-r--r--cds-ui/server/src/config/app-config.ts47
-rw-r--r--cds-ui/server/src/controllers/blueprint-rest.controller.ts30
-rw-r--r--cds-ui/server/src/datasources/blueprint.datasource-template.ts8
-rw-r--r--cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts24
-rw-r--r--cds-ui/server/src/sequence.ts13
-rw-r--r--ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintProcessorApplication.java3
-rwxr-xr-xms/blueprintsprocessor/application/src/main/resources/application-dev.properties10
-rwxr-xr-xms/blueprintsprocessor/application/src/main/resources/application.properties8
-rw-r--r--ms/blueprintsprocessor/application/src/test/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintProcessorApplicationTest.java2
-rw-r--r--ms/blueprintsprocessor/application/src/test/resources/application.properties10
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt16
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaBasicAuthMessageProducerService.kt5
-rwxr-xr-xms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml25
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/MessagingConfig.kt47
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/MessagingController.kt74
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt7
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt4
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt4
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/messaginglib/MessagingControllerTest.kt211
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/messaginglib/ProducerConfiguration.kt48
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/application-test.properties9
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/cba-for-kafka-integration.zipbin0 -> 20700 bytes
-rwxr-xr-xms/blueprintsprocessor/parent/pom.xml7
-rw-r--r--ms/command-executor/src/main/python/command_executor_handler.py7
-rw-r--r--pom.xml2
46 files changed, 994 insertions, 72 deletions
diff --git a/cds-ui/client/src/app/common/shared/components/home/home.component.html b/cds-ui/client/src/app/common/shared/components/home/home.component.html
index f8cfc888e..ef6880d37 100644
--- a/cds-ui/client/src/app/common/shared/components/home/home.component.html
+++ b/cds-ui/client/src/app/common/shared/components/home/home.component.html
@@ -37,7 +37,18 @@ limitations under the License.
<mat-sidenav #drawer mode="side" [(opened)]="opened" (opened)="events.push('open!')" (closed)="events.push('close!')">
<mat-toolbar color="" primary>Menu</mat-toolbar>
<mat-nav-list>
- <a mat-list-item [routerLink]="['/blueprint']">Controller Blueprint</a>
+ <!-- <a mat-list-item [routerLink]="['/blueprint']">Controller Blueprint</a> -->
+ <nav class="ng-tns-c12-2 ng-star-inserted">
+ <!-- <button class="docs-nav-content-btn" cdkaccordionitem="" expanded="true"
+ aria-label="Form Controls, section toggle" aria-controls="panel-forms" aria-expanded="false">-->
+ <label>Controller Blueprint</label>
+ <!-- <mat-icon class="mat-icon notranslate material-icons mat-icon-no-color" role="img" aria-hidden="true">
+ keyboard_arrow_down</mat-icon></button> -->
+ <ul>
+ <a mat-list-item [routerLink]="['/blueprint']">Create Blueprint</a>
+ <a mat-list-item [routerLink]="['/']">Search Blueprint</a>
+ </ul>
+ </nav>
<a mat-list-item [routerLink]="['/resource-definition']">Resource Definition</a>
</mat-nav-list>
</mat-sidenav>
diff --git a/cds-ui/client/src/app/common/shared/components/home/home.component.scss b/cds-ui/client/src/app/common/shared/components/home/home.component.scss
index df9a48de5..be21b750c 100644
--- a/cds-ui/client/src/app/common/shared/components/home/home.component.scss
+++ b/cds-ui/client/src/app/common/shared/components/home/home.component.scss
@@ -26,22 +26,41 @@ limitations under the License.
// left: 0;
// right: 0;
// }
-
// .example-events {
// width: 300px;
// height: 200px;
// overflow: auto;
// border: 1px solid #555;
// }
-.mat-sidenav-container{
+.mat-sidenav-container {
height: 652px;
}
-.mat-button.mat-primary, .mat-icon-button.mat-primary, .mat-stroked-button.mat-primary {
+
+.mat-button.mat-primary,
+.mat-icon-button.mat-primary,
+.mat-stroked-button.mat-primary {
color: white !important;
}
-.menuBar{
+
+.menuBar {
cursor: pointer;
}
-.title{
+
+.title {
margin: 1em;
+}
+
+.docs-component-viewer-nav .docs-component-viewer-nav-content button {
+ padding: 10px 15px;
+ font-weight: 700;
+ line-height: 16px;
+ margin: 0;
+ font-size: 13px;
+ cursor: pointer;
+ position: relative;
+ display: block;
+ width: 100%;
+ text-align: left;
+ background: 0 0;
+ border: none;
} \ No newline at end of file
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/blueprint.module.ts b/cds-ui/client/src/app/feature-modules/blueprint/blueprint.module.ts
index 3a25e92f0..ae4df4ccf 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/blueprint.module.ts
+++ b/cds-ui/client/src/app/feature-modules/blueprint/blueprint.module.ts
@@ -30,7 +30,7 @@ import { SelectTemplateModule } from './select-template/select-template.module';
import { ModifyTemplateModule } from './modify-template/modify-template.module';
import { DeployTemplateModule } from './deploy-template/deploy-template.module';
import { TestTemplateModule } from './test-template/test-template.module';
-
+import { SearchEditCBAComponent } from './search-edit-cba/search-edit-cba.component';
import { AppMaterialModule } from '../../../app/common/modules/app-material.module';
@NgModule({
@@ -45,7 +45,8 @@ import { AppMaterialModule } from '../../../app/common/modules/app-material.modu
SelectTemplateModule,
ModifyTemplateModule,
DeployTemplateModule,
- TestTemplateModule
+ TestTemplateModule,
+ SearchEditCBAComponent
]
})
export class BlueprintModule { }
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/search-edit-cba/search-edit-cba.component.html b/cds-ui/client/src/app/feature-modules/blueprint/search-edit-cba/search-edit-cba.component.html
new file mode 100644
index 000000000..7371d2105
--- /dev/null
+++ b/cds-ui/client/src/app/feature-modules/blueprint/search-edit-cba/search-edit-cba.component.html
@@ -0,0 +1,16 @@
+/* ============LICENSE_START========================================== =================================================================== Copyright (C) 2018 IBM Intellectual Property. 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============================================ */
+
+<form class="search-form" [formGroup]="myControl">
+ <mat-form-field class="search-full-width">
+ <input #resourceSelect type="text" [(ngModel)]="searchText" placeholder="Search Resources" matInput [matAutocomplete]="auto" formControlName="search_input">
+ <button matSuffix mat-icon-button (click)="fetchResourceByName()"><mat-icon>search</mat-icon></button>
+ <!-- <mat-autocomplete #auto="matAutocomplete">
+ <mat-option (click)="selected(option)" *ngFor="let option of options | search : searchText" [value]="option.tags">
+ {{option.tags}}
+ </mat-option>
+ </mat-autocomplete> -->
+ </mat-form-field>
+</form> \ No newline at end of file
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/search-edit-cba/search-edit-cba.component.scss b/cds-ui/client/src/app/feature-modules/blueprint/search-edit-cba/search-edit-cba.component.scss
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/cds-ui/client/src/app/feature-modules/blueprint/search-edit-cba/search-edit-cba.component.scss
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/search-edit-cba/search-edit-cba.component.spec.ts b/cds-ui/client/src/app/feature-modules/blueprint/search-edit-cba/search-edit-cba.component.spec.ts
new file mode 100644
index 000000000..78210cf12
--- /dev/null
+++ b/cds-ui/client/src/app/feature-modules/blueprint/search-edit-cba/search-edit-cba.component.spec.ts
@@ -0,0 +1,25 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { SearchEditCBAComponent } from './search-edit-cba.component';
+
+describe('SearchEditCBAComponent', () => {
+ let component: SearchEditCBAComponent;
+ let fixture: ComponentFixture<SearchEditCBAComponent>;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ SearchEditCBAComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(SearchEditCBAComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/search-edit-cba/search-edit-cba.component.ts b/cds-ui/client/src/app/feature-modules/blueprint/search-edit-cba/search-edit-cba.component.ts
new file mode 100644
index 000000000..14a79e0f1
--- /dev/null
+++ b/cds-ui/client/src/app/feature-modules/blueprint/search-edit-cba/search-edit-cba.component.ts
@@ -0,0 +1,67 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright 2019 TechMahindra
+*
+* Modifications Copyright (C) 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.
+* ============LICENSE_END=========================================================
+*/
+
+import { Component, OnInit, ViewChild, EventEmitter, Output } from '@angular/core';
+import {FormBuilder, FormGroup, Validators} from '@angular/forms';
+
+import { MatAutocompleteTrigger } from '@angular/material'
+@Component({
+ selector: 'app-search-edit-cba',
+ templateUrl: './search-edit-cba.component.html',
+ styleUrls: ['./search-edit-cba.component.scss']
+})
+export class SearchEditCBAComponent implements OnInit {
+
+ myControl: FormGroup;
+ @Output() resourcesData = new EventEmitter();
+ options: any[] = [];
+ //['One','One1', 'Two', 'Three'];
+ // @ViewChild('resourceSelect') resourceSelect;
+ @ViewChild('resourceSelect', { read: MatAutocompleteTrigger }) resourceSelect: MatAutocompleteTrigger;
+
+ searchText: string = '';
+ constructor(private _formBuilder: FormBuilder,
+ ) { }
+
+ ngOnInit() {
+ this.myControl = this._formBuilder.group({
+ search_input: ['', Validators.required]
+ });
+ }
+ selected(value){
+ this.resourcesData.emit(value);
+ }
+
+ fetchResourceByName() {
+ // this.exsistingModelService.searchByTags(this.searchText)
+ // .subscribe(data=>{
+ // console.log(data);
+ // data.forEach(element => {
+ // this.options.push(element)
+ // });
+ // this.resourceSelect.openPanel();
+ // }, error=>{
+ // window.alert('error' + error);
+ // })
+ }
+
+}
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.html b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.html
index b58be9fce..491c5e06d 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.html
+++ b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.html
@@ -18,9 +18,24 @@ See the License for the specific language governing permissions and
limitations under the License.
============LICENSE_END============================================
-->
-<div>
- <input type="file" accept=".zip" (change)="fileChanged($event)">
+<div *ngIf="optionSelected==1">
+ <div>
+ <input type="file" accept=".zip" (change)="fileChanged($event)">
+ </div>
+ <div>
+ <button mat-button matStepperNext (click)="updateBlueprintState()" [ngClass]="{'mat-upload-btn-disabled': !validfile, 'matStepNextBtn': validfile}" [disabled]="!validfile">Upload</button>
+ </div>
</div>
-<div>
- <button mat-button matStepperNext (click)="updateBlueprintState()" [ngClass] = "{'mat-upload-btn-disabled': !validfile, 'matStepNextBtn': validfile}" [disabled]="!validfile">Upload</button>
+<div *ngIf="optionSelected==2">
+ <form class="search-form" [formGroup]="myControl">
+ <mat-form-field class="search-full-width">
+ <input #resourceSelect type="text" [(ngModel)]="searchText" placeholder="Search Resources" matInput [matAutocomplete]="auto" formControlName="search_input">
+ <button matSuffix mat-icon-button (click)="fetchResourceByName()"><mat-icon>search</mat-icon></button>
+ <!-- <mat-autocomplete #auto="matAutocomplete">
+ <mat-option (click)="selected(option)" *ngFor="let option of options | search : searchText" [value]="option.tags">
+ {{option.tags}}
+ </mat-option>
+ </mat-autocomplete> -->
+ </mat-form-field>
+ </form>
</div> \ No newline at end of file
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts
index 1221e8f2b..64352b224 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts
+++ b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts
@@ -19,7 +19,7 @@ limitations under the License.
============LICENSE_END============================================
*/
-import { Component, OnInit, EventEmitter, Output, ViewChild } from '@angular/core';
+import { Component, OnInit, EventEmitter, Output, ViewChild, Input } from '@angular/core';
import { Store } from '@ngrx/store';
import * as JSZip from 'jszip';
import { Observable } from 'rxjs';
@@ -31,6 +31,8 @@ import { LoadBlueprintSuccess, SET_BLUEPRINT_STATE, SetBlueprintState } from '..
import { json } from 'd3';
import { SortPipe } from '../../../../common/shared/pipes/sort.pipe';
import { LoaderService } from '../../../../common/core/services/loader.service';
+import { FormGroup, FormBuilder, Validators } from '@angular/forms';
+import { MatAutocompleteTrigger } from '@angular/material';
@Component({
selector: 'app-search-template',
@@ -47,6 +49,12 @@ export class SearchTemplateComponent implements OnInit {
uploadedFileName: string;
@ViewChild('fileInput') fileInput;
result: string = '';
+ @Input() optionSelected: string;
+ myControl: FormGroup;
+ @ViewChild('resourceSelect', { read: MatAutocompleteTrigger }) resourceSelect: MatAutocompleteTrigger;
+ @Output() resourcesData = new EventEmitter();
+ options: any[] = [];
+ searchText: string = '';
private paths = [];
private tree;
@@ -57,11 +65,30 @@ export class SearchTemplateComponent implements OnInit {
private blueprintName: string;
private entryDefinition: string;
- constructor(private store: Store<IAppState>, private loader: LoaderService) { }
+ constructor(private store: Store<IAppState>, private loader: LoaderService,private formBuilder: FormBuilder) { }
ngOnInit() {
+ this.myControl = this.formBuilder.group({
+ search_input: ['', Validators.required]
+ });
+ }
+
+ selected(value) {
+ this.resourcesData.emit(value);
}
+ fetchResourceByName() {
+ // this.exsistingModelService.searchByTags(this.searchText)
+ // .subscribe(data => {
+ // console.log(data);
+ // data.forEach(element => {
+ // this.options.push(element)
+ // });
+ // this.resourceSelect.openPanel();
+ // }, error => {
+ // window.alert('error' + error);
+ // })
+ }
fileChanged(e: any) {
this.paths = [];
this.file = e.target.files[0];
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.service.spec.ts b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.service.spec.ts
new file mode 100644
index 000000000..418b7e9ca
--- /dev/null
+++ b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.service.spec.ts
@@ -0,0 +1,12 @@
+import { TestBed } from '@angular/core/testing';
+
+import { SearchTemplateService } from './search-template.service';
+
+describe('SearchTemplateService', () => {
+ beforeEach(() => TestBed.configureTestingModule({}));
+
+ it('should be created', () => {
+ const service: SearchTemplateService = TestBed.get(SearchTemplateService);
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.service.ts b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.service.ts
new file mode 100644
index 000000000..fdb261d52
--- /dev/null
+++ b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.service.ts
@@ -0,0 +1,16 @@
+import { Injectable } from '@angular/core';
+import { HttpClient } from '@angular/common/http';
+import { Observable } from 'rxjs';
+import { ApiService } from '../../../../common/core/services/api.service';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class SearchTemplateService {
+
+ constructor(private _http: HttpClient, private api: ApiService) { }
+
+ searchByTags(uri: string, searchText: String): Observable<any>{
+ return this.api.post(uri, searchText);
+ }
+}
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/select-template/select-template.component.html b/cds-ui/client/src/app/feature-modules/blueprint/select-template/select-template.component.html
index d11b37144..97c65b220 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/select-template/select-template.component.html
+++ b/cds-ui/client/src/app/feature-modules/blueprint/select-template/select-template.component.html
@@ -22,7 +22,7 @@ limitations under the License.
<mat-step [stepControl]="step1FormGroup">
<ng-template matStepLabel>Choose CBA Template file</ng-template>
<div class="matStepContent">
- <app-template-options></app-template-options>
+ <app-template-options (option)="templateSelected($event)"></app-template-options>
<br>
<div>
<button mat-button matStepperNext class="matStepNextBtn">Proceed</button>
@@ -30,10 +30,10 @@ limitations under the License.
</div>
</mat-step>
- <mat-step [stepControl]="step2FormGroup">
+ <mat-step [stepControl]="step2FormGroup" *ngIf="templateOption==1 || templateOption == 2">
<ng-template matStepLabel>Browse CBA Template file</ng-template>
<div class="matStepContent">
- <app-search-template (cbaFile)="fileChange($event)"></app-search-template>
+ <app-search-template [optionSelected]="templateOption" (cbaFile)="fileChange($event)"></app-search-template>
<!-- <div>
<button mat-button matStepperNext class="matStepNextBtn">Upload</button>
</div>-->
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/select-template/select-template.component.ts b/cds-ui/client/src/app/feature-modules/blueprint/select-template/select-template.component.ts
index d9591dd80..561f15a5d 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/select-template/select-template.component.ts
+++ b/cds-ui/client/src/app/feature-modules/blueprint/select-template/select-template.component.ts
@@ -38,6 +38,7 @@ export class SelectTemplateComponent implements OnInit {
metaData: IMetaData;
blueprintState: IBlueprintState;
importModel: IImportModel;
+ templateOption: any;
constructor(private store: Store<IBlueprintState>) {
// this.importModel.file = '';
@@ -45,6 +46,12 @@ export class SelectTemplateComponent implements OnInit {
ngOnInit() {
}
+
+ templateSelected(option: any) {
+ this.templateOption = option;
+ console.log(this.templateOption);
+ }
+
fileChange(topologyTemp: ITopologyTemplate) {
this.topologyTemplate = topologyTemp;
console.log(topologyTemp);
@@ -57,6 +64,7 @@ export class SelectTemplateComponent implements OnInit {
upload() {
}
+
// saveBlueprintModel(){
// this.blueprint.toplogyTemplates=this.topologyTemplate;
// this.blueprint.metadata= this.metaData;
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/select-template/template-options/template-options.component.html b/cds-ui/client/src/app/feature-modules/blueprint/select-template/template-options/template-options.component.html
index d66b559f3..57ff00df5 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/select-template/template-options/template-options.component.html
+++ b/cds-ui/client/src/app/feature-modules/blueprint/select-template/template-options/template-options.component.html
@@ -19,7 +19,7 @@ limitations under the License.
============LICENSE_END============================================
-->
<mat-radio-group>
- <mat-radio-button value="1" (click)="selected(1)">Upload Template file</mat-radio-button><br><br>
- <!-- <mat-radio-button value="2" (click)="selected(2)">Starter Template</mat-radio-button><br><br>
- <mat-radio-button value="3" (click)="selected(3)">Existing Model File</mat-radio-button> -->
+ <mat-radio-button value="1" (click)="selected(1)">Upload Template file</mat-radio-button><br> <br>
+ <mat-radio-button value="2" (click)="selected(2)">Starter Template</mat-radio-button><br> <br>
+ <mat-radio-button value="3" (click)="selected(3)">Existing Model File</mat-radio-button>
</mat-radio-group> \ No newline at end of file
diff --git a/cds-ui/server/config/app-config.ts b/cds-ui/server/config/app-config.ts
deleted file mode 100644
index 80f246427..000000000
--- a/cds-ui/server/config/app-config.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-export const controllerApiConfig = Object.freeze({
- url: process.env.API_BLUEPRINT_CONTROLLER_BASE_URL || "http://localhost:8080/api/v1",
- authToken: process.env.API_BLUEPRINT_CONTROLLER_AUTH_TOKEN || "Basic Y2NzZGthcHBzOmNjc2RrYXBwcw=="
-});
-
-export const processorApiConfig = Object.freeze({
- url: process.env.API_BLUEPRINT_PROCESSOR_BASE_URL || "http://localhost:8081/api/v1",
- authToken: process.env.API_BLUEPRINT_PROCESSOR_AUTH_TOKEN || "Basic Y2NzZGthcHBzOmNjc2RrYXBwcw=="
-}); \ No newline at end of file
diff --git a/cds-ui/server/index.js b/cds-ui/server/index.js
index b79f7d6d3..161a18be7 100644
--- a/cds-ui/server/index.js
+++ b/cds-ui/server/index.js
@@ -20,6 +20,7 @@ limitations under the License.
*/
const application = require('./dist');
+const fs = require('fs')
module.exports = application;
@@ -27,6 +28,9 @@ if (require.main === module) {
// Run the application
const config = {
rest: {
+ protocol: 'https',
+ key: fs.readFileSync('server.key'),
+ cert: fs.readFileSync('server.cert'),
port: +process.env.PORT || 3000,
host: process.env.HOST || 'localhost',
openApiSpec: {
diff --git a/cds-ui/server/package.json b/cds-ui/server/package.json
index 5b8f7e67c..2f33abae7 100644
--- a/cds-ui/server/package.json
+++ b/cds-ui/server/package.json
@@ -12,7 +12,7 @@
},
"scripts": {
"build:apidocs": "lb-apidocs",
- "build": "lb-tsc es2017 --outDir dist",
+ "build": "npm run copy:proto && lb-tsc es2017 --copy-resources --outDir dist",
"build:watch": "lb-tsc --watch",
"clean": "lb-clean dist",
"lint": "npm run prettier:check && npm run tslint",
@@ -29,7 +29,8 @@
"migrate": "node ./dist/src/migrate",
"prestart": "npm run build",
"start": "node .",
- "prepublishOnly": "npm run test"
+ "prepublishOnly": "npm run test",
+ "copy:proto": "mkdir -p dist; cp -R target/generated/proto-definition/proto/ dist/proto"
},
"repository": {
"type": "git"
@@ -45,6 +46,7 @@
"src"
],
"dependencies": {
+ "@grpc/proto-loader": "^0.5.1",
"@loopback/boot": "^1.0.8",
"@loopback/context": "^1.16.0",
"@loopback/core": "^1.1.3",
@@ -55,6 +57,7 @@
"@loopback/service-proxy": "^1.0.8",
"@types/form-data": "^2.2.1",
"@types/jszip": "^3.1.5",
+ "@types/uuid": "^3.4.4",
"bluebird": "^3.5.3",
"cors": "^2.8.5",
"file": "^0.2.2",
@@ -63,11 +66,13 @@
"form-data": "^2.3.3",
"formidable": "^1.2.1",
"fs": "0.0.1-security",
+ "grpc": "^1.21.1",
"jszip": "^3.2.1",
"loopback-connector-rest": "^3.4.1",
"multer": "^1.4.1",
"multiparty": "^4.2.1",
"nodemon": "^1.18.10",
+ "uuid": "^3.3.2",
"winston": "^3.2.1"
},
"devDependencies": {
diff --git a/cds-ui/server/pom.xml b/cds-ui/server/pom.xml
index ae9b1b293..8d758c710 100644
--- a/cds-ui/server/pom.xml
+++ b/cds-ui/server/pom.xml
@@ -42,9 +42,38 @@ limitations under the License.
<docker.push.phase>deploy</docker.push.phase>
</properties>
+
<build>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>3.1.1</version>
+ <executions>
+ <execution>
+ <id>unpack-blueprint-grpc-proto</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.onap.ccsdk.cds.components</groupId>
+ <artifactId>proto-definition</artifactId>
+ <version>${project.version}</version>
+ <type>jar</type>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/generated/proto-definition/proto</outputDirectory>
+ <includes>**/*.proto</includes>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<!-- Use the latest released version: https://repo1.maven.org/maven2/com/github/eirslett/frontend-maven-plugin/ -->
diff --git a/cds-ui/server/server.cert b/cds-ui/server/server.cert
new file mode 100644
index 000000000..a5b2eca4f
--- /dev/null
+++ b/cds-ui/server/server.cert
@@ -0,0 +1,23 @@
+-----BEGIN CERTIFICATE-----
+MIID6zCCAtOgAwIBAgIUKOL8h9cYkcHjt/7+3zsOUZGBEggwDQYJKoZIhvcNAQEL
+BQAwgYQxCzAJBgNVBAYTAklFMQswCQYDVQQIDAJXSDEQMA4GA1UEBwwHQXRobG9u
+ZTERMA8GA1UECgwIRXJpY3Nzb24xDDAKBgNVBAsMA0VTWTESMBAGA1UEAwwJSGVu
+cnkgWGllMSEwHwYJKoZIhvcNAQkBFhJoZW5yeS54aWVAZXN0LnRlY2gwHhcNMTkw
+NzAzMTU1MzAxWhcNMTkwODAyMTU1MzAxWjCBhDELMAkGA1UEBhMCSUUxCzAJBgNV
+BAgMAldIMRAwDgYDVQQHDAdBdGhsb25lMREwDwYDVQQKDAhFcmljc3NvbjEMMAoG
+A1UECwwDRVNZMRIwEAYDVQQDDAlIZW5yeSBYaWUxITAfBgkqhkiG9w0BCQEWEmhl
+bnJ5LnhpZUBlc3QudGVjaDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
+ALuanknRJk8yXoafxrcbV1JBU57REt4Qpesv4jWt5YybQ+EvdodOCl65Rjsfe38q
+hVzUV/4RWctERXutE0pofDGK5Q29Uu3W627eMuSYitbVvuHcVCCVRgjYVjZDh53j
+y29IrzSiV2W6Sp4hkUZpTciLXNFFoSC8ZIKz7k1uF7Sokrk4ehm38vIcRFsbkxtu
+a41P0/aT1XK/+dr5u2KzyfC/1gj3t4o03vSuBWopcRxabnKg2uygWYHAjzvyUqfj
+y3Su55wjl3pw2/0qKvaYCvDV4DQLxs0yIrV1oYyckoHeW0GUEROrGFQIzk8KyEOS
+WdlqpJco6RonGn1eErEf3gUCAwEAAaNTMFEwHQYDVR0OBBYEFO7nN1ukrhBLZAD7
+yYD1G1g8VGNRMB8GA1UdIwQYMBaAFO7nN1ukrhBLZAD7yYD1G1g8VGNRMA8GA1Ud
+EwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBADzyzDmN3J2sALTtmjfiAelH
+NfVmNc0ZjiExURCyEreAE78XGz/a/5avQWlLqo0TkaUVnrUh1UAOAFl2sa6uASOe
+xwRk3eIwuQQHiYV+W2BlW0tEiQ6vtmRJ7/CvCDKM9LN/FPWWN0abZ78NXruQSZox
+RJ9z6osrQv5sEkZ9cQ9m7/TW1fG0aysAtHqDccDIOpNEmOCxlLBdnI1IeQjqcCHO
+K1+5mYhf9TiRFmnVulwzPDB1VyXsM17Q2AcwfvP+9A/c9aDBkuzkGuC5hEEgyH1z
+3G/y2KKaZ/L3/cCaB0X0YcY0bvLVHdaKehTpbYn8BzA78zJTQJ27Q1MLl1PX8BY=
+-----END CERTIFICATE-----
diff --git a/cds-ui/server/server.key b/cds-ui/server/server.key
new file mode 100644
index 000000000..c73a1b9d8
--- /dev/null
+++ b/cds-ui/server/server.key
@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC7mp5J0SZPMl6G
+n8a3G1dSQVOe0RLeEKXrL+I1reWMm0PhL3aHTgpeuUY7H3t/KoVc1Ff+EVnLREV7
+rRNKaHwxiuUNvVLt1utu3jLkmIrW1b7h3FQglUYI2FY2Q4ed48tvSK80oldlukqe
+IZFGaU3Ii1zRRaEgvGSCs+5Nbhe0qJK5OHoZt/LyHERbG5MbbmuNT9P2k9Vyv/na
++btis8nwv9YI97eKNN70rgVqKXEcWm5yoNrsoFmBwI878lKn48t0ruecI5d6cNv9
+Kir2mArw1eA0C8bNMiK1daGMnJKB3ltBlBETqxhUCM5PCshDklnZaqSXKOkaJxp9
+XhKxH94FAgMBAAECggEAdSXMChRMc8/kLvS+xcCQ+pBIgzfTLFABC6fO/e4lFXQv
+IwLcZQlaeGQBcxHpsDMBLEJ83+49wCxVpzEghqpQQy+UcMv0aQh347dk2FJZAGZg
+1/EZp28PWJ6e1yu8F+ATPN6KabemE6QMzEnxyaIgLEa6IwPz5dk+ek+ZU0iYDPrT
+1b7co+ompuOF34huHLks8U65CGlflatsgmPf+iXIOh0qLMJCAxavncbCPIH2BzpK
+T9YLPWHc3g0NVx/uPJi2/AIjaJ7+iC6qJnsEmD6akKpjUCvTkbUDUKjl9V+U5R0Q
+tSA3omnoIAs5CJ2GQuzTG+PNG6gAc3PuXuMfaSCiUQKBgQDzM8b1VokWOu9jNV1a
+2W86r9ShHFc/y7X5sgfHz1waPAyoYkNpjviYMqCtLDKK+A8Q/4qRKFykApN3TdqI
+ZHIZLHFQ32JUC8BbMKjSutnGlm/ovu01xI+fOKIvM4SsnQ5sJtpU1Z63g8IXPsjz
+kItGh2ETFaGxEk65v5j6qrXCOwKBgQDFed3MghVZRLxzbpFR7FN0W+T6G6d0Gp8x
+cSGUGqAcM62FhDI/fDguTwLcQz4ruHKXAwlOuX+FwV9RAQ046EuqZU8iBHpbO8Mh
+QfnoChRgCDHyL9bBSqOiGqNpwFMPk3p/XhQ1yGKjXCDTNtmfDKMZkkz4rM8uc1zC
+AliIuPicvwKBgQDYPR5W/8VOFcLJ5CYIZDJI7RPS2F8fYyJ/THMsjsvmq6PZh91G
+mw+gS8ufjh+2fo7u3ze2jzunvH6f4oI/KYhlp6VtceF8tyImMqK5E9gUgagpOrGx
+T/8fY/yYmWcLD25GbVlNes7vfuBxSKrmHYwofrCqhl5JEe0brSb5IhYQBwKBgEAM
+bqvN5S625Ihr7CYuCENNKs8T+RPnLorSrpliqVt8R2NupP2CRJaAeeUGyjtT75ab
+HYGzGHFBbrDPLoKulRwHD8twuF6u23MF+xAPdNxQzCJI8dZvZvNEwIukHUyIAMse
+sF9hRtzFHMBkoeC8MIoysVRWeDwQnp0uNZjipX/xAoGAFuCuYcN7MghscnoBcgK8
+0S57weKw4l2gNTMBCCQo/FiYHQN2H298oVu19dYSUZ/J5oJSHDp5ezC0Taxc4NB+
+3dQiZbVwiimoNuEj/PG95gA84TVld1igiG4ynQOAjw5s6H7sQX/ePVzorPrmcoGL
+4YZxlJnmWQc201pMXp2mPEY=
+-----END PRIVATE KEY-----
diff --git a/cds-ui/server/src/clients/blueprint-management-service-grpc-client.ts b/cds-ui/server/src/clients/blueprint-management-service-grpc-client.ts
new file mode 100644
index 000000000..b66b2a771
--- /dev/null
+++ b/cds-ui/server/src/clients/blueprint-management-service-grpc-client.ts
@@ -0,0 +1,86 @@
+/**
+ ~ Copyright © 2019 Bell Canada.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ 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.
+*/
+import * as fs from 'fs';
+import * as uuidv1 from 'uuid/v1';
+const grpc = require('grpc');
+import * as protoLoader from '@grpc/proto-loader';
+import {processorApiConfig} from '../config/app-config';
+
+const PROTO_PATH = processorApiConfig.grpc.bluePrintManagement.protoPath;
+
+// Suggested options for similarity to existing grpc.load behavior
+const packageDefinition: protoLoader.PackageDefinition = protoLoader.loadSync(
+ PROTO_PATH,
+ {
+ keepCase: true,
+ longs: String,
+ enums: String,
+ defaults: true,
+ oneofs: true
+ });
+
+const protoDescriptor = grpc.loadPackageDefinition(packageDefinition);
+// The protoDescriptor object has the full package hierarchy
+
+const stub = new protoDescriptor.org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementService(
+ "" + processorApiConfig.grpc.host + ":" + processorApiConfig.grpc.port + "",
+ grpc.credentials.createInsecure());
+
+const metadata = new grpc.Metadata();
+metadata.add('Authorization', processorApiConfig.grpc.authToken);
+
+class BluePrintManagementServiceGrpcClient {
+
+ async uploadBlueprint(filePath: string): Promise<any> {
+
+ let input = {
+ commonHeader: {
+ timestamp: new Date(),
+ originatorId: "cds-ui",
+ requestId: uuidv1(),
+ subRequestId: "1234-56",
+ },
+ fileChunk: {
+ chunk: fs.readFileSync(filePath)
+ }
+ }
+
+ let removeTempFile = () => {
+ fs.unlink(filePath, (err: any) => {
+ if (err) {
+ console.error(err);
+ }
+ });
+ }
+
+ return new Promise<any>((resolve, reject) => {
+ stub.uploadBlueprint(input, metadata, (err: any, output: any) => {
+ if (err) {
+ removeTempFile();
+ reject(err);
+ return;
+ }
+
+ removeTempFile();
+ resolve(output);
+ });
+ });
+
+ }
+}
+
+export const bluePrintManagementServiceGrpcClient = new BluePrintManagementServiceGrpcClient();
+
diff --git a/cds-ui/server/src/config/app-config.ts b/cds-ui/server/src/config/app-config.ts
new file mode 100644
index 000000000..24aeb26b5
--- /dev/null
+++ b/cds-ui/server/src/config/app-config.ts
@@ -0,0 +1,47 @@
+/**
+ ~ Copyright © 2019 Bell Canada.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ 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.
+*/
+export const appConfig = Object.freeze({
+ action: Object.freeze({
+ deployBlueprint: Object.freeze({
+ grpcEnabled: process.env.APP_ACTION_DEPLOY_BLUEPRINT_GRPC_ENABLED || true
+ })
+ })
+});
+
+export const controllerApiConfig = Object.freeze({
+ http: Object.freeze({
+ url: process.env.API_BLUEPRINT_CONTROLLER_HTTP_BASE_URL || "http://localhost:8080/api/v1",
+ authToken: process.env.API_BLUEPRINT_CONTROLLER_HTTP_AUTH_TOKEN || "Basic Y2NzZGthcHBzOmNjc2RrYXBwcw=="
+ })
+});
+
+export const processorApiConfig = Object.freeze({
+ http: Object.freeze({
+ url: process.env.API_BLUEPRINT_PROCESSOR_HTTP_BASE_URL || "http://localhost:8081/api/v1",
+ authToken: process.env.API_BLUEPRINT_PROCESSOR_HTTP_AUTH_TOKEN || "Basic Y2NzZGthcHBzOmNjc2RrYXBwcw=="
+ }),
+ grpc: Object.freeze({
+ host: process.env.API_BLUEPRINT_PROCESSOR_GRPC_HOST || "localhost",
+ port: process.env.API_BLUEPRINT_PROCESSOR_GRPC_PORT || 9111,
+ authToken: process.env.API_BLUEPRINT_PROCESSOR_GRPC_AUTH_TOKEN || "Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==",
+ bluePrintManagement: Object.freeze({
+ //this path is relative to 'dist' folder
+ protoPath: __dirname + '../../../proto/BluePrintManagement.proto'
+ })
+ })
+});
+
+
diff --git a/cds-ui/server/src/controllers/blueprint-rest.controller.ts b/cds-ui/server/src/controllers/blueprint-rest.controller.ts
index 877fa02bb..52e77ee7b 100644
--- a/cds-ui/server/src/controllers/blueprint-rest.controller.ts
+++ b/cds-ui/server/src/controllers/blueprint-rest.controller.ts
@@ -48,7 +48,8 @@ import { BlueprintService } from '../services';
import * as fs from 'fs';
import * as multiparty from 'multiparty';
import * as request_lib from 'request';
-import {controllerApiConfig, processorApiConfig} from '../../config/app-config';
+import {controllerApiConfig, processorApiConfig, appConfig} from '../config/app-config';
+import {bluePrintManagementServiceGrpcClient} from '../clients/blueprint-management-service-grpc-client';
export class BlueprintRestController {
constructor(
@@ -197,11 +198,10 @@ export class BlueprintRestController {
): Promise<Response> {
return new Promise((resolve, reject) => {
this.getFileFromMultiPartForm(request).then(file=>{
- this.uploadFileToBlueprintProcessor(file, "/execution-service/upload/", response).then(resp=>{
- resolve(resp);
- }, err=>{
- reject(err);
- });
+ if(appConfig.action.deployBlueprint.grpcEnabled)
+ return this.uploadFileToBlueprintProcessorGrpc(file, response);
+ else
+ return this.uploadFileToBlueprintProcessor(file, "/execution-service/upload/", response);
}, err=>{
reject(err);
});
@@ -209,11 +209,11 @@ export class BlueprintRestController {
}
async uploadFileToBlueprintController(file: multiparty.File, uri: string, response: Response): Promise<Response>{
- return this.uploadFileToBlueprintService(file, controllerApiConfig.url + uri, controllerApiConfig.authToken, response);
+ return this.uploadFileToBlueprintService(file, controllerApiConfig.http.url + uri, controllerApiConfig.http.authToken, response);
}
async uploadFileToBlueprintProcessor(file: multiparty.File, uri: string, response: Response): Promise<Response>{
- return this.uploadFileToBlueprintService(file, processorApiConfig.url + uri, processorApiConfig.authToken, response);
+ return this.uploadFileToBlueprintService(file, processorApiConfig.http.url + uri, processorApiConfig.http.authToken, response);
}
async uploadFileToBlueprintService(file: multiparty.File, url: string, authToken: string, response: Response): Promise<Response>{
@@ -256,7 +256,7 @@ export class BlueprintRestController {
}
async downloadFileFromBlueprintController(uri: string, response: Response): Promise<Response> {
- return this.downloadFileFromBlueprintService(controllerApiConfig.url + uri, controllerApiConfig.authToken, response);
+ return this.downloadFileFromBlueprintService(controllerApiConfig.http.url + uri, controllerApiConfig.http.authToken, response);
}
async downloadFileFromBlueprintService(url: string, authToken: string, response: Response): Promise<Response> {
@@ -277,4 +277,16 @@ export class BlueprintRestController {
});
})
}
+
+ async uploadFileToBlueprintProcessorGrpc(file: multiparty.File, response: Response): Promise<Response> {
+ return new Promise<Response>((resolve, reject) => {
+ bluePrintManagementServiceGrpcClient.uploadBlueprint(file.path).then(output=>{
+ response.send(output.status.message);
+ resolve(response);
+ }, err=>{
+ response.status(500).send(err);
+ resolve(response);
+ });
+ });
+ }
} \ No newline at end of file
diff --git a/cds-ui/server/src/datasources/blueprint.datasource-template.ts b/cds-ui/server/src/datasources/blueprint.datasource-template.ts
index f5dad3a1e..35edf33e3 100644
--- a/cds-ui/server/src/datasources/blueprint.datasource-template.ts
+++ b/cds-ui/server/src/datasources/blueprint.datasource-template.ts
@@ -1,19 +1,19 @@
-import {controllerApiConfig} from '../../config/app-config';
+import {controllerApiConfig} from '../config/app-config';
export default {
"name": "blueprint",
"connector": "rest",
- "baseURL": controllerApiConfig.url,
+ "baseURL": controllerApiConfig.http.url,
"crud": false,
"debug": true,
"operations": [{
"template": {
"method": "GET",
- "url": controllerApiConfig.url + "/blueprint-model/",
+ "url": controllerApiConfig.http.url + "/blueprint-model/",
"headers": {
"accepts": "application/json",
"content-type": "application/json",
- "authorization": controllerApiConfig.authToken
+ "authorization": controllerApiConfig.http.authToken
},
"responsePath": "$.*"
},
diff --git a/cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts b/cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts
index 1c459e0e7..c749eee62 100644
--- a/cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts
+++ b/cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts
@@ -1,19 +1,19 @@
-import {controllerApiConfig} from '../../config/app-config';
+import {controllerApiConfig} from '../config/app-config';
export default {
"name": "resourceDictionary",
"connector": "rest",
- "baseURL": controllerApiConfig.url + "/dictionary",
+ "baseURL": controllerApiConfig.http.url + "/dictionary",
"crud": false,
"debug": true,
"operations": [{
"template": {
"method": "GET",
- "url": controllerApiConfig.url + "/dictionary/{name}",
+ "url": controllerApiConfig.http.url + "/dictionary/{name}",
"headers": {
"accepts": "application/json",
"content-type": "application/json",
- "authorization": controllerApiConfig.authToken
+ "authorization": controllerApiConfig.http.authToken
},
"responsePath": "$.*"
},
@@ -25,11 +25,11 @@ export default {
{
"template": {
"method": "GET",
- "url": controllerApiConfig.url + "/dictionary/source-mapping",
+ "url": controllerApiConfig.http.url + "/dictionary/source-mapping",
"headers": {
"accepts": "application/json",
"content-type": "application/json",
- "authorization": controllerApiConfig.authToken
+ "authorization": controllerApiConfig.http.authToken
},
"responsePath": "$.*"
},
@@ -41,11 +41,11 @@ export default {
{
"template": {
"method": "GET",
- "url": controllerApiConfig.url + "/dictionary/search/{tags}",
+ "url": controllerApiConfig.http.url + "/dictionary/search/{tags}",
"headers": {
"accepts": "application/json",
"content-type": "application/json",
- "authorization": controllerApiConfig.authToken
+ "authorization": controllerApiConfig.http.authToken
},
"responsePath": "$.*"
},
@@ -57,11 +57,11 @@ export default {
{
"template": {
"method": "POST",
- "url": controllerApiConfig.url + "/dictionary",
+ "url": controllerApiConfig.http.url + "/dictionary",
"headers": {
"accepts": "application/json",
"content-type": "application/json",
- "authorization": controllerApiConfig.authToken
+ "authorization": controllerApiConfig.http.authToken
},
"body": "{resourceDictionary}",
"responsePath": "$.*"
@@ -74,11 +74,11 @@ export default {
{
"template": {
"method": "POST",
- "url": controllerApiConfig.url + "/dictionary/by-names",
+ "url": controllerApiConfig.http.url + "/dictionary/by-names",
"headers": {
"accepts": "application/json",
"content-type": "application/json",
- "authorization": controllerApiConfig.authToken
+ "authorization": controllerApiConfig.http.authToken
},
"body": "{resourceDictionaryList}",
"responsePath": "$.*"
diff --git a/cds-ui/server/src/sequence.ts b/cds-ui/server/src/sequence.ts
index b282cbc62..84da5249d 100644
--- a/cds-ui/server/src/sequence.ts
+++ b/cds-ui/server/src/sequence.ts
@@ -31,6 +31,7 @@ import {
SequenceHandler,
} from '@loopback/rest';
import { logger } from './logger/logger';
+import { v4 as uuid } from 'uuid';
const SequenceActions = RestBindings.SequenceActions;
@@ -44,16 +45,22 @@ export class MySequence implements SequenceHandler {
) { }
async handle(context: RequestContext) {
+ const { request, response } = context;
try {
- const { request, response } = context;
- logger.info("Incoming request from %s %s and with header %s query %s params %s",
- request.method, request.url, JSON.stringify(request.headers), JSON.stringify(request.query), JSON.stringify(request.params))
+ if (!('X-ONAP-RequestID' in request.headers || 'x-onap-requestid' in request.headers)) {
+ request.headers = { 'X-ONAP-RequestID': uuid(), ...request.headers}
+ logger.info(JSON.stringify(request.headers))
+ }
const route = this.findRoute(request);
const args = await this.parseParams(request, route);
const result = await this.invoke(route, args);
this.send(response, result);
} catch (err) {
this.reject(context, err);
+ } finally {
+ const { authorization, ...headers} = request.headers;
+ logger.info("Incoming request from %s %s and with header %s query %s params %s and response code: %s",
+ request.method, request.url, JSON.stringify(headers), JSON.stringify(request.query), JSON.stringify(request.params), JSON.stringify(response.statusCode))
}
}
}
diff --git a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintProcessorApplication.java b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintProcessorApplication.java
index a27e079c7..3d5145a22 100644
--- a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintProcessorApplication.java
+++ b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintProcessorApplication.java
@@ -29,8 +29,7 @@ import org.springframework.context.annotation.ComponentScan;
*/
@SpringBootApplication
@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class})
-@ComponentScan(basePackages = {"org.onap.ccsdk.cds.controllerblueprints",
- "org.onap.ccsdk.cds.blueprintsprocessor"})
+@ComponentScan(basePackages = {"org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"})
public class BlueprintProcessorApplication {
public static void main(String[] args) {
diff --git a/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties b/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties
index a94fdf390..fae1adb72 100755
--- a/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties
+++ b/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties
@@ -1,3 +1,4 @@
+<<<<<<< HEAD
#
# Copyright � 2017-2018 AT&T Intellectual Property.
#
@@ -73,3 +74,12 @@ blueprintsprocessor.cliExecutor.enabled=true
### If enabling remote python executor, set this value to true
### blueprintprocessor.remoteScriptCommand.enabled=true
blueprintprocessor.remoteScriptCommand.enabled=false
+
+# Kafka-message-lib Configurations
+blueprintsprocessor.messageclient.self-service-api.topic=producer.t
+blueprintsprocessor.messageclient.self-service-api.type=kafka-basic-auth
+blueprintsprocessor.messageclient.self-service-api.bootstrapServers=127.0.0.1:9092
+blueprintsprocessor.messageclient.self-service-api.consumerTopic=receiver.t
+blueprintsprocessor.messageclient.self-service-api.groupId=receiver-id
+blueprintsprocessor.messageclient.self-service-api.clientId=default-client-id
+blueprintsprocessor.messageclient.self-service-api.kafkaEnable=false
diff --git a/ms/blueprintsprocessor/application/src/main/resources/application.properties b/ms/blueprintsprocessor/application/src/main/resources/application.properties
index 1319d9fb5..d6e7dc890 100755
--- a/ms/blueprintsprocessor/application/src/main/resources/application.properties
+++ b/ms/blueprintsprocessor/application/src/main/resources/application.properties
@@ -72,3 +72,11 @@ blueprintsprocessor.restclient.primary-aai-data.url=https://aai.onap:8443
blueprintsprocessor.restclient.primary-aai-data.username=aai@aai.onap.org
blueprintsprocessor.restclient.primary-aai-data.password=demo123456!
+# Kafka-message-lib Configuration
+blueprintsprocessor.messageclient.self-service-api.topic=producer.t
+blueprintsprocessor.messageclient.self-service-api.type=kafka-basic-auth
+blueprintsprocessor.messageclient.self-service-api.bootstrapServers=127.0.0.1:9092
+blueprintsprocessor.messageclient.self-service-api.consumerTopic=receiver.t
+blueprintsprocessor.messageclient.self-service-api.groupId=receiver-id
+blueprintsprocessor.messageclient.self-service-api.clientId=default-client-id
+blueprintsprocessor.messageclient.self-service-api.kafkaEnable=false
diff --git a/ms/blueprintsprocessor/application/src/test/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintProcessorApplicationTest.java b/ms/blueprintsprocessor/application/src/test/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintProcessorApplicationTest.java
index 90783d40f..fc36e6287 100644
--- a/ms/blueprintsprocessor/application/src/test/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintProcessorApplicationTest.java
+++ b/ms/blueprintsprocessor/application/src/test/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintProcessorApplicationTest.java
@@ -16,7 +16,6 @@
package org.onap.ccsdk.cds.blueprintsprocessor;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -34,7 +33,6 @@ import org.springframework.test.context.junit4.SpringRunner;
* @author Brinda Santh
* DATE : 8/14/2018
*/
-
@RunWith(SpringRunner.class)
@ContextConfiguration(classes = {BlueprintProcessorApplication.class, BluePrintLoadConfiguration.class})
@SpringBootTest(classes = BlueprintProcessorApplication.class,
diff --git a/ms/blueprintsprocessor/application/src/test/resources/application.properties b/ms/blueprintsprocessor/application/src/test/resources/application.properties
index 09ee651a4..ea2f976a3 100644
--- a/ms/blueprintsprocessor/application/src/test/resources/application.properties
+++ b/ms/blueprintsprocessor/application/src/test/resources/application.properties
@@ -46,3 +46,13 @@ blueprintprocessor.netconfExecutor.enabled=true
blueprintprocessor.restConfExecutor.enabled=true
blueprintsprocessor.cliExecutor.enabled=true
blueprintprocessor.remoteScriptCommand.enabled=false
+
+
+# Kafka-message-lib Configuration
+blueprintsprocessor.messageclient.self-service-api.topic=producer.t
+blueprintsprocessor.messageclient.self-service-api.type=kafka-basic-auth
+blueprintsprocessor.messageclient.self-service-api.bootstrapServers=127.0.0.1:9092
+blueprintsprocessor.messageclient.self-service-api.consumerTopic=receiver.t
+blueprintsprocessor.messageclient.self-service-api.groupId=receiver-id
+blueprintsprocessor.messageclient.self-service-api.clientId=default-client-id
+blueprintsprocessor.messageclient.self-service-api.kafkaEnable=false
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt
index 2de22424e..c45fb881f 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt
@@ -16,6 +16,7 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.python.executor
+import com.fasterxml.jackson.databind.JsonNode
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.*
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ExecutionServiceConstant
@@ -75,8 +76,19 @@ open class ComponentRemotePythonExecutor(private val remoteScriptExecutionServic
val dynamicProperties = getOptionalOperationInput(INPUT_DYNAMIC_PROPERTIES)
val packages = getOptionalOperationInput(INPUT_PACKAGES)?.returnNullIfMissing()
- val args = getOptionalOperationInput(INPUT_ARGUMENT_PROPERTIES)?.returnNullIfMissing()
- ?.rootFieldsToMap()?.toSortedMap()?.values?.map { it.textValue() }?.joinToString(" ")
+ val argsNode = getOptionalOperationInput(INPUT_ARGUMENT_PROPERTIES)?.returnNullIfMissing()
+
+ // This prevents unescaping values, as well as quoting the each parameter, in order to allow for spaces in values
+ var args = ""
+ argsNode?.fields()?.forEach {
+ if (it.value.isValueNode) {
+ args = "$args ${it.value}"
+ } else {
+ it.value.fields().forEach { item ->
+ args = "$args ${item.value}"
+ }
+ }
+ }
val command = getOperationInput(INPUT_COMMAND).asText()
var scriptCommand = command.replace(pythonScript.name, pythonScript.absolutePath)
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
index 52ac346db..008e92437 100644
--- 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
@@ -16,6 +16,7 @@
package org.onap.ccsdk.cds.blueprintsprocessor.message.service
+import org.apache.commons.lang.builder.ToStringBuilder
import org.apache.kafka.clients.producer.ProducerConfig.*
import org.apache.kafka.common.serialization.StringSerializer
import org.onap.ccsdk.cds.blueprintsprocessor.message.KafkaBasicAuthMessageProducerProperties
@@ -27,7 +28,6 @@ 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 {
@@ -64,9 +64,8 @@ class KafkaBasicAuthMessageProducerService(
return true
}
-
private fun producerFactory(additionalConfig: Map<String, Any>? = null): ProducerFactory<String, Any> {
- log.info("Client Properties : $messageProducerProperties")
+ log.info("Client Properties : ${ToStringBuilder.reflectionToString(messageProducerProperties)}")
val configProps = hashMapOf<String, Any>()
configProps[BOOTSTRAP_SERVERS_CONFIG] = messageProducerProperties.bootstrapServers
configProps[KEY_SERIALIZER_CLASS_CONFIG] = StringSerializer::class.java
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml
index 340f2c618..89ad720f6 100755
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml
@@ -42,6 +42,7 @@
<artifactId>proto-definition</artifactId>
<version>${project.version}</version>
</dependency>
+
<dependency>
<groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
<artifactId>blueprint-core</artifactId>
@@ -59,6 +60,30 @@
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
+
+ <!-- For Message libraries -->
+ <dependency>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+ <artifactId>message-lib</artifactId>
+ </dependency>
+
+ <!-- For spring-kafka -->
+ <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>
+
+ <!-- Apache Kafka -->
+ <dependency>
+ <groupId>org.apache.kafka</groupId>
+ <artifactId>kafka_2.11</artifactId>
+ <version>${kafka.version}</version>
+ </dependency>
</dependencies>
</project>
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/MessagingConfig.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/MessagingConfig.kt
new file mode 100644
index 000000000..a04a79921
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/MessagingConfig.kt
@@ -0,0 +1,47 @@
+package org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api
+
+import org.apache.kafka.clients.CommonClientConfigs
+import org.apache.kafka.clients.consumer.ConsumerConfig
+import org.apache.kafka.common.serialization.StringDeserializer
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
+import org.springframework.beans.factory.annotation.Value
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+import org.springframework.kafka.annotation.EnableKafka
+import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory
+import org.springframework.kafka.core.ConsumerFactory
+import org.springframework.kafka.core.DefaultKafkaConsumerFactory
+import org.springframework.kafka.support.serializer.JsonDeserializer
+
+@Configuration
+open class MessagingConfig {
+
+ @Value("\${blueprintsprocessor.messageclient.self-service-api.groupId}")
+ lateinit var groupId: String
+
+ @Value("\${blueprintsprocessor.messageclient.self-service-api.bootstrapServers}")
+ lateinit var bootstrapServers: String
+
+ open fun consumerFactory(): ConsumerFactory<String, ExecutionServiceInput>? {
+ val configProperties = hashMapOf<String, Any>()
+ configProperties[CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG] = bootstrapServers
+ configProperties[ConsumerConfig.GROUP_ID_CONFIG] = groupId
+ configProperties[ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG] = StringDeserializer::class.java.name
+ configProperties[ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG] = JsonDeserializer::class.java.name
+ configProperties.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest")
+
+ return DefaultKafkaConsumerFactory(configProperties, StringDeserializer(), JsonDeserializer(ExecutionServiceInput::class.java))
+ }
+
+ /**
+ * Creation of a Kafka MessageListener Container
+ *
+ * @return KafkaListener instance.
+ */
+ @Bean
+ open fun kafkaListenerContainerFactory(): ConcurrentKafkaListenerContainerFactory<String, ExecutionServiceInput> {
+ val factory = ConcurrentKafkaListenerContainerFactory<String, ExecutionServiceInput>()
+ factory.consumerFactory = consumerFactory()
+ return factory
+ }
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/MessagingController.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/MessagingController.kt
new file mode 100644
index 000000000..1d219a83e
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/MessagingController.kt
@@ -0,0 +1,74 @@
+/*
+ * Copyright © 2019 Bell Canada
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * 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.selfservice.api
+
+import kotlinx.coroutines.async
+import kotlinx.coroutines.runBlocking
+import org.apache.commons.lang3.builder.ToStringBuilder
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
+import org.onap.ccsdk.cds.blueprintsprocessor.message.service.BluePrintMessageLibPropertyService
+import org.slf4j.LoggerFactory
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
+import org.springframework.kafka.annotation.KafkaListener
+import org.springframework.stereotype.Service
+
+@ConditionalOnProperty(name = ["blueprintsprocessor.messageclient.self-service-api.kafkaEnable"], havingValue = "true")
+@Service
+open class MessagingController(private val propertyService: BluePrintMessageLibPropertyService,
+ private val executionServiceHandler: ExecutionServiceHandler) {
+
+ private val log = LoggerFactory.getLogger(MessagingController::class.java)!!
+
+ companion object {
+ // TODO PREFIX should be retrieved from model or from request.
+ const val PREFIX = "self-service-api"
+ const val EXECUTION_STATUS = 200
+ }
+
+ @KafkaListener(topics = ["\${blueprintsprocessor.messageclient.self-service-api.consumerTopic}"])
+ open fun receive(input: ExecutionServiceInput) {
+
+ log.info("Successfully received a message: {}", ToStringBuilder.reflectionToString(input))
+
+ runBlocking {
+ log.info("Successfully received a message: {}", ToStringBuilder.reflectionToString(input))
+
+ // Process the message.
+ async {
+ processMessage(input)
+ }
+ }
+ }
+
+ private suspend fun processMessage(executionServiceInput: ExecutionServiceInput) {
+
+ val executionServiceOutput = executionServiceHandler.doProcess(executionServiceInput)
+
+ if (executionServiceOutput.status.code == EXECUTION_STATUS) {
+ val bluePrintMessageClientService = propertyService
+ .blueprintMessageClientService(PREFIX)
+
+ val payload = executionServiceOutput.payload
+
+ log.info("The payload to publish is {}", payload)
+
+ bluePrintMessageClientService.sendMessage(payload)
+ }
+ else {
+ log.error("Fail to process the given event due to {}", executionServiceOutput.status.errorMessage)
+ }
+ }
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt
index fd764d78f..e084c60cf 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt
@@ -23,6 +23,8 @@ import io.grpc.testing.GrpcServerRule
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
+import org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.messaginglib.MessagingControllerTest
+import org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.messaginglib.ProducerConfiguration
import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader
import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir
import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
@@ -33,6 +35,7 @@ import org.onap.ccsdk.cds.controllerblueprints.management.api.FileChunk
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
import org.springframework.context.annotation.ComponentScan
+import org.springframework.context.annotation.FilterType
import org.springframework.test.annotation.DirtiesContext
import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
@@ -44,7 +47,9 @@ import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
@EnableAutoConfiguration
@DirtiesContext
-@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"])
+@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"],
+ excludeFilters = [ComponentScan.Filter(value = [MessagingConfig::class, MessagingController::class, ProducerConfiguration::class,
+ MessagingControllerTest.ConsumerConfiguration::class, MessagingControllerTest::class], type = FilterType.ASSIGNABLE_TYPE)])
@TestPropertySource(locations = ["classpath:application-test.properties"])
class BluePrintManagementGRPCHandlerTest {
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt
index f8b972e64..5072b3c6a 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt
@@ -36,6 +36,7 @@ import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
import org.springframework.context.annotation.ComponentScan
+import org.springframework.context.annotation.FilterType
import org.springframework.test.annotation.DirtiesContext
import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
@@ -45,7 +46,8 @@ import kotlin.test.BeforeTest
@RunWith(SpringRunner::class)
@DirtiesContext
@EnableAutoConfiguration
-@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"])
+@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"],
+ excludeFilters =arrayOf(ComponentScan.Filter(value = [(MessagingController::class)], type = FilterType.ASSIGNABLE_TYPE)))
@TestPropertySource(locations = ["classpath:application-test.properties"])
class BluePrintProcessingGRPCHandlerTest {
private val log = LoggerFactory.getLogger(BluePrintProcessingGRPCHandlerTest::class.java)
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt
index 9cbd898dc..65b41262b 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt
@@ -30,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.autoconfigure.security.SecurityProperties
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest
import org.springframework.context.annotation.ComponentScan
+import org.springframework.context.annotation.FilterType
import org.springframework.core.io.ByteArrayResource
import org.springframework.http.client.MultipartBodyBuilder
import org.springframework.test.context.ContextConfiguration
@@ -49,7 +50,8 @@ import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
@WebFluxTest
@ContextConfiguration(classes = [ExecutionServiceHandler::class, BluePrintCoreConfiguration::class, BluePrintCatalogService::class, SecurityProperties::class])
-@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"])
+@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"],
+ excludeFilters =arrayOf(ComponentScan.Filter(value = [(MessagingController::class)], type = FilterType.ASSIGNABLE_TYPE)))
@TestPropertySource(locations = ["classpath:application-test.properties"])
class ExecutionServiceHandlerTest {
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/messaginglib/MessagingControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/messaginglib/MessagingControllerTest.kt
new file mode 100644
index 000000000..f7459f522
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/messaginglib/MessagingControllerTest.kt
@@ -0,0 +1,211 @@
+/*
+ * Copyright © 2019 Bell Canada
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * 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.selfservice.api.messaginglib
+
+import com.fasterxml.jackson.databind.node.ObjectNode
+import kotlinx.coroutines.reactive.awaitSingle
+import kotlinx.coroutines.runBlocking
+import org.apache.commons.lang.builder.ToStringBuilder
+import org.apache.kafka.clients.CommonClientConfigs
+import org.apache.kafka.clients.consumer.ConsumerConfig
+import org.apache.kafka.common.serialization.StringDeserializer
+import org.junit.After
+import org.junit.Before
+import org.junit.Test
+import org.junit.runner.RunWith
+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.selfservice.api.MessagingController
+import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
+import org.slf4j.LoggerFactory
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.beans.factory.annotation.Value
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration
+import org.springframework.boot.autoconfigure.security.SecurityProperties
+import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.ComponentScan
+import org.springframework.context.annotation.Configuration
+import org.springframework.core.io.ByteArrayResource
+import org.springframework.http.client.MultipartBodyBuilder
+import org.springframework.kafka.annotation.EnableKafka
+import org.springframework.kafka.annotation.KafkaListener
+import org.springframework.kafka.annotation.PartitionOffset
+import org.springframework.kafka.annotation.TopicPartition
+import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory
+import org.springframework.kafka.core.ConsumerFactory
+import org.springframework.kafka.core.DefaultKafkaConsumerFactory
+import org.springframework.kafka.core.KafkaTemplate
+import org.springframework.kafka.support.serializer.JsonDeserializer
+import org.springframework.kafka.test.context.EmbeddedKafka
+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.test.web.reactive.server.WebTestClient
+import org.springframework.test.web.reactive.server.returnResult
+import org.springframework.web.reactive.function.BodyInserters
+import java.io.File
+import java.nio.file.Files
+import java.nio.file.Paths
+import kotlin.test.assertNotNull
+
+@RunWith(SpringRunner::class)
+@EnableAutoConfiguration
+@ContextConfiguration(classes = [MessagingControllerTest::class, SecurityProperties::class])
+@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"])
+@TestPropertySource(locations = ["classpath:application-test.properties"])
+@DirtiesContext
+@EmbeddedKafka(ports = [9092])
+@WebFluxTest
+class MessagingControllerTest {
+
+ private val log = LoggerFactory.getLogger(MessagingControllerTest::class.java)!!
+
+ @Autowired
+ lateinit var controller: MessagingController
+
+ @Value("\${blueprintsprocessor.messageclient.self-service-api.consumerTopic}")
+ lateinit var topicUsedForConsumer: String
+
+ @Autowired
+ lateinit var kt: KafkaTemplate<String, ExecutionServiceInput>
+
+ @Autowired
+ lateinit var webTestClient: WebTestClient
+
+ var receivedEvent: String? = null
+
+ @Before
+ fun setup() {
+ deleteDir("target", "blueprints")
+ uploadBluePrint()
+ }
+
+ @After
+ fun clean() {
+ deleteDir("target", "blueprints")
+ }
+
+ @Test
+ fun testReceive() {
+ val samplePayload = "{\n" +
+ " \"resource-assignment-request\": {\n" +
+ " \"artifact-name\": [\"hostname\"],\n" +
+ " \"store-result\": true,\n" +
+ " \"resource-assignment-properties\" : {\n" +
+ " \"hostname\": \"demo123\"\n" +
+ " }\n" +
+ " }\n" +
+ " }"
+
+ kt.defaultTopic = topicUsedForConsumer
+
+ val input = ExecutionServiceInput().apply {
+ commonHeader = CommonHeader().apply {
+ originatorId = "1"
+ requestId = "1234"
+ subRequestId = "1234-1234"
+ }
+
+ actionIdentifiers = ActionIdentifiers().apply {
+ blueprintName = "golden"
+ blueprintVersion = "1.0.0"
+ actionName = "resource-assignment"
+ mode = "sync"
+ }
+
+ stepData = StepData().apply {
+ name = "resource-assignment"
+ }
+
+ payload = JacksonUtils.jsonNode(samplePayload) as ObjectNode
+ }
+
+ kt.sendDefault(input)
+ log.info("test-sender sent message='{}'", ToStringBuilder.reflectionToString(input))
+
+ Thread.sleep(1000)
+ }
+
+ @KafkaListener(topicPartitions = [TopicPartition(topic = "\${blueprintsprocessor.messageclient.self-service-api.topic}", partitionOffsets = [PartitionOffset(partition = "0", initialOffset = "0")])])
+ fun receivedEventFromBluePrintProducer(event: ExecutionServiceInput) {
+ assertNotNull(event)
+ }
+
+ private fun uploadBluePrint() {
+ runBlocking {
+ val body = MultipartBodyBuilder().apply {
+ part("file", object : ByteArrayResource(Files.readAllBytes(loadCbaArchive().toPath())) {
+ override fun getFilename(): String {
+ return "test-cba.zip"
+ }
+ })
+ }.build()
+
+ webTestClient
+ .post()
+ .uri("/api/v1/execution-service/upload")
+ .body(BodyInserters.fromMultipartData(body))
+ .exchange()
+ .expectStatus().isOk
+ .returnResult<String>()
+ .responseBody
+ .awaitSingle()
+ }
+ }
+
+ private fun loadCbaArchive():File {
+ return Paths.get("./src/test/resources/cba-for-kafka-integration.zip").toFile()
+ }
+
+ @Configuration
+ @EnableKafka
+ open class ConsumerConfiguration {
+
+ @Value("\${blueprintsprocessor.messageclient.self-service-api.bootstrapServers}")
+ lateinit var bootstrapServers: String
+
+ @Value("\${blueprintsprocessor.messageclient.self-service-api.groupId}")
+ lateinit var groupId:String
+
+ @Bean
+ open fun consumerFactory2(): ConsumerFactory<String, ExecutionServiceInput>? {
+ val configProperties = hashMapOf<String, Any>()
+ configProperties[CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG] = bootstrapServers
+ configProperties[ConsumerConfig.GROUP_ID_CONFIG] = groupId
+ configProperties[ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG] = StringDeserializer::class.java.name
+ configProperties[ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG] = JsonDeserializer::class.java.name
+ configProperties[ConsumerConfig.AUTO_OFFSET_RESET_CONFIG] = "earliest"
+ configProperties[ConsumerConfig.MAX_POLL_INTERVAL_MS_CONFIG] = 1000
+
+ return DefaultKafkaConsumerFactory(configProperties, StringDeserializer(),
+ JsonDeserializer(ExecutionServiceInput::class.java))
+ }
+
+ @Bean
+ open fun listenerFactory(): ConcurrentKafkaListenerContainerFactory<String, ExecutionServiceInput> {
+ val factory = ConcurrentKafkaListenerContainerFactory<String, ExecutionServiceInput>()
+ factory.consumerFactory = consumerFactory2()
+ return factory
+ }
+ }
+}
+
+
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/messaginglib/ProducerConfiguration.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/messaginglib/ProducerConfiguration.kt
new file mode 100644
index 000000000..dc1f38a63
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/messaginglib/ProducerConfiguration.kt
@@ -0,0 +1,48 @@
+/*
+ * Copyright © 2019 Bell Canada
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * 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.selfservice.api.messaginglib
+
+import org.apache.kafka.clients.producer.ProducerConfig
+import org.apache.kafka.common.serialization.StringSerializer
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
+import org.springframework.beans.factory.annotation.Value
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+import org.springframework.kafka.annotation.EnableKafka
+import org.springframework.kafka.core.DefaultKafkaProducerFactory
+import org.springframework.kafka.core.KafkaTemplate
+import org.springframework.kafka.core.ProducerFactory
+import org.springframework.kafka.support.serializer.JsonSerializer
+
+@Configuration
+open class ProducerConfiguration {
+
+ @Value("\${blueprintsprocessor.messageclient.self-service-api.bootstrapServers}")
+ lateinit var bootstrapServers: String
+
+ open fun kpf(): ProducerFactory<String, ExecutionServiceInput> {
+ val configs = HashMap<String, Any>()
+ configs[ProducerConfig.BOOTSTRAP_SERVERS_CONFIG] = bootstrapServers
+ configs[ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG] = StringSerializer::class.java
+ configs[ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG] = JsonSerializer::class.java
+ return DefaultKafkaProducerFactory(configs)
+ }
+
+ @Bean
+ open fun kt(): KafkaTemplate<String, ExecutionServiceInput> {
+ return KafkaTemplate<String, ExecutionServiceInput>(kpf())
+ }
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/application-test.properties b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/application-test.properties
index 6705523df..d532b1582 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/application-test.properties
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/application-test.properties
@@ -31,3 +31,12 @@ 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
+
+# Kafka-message-lib Configuration
+blueprintsprocessor.messageclient.self-service-api.kafkaEnable=true
+blueprintsprocessor.messageclient.self-service-api.topic=producer.t
+blueprintsprocessor.messageclient.self-service-api.type=kafka-basic-auth
+blueprintsprocessor.messageclient.self-service-api.bootstrapServers=127.0.0.1:9092
+blueprintsprocessor.messageclient.self-service-api.consumerTopic=receiver.t
+blueprintsprocessor.messageclient.self-service-api.groupId=receiver-id
+blueprintsprocessor.messageclient.self-service-api.clientId=default-client-id
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/cba-for-kafka-integration.zip b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/cba-for-kafka-integration.zip
new file mode 100644
index 000000000..23070380c
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/cba-for-kafka-integration.zip
Binary files differ
diff --git a/ms/blueprintsprocessor/parent/pom.xml b/ms/blueprintsprocessor/parent/pom.xml
index 4084f58f2..686be49fd 100755
--- a/ms/blueprintsprocessor/parent/pom.xml
+++ b/ms/blueprintsprocessor/parent/pom.xml
@@ -485,6 +485,13 @@
<scope>test</scope>
</dependency>
+ <!-- message-lib dependency -->
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>message-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
</dependencies>
</dependencyManagement>
diff --git a/ms/command-executor/src/main/python/command_executor_handler.py b/ms/command-executor/src/main/python/command_executor_handler.py
index 365c00188..305c83e17 100644
--- a/ms/command-executor/src/main/python/command_executor_handler.py
+++ b/ms/command-executor/src/main/python/command_executor_handler.py
@@ -163,9 +163,16 @@ class CommandExecutorHandler():
def activate_venv(self):
self.logger.info("{} - Activate Python Virtual Environment".format(self.blueprint_id))
+ # Fix: The python generated activate_this.py script concatenates the env bin dir to PATH on every call
+ # eventually this process PATH variable was so big (128Kb) that no child process could be spawn
+ # This script will remove all duplicates; while keeping the order of the PATH folders
+ fixpathenvvar = "os.environ['PATH']=os.pathsep.join(list(dict.fromkeys(os.environ['PATH'].split(':'))))"
+
path = "%s/bin/activate_this.py" % self.venv_home
try:
exec (open(path).read(), {'__file__': path})
+ exec (fixpathenvvar)
+ self.logger.info("Running with PATH : {}".format(os.environ['PATH']))
return True
except Exception as err:
self.logger.info(
diff --git a/pom.xml b/pom.xml
index ffdf0b92e..2a227c747 100644
--- a/pom.xml
+++ b/pom.xml
@@ -36,8 +36,8 @@ limitations under the License.
<description>CCSDK Controller Design Studio</description>
<modules>
- <module>cds-ui</module>
<module>components</module>
+ <module>cds-ui</module>
<module>ms</module>
</modules>