diff options
31 files changed, 424 insertions, 74 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/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..c69c511e6 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,25 @@ 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> + +</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/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/datadictionary/capabilitytable.JPG b/docs/datadictionary/capabilitytable.JPG Binary files differnew file mode 100644 index 000000000..7db4715ea --- /dev/null +++ b/docs/datadictionary/capabilitytable.JPG 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 Binary files differnew file mode 100644 index 000000000..074d20076 --- /dev/null +++ b/docs/datadictionary/media/image0.JPG diff --git a/docs/datadictionary/media/image1.JPG b/docs/datadictionary/media/image1.JPG Binary files differnew file mode 100644 index 000000000..a27502a75 --- /dev/null +++ b/docs/datadictionary/media/image1.JPG 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 Binary files differnew file mode 100644 index 000000000..568ad0a9f --- /dev/null +++ b/docs/datadictionary/resttable.JPG diff --git a/docs/datadictionary/sqltable.JPG b/docs/datadictionary/sqltable.JPG Binary files differnew file mode 100644 index 000000000..15d246743 --- /dev/null +++ b/docs/datadictionary/sqltable.JPG diff --git a/docs/index.rst b/docs/index.rst index 8db565a37..477c251da 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:: diff --git a/docs/media/image0.jpg b/docs/media/image0.jpg Binary files differnew file mode 100644 index 000000000..dce3cee25 --- /dev/null +++ b/docs/media/image0.jpg diff --git a/ms/blueprintsprocessor/application/pom.xml b/ms/blueprintsprocessor/application/pom.xml index e7af4c852..c079ba990 100755 --- a/ms/blueprintsprocessor/application/pom.xml +++ b/ms/blueprintsprocessor/application/pom.xml @@ -37,11 +37,6 @@ </dependency> <dependency> <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-devtools</artifactId> - <scope>runtime</scope> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> diff --git a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintHttpServer.java b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/HttpServerWhenGrpcDisable.java index 85ccd1f43..c20a324d5 100644 --- a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintHttpServer.java +++ b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/HttpServerWhenGrpcDisable.java @@ -17,12 +17,15 @@ package org.onap.ccsdk.cds.blueprintsprocessor; import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.web.embedded.netty.NettyReactiveWebServerFactory; import org.springframework.boot.web.server.WebServerFactoryCustomizer; import org.springframework.stereotype.Component; +// When GRPC disable, no need to create the netty server +@ConditionalOnProperty(name = "blueprintsprocessor.grpcEnable", havingValue = "false") @Component -public class BlueprintHttpServer implements WebServerFactoryCustomizer<NettyReactiveWebServerFactory> { +public class HttpServerWhenGrpcDisable implements WebServerFactoryCustomizer<NettyReactiveWebServerFactory> { @Value("${blueprintsprocessor.httpPort}") private Integer httpPort; diff --git a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/HttpServerWhenGrpcEnable.java b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/HttpServerWhenGrpcEnable.java new file mode 100644 index 000000000..e769b9361 --- /dev/null +++ b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/HttpServerWhenGrpcEnable.java @@ -0,0 +1,56 @@ +/* + * Copyright © 2019 Bell Canada. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.ccsdk.cds.blueprintsprocessor; + +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.web.embedded.netty.NettyReactiveWebServerFactory; +import org.springframework.boot.web.reactive.server.ReactiveWebServerFactory; +import org.springframework.boot.web.server.WebServer; +import org.springframework.http.server.reactive.HttpHandler; +import org.springframework.stereotype.Component; + +// When GRPC enable, we need to manually create the netty server +@ConditionalOnProperty(name = "blueprintsprocessor.grpcEnable", havingValue = "true") +@Component +public class HttpServerWhenGrpcEnable { + + @Value("${blueprintsprocessor.httpPort}") + private Integer httpPort; + + private final HttpHandler httpHandler; + private WebServer http; + + @Autowired + public HttpServerWhenGrpcEnable(HttpHandler httpHandler) { + this.httpHandler = httpHandler; + } + + @PostConstruct + public void start() { + ReactiveWebServerFactory factory = new NettyReactiveWebServerFactory(httpPort); + this.http = factory.getWebServer(this.httpHandler); + this.http.start(); + } + + @PreDestroy + public void stop() { + this.http.stop(); + } +}
\ No newline at end of file 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 |