summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.html6
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts66
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.service.ts1
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/modify-template/modify-template.component.html2
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts7
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.component.html17
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.component.ts16
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.module.ts5
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.service.ts39
-rw-r--r--docs/CBA/index.rst4
-rw-r--r--docs/CBA/resourceassignment.rst3
-rw-r--r--docs/bluePrintsProcessor.rst54
-rw-r--r--docs/controllerBlueprintStudioProcessor.rst28
-rw-r--r--docs/datadictionary/capabilitytable.JPGbin0 -> 57448 bytes
-rw-r--r--docs/datadictionary/index.rst87
-rw-r--r--docs/datadictionary/media/image0.JPGbin0 -> 48105 bytes
-rw-r--r--docs/datadictionary/media/image1.JPGbin0 -> 79730 bytes
-rw-r--r--docs/datadictionary/resourcesource.rst110
-rw-r--r--docs/datadictionary/restauth.rst42
-rw-r--r--docs/datadictionary/resttable.JPGbin0 -> 79877 bytes
-rw-r--r--docs/datadictionary/sqltable.JPGbin0 -> 36259 bytes
-rw-r--r--docs/index.rst25
-rw-r--r--docs/media/CDS_architecture.JPGbin0 -> 140539 bytes
-rw-r--r--docs/media/image0.jpgbin0 -> 84320 bytes
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt (renamed from ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt)8
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicContext.kt (renamed from ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicContext.kt)0
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt (renamed from ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt)0
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ComponentWorkflowExecutionService.kt (renamed from ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/ComponentWorkflowExecutionService.kt)2
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionService.kt (renamed from ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionService.kt)6
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionService.kt (renamed from ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionService.kt)2
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/WorkflowServiceConfiguration.kt (renamed from ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/WorkflowServiceConfiguration.kt)0
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt (renamed from ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt)2
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/utils/SvcGraphUtils.kt (renamed from ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/utils/SvcGraphUtils.kt)0
-rw-r--r--ms/cds-sdc-listener/application/pom.xml33
-rw-r--r--ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerApplication.java17
-rw-r--r--ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerConfiguration.java18
-rw-r--r--ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerNotificationCallback.java58
-rw-r--r--ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/client/CdsSdcListenerAuthClientInterceptor.java16
-rw-r--r--ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/client/CdsSdcListenerClient.java25
-rw-r--r--ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/controller/HealthCheck.java35
-rw-r--r--ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/dto/CdsSdcListenerDto.java53
-rw-r--r--ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/exceptions/CdsSdcListenerException.java17
-rw-r--r--ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/handler/BluePrintProcesssorHandler.java17
-rw-r--r--ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/service/ListenerService.java23
-rw-r--r--ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/service/ListenerServiceImpl.java96
-rw-r--r--ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/status/CdsSdcListenerStatus.java83
-rw-r--r--ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/status/DistributionStatusMessage.java55
-rw-r--r--ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/util/BuilderUtil.java33
-rw-r--r--ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/util/FileUtil.java61
-rw-r--r--ms/cds-sdc-listener/application/src/main/resources/application.yml12
-rw-r--r--ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerClientTest.java19
-rw-r--r--ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerConfigurationTest.java19
-rw-r--r--ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/handler/BluePrintProcessorHandlerTest.java18
-rw-r--r--ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/service/ListenerServiceImplTest.java59
54 files changed, 1062 insertions, 237 deletions
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.html b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.html
index 5a3973a5e..619412c17 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.html
+++ b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.html
@@ -35,13 +35,13 @@ limitations under the License.
<button mat-icon-button disabled></button>
<button mat-icon-button (click)="selectFileToView(node)">{{node.name}}</button>
</mat-tree-node>
- <mat-tree-node *matTreeNodeDef="let node;when: hasChild" matTreeNodePadding (click)="activeNode = node" [ngClass]="{ 'background-highlight': activeNode === node }">
+ <mat-tree-node *matTreeNodeDef="let node;when: hasChild" matTreeNodePadding (click)="selectFolder(node);activeNode = node" [ngClass]="{ 'background-highlight': activeNode === node }">
<button mat-icon-button matTreeNodeToggle [attr.aria-label]="'toggle ' + node.name">
<mat-icon class="mat-icon-rtl-mirror">
{{treeControl.isExpanded(node) ? 'expand_more' : 'chevron_right'}}
</mat-icon>
</button>
- <button mat-icon-button (click)="selectFolder(node)">{{node.name}}</button>
+ <button mat-icon-button>{{node.name}}</button>
</mat-tree-node>
</mat-tree>
</div>
@@ -49,7 +49,7 @@ limitations under the License.
<!-- <i class="fa fa-save save-icon" style="font-size:24px" (click)="updateBlueprint()"></i>
<ace-editor [(text)]="text" [(mode)]="mode" #editor class="aceEditor"></ace-editor> -->
<div class="normal-editor-mode" [ngClass]="{ 'resource-mapping-mode': viewTemplateMode}">
- <i class="fa fa-save save-icon" style="font-size:24px" (click)="updateBlueprint()"></i>
+ <i class="fa fa-save save-icon" style="font-size:24px" (click)="saveEditedChanges()"></i>
<ace-editor [(text)]="text" [(mode)]="mode" #editor class="aceEditor"></ace-editor>
</div>
<button *ngIf="viewTemplateMode" class="btn-active" (click)="loadConfigParams()">Load Config Parameters</button>
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts
index 73cc72cfd..1f8526a53 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts
+++ b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts
@@ -165,7 +165,7 @@ export class EditorComponent implements OnInit {
blueprint.push(this.blueprintdata[key]);
}
}
- this.metadata=blueprintState.blueprint.metadata;
+ this.metadata = blueprintState.blueprint.metadata;
let metadatavalues = [];
for (let key in this.metadata) {
if (this.metadata.hasOwnProperty(key)) {
@@ -181,21 +181,21 @@ export class EditorComponent implements OnInit {
}
updateBlueprint() {
- console.log(this.blueprint);
- this.filesData.forEach(fileNode => {
- if (this.selectedFile && fileNode.name.includes(this.blueprintName.trim()) && fileNode.name.includes(this.selectedFile.trim())) {
- fileNode.data = this.text;
- } else if (this.selectedFile && fileNode.name.includes(this.currentFilePath)) {
- // this.selectedFile && fileNode.name.includes(this.selectedFile.trim())) {
- fileNode.data = this.text;
- }
- });
+ // console.log(this.blueprint);
+ // this.filesData.forEach(fileNode => {
+ // if (this.selectedFile && fileNode.name.includes(this.blueprintName.trim()) && fileNode.name.includes(this.selectedFile.trim())) {
+ // fileNode.data = this.text;
+ // } else if (this.selectedFile && fileNode.name.includes(this.currentFilePath)) {
+ // // this.selectedFile && fileNode.name.includes(this.selectedFile.trim())) {
+ // fileNode.data = this.text;
+ // }
+ // });
- if (this.selectedFile && this.selectedFile == this.blueprintName.trim()) {
- this.blueprint = JSON.parse(this.text);
- } else {
- this.blueprint = this.blueprintdata;
- }
+ // if (this.selectedFile && this.selectedFile == this.blueprintName.trim()) {
+ // this.blueprint = JSON.parse(this.text);
+ // } else {
+ // this.blueprint = this.blueprintdata;
+ // }
let blueprintState = {
blueprint: this.blueprint,
@@ -243,11 +243,11 @@ export class EditorComponent implements OnInit {
console.log("processed");
}
});
- window.alert('Blueprint enriched successfully' );
+ window.alert('Blueprint enriched successfully');
});
});
}
-
+
saveToBackend() {
@@ -300,7 +300,9 @@ export class EditorComponent implements OnInit {
create() {
this.filesData.forEach((path) => {
- this.zipFile.file(path.name, path.data);
+ let index = path.name.indexOf("/");
+ let name = path.name.slice(index + 1, path.name.length);
+ this.zipFile.file(name, path.data);
});
}
@@ -318,6 +320,13 @@ export class EditorComponent implements OnInit {
// console.log(error);
// }
// );
+
+ // this.create();
+ // var zipFilename = "baseconfiguration.zip";
+ // this.zipFile.generateAsync({ type: "blob" })
+ // .then(blob => {
+ // saveAs(blob, zipFilename);
+ // });
}
setEditorMode() {
switch (this.fileExtension) {
@@ -436,7 +445,7 @@ export class EditorComponent implements OnInit {
this.blueprintName = (((toscaData['Entry-Definitions']).split('/'))[1]).toString();;
console.log(toscaData);
}
-
+
arrangeTreeData(paths) {
const tree = [];
@@ -557,4 +566,23 @@ export class EditorComponent implements OnInit {
return paramValue;
}
}
+
+ saveEditedChanges() {
+ this.filesData.forEach(fileNode => {
+ if (this.selectedFile && fileNode.name.includes(this.blueprintName.trim()) && fileNode.name.includes(this.selectedFile.trim())) {
+ fileNode.data = this.text;
+ } else if (this.selectedFile && fileNode.name.includes(this.currentFilePath)) {
+ // this.selectedFile && fileNode.name.includes(this.selectedFile.trim())) {
+ fileNode.data = this.text;
+ }
+ });
+
+ if (this.selectedFile && this.selectedFile == this.blueprintName.trim()) {
+ this.blueprint = JSON.parse(this.text);
+ } else {
+ this.blueprint = this.blueprintdata;
+ }
+
+ this.updateBlueprint();
+ }
}
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.service.ts b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.service.ts
index 98e43b6b1..63c8019c3 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.service.ts
+++ b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.service.ts
@@ -42,6 +42,7 @@ export class EditorService {
.subscribe(response => {
let blob = new Blob([response], { 'type': "application/octet-stream" });
saveAs(blob, "CBA.zip");
+ window.alert('Blueprint download successfull' );
});
return "Download Success";
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/modify-template.component.html b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/modify-template.component.html
index b3eeeeda2..546668d43 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/modify-template.component.html
+++ b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/modify-template.component.html
@@ -36,7 +36,7 @@ limitations under the License.
<button class="mat-button-active" mat-button [matMenuTriggerFor]="menu">Deploy</button>
<mat-menu #menu="matMenu">
<button mat-menu-item (click)="saveToBlueprintProcessor()">Deploy</button>
- <button mat-menu-item (click)="processBlueprint()">Test</button>
+ <!-- <button mat-menu-item (click)="processBlueprint()">Test</button> -->
</mat-menu>
<button class="btn-active" (click)="publishToControllerBlueprint()">Publish</button>
<button class="btn-active" (click)="saveToControllerBlueprint()">Save</button>
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 36876233d..9c11f7684 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
@@ -42,7 +42,7 @@ export class SearchTemplateComponent implements OnInit {
blueprintState: IBlueprintState;
bpState: Observable<IBlueprintState>;
validfile: boolean = false;
-
+ uploadedFileName: string;
@ViewChild('fileInput') fileInput;
result: string = '';
@@ -62,6 +62,7 @@ export class SearchTemplateComponent implements OnInit {
fileChanged(e: any) {
this.paths = [];
this.file = e.target.files[0];
+ this.uploadedFileName = (this.file.name.split('.'))[0];
this.zipFile.files = {};
this.zipFile.loadAsync(this.file)
.then((zip) => {
@@ -88,7 +89,9 @@ export class SearchTemplateComponent implements OnInit {
this.paths = [];
for (var file in zip.files) {
this.fileObject = {
- name: zip.files[file].name,
+ // nameForUIDisplay: this.uploadedFileName + '/' + zip.files[file].name,
+ // name: zip.files[file].name,
+ name: this.uploadedFileName + '/' + zip.files[file].name,
data: ''
};
const value = <any>await zip.files[file].async('string');
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.component.html b/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.component.html
index da3580cd5..fe322fada 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.component.html
+++ b/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.component.html
@@ -18,21 +18,30 @@ See the License for the specific language governing permissions and
limitations under the License.
============LICENSE_END============================================
-->
-<div class="testTemplateContainer">
+<div style="border: 1px solid #3f51b5; padding: 1em;">
+ <i class="fa fa-exclamation-circle" style="color: #3f51b5" aria-hidden="true"></i>
+ Disclaimer*: The Test CBA Certification page allow the testing/certification team with the certification
+ of the CBA workflow action. Workflow action may include various action and subaction that result in content
+ resolution (using mS such as naming , netbox , and etc.), content generation (Jinja/Velocity) and content
+ distribution (netconf, restconf etc.) . Once the certification is complete, it is the responsibility of the
+ testing/certification team to rollback all the resource assignment and network function configuration that has
+ been reserved and distributed during the certification.
+</div>
+<div class="testTemplateContainer">
<div class="editorContainer">
<div class="editorDiv">
<p>Request</p>
- <ace-editor [(text)]="text" mode="json" [theme]="eclipse" [options]="options" #editor class="aceEditor"></ace-editor>
+ <ace-editor [(text)]="requestText" mode="json" [theme]="eclipse" [options]="options" #editor class="aceEditor"></ace-editor>
<div class="btnContainer">
- <button class="button">Submit</button>
+ <button class="button" (click)="submitRequest()">Submit</button>
<button class="button">Clear</button>
</div>
</div>
<div class="editorDiv">
<p>Response</p>
- <ace-editor [(text)]="text" mode="json" [theme]="eclipse" [options]="options" #editor class="aceEditor"></ace-editor>
+ <ace-editor [(text)]="responseText" mode="json" [theme]="eclipse" [options]="options" #editor class="aceEditor"></ace-editor>
</div>
</div>
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.component.ts b/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.component.ts
index 9a7a570ad..63c00e508 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.component.ts
+++ b/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.component.ts
@@ -30,6 +30,7 @@ import { IBlueprintState } from 'src/app/common/core/store/models/blueprintState
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 { TestTemplateService } from './test-template.service'
import "ace-builds/webpack-resolver";
import 'brace';
@@ -47,8 +48,10 @@ export class TestTemplateComponent implements OnInit {
private workflows = [];
@ViewChild('editor') editor;
options: any = { fontSize: "100%", printMargin: false, tabSize: 2 };
+ requestText: string;
+ responseText: string;
- constructor(private store: Store<IAppState>) {
+ constructor(private store: Store<IAppState>, private testTemplateService: TestTemplateService) {
this.blueprintpState = this.store.select('blueprint')
.subscribe((data: any) => {
console.log(data);
@@ -81,4 +84,15 @@ export class TestTemplateComponent implements OnInit {
}
+ submitRequest() {
+ this.testTemplateService.submitRequest(this.requestText)
+ .subscribe((response) =>{
+ this.responseText = response;
+ window.alert('Success');
+ },
+ (error)=>{
+ this.responseText = "Error in processing request";
+ })
+ }
+
}
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.module.ts b/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.module.ts
index ea5b5ffb2..6eca01877 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.module.ts
+++ b/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.module.ts
@@ -25,7 +25,7 @@ import { TestTemplateComponent } from './test-template.component';
import { TestTemplateRoutingModule } from './test-template-routing.module';
import { AppMaterialModule } from '../../../common/modules/app-material.module';
import { AceEditorModule } from 'ng2-ace-editor';
-
+import { TestTemplateService } from './test-template.service';
@NgModule({
declarations: [
TestTemplateComponent
@@ -38,6 +38,7 @@ import { AceEditorModule } from 'ng2-ace-editor';
AppMaterialModule,
TestTemplateRoutingModule,
AceEditorModule
- ]
+ ],
+ providers: [TestTemplateService]
})
export class TestTemplateModule { }
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.service.ts b/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.service.ts
new file mode 100644
index 000000000..8df8e78a6
--- /dev/null
+++ b/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.service.ts
@@ -0,0 +1,39 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2018-19 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============================================
+*/
+
+
+import { Injectable } from '@angular/core';
+import { HttpClient } from '@angular/common/http';
+import { Observable, observable } from 'rxjs';
+import { ApiService } from '../../../common/core/services/api.service';
+import { LoopbackConfig } from '../../../common/constants/app-constants';
+
+@Injectable()
+export class TestTemplateService {
+ // blueprintUrl = '../../constants/blueprint.json';
+
+ constructor(private _http: HttpClient, private api: ApiService) {
+ }
+
+ submitRequest(request) {
+ return this.api.get('', request);
+ }
+} \ No newline at end of file
diff --git a/docs/CBA/index.rst b/docs/CBA/index.rst
index c7b219f5c..43317e6e5 100644
--- a/docs/CBA/index.rst
+++ b/docs/CBA/index.rst
@@ -2,8 +2,8 @@
.. http://creativecommons.org/licenses/by/4.0
.. Copyright (C) 2019 IBM.
-Controller Blueprint Archived Tool(CBA)
-----------------------------------------
+Controller Blueprint Archived Designer Tool(CBA)
+------------------------------------------------
.. toctree::
:maxdepth: 1
diff --git a/docs/CBA/resourceassignment.rst b/docs/CBA/resourceassignment.rst
index be8b08e25..eec6ba368 100644
--- a/docs/CBA/resourceassignment.rst
+++ b/docs/CBA/resourceassignment.rst
@@ -4,9 +4,6 @@
Resource Assignment
===================
-.. toctree::
- :maxdepth: 1
-
Component executor:
===================
diff --git a/docs/bluePrintsProcessor.rst b/docs/bluePrintsProcessor.rst
index a687d50be..911f99945 100644
--- a/docs/bluePrintsProcessor.rst
+++ b/docs/bluePrintsProcessor.rst
@@ -11,6 +11,8 @@ Blueprints Processor
Micro service to Manage Controller Blueprint Models, such as Resource Dictionary, Service Models, Velocity Templates etc, which will serve service for Controller Design Studio and Controller runtimes.
+This microservice is used to deploy Controller Blueprint Archive file in Run time database. This also helps to test the Valid Blueprint.
+
Architecture:
==============
@@ -18,4 +20,54 @@ Architecture:
.. |image0| image:: images/blueprintprocessor.jpg
:height: 600px
- :width: 800px \ No newline at end of file
+ :width: 800px
+
+Running Blueprints Processor Microservice Locally:
+==================================================
+
+The purpose of this page is to show how to run the Blueprints Processor microservice locally, using the docker-compose.yaml file provided in the project.
+
+Check out the CDS' code:
+
+Check out the latest code from Gerrit: https://gerrit.onap.org/r/#/admin/projects/ccsdk/cds
+
+Build CDS locally:
+In the checked out directory, type
+
+ mvn clean install -DskipTests=true -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -Dadditionalparam=-Xdoclint:none
+
+Create the needed Docker images:
+
+The Blueprints Processor microservice project has a module, called distribution, that provides a docker-compose.yaml file that can be used to spin up Docker containers to run this microservice.
+
+The first step is to create any custom image needed, by building the distribution module. From the CDS home directory (where the code was checked out), navigate to the module:
+
+ cd ms/blueprintsprocessor/distribution/
+Build it using the Maven profile called Docker:
+
+ mvn clean install -Pdocker
+
+Start Docker containers using docker-composer:
+==============================================
+
+Navigate to the docker-compose file in the distribution module:
+
+ cd src/main/dc/
+
+From there, start the containers:
+
+ docker-compose up -d
+This will spin the Docker containers declared inside the docker-compose.yaml file in the background.
+
+
+To verify the logs generated by docker-composer, type:
+
+ docker-compose logs -f
+
+
+Testing the environment:
+========================
+
+Point your browser to http://localhost:8000/api/v1/execution-service/ping (please note that the port is 8000, not 8080)
+
+To authenticate, use ccsdkapps / ccsdkapps as login / password. \ No newline at end of file
diff --git a/docs/controllerBlueprintStudioProcessor.rst b/docs/controllerBlueprintStudioProcessor.rst
index fc9112296..5c67d6c1d 100644
--- a/docs/controllerBlueprintStudioProcessor.rst
+++ b/docs/controllerBlueprintStudioProcessor.rst
@@ -5,6 +5,28 @@
Controller Blueprints Studio Processor
======================================
-.. toctree::
- :maxdepth: 1
- :titlesonly: \ No newline at end of file
+The Controller Blueprint Archive is the overall service design, fully model-driven, intent based package needed for SELF SERVICE provisioning and configuration management automation.
+
+The CBA is .zip file which is saved in Controller Blueprint Database.
+
+Dynamic API:
+===========
+
+The nature of the API request and response is meant to be model driven and dynamic. They both share the same definition.
+
+The actionName, under the actionIdentifiers refers to the name of a Workflow (see workflow)
+
+The content of the payload is what is fully dynamic / model driven.
+
+The first top level element will always be either $actionName-request for a request or $actionName-response for a response.
+
+Then the content within this element is fully based on the workflow input and output.
+
+
+Enrichment:
+===========
+
+Helps to generate complete valid CBA file.
+
+
+ \ No newline at end of file
diff --git a/docs/datadictionary/capabilitytable.JPG b/docs/datadictionary/capabilitytable.JPG
new file mode 100644
index 000000000..7db4715ea
--- /dev/null
+++ b/docs/datadictionary/capabilitytable.JPG
Binary files differ
diff --git a/docs/datadictionary/index.rst b/docs/datadictionary/index.rst
index 83c6e47b8..a7e78564f 100644
--- a/docs/datadictionary/index.rst
+++ b/docs/datadictionary/index.rst
@@ -9,37 +9,74 @@ Resource Definition
Introduction:
=============
-A Resource Definition defines a specifc resource that can be resolved using the bellow supported sources.
+A data dictionary models the how a specific resource can be resolved.
-A Resource Definition can support multiple sources.
+A resource is a variable/parameter in the context of the service. It can be anything, but it should not be confused with SDC or Openstack resources.
-The main goal of Resource Definition is to define generic entity that could be shared accross services.
+A data dictionary can have multiple sources to handle resolution in different ways.
+The main goal of data dictionary is to define re-usable entity that could be shared.
-Resolution sources:
-===================
+Creation of data dictionaries is a standalone activity, separated from the blueprint design.
- * Input
- * Default
- * DB
- * REST
- * Capability
-Artifacts:
-==========
+As part of modelling a data dictionary entry, the following generic information should be provided:
- * artifact-mapping-resource
- * artifact-template-velocity
- * artifact-directed-graph
+|image0|
-Node type:
-==========
-
- * component-resource-resolution
- * component-jython-executor
- * component-netconf-executor
- * component-restconf-executor
+.. |image0| image:: media/image0.jpg
+ :width: 7.88889in
+ :height: 4.43750in
-Data type:
-==========
- * vnf-netconf-device \ No newline at end of file
+Bellow are properties that all the resource source have will have
+
+The modeling does allow for data translation between external capability and CDS for both input and output key mapping.
+
+|image1|
+
+.. |image1| image:: media/image0.jpg
+ :width: 7.88889in
+ :height: 4.43750in
+
+Example:
+========
+
+vf-module-model-customization-uuid and vf-module-label are two data dictionaries. A SQL table, VF_MODULE_MODEL, exist to correlate them.
+
+Here is how input-key-mapping, output-key-mapping and key-dependencies can be used:
+
+vf-module-label data dictionary
+
+{
+ "name" : "vf-module-label",
+ "tags" : "vf-module-label",
+ "updated-by" : "adetalhouet",
+ "property" : {
+ "description" : "vf-module-label",
+ "type" : "string"
+ },
+ "sources" : {
+ "primary-db" : {
+ "type" : "source-primary-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" ]
+ }
+ }
+ }
+}
+
+
+Resource source:
+================
+
+Defines the contract to resolve a resource.
+
+A resource source is modeled, following http://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.0/csprd01/TOSCA-Simple-Profile-YAML-v1.0-csprd01.html#DEFN_ENTITY_NODE_TYPE, and derives from the https://wiki.onap.org/display/DW/Modeling+Concepts#ModelingConcepts-NodeResourceSource \ No newline at end of file
diff --git a/docs/datadictionary/media/image0.JPG b/docs/datadictionary/media/image0.JPG
new file mode 100644
index 000000000..074d20076
--- /dev/null
+++ b/docs/datadictionary/media/image0.JPG
Binary files differ
diff --git a/docs/datadictionary/media/image1.JPG b/docs/datadictionary/media/image1.JPG
new file mode 100644
index 000000000..a27502a75
--- /dev/null
+++ b/docs/datadictionary/media/image1.JPG
Binary files differ
diff --git a/docs/datadictionary/resourcesource.rst b/docs/datadictionary/resourcesource.rst
new file mode 100644
index 000000000..fffeec313
--- /dev/null
+++ b/docs/datadictionary/resourcesource.rst
@@ -0,0 +1,110 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.org/licenses/by/4.0
+.. Copyright (C) 2019 IBM.
+
+Resource Source
+---------------
+
+Input:
+======
+Expects the value to be provided as input to the request.
+
+source-input:
+
+{
+ "description": "This is Input Resource Source Node Type",
+ "version": "1.0.0",
+ "properties": {},
+ "derived_from": "tosca.nodes.ResourceSource"
+}
+
+
+Default:
+========
+Expects the value to be defaulted in the model itself.
+
+source-default:
+
+{
+ "description": "This is Default Resource Source Node Type",
+ "version": "1.0.0",
+ "properties": {},
+ "derived_from": "tosca.nodes.ResourceSource"
+}
+
+
+sql:
+====
+
+Expects the SQL query to be modeled; that SQL query can be parameterized, and the parameters be other resources resolved through other means. If that's the case, this data dictionary definition will have to define key-dependencies along with input-key-mapping.
+
+CDS is currently deployed along the side of SDNC, hence the primary database connection provided by the framework is to SDNC database.
+
+|image0|
+
+.. |image0| image:: image0.jpg
+ :width: 7.88889in
+ :height: 4.43750in
+
+.. toctree::
+ :maxdepth: 1
+
+ sourceprimarydb
+
+Connection to a specific database can be expressed through the endpoint-selector property, which refers to a macro defining the information about the database the connect to. Understand TOSCA Macro in the context of CDS.
+
+.. toctree::
+ :maxdepth: 1
+
+ dbsystem
+
+
+REST:
+=====
+
+Expects the URI along with the VERB and the payload, if needed.
+
+CDS is currently deployed along the side of SDNC, hence the default rest connection provided by the framework is to SDNC MDSAL.
+
+|image1|
+
+.. |image1| image:: image1.jpg
+ :width: 7.88889in
+ :height: 4.43750in
+
+.. toctree::
+ :maxdepth: 1
+
+ rest
+
+Connection to a specific REST system can be expressed through the endpoint-selector property, which refers to a macro defining the information about the REST system the connect to. Understand TOSCA Macro in the context of CDS.
+
+Few ways are available to authenticate to the REST system:
+
+ * token-auth
+ * basic-auth
+ * ssl-basic-auth
+
+For source code of Authentication click below link:
+
+.. toctree::
+ :maxdepth: 1
+
+ auth
+
+Capability:
+===========
+
+Expects a script to be provided.
+
+|image2|
+
+.. |image2| image:: image2.jpg
+ :width: 7.88889in
+ :height: 4.43750in
+
+
+.. toctree::
+ :maxdepth: 1
+
+ source-capability
diff --git a/docs/datadictionary/restauth.rst b/docs/datadictionary/restauth.rst
new file mode 100644
index 000000000..40c179375
--- /dev/null
+++ b/docs/datadictionary/restauth.rst
@@ -0,0 +1,42 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.org/licenses/by/4.0
+.. Copyright (C) 2019 IBM.
+
+
+Resource Rest Authentication
+----------------------------
+
+token-auth:
+
+"dsl_definitions": {
+ "dynamic-rest-source": {
+ "type" : "token-auth",
+ "url" : "http://localhost:32778",
+ "token" : "Token 0123456789abcdef0123456789abcdef01234567"
+ }
+}
+
+basic-auth:
+
+"dsl_definitions": {
+ "dynamic-rest-source": {
+ "type" : "basic-auth",
+ "url" : "http://localhost:32778",
+ "username" : "bob",
+ "password": "marley"
+ }
+}
+
+ssl-basic-auth:
+
+"dsl_definitions": {
+ "dynamic-rest-source": {
+ "type" : "ssl-basic-auth",
+ "url" : "http://localhost:32778",
+ "keyStoreInstance": "JKS or PKCS12",
+ "sslTrust": "trusture",
+ "sslTrustPassword": "trustore password",
+ "sslKey": "keystore",
+ "sslKeyPassword: "keystore password"
+ }
+} \ No newline at end of file
diff --git a/docs/datadictionary/resttable.JPG b/docs/datadictionary/resttable.JPG
new file mode 100644
index 000000000..568ad0a9f
--- /dev/null
+++ b/docs/datadictionary/resttable.JPG
Binary files differ
diff --git a/docs/datadictionary/sqltable.JPG b/docs/datadictionary/sqltable.JPG
new file mode 100644
index 000000000..15d246743
--- /dev/null
+++ b/docs/datadictionary/sqltable.JPG
Binary files differ
diff --git a/docs/index.rst b/docs/index.rst
index 8db565a37..5f3902687 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -13,6 +13,24 @@ The system is designed to be self service, which means that users, not just prog
Self service is a completely new way of delivering services. It removes the dependence on code releases and the delays they cause and puts the control of services into the hands of the service providers. They can change a model and its parameters and create a new service without writing a single line of code.
This makes SERVICE PROVIDER(S) more responsive to its customers and able to deliver products that more closely match the needs of its customers.
+Modeling Concept:
+=================
+In Dublin release, the CDS community has contributed a framework to automate the resolution of resources for instantiation and any config provisioning operation, such as day0, day1 or day2 configuration.
+
+The content of the CBA Package is driven from a catalog of reusable data dictionary, component and workflow, delivering a reusable and simplified self service experience.
+
+TOSCA based JSON formatted model following standard: http://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.2/csd01/TOSCA-Simple-Profile-YAML-v1.2-csd01.html
+
+Most of the TOSCA modeled entity presented in the bellow documentation can be found here: https://github.com/onap/ccsdk-cds/tree/master/components/model-catalog/definition-type/starter-type
+
+Tosca Model Reference:
+
+|image0|
+
+.. |image0| image:: media/image0.jpg
+ :width: 7.88889in
+ :height: 4.43750in
+
Design tools:
=============
.. toctree::
@@ -38,6 +56,13 @@ The Controller Design Studio is composed of two major components:
* The Run Time (or backend)
The GUI handles direct user input and allows for displaying both design time and run time activities. For design time, it allows for the creation of controller blueprint, from selecting the DGs to be included, to incorporating the artifact templates, to adding necessary components. For run time, it allows the user to direct the system to resolve the unresolved elements of the controller blueprint and download the resulting configuration into a VNF. At a more basic level, it allows for creation of data dictionaries, capabilities catalogs, and controller blueprint, the basic elements that are used to generate a configuration. The essential function of the Controller Design Studio is to create and populate a controller blueprint, create a configuration file from this Controller blueprint, and download this configuration file (configlet) to a VNF/PNF.
+|image0|
+
+.. |image0| image:: media/CDS_architecture.jpg
+ :height: 4.43750in
+ :width: 7.88889in
+
+
Resource assignment:
=====================
.. toctree::
diff --git a/docs/media/CDS_architecture.JPG b/docs/media/CDS_architecture.JPG
new file mode 100644
index 000000000..c8528ac1e
--- /dev/null
+++ b/docs/media/CDS_architecture.JPG
Binary files differ
diff --git a/docs/media/image0.jpg b/docs/media/image0.jpg
new file mode 100644
index 000000000..dce3cee25
--- /dev/null
+++ b/docs/media/image0.jpg
Binary files differ
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt
index b18617422..8ae128d4b 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt
@@ -29,8 +29,8 @@ import org.springframework.stereotype.Service
@Service("bluePrintWorkflowExecutionService")
open class BluePrintWorkflowExecutionServiceImpl(
- private val componentWorkflowExecutionService: ComponentWorkflowExecutionService,
- private val dgWorkflowExecutionService: DGWorkflowExecutionService
+ private val componentWorkflowExecutionService: ComponentWorkflowExecutionService,
+ private val dgWorkflowExecutionService: DGWorkflowExecutionService
) : BluePrintWorkflowExecutionService<ExecutionServiceInput, ExecutionServiceOutput> {
private val log = LoggerFactory.getLogger(BluePrintWorkflowExecutionServiceImpl::class.java)!!
@@ -57,11 +57,11 @@ open class BluePrintWorkflowExecutionServiceImpl(
val executionServiceOutput: ExecutionServiceOutput = when {
derivedFrom.startsWith(BluePrintConstants.MODEL_TYPE_NODE_COMPONENT, true) -> {
componentWorkflowExecutionService
- .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, properties)
+ .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, properties)
}
derivedFrom.startsWith(BluePrintConstants.MODEL_TYPE_NODE_WORKFLOW, true) -> {
dgWorkflowExecutionService
- .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, properties)
+ .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, properties)
}
else -> {
throw BluePrintProcessorException("couldn't execute workflow($workflowName) step mapped " +
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicContext.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicContext.kt
index a2db8aab7..a2db8aab7 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicContext.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicContext.kt
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt
index df250ae98..df250ae98 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/ComponentWorkflowExecutionService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ComponentWorkflowExecutionService.kt
index ee6c35397..3c474de37 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/ComponentWorkflowExecutionService.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ComponentWorkflowExecutionService.kt
@@ -39,7 +39,7 @@ open class ComponentWorkflowExecutionService(private val nodeTemplateExecutionSe
val nodeTemplateName = bluePrintContext.workflowFirstStepNodeTemplate(workflowName)
return nodeTemplateExecutionService.executeNodeTemplate(bluePrintRuntimeService,
- nodeTemplateName, executionServiceInput)
+ nodeTemplateName, executionServiceInput)
}
} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionService.kt
index 80aa1030d..4485800ff 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionService.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionService.kt
@@ -48,7 +48,7 @@ open class DGWorkflowExecutionService(private val blueprintSvcLogicService: Blue
// Get the DG file info
val artifactDefinition = bluePrintContext.nodeTemplateArtifactForArtifactType(nodeTemplateName,
- WorkflowServiceConstants.ARTIFACT_TYPE_DIRECTED_GRAPH)
+ WorkflowServiceConstants.ARTIFACT_TYPE_DIRECTED_GRAPH)
// Populate the DG Path
val dgFilePath = normalizedPathName(bluePrintContext.rootPath, artifactDefinition.file)
@@ -59,7 +59,9 @@ open class DGWorkflowExecutionService(private val blueprintSvcLogicService: Blue
val graph = SvcGraphUtils.getSvcGraphFromFile(dgFilePath)
// Execute the DG
- return blueprintSvcLogicService.execute(graph, bluePrintRuntimeService, executionServiceInput) as ExecutionServiceOutput
+ return blueprintSvcLogicService.execute(graph,
+ bluePrintRuntimeService,
+ executionServiceInput) as ExecutionServiceOutput
}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionService.kt
index 5ed280cb5..af7846340 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionService.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionService.kt
@@ -72,7 +72,7 @@ open class NodeTemplateExecutionService(private val applicationContext: Applicat
clonedExecutionServiceInput.stepData = stepInputData
// Get the Request from the Context and Set to the Function Input and Invoke the function
- return plugin.applyNB(clonedExecutionServiceInput)
+ return plugin.applyNB(clonedExecutionServiceInput)
}
} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/WorkflowServiceConfiguration.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/WorkflowServiceConfiguration.kt
index 67f13f760..67f13f760 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/WorkflowServiceConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/WorkflowServiceConfiguration.kt
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt
index cfba5becd..b6e767503 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt
@@ -50,7 +50,7 @@ open class ComponentExecuteNodeExecutor(private val nodeTemplateExecutionService
try { // Get the Request from the Context and Set to the Function Input and Invoke the function
val executionOutput = nodeTemplateExecutionService.executeNodeTemplate(ctx.getBluePrintService(),
- nodeTemplateName, executionInput)
+ nodeTemplateName, executionInput)
ctx.setResponse(executionOutput)
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/utils/SvcGraphUtils.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/utils/SvcGraphUtils.kt
index 8f9579230..8f9579230 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/utils/SvcGraphUtils.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/utils/SvcGraphUtils.kt
diff --git a/ms/cds-sdc-listener/application/pom.xml b/ms/cds-sdc-listener/application/pom.xml
index cbf8ca879..c58bb130f 100644
--- a/ms/cds-sdc-listener/application/pom.xml
+++ b/ms/cds-sdc-listener/application/pom.xml
@@ -10,13 +10,12 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
- <artifactId>spring-boot-1-starter-parent</artifactId>
+ <artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.2-SNAPSHOT</version>
- <relativePath/>
</parent>
- <modelVersion>4.0.0</modelVersion>
<groupId>org.onap.ccsdk.cds</groupId>
+ <modelVersion>4.0.0</modelVersion>
<artifactId>cds-sdc-listener-application</artifactId>
<version>0.4.2-SNAPSHOT</version>
<name>CDS-SDC Listener Application </name>
@@ -28,19 +27,14 @@
<dependencies>
<!-- Spring boot -->
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- <scope>test</scope>
- </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-devtools</artifactId>
- <optional>true</optional>
+ <artifactId>spring-boot-starter-web</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
</dependency>
<!-- SDC Distribution client dependency -->
@@ -87,16 +81,15 @@
<dependency>
<groupId>org.onap.ccsdk.cds.components</groupId>
<artifactId>proto-definition</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>${project.version}</version>
</dependency>
- <!-- SDC Distribution client dependency -->
<dependency>
- <groupId>org.onap.sdc.sdc-distribution-client</groupId>
- <artifactId>sdc-distribution-client</artifactId>
- <version>1.3.0</version>
+ <groupId>io.projectreactor</groupId>
+ <artifactId>reactor-core</artifactId>
+ <version>3.2.6.RELEASE</version>
+ <scope>compile</scope>
</dependency>
-
</dependencies>
<build>
diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerApplication.java b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerApplication.java
index 30f101246..6f0f65323 100644
--- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerApplication.java
+++ b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerApplication.java
@@ -1,11 +1,18 @@
/*
- * Copyright (C) 2019 Bell Canada. All rights reserved.
+ * Copyright © 2019 Bell Canada
*
- * NOTICE: All the intellectual and technical concepts contained herein are
- * proprietary to Bell Canada and are protected by trade secret or copyright law.
- * Unauthorized copying of this file, via any medium is strictly prohibited.
+ * 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.cdssdclistener;
import org.springframework.boot.SpringApplication;
diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerConfiguration.java b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerConfiguration.java
index 242c19c1e..3dfb07eb8 100644
--- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerConfiguration.java
+++ b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerConfiguration.java
@@ -1,11 +1,18 @@
/*
- * Copyright (C) 2019 Bell Canada. All rights reserved.
+ * Copyright © 2019 Bell Canada
*
- * NOTICE: All the intellectual and technical concepts contained herein are
- * proprietary to Bell Canada and are protected by trade secret or copyright law.
- * Unauthorized copying of this file, via any medium is strictly prohibited.
+ * 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.cdssdclistener;
import java.util.List;
@@ -58,7 +65,6 @@ public class CdsSdcListenerConfiguration implements IConfiguration {
@Value("${listenerservice.config.isUseHttpsWithDmaap}")
private boolean isUseHttpsWithDmaap;
-
@Override
public String getAsdcAddress() {
return asdcAddress;
diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerNotificationCallback.java b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerNotificationCallback.java
index e2aae9654..58c667c26 100644
--- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerNotificationCallback.java
+++ b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerNotificationCallback.java
@@ -1,11 +1,18 @@
/*
- * Copyright (C) 2019 Bell Canada. All rights reserved.
+ * Copyright © 2019 Bell Canada
*
- * NOTICE: All the intellectual and technical concepts contained herein are
- * proprietary to Bell Canada and are protected by trade secret or copyright law.
- * Unauthorized copying of this file, via any medium is strictly prohibited.
+ * 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.cdssdclistener;
import static org.onap.sdc.utils.DistributionActionResultEnum.SUCCESS;
@@ -16,12 +23,15 @@ import java.util.List;
import java.util.Objects;
import java.util.Optional;
import org.onap.ccsdk.cds.cdssdclistener.dto.CdsSdcListenerDto;
-import org.onap.ccsdk.cds.cdssdclistener.service.ListenerServiceImpl;
+import org.onap.ccsdk.cds.cdssdclistener.service.ListenerService;
+import org.onap.ccsdk.cds.cdssdclistener.status.CdsSdcListenerStatus;
+import org.onap.ccsdk.cds.cdssdclistener.util.FileUtil;
import org.onap.sdc.api.IDistributionClient;
import org.onap.sdc.api.consumer.INotificationCallback;
import org.onap.sdc.api.notification.IArtifactInfo;
import org.onap.sdc.api.notification.INotificationData;
import org.onap.sdc.api.results.IDistributionClientDownloadResult;
+import org.onap.sdc.utils.DistributionStatusEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -39,16 +49,21 @@ public class CdsSdcListenerNotificationCallback implements INotificationCallback
private CdsSdcListenerDto cdsSdcListenerDto;
@Autowired
- private ListenerServiceImpl listenerService;
+ private ListenerService listenerService;
@Value("${listenerservice.config.archivePath}")
private String pathToStoreArchives;
+ @Autowired
+ private CdsSdcListenerStatus listenerStatus;
+
private static final Logger LOGGER = LoggerFactory.getLogger(CdsSdcListenerNotificationCallback.class);
@Override
public void activateCallback(INotificationData notificationData) {
- LOGGER.info(notificationData.getDistributionID(), "The UUID generated by SDC {}");
+ final String distributionId = notificationData.getDistributionID();
+ cdsSdcListenerDto.setDistributionId(distributionId);
+ LOGGER.info("Received service distribution from SDC with the id {}", distributionId);
processNotification(notificationData);
}
@@ -75,8 +90,11 @@ public class CdsSdcListenerNotificationCallback implements INotificationCallback
IDistributionClientDownloadResult result = distributionClient.download(info);
if (!Objects.equals(result.getDistributionActionResult(), SUCCESS)) {
- LOGGER.error("Failed to download the artifact from : {} due to {} ", url,
+ String errorMessage = String.format("Failed to download the artifact from : %s due to %s ", url,
result.getDistributionActionResult());
+ listenerStatus.sendResponseStatusBackToSDC(cdsSdcListenerDto.getDistributionId(),
+ DistributionStatusEnum.COMPONENT_DONE_ERROR, errorMessage);
+ LOGGER.error(errorMessage);
} else {
LOGGER.info("Trying to write CSAR artifact to file with URL {} and UUID {}", url, id);
processCsarArtifact(result);
@@ -88,20 +106,24 @@ public class CdsSdcListenerNotificationCallback implements INotificationCallback
Path cbaArchivePath = Paths.get(pathToStoreArchives, "cba-archive");
Path csarArchivePath = Paths.get(pathToStoreArchives, "csar-archive");
- // extract and store the CSAR archive into local disk.
+ // Extract and store the CSAR archive into local disk.
listenerService.extractCsarAndStore(result, csarArchivePath.toString());
- Optional<List<File>> csarFiles = listenerService.getFilesFromDisk(csarArchivePath);
+ Optional<List<File>> csarFiles = FileUtil.getFilesFromDisk(csarArchivePath);
if (csarFiles.isPresent()) {
+ //Extract CBA archive from CSAR package and store it into local disk.
+ List<File> files = csarFiles.get();
- //Extract CBA archive from CSAR package and and store it into CDS Database.
- csarFiles.get()
- .forEach(file -> listenerService.extractBluePrint(file.getAbsolutePath(), cbaArchivePath.toString()));
-
- listenerService.saveBluePrintToCdsDatabase(cbaArchivePath);
- } else {
- LOGGER.error("The CSAR file is not present at this location {}", csarArchivePath);
+ if (!files.isEmpty()) {
+ final String archivePath = cbaArchivePath.toString();
+ files.forEach(file -> listenerService.extractBluePrint(file.getAbsolutePath(), archivePath));
+ files.forEach(file -> FileUtil.deleteFile(file, archivePath));
+ } else {
+ LOGGER.error("The CSAR file is not present at this location {}", csarArchivePath);
+ }
}
+
+ listenerService.saveBluePrintToCdsDatabase(cbaArchivePath, cdsSdcListenerDto.getManagedChannelForGrpc());
}
}
diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/client/CdsSdcListenerAuthClientInterceptor.java b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/client/CdsSdcListenerAuthClientInterceptor.java
index 528fbe2f3..bae4a3754 100644
--- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/client/CdsSdcListenerAuthClientInterceptor.java
+++ b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/client/CdsSdcListenerAuthClientInterceptor.java
@@ -1,9 +1,17 @@
/*
- * Copyright (C) 2019 Bell Canada. All rights reserved.
+ * Copyright © 2019 Bell Canada
*
- * NOTICE: All the intellectual and technical concepts contained herein are
- * proprietary to Bell Canada and are protected by trade secret or copyright law.
- * Unauthorized copying of this file, via any medium is strictly prohibited.
+ * 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.cdssdclistener.client;
diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/client/CdsSdcListenerClient.java b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/client/CdsSdcListenerClient.java
index 6f888dd0b..8d6aca5cd 100644
--- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/client/CdsSdcListenerClient.java
+++ b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/client/CdsSdcListenerClient.java
@@ -1,9 +1,17 @@
/*
- * Copyright (C) 2019 Bell Canada. All rights reserved.
+ * Copyright © 2019 Bell Canada
*
- * NOTICE: All the intellectual and technical concepts contained herein are
- * proprietary to Bell Canada and are protected by trade secret or copyright law.
- * Unauthorized copying of this file, via any medium is strictly prohibited.
+ * 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.cdssdclistener.client;
@@ -51,10 +59,11 @@ public class CdsSdcListenerClient {
distributionClient = Optional.of(DistributionClientFactory.createDistributionClient())
.orElseThrow(() -> new CdsSdcListenerException("Could not able to create SDC Distribution client"));
+ listenerDto.setManagedChannelForGrpc();
+
listenerDto.setDistributionClient(distributionClient);
IDistributionClientResult result = distributionClient.init(configuration, notification);
-
startSdcClientBasedOnTheResult(result);
}
@@ -64,6 +73,8 @@ public class CdsSdcListenerClient {
"SDC distribution client init failed with reason:" + result.getDistributionMessageResult());
}
+ LOG.info("Initialization of the SDC distribution client is complete");
+
// Start the client.
result = this.distributionClient.start();
@@ -74,10 +85,8 @@ public class CdsSdcListenerClient {
}
private void closeSdcDistributionclient() throws CdsSdcListenerException {
-
- IDistributionClientResult status = this.distributionClient.stop();
-
LOG.info("Closing SDC distribution client");
+ IDistributionClientResult status = this.distributionClient.stop();
if (status.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) {
throw new CdsSdcListenerException(
"Failed to close the SDC distribution client due to : " + status.getDistributionMessageResult());
diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/controller/HealthCheck.java b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/controller/HealthCheck.java
new file mode 100644
index 000000000..a1bb116bf
--- /dev/null
+++ b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/controller/HealthCheck.java
@@ -0,0 +1,35 @@
+/*
+ * 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.cdssdclistener.controller;
+
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+import reactor.core.publisher.Mono;
+
+@RestController
+@RequestMapping("/api/v1/sdclistener")
+public class HealthCheck {
+
+ @RequestMapping(path = "/healthcheck", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
+ public @ResponseBody
+ Mono<String> ping() {
+ return Mono.just("{\"status\":\"UP\"}");
+ }
+}
diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/dto/CdsSdcListenerDto.java b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/dto/CdsSdcListenerDto.java
index 41039eb28..68669307e 100644
--- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/dto/CdsSdcListenerDto.java
+++ b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/dto/CdsSdcListenerDto.java
@@ -1,19 +1,45 @@
/*
- * Copyright (C) 2019 Bell Canada. All rights reserved.
+ * Copyright © 2019 Bell Canada
*
- * NOTICE: All the intellectual and technical concepts contained herein are
- * proprietary to Bell Canada and are protected by trade secret or copyright law.
- * Unauthorized copying of this file, via any medium is strictly prohibited.
+ * 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.cdssdclistener.dto;
+import io.grpc.ManagedChannel;
+import io.grpc.ManagedChannelBuilder;
+import org.onap.ccsdk.cds.cdssdclistener.client.CdsSdcListenerAuthClientInterceptor;
import org.onap.sdc.api.IDistributionClient;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Component
+@ConfigurationProperties("listenerservice")
public class CdsSdcListenerDto {
+ @Value("${listenerservice.config.grpcAddress}")
+ private String grpcAddress;
+
+ @Value("${listenerservice.config.grpcPort}")
+ private int grpcPort;
+
+ @Autowired
+ private CdsSdcListenerAuthClientInterceptor cdsSdcListenerAuthClientInterceptor;
+
private IDistributionClient distributionClient;
+ private ManagedChannel managedChannel;
+ private String distributionId;
public IDistributionClient getDistributionClient() {
return distributionClient;
@@ -22,4 +48,23 @@ public class CdsSdcListenerDto {
public void setDistributionClient(IDistributionClient distributionClient) {
this.distributionClient = distributionClient;
}
+
+ public void setDistributionId(String id) {
+ this.distributionId = id;
+ }
+
+ public String getDistributionId() {
+ return distributionId;
+ }
+
+ public void setManagedChannelForGrpc() {
+ managedChannel = ManagedChannelBuilder.forAddress(grpcAddress, grpcPort)
+ .usePlaintext()
+ .intercept(cdsSdcListenerAuthClientInterceptor)
+ .build();
+ }
+
+ public ManagedChannel getManagedChannelForGrpc() {
+ return managedChannel;
+ }
}
diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/exceptions/CdsSdcListenerException.java b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/exceptions/CdsSdcListenerException.java
index 09ef4ed8c..eff5ef050 100644
--- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/exceptions/CdsSdcListenerException.java
+++ b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/exceptions/CdsSdcListenerException.java
@@ -1,11 +1,18 @@
/*
- * Copyright (C) 2019 Bell Canada. All rights reserved.
+ * Copyright © 2019 Bell Canada
*
- * NOTICE: All the intellectual and technical concepts contained herein are
- * proprietary to Bell Canada and are protected by trade secret or copyright law.
- * Unauthorized copying of this file, via any medium is strictly prohibited.
+ * 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.cdssdclistener.exceptions;
public class CdsSdcListenerException extends Exception {
diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/handler/BluePrintProcesssorHandler.java b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/handler/BluePrintProcesssorHandler.java
index 6b03b6da2..b05245392 100644
--- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/handler/BluePrintProcesssorHandler.java
+++ b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/handler/BluePrintProcesssorHandler.java
@@ -1,11 +1,18 @@
/*
- * Copyright (C) 2019 Bell Canada. All rights reserved.
+ * Copyright © 2019 Bell Canada
*
- * NOTICE: All the intellectual and technical concepts contained herein are
- * proprietary to Bell Canada and are protected by trade secret or copyright law.
- * Unauthorized copying of this file, via any medium is strictly prohibited.
+ * 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.cdssdclistener.handler;
import io.grpc.ManagedChannel;
diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/service/ListenerService.java b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/service/ListenerService.java
index 1efbe8f33..e55aeb134 100644
--- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/service/ListenerService.java
+++ b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/service/ListenerService.java
@@ -1,13 +1,21 @@
/*
- * Copyright (C) 2019 Bell Canada. All rights reserved.
+ * Copyright © 2019 Bell Canada
*
- * NOTICE: All the intellectual and technical concepts contained herein are
- * proprietary to Bell Canada and are protected by trade secret or copyright law.
- * Unauthorized copying of this file, via any medium is strictly prohibited.
+ * 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.cdssdclistener.service;
+import io.grpc.ManagedChannel;
import java.nio.file.Path;
import org.onap.sdc.api.results.IDistributionClientDownloadResult;
@@ -25,11 +33,12 @@ public interface ListenerService {
* Store the Zip file into CDS database.
*
* @param path path where zip file exists.
+ * @param managedChannel To access the blueprint processor application end point
*/
- void saveBluePrintToCdsDatabase(Path path);
+ void saveBluePrintToCdsDatabase(Path path, ManagedChannel managedChannel);
/**
- * Extract and store CSAR to file.
+ * Extract and store the csar package to local disk.
*
* @param result - IDistributionClientDownloadResult contains payload.
* @param csarArchivePath The destination path where CSAR will be stored.
diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/service/ListenerServiceImpl.java b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/service/ListenerServiceImpl.java
index 37052082a..1cf1a1bae 100644
--- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/service/ListenerServiceImpl.java
+++ b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/service/ListenerServiceImpl.java
@@ -1,17 +1,26 @@
/*
- * Copyright (C) 2019 Bell Canada. All rights reserved.
+ * Copyright © 2017-2019 AT&T, Bell Canada
*
- * NOTICE: All the intellectual and technical concepts contained herein are
- * proprietary to Bell Canada and are protected by trade secret or copyright law.
- * Unauthorized copying of this file, via any medium is strictly prohibited.
+ * 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.cdssdclistener.service;
import static java.nio.file.Files.walk;
+import static org.onap.sdc.utils.DistributionStatusEnum.COMPONENT_DONE_ERROR;
+import static org.onap.sdc.utils.DistributionStatusEnum.COMPONENT_DONE_OK;
import com.google.protobuf.ByteString;
import io.grpc.ManagedChannel;
-import io.grpc.ManagedChannelBuilder;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -31,7 +40,10 @@ import java.util.zip.ZipFile;
import org.apache.commons.io.FileUtils;
import org.apache.tomcat.util.http.fileupload.IOUtils;
import org.onap.ccsdk.cds.cdssdclistener.client.CdsSdcListenerAuthClientInterceptor;
+import org.onap.ccsdk.cds.cdssdclistener.dto.CdsSdcListenerDto;
import org.onap.ccsdk.cds.cdssdclistener.handler.BluePrintProcesssorHandler;
+import org.onap.ccsdk.cds.cdssdclistener.status.CdsSdcListenerStatus;
+import org.onap.ccsdk.cds.cdssdclistener.util.FileUtil;
import org.onap.ccsdk.cds.controllerblueprints.common.api.Status;
import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintUploadInput;
import org.onap.ccsdk.cds.controllerblueprints.management.api.FileChunk;
@@ -53,6 +65,12 @@ public class ListenerServiceImpl implements ListenerService {
@Autowired
private CdsSdcListenerAuthClientInterceptor cdsSdcListenerAuthClientInterceptor;
+ @Autowired
+ private CdsSdcListenerStatus listenerStatus;
+
+ @Autowired
+ private CdsSdcListenerDto cdsSdcListenerDto;
+
@Value("${listenerservice.config.grpcAddress}")
private String grpcAddress;
@@ -61,7 +79,6 @@ public class ListenerServiceImpl implements ListenerService {
private static final String CBA_ZIP_PATH = "Artifacts/Resources/[a-zA-Z0-9-_]+/Deployment/CONTROLLER_BLUEPRINT_ARCHIVE/[a-zA-Z0-9-_]+[.]zip";
private static final int SUCCESS_CODE = 200;
- private static final String CSAR_FILE_EXTENSION = ".csar";
private static final Logger LOGGER = LoggerFactory.getLogger(ListenerServiceImpl.class);
@Override
@@ -78,8 +95,9 @@ public class ListenerServiceImpl implements ListenerService {
storeBluePrint(zipFile, cbaArchiveName, cbaStorageDir, entry);
}
}
+
} catch (Exception e) {
- LOGGER.error("Failed to extract blueprint", e);
+ LOGGER.error("Failed to extract blueprint {}", e);
}
}
@@ -97,16 +115,16 @@ public class ListenerServiceImpl implements ListenerService {
try (InputStream inputStream = zipFile.getInputStream(entry); OutputStream out = new FileOutputStream(
targetZipFile)) {
IOUtils.copy(inputStream, out);
- LOGGER.info("Succesfully store the CBA archive {} at this location", targetZipFile);
+ LOGGER.info("Successfully store the CBA archive {} at this location", targetZipFile);
} catch (Exception e) {
LOGGER.error("Failed to put zip file into target location {}, {}", targetLocation, e);
}
}
@Override
- public void saveBluePrintToCdsDatabase(Path cbaArchivePath) {
- Optional<List<File>> zipFiles = getFilesFromDisk(cbaArchivePath);
- zipFiles.ifPresent(this::prepareRequestForCdsBackend);
+ public void saveBluePrintToCdsDatabase(Path cbaArchivePath, ManagedChannel channel) {
+ Optional<List<File>> zipFiles = FileUtil.getFilesFromDisk(cbaArchivePath);
+ zipFiles.ifPresent(files -> prepareRequestForCdsBackend(files, channel, cbaArchivePath.toString()));
}
@Override
@@ -114,9 +132,8 @@ public class ListenerServiceImpl implements ListenerService {
// Create CSAR storage directory
Path csarStorageDir = getStorageDirectory(csarArchivePath);
-
byte[] payload = result.getArtifactPayload();
- String csarFileName = result.getArtifactFilename() + CSAR_FILE_EXTENSION;
+ String csarFileName = result.getArtifactFilename();
Path targetLocation = csarStorageDir.resolve(csarFileName);
LOGGER.info("The target location for the CSAR file is {}", targetLocation);
@@ -137,49 +154,45 @@ public class ListenerServiceImpl implements ListenerService {
try {
return Files.createDirectories(fileStorageLocation);
} catch (IOException e) {
- LOGGER.error("Fail to create directory", e);
+ LOGGER.error("Fail to create directory {}, {}", e, fileStorageLocation);
}
}
return fileStorageLocation;
}
- private void prepareRequestForCdsBackend(List<File> files) {
- final ManagedChannel channel = getManagedChannel();
+ private void prepareRequestForCdsBackend(List<File> files, ManagedChannel managedChannel, String path) {
+ final String distributionId = cdsSdcListenerDto.getDistributionId();
files.forEach(zipFile -> {
try {
final BluePrintUploadInput request = generateBluePrintUploadInputBuilder(zipFile);
// Send request to CDS Backend.
- final Status responseStatus = bluePrintProcesssorHandler.sendRequest(request, channel);
+ final Status responseStatus = bluePrintProcesssorHandler.sendRequest(request, managedChannel);
if (responseStatus.getCode() != SUCCESS_CODE) {
- LOGGER.error("Failed to store the CBA archive into CDS DB due to {}",
+ final String errorMessage = String.format("Failed to store the CBA archive into CDS DB due to %s",
responseStatus.getErrorMessage());
+ listenerStatus.sendResponseStatusBackToSDC(distributionId,
+ COMPONENT_DONE_ERROR, errorMessage);
+ LOGGER.error(errorMessage);
+
} else {
LOGGER.info(responseStatus.getMessage());
+ listenerStatus.sendResponseStatusBackToSDC(distributionId,
+ COMPONENT_DONE_OK, null);
}
} catch (Exception e) {
- LOGGER.error("Failure due to", e);
+ final String errorMessage = String.format("Failure due to %s", e.getMessage());
+ listenerStatus.sendResponseStatusBackToSDC(distributionId, COMPONENT_DONE_ERROR, errorMessage);
+ LOGGER.error("Failure due to {}", e);
} finally {
- //Delete the file from the local disk.
- boolean fileDeleted = zipFile.delete();
-
- if (!fileDeleted) {
- LOGGER.error("Could not able to delete the zip file {}", zipFile.toString());
- }
+ FileUtil.deleteFile(zipFile, path);
}
});
}
- private ManagedChannel getManagedChannel() {
- return ManagedChannelBuilder.forAddress(grpcAddress, grpcPort)
- .usePlaintext()
- .intercept(cdsSdcListenerAuthClientInterceptor)
- .build();
- }
-
private BluePrintUploadInput generateBluePrintUploadInputBuilder(File file) throws IOException {
byte[] bytes = FileUtils.readFileToByteArray(file);
FileChunk fileChunk = FileChunk.newBuilder().setChunk(ByteString.copyFrom(bytes)).build();
@@ -188,23 +201,4 @@ public class ListenerServiceImpl implements ListenerService {
.setFileChunk(fileChunk)
.build();
}
-
- /**
- * Extract files from the given path
- *
- * @param path where files reside.
- * @return list of files.
- */
- public Optional<List<File>> getFilesFromDisk(Path path) {
- try (Stream<Path> fileTree = walk(path)) {
- // Get the list of files from the path
- return Optional.of(fileTree.filter(Files::isRegularFile)
- .map(Path::toFile)
- .collect(Collectors.toList()));
- } catch (IOException e) {
- LOGGER.error("Failed to find the file", e);
- }
-
- return Optional.empty();
- }
}
diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/status/CdsSdcListenerStatus.java b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/status/CdsSdcListenerStatus.java
new file mode 100644
index 000000000..60d3127f9
--- /dev/null
+++ b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/status/CdsSdcListenerStatus.java
@@ -0,0 +1,83 @@
+/*
+ * 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.cdssdclistener.status;
+
+import static org.onap.sdc.utils.DistributionActionResultEnum.SUCCESS;
+import java.util.Objects;
+import org.onap.ccsdk.cds.cdssdclistener.dto.CdsSdcListenerDto;
+import org.onap.ccsdk.cds.cdssdclistener.util.BuilderUtil;
+import org.onap.sdc.api.IDistributionClient;
+import org.onap.sdc.api.consumer.IFinalDistrStatusMessage;
+import org.onap.sdc.api.results.IDistributionClientResult;
+import org.onap.sdc.impl.DistributionClientImpl;
+import org.onap.sdc.utils.DistributionStatusEnum;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.stereotype.Component;
+
+@Component
+@ConfigurationProperties("listenerservice")
+@ComponentScan("org.onap.ccsdk.cds.cdssdclistener.dto")
+public class CdsSdcListenerStatus {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(CdsSdcListenerStatus.class);
+ private static final String COMPONENT_NAME = "cds";
+
+ @Value("${listenerservice.config.consumerId}")
+ private String consumerId;
+
+ @Autowired
+ private CdsSdcListenerDto cdsSdcListenerDto;
+
+ /**
+ * Send the response back to SDC.
+ *
+ * @param distributionID SDC Distribution ID
+ * @param status Distribution status
+ * @param errorReason Reason of failure
+ */
+ public void sendResponseStatusBackToSDC(String distributionID, DistributionStatusEnum status, String errorReason) {
+
+ final IDistributionClient distributionClient = cdsSdcListenerDto.getDistributionClient();
+
+ IFinalDistrStatusMessage finalDistribution = new BuilderUtil<>(new DistributionStatusMessage())
+ .build(builder -> {
+ builder.distributionID = distributionID;
+ builder.status = status;
+ builder.consumerID = consumerId;
+ builder.componentName = COMPONENT_NAME;
+ }).create();
+
+ if (errorReason == null) {
+ checkResponseStatusFromSdc(distributionClient.sendFinalDistrStatus(finalDistribution));
+ } else {
+ checkResponseStatusFromSdc(distributionClient.sendFinalDistrStatus(finalDistribution, errorReason));
+ }
+ }
+
+ private void checkResponseStatusFromSdc(IDistributionClientResult result) {
+ if (!Objects.equals(result.getDistributionActionResult(), SUCCESS)) {
+ LOGGER.error("SDC failed to receive the response from cds-sdc listener due to {}",
+ result.getDistributionMessageResult());
+ } else {
+ LOGGER.info("SDC successfully received the response");
+ }
+ }
+}
diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/status/DistributionStatusMessage.java b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/status/DistributionStatusMessage.java
new file mode 100644
index 000000000..676c85c98
--- /dev/null
+++ b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/status/DistributionStatusMessage.java
@@ -0,0 +1,55 @@
+/*
+ * 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.cdssdclistener.status;
+
+import org.onap.sdc.api.consumer.IFinalDistrStatusMessage;
+import org.onap.sdc.utils.DistributionStatusEnum;
+
+public class DistributionStatusMessage implements IFinalDistrStatusMessage {
+
+ public String componentName;
+
+ public String consumerID;
+
+ public String distributionID;
+
+ public DistributionStatusEnum status;
+
+ @Override
+ public String getDistributionID() {
+ return distributionID;
+ }
+
+ @Override
+ public long getTimestamp() {
+ return 0;
+ }
+
+ @Override
+ public DistributionStatusEnum getStatus() {
+ return status;
+ }
+
+ @Override
+ public String getConsumerID() {
+ return consumerID;
+ }
+
+ @Override
+ public String getComponentName() {
+ return componentName;
+ }
+}
diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/util/BuilderUtil.java b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/util/BuilderUtil.java
new file mode 100644
index 000000000..4df545c82
--- /dev/null
+++ b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/util/BuilderUtil.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2019 Bell Canada. All rights reserved.
+ *
+ * NOTICE: All the intellectual and technical concepts contained herein are
+ * proprietary to Bell Canada and are protected by trade secret or copyright law.
+ * Unauthorized copying of this file, via any medium is strictly prohibited.
+ */
+package org.onap.ccsdk.cds.cdssdclistener.util;
+
+import java.util.function.Consumer;
+
+/**
+ * A generic builder for constructing an object.
+ *
+ * @param <T> - Any object
+ */
+public class BuilderUtil<T> {
+
+ private final T object;
+
+ public BuilderUtil(T instance) {
+ this.object = instance;
+ }
+
+ public BuilderUtil<T> build(Consumer<T> consumer) {
+ consumer.accept(object);
+ return this;
+ }
+
+ public T create() {
+ return object;
+ }
+}
diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/util/FileUtil.java b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/util/FileUtil.java
new file mode 100644
index 000000000..11f4eade1
--- /dev/null
+++ b/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/util/FileUtil.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2019 Bell Canada. All rights reserved.
+ *
+ * NOTICE: All the intellectual and technical concepts contained herein are
+ * proprietary to Bell Canada and are protected by trade secret or copyright law.
+ * Unauthorized copying of this file, via any medium is strictly prohibited.
+ */
+
+package org.onap.ccsdk.cds.cdssdclistener.util;
+
+import static java.nio.file.Files.walk;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import org.apache.commons.io.FileUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public final class FileUtil {
+ private static final Logger LOGGER = LoggerFactory.getLogger(FileUtils.class);
+
+ private FileUtil() {
+
+ }
+
+ /**
+ * Delete the file.
+ *
+ * @param file - Given file
+ * @param path - Given path
+ */
+ public static void deleteFile(File file, String path) {
+ boolean value = file.delete();
+ if (!value) {
+ LOGGER.error("Failed to delete the file {} at the location {}", file, path);
+ }
+ }
+
+ /**
+ * Extract files from the given path
+ *
+ * @param path where files reside.
+ * @return list of files.
+ */
+ public static Optional<List<File>> getFilesFromDisk(Path path) {
+ try (Stream<Path> fileTree = walk(path)) {
+ // Get the list of files from the path
+ return Optional.of(fileTree.filter(Files::isRegularFile)
+ .map(Path::toFile)
+ .collect(Collectors.toList()));
+ } catch (IOException e) {
+ LOGGER.error("Failed to find the file due to", e);
+ }
+ return Optional.empty();
+ }
+}
diff --git a/ms/cds-sdc-listener/application/src/main/resources/application.yml b/ms/cds-sdc-listener/application/src/main/resources/application.yml
index 657ea9e80..0c2c60dca 100644
--- a/ms/cds-sdc-listener/application/src/main/resources/application.yml
+++ b/ms/cds-sdc-listener/application/src/main/resources/application.yml
@@ -5,7 +5,7 @@ listenerservice:
user: vid
password: Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U
pollingInterval: 15
- pollingTimeout: 15
+ pollingTimeout: 60
relevantArtifactTypes: TOSCA_CSAR
consumerGroup: cds-id-local
environmentName: AUTO
@@ -14,8 +14,14 @@ listenerservice:
keyStorePath:
activateServerTLSAuth : false
isUseHttpsWithDmaap: false
- archivePath: opt/app/onap/cds-sdc-listener/
+ archivePath: /opt/app/onap/cds-sdc-listener/
grpcAddress: localhost
grpcPort: 9111
authHeader: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==
-
+#port needed by Liveness probe
+server:
+ port: 9000
+#set spring.main.web-environment=false if you want to NOT to open a port for healthcheck.
+#spring:
+# main:
+# web-environment: false \ No newline at end of file
diff --git a/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerClientTest.java b/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerClientTest.java
index 948631462..e980c24c6 100644
--- a/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerClientTest.java
+++ b/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerClientTest.java
@@ -1,11 +1,18 @@
/*
- * Copyright (C) 2019 Bell Canada. All rights reserved.
+ * Copyright © 2019 Bell Canada
*
- * NOTICE: All the intellectual and technical concepts contained herein are
- * proprietary to Bell Canada and are protected by trade secret or copyright law.
- * Unauthorized copying of this file, via any medium is strictly prohibited.
+ * 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.cdssdclistener;
import mockit.Expectations;
@@ -38,7 +45,7 @@ public class CdsSdcListenerClientTest {
@Injectable CdsSdcListenerNotificationCallback notification,
@Injectable CdsSdcListenerDto cdsSdcListenerDto) throws CdsSdcListenerException {
- // Arrange
+ //Arrange
new MockUp<DistributionClientFactory>() {
@Mock
public IDistributionClient createDistributionClient() {
diff --git a/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerConfigurationTest.java b/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerConfigurationTest.java
index 338b9c150..f940db2aa 100644
--- a/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerConfigurationTest.java
+++ b/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerConfigurationTest.java
@@ -1,11 +1,18 @@
/*
- * Copyright (C) 2019 Bell Canada. All rights reserved.
+ * Copyright © 2019 Bell Canada
*
- * NOTICE: All the intellectual and technical concepts contained herein are
- * proprietary to Bell Canada and are protected by trade secret or copyright law.
- * Unauthorized copying of this file, via any medium is strictly prohibited.
+ * 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.cdssdclistener;
import static org.junit.Assert.assertEquals;
@@ -31,7 +38,7 @@ public class CdsSdcListenerConfigurationTest {
assertEquals(listenerConfiguration.getUser(), "vid");
assertEquals(listenerConfiguration.getPassword(), "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U");
assertEquals(listenerConfiguration.getPollingInterval(), 15);
- assertEquals(listenerConfiguration.getPollingTimeout(), 15);
+ assertEquals(listenerConfiguration.getPollingTimeout(), 60);
assertEquals(listenerConfiguration.getRelevantArtifactTypes().stream().findFirst().get(), "TOSCA_CSAR");
assertEquals(listenerConfiguration.getConsumerGroup(), "cds-id-local");
assertEquals(listenerConfiguration.getEnvironmentName(), "AUTO");
diff --git a/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/handler/BluePrintProcessorHandlerTest.java b/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/handler/BluePrintProcessorHandlerTest.java
index 0d38decdf..f700a7dd2 100644
--- a/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/handler/BluePrintProcessorHandlerTest.java
+++ b/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/handler/BluePrintProcessorHandlerTest.java
@@ -1,11 +1,18 @@
/*
- * Copyright (C) 2019 Bell Canada. All rights reserved.
+ * Copyright © 2019 Bell Canada
*
- * NOTICE: All the intellectual and technical concepts contained herein are
- * proprietary to Bell Canada and are protected by trade secret or copyright law.
- * Unauthorized copying of this file, via any medium is strictly prohibited.
+ * 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.cdssdclistener.handler;
import static org.junit.Assert.assertEquals;
@@ -35,7 +42,6 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
-
@RunWith(SpringRunner.class)
@EnableConfigurationProperties({BluePrintProcesssorHandler.class, CdsSdcListenerAuthClientInterceptor.class})
@SpringBootTest(classes = {BluePrintProcessorHandlerTest.class})
diff --git a/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/service/ListenerServiceImplTest.java b/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/service/ListenerServiceImplTest.java
index e33fbcdcc..359ee6cc4 100644
--- a/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/service/ListenerServiceImplTest.java
+++ b/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/service/ListenerServiceImplTest.java
@@ -1,34 +1,48 @@
/*
- * Copyright (C) 2019 Bell Canada. All rights reserved.
+ * Copyright © 2019 Bell Canada
*
- * NOTICE: All the intellectual and technical concepts contained herein are
- * proprietary to Bell Canada and are protected by trade secret or copyright law.
- * Unauthorized copying of this file, via any medium is strictly prohibited.
+ * 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.cdssdclistener.service;
import static junit.framework.TestCase.assertTrue;
+import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
+import org.apache.commons.io.FileUtils;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
+import org.onap.ccsdk.cds.cdssdclistener.CdsSdcListenerConfiguration;
import org.onap.ccsdk.cds.cdssdclistener.client.CdsSdcListenerAuthClientInterceptor;
+import org.onap.ccsdk.cds.cdssdclistener.dto.CdsSdcListenerDto;
import org.onap.ccsdk.cds.cdssdclistener.handler.BluePrintProcesssorHandler;
-import org.onap.sdc.impl.mock.DistributionClientDownloadResultStubImpl;
+import org.onap.ccsdk.cds.cdssdclistener.status.CdsSdcListenerStatus;
+import org.onap.sdc.api.results.IDistributionClientDownloadResult;
+import org.onap.sdc.impl.mock.DistributionClientResultStubImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
-@EnableConfigurationProperties({ListenerServiceImpl.class, CdsSdcListenerAuthClientInterceptor.class,
- BluePrintProcesssorHandler.class})
+@EnableConfigurationProperties({CdsSdcListenerAuthClientInterceptor.class,
+ BluePrintProcesssorHandler.class, CdsSdcListenerDto.class, ListenerServiceImpl.class, CdsSdcListenerStatus.class,
+ CdsSdcListenerConfiguration.class})
@SpringBootTest(classes = {ListenerServiceImplTest.class})
public class ListenerServiceImplTest {
@@ -80,4 +94,33 @@ public class ListenerServiceImplTest {
.get()
.getName();
}
+
+ public byte[] convertFileToByteArray(File file) {
+ try {
+ return FileUtils.readFileToByteArray(file);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public class DistributionClientDownloadResultStubImpl extends DistributionClientResultStubImpl implements
+ IDistributionClientDownloadResult {
+
+ public DistributionClientDownloadResultStubImpl() {
+ }
+
+ public byte[] getArtifactPayload() {
+ File file = Paths.get(CSAR_SAMPLE).toFile();
+ return convertFileToByteArray(file);
+ }
+
+ public String getArtifactName() {
+ return "MackArtifactName";
+ }
+
+ public String getArtifactFilename() {
+ return "MackArtifactName.csar";
+ }
+ }
}