diff options
65 files changed, 1281 insertions, 423 deletions
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 546668d43..a6612d537 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 @@ -26,7 +26,7 @@ limitations under the License. <div style="display: flex;flex-direction: row"> <div style="width: 30em;"> - <button class="btn-active" (click)="changeView()">{{viewText}}</button> + <button class="btn-active" (click)="changeView()" disabled>{{viewText}}</button> </div> <div style="width: 16em"> </div> diff --git a/cds-ui/client/src/app/feature-modules/blueprint/select-template/template-options/template-options.component.html b/cds-ui/client/src/app/feature-modules/blueprint/select-template/template-options/template-options.component.html index 9c2d721e0..d66b559f3 100644 --- a/cds-ui/client/src/app/feature-modules/blueprint/select-template/template-options/template-options.component.html +++ b/cds-ui/client/src/app/feature-modules/blueprint/select-template/template-options/template-options.component.html @@ -19,7 +19,7 @@ limitations under the License. ============LICENSE_END============================================ --> <mat-radio-group> - <mat-radio-button value="1" (click)="selected(1)">Upload Template file</mat-radio-button><br><br> - <mat-radio-button value="2" (click)="selected(2)">Starter Template</mat-radio-button><br><br> - <mat-radio-button value="3" (click)="selected(3)">Existing Model File</mat-radio-button> -</mat-radio-group> + <mat-radio-button value="1" (click)="selected(1)">Upload Template file</mat-radio-button><br><br> + <!-- <mat-radio-button value="2" (click)="selected(2)">Starter Template</mat-radio-button><br><br> + <mat-radio-button value="3" (click)="selected(3)">Existing Model File</mat-radio-button> --> +</mat-radio-group>
\ No newline at end of file diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/existing-model/search-resource/search-resource.component.html b/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/existing-model/search-resource/search-resource.component.html index d02cef429..a2e0a7c05 100644 --- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/existing-model/search-resource/search-resource.component.html +++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/existing-model/search-resource/search-resource.component.html @@ -20,7 +20,7 @@ <form class="example-form" [formGroup]="myControl"> <mat-form-field class="example-full-width"> - <input type="text" [(ngModel)]="searchText" placeholder="Search Resources" matInput [matAutocomplete]="auto" formControlName="search_input"> + <input #resourceSelect type="text" [(ngModel)]="searchText" placeholder="Search Resources" matInput [matAutocomplete]="auto" formControlName="search_input"> <button matSuffix mat-icon-button (click)="fetchResourceByName()"><mat-icon>search</mat-icon></button> <mat-autocomplete #auto="matAutocomplete"> <mat-option (click)="selected(option)" *ngFor="let option of options | search : searchText" [value]="option.tags"> diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/existing-model/search-resource/search-resource.component.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/existing-model/search-resource/search-resource.component.ts index 1850549aa..5aac51bed 100644 --- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/existing-model/search-resource/search-resource.component.ts +++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/existing-model/search-resource/search-resource.component.ts @@ -21,6 +21,7 @@ import { Component, OnInit, ViewChild, EventEmitter, Output } from '@angular/core'; import {FormBuilder, FormGroup, Validators} from '@angular/forms'; import { ExsistingModelService } from '../exsisting-model.service'; +import { MatAutocompleteTrigger } from '@angular/material' @Component({ selector: 'app-search-resource', @@ -31,8 +32,9 @@ export class SearchResourceComponent implements OnInit { myControl: FormGroup; @Output() resourcesData = new EventEmitter(); - options: any[] = [] ; - // = ['One','One1', 'Two', 'Three']; + options: any[] = ['One','One1', 'Two', 'Three']; + // @ViewChild('resourceSelect') resourceSelect; + @ViewChild('resourceSelect', { read: MatAutocompleteTrigger }) resourceSelect: MatAutocompleteTrigger; searchText: string = ''; constructor(private _formBuilder: FormBuilder, @@ -53,8 +55,8 @@ export class SearchResourceComponent implements OnInit { console.log(data); data.forEach(element => { this.options.push(element) - }); - // this.options = data. + }); + this.resourceSelect.openPanel(); }, error=>{ window.alert('error' + error); }) diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.html b/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.html index 9b4dbe5e1..afb2b9d55 100644 --- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.html +++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.html @@ -29,10 +29,10 @@ <app-resource-template-options (option)="selectedOption($event)"></app-resource-template-options> <br> <div> - <button mat-button matStepperNext class="matStepNextBtn">Proceed</button> + <button mat-button matStepperNext class="matStepNextBtn" *ngIf="selectedValue == 1 || selectedValue == 3">Proceed</button> </div> </mat-step> - <mat-step [stepControl]="step2FormGroup"> + <mat-step [stepControl]="step2FormGroup" *ngIf="selectedValue == 1 || selectedValue == 3"> <ng-template matStepLabel>Browse or Search Resources</ng-template> <app-upload-resource (fileData)=upload($event) *ngIf="selectedValue == 1"></app-upload-resource><br><br> <app-existing-model *ngIf="selectedValue == 3"></app-existing-model> diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.scss b/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.scss index 51df0969b..50a386aa4 100644 --- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.scss +++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.scss @@ -22,7 +22,7 @@ background:#3f51b5; margin-top: 10px; position: absolute; - border-radius: 1em; + border-radius: 4px; } .ver-card { width: 100%; @@ -46,4 +46,7 @@ } .success{ color:green; +} +.comp-disabled { + display: none; }
\ No newline at end of file diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.component.scss b/cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.component.scss index c27e7d216..328adcf71 100644 --- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.component.scss +++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.component.scss @@ -28,5 +28,5 @@ margin-top: 10px; position: absolute; margin-bottom: 5px; - border-radius: 1em; + border-radius: 4px; } diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.html b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.html index de81e2394..4bd4ad456 100644 --- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.html +++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.html @@ -19,7 +19,7 @@ */--> -<button (click) ="changeView()" class="toggle-view-btn">{{viewText}}</button> +<button disabled style="opacity: 0.5;" (click) ="changeView()" class="toggle-view-btn">{{viewText}}</button> <br><br> <div *ngIf="designerMode"> <mat-card class="metadata-card"> @@ -50,5 +50,5 @@ <div class="btn"> <button mat-button matStepperPrevious>Back</button></div> <div class="btn"> - <button mat-button matStepperNext type="submit" (click)="updateResourcesState()">Upload</button> + <button mat-button matStepperNext type="submit" (click)="saveToBackend()">Save</button> </div> diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.scss b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.scss index 280645e3d..9c2d42a83 100644 --- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.scss +++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.scss @@ -41,7 +41,7 @@ background:#3f51b5; margin-top: 10px; position: absolute; - border-radius: 1em; + border-radius: 4px; } .mat-card-title{ padding-top: 7px; @@ -61,11 +61,12 @@ margin: 0 25px 25px 0; display: inline-block; vertical-align: top; + border-radius: 4px; } .toggle-view-btn{ color:white; background:#3f51b5; - border-radius: 1em; + border-radius: 4px; margin-top: 10px; padding:0.6em; border: 1px solid #3f51b5; diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.ts index 55b80628d..77e901717 100644 --- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.ts +++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.ts @@ -27,6 +27,7 @@ import { IAppState } from '../../../common/core/store/state/app.state'; import { JsonEditorComponent, JsonEditorOptions } from 'ang-jsoneditor'; import { Observable } from 'rxjs'; import { A11yModule } from '@angular/cdk/a11y'; +import { ResourceEditService } from './resource-edit.service'; @Component({ selector: 'app-resource-edit', @@ -38,13 +39,13 @@ export class ResourceEditComponent implements OnInit { resources:IResources; data:IResources; rdState: Observable<IResourcesState>; - designerMode: boolean = true; - editorMode: boolean = false; + designerMode: boolean = false; + editorMode: boolean = true; viewText: string = "Open in Editor Mode"; @ViewChild(JsonEditorComponent) editor: JsonEditorComponent; options = new JsonEditorOptions(); - constructor(private store: Store<IAppState>) { + constructor(private store: Store<IAppState>, private resourceEditService: ResourceEditService) { this.rdState = this.store.select('resources'); this.options.mode = 'text'; this.options.modes = [ 'text', 'tree', 'view']; @@ -92,5 +93,15 @@ export class ResourceEditComponent implements OnInit { this.designerMode = true; this.viewText = 'Open in Editor Mode' } - } + } + + saveToBackend() { + this.resourceEditService.saveResource(this.data) + .subscribe(response=>{ + window.alert("save success"); + }, + error=>{ + window.alert('Error saving resources'); + }) + } } diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.module.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.module.ts index 2b25ae339..ae7143cfb 100644 --- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.module.ts +++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.module.ts @@ -30,6 +30,7 @@ import { SourcesTemplateComponent } from './sources-template/sources-template.co import { ResourceMetadataComponent } from './resource-metadata/resource-metadata.component'; import { DragDropModule } from '@angular/cdk/drag-drop'; import { NgJsonEditorModule } from 'ang-jsoneditor'; +import { ResourceEditService } from './resource-edit.service'; @NgModule({ declarations: [ ResourceEditComponent,SourcesTemplateComponent,ResourceMetadataComponent ], @@ -42,6 +43,7 @@ import { NgJsonEditorModule } from 'ang-jsoneditor'; MatExpansionModule,MatToolbarModule,MatIconModule, MatButtonModule, MatSidenavModule, MatCheckboxModule, MatListModule, MatGridListModule, MatCardModule, MatMenuModule, MatTableModule, MatPaginatorModule, MatSortModule, MatInputModule, MatSelectModule, MatRadioModule, MatFormFieldModule, MatStepperModule, NgJsonEditorModule ], - exports: [ ResourceEditComponent,SharedModule ] + exports: [ ResourceEditComponent,SharedModule ], + providers: [ ResourceEditService ] }) export class ResourceEditModule { } diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.service.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.service.ts new file mode 100644 index 000000000..982d71d58 --- /dev/null +++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.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, ResourceDictionaryURLs } from '../../../common/constants/app-constants'; + +@Injectable() +export class ResourceEditService { + // blueprintUrl = '../../constants/blueprint.json'; + + constructor(private _http: HttpClient, private api: ApiService) { + } + + saveResource(resource) { + return this.api.post(LoopbackConfig.url+ ResourceDictionaryURLs.saveResourceDictionary, resource); + } +}
\ No newline at end of file diff --git a/docs/CBA/index.rst b/docs/CBA/index.rst index 43317e6e5..27d69b086 100644 --- a/docs/CBA/index.rst +++ b/docs/CBA/index.rst @@ -93,13 +93,6 @@ Steps 3. cd cds ; mvn clean install ; cd .. 4. Open the cds-ui/client code for development -Data Flow: -========== -|image1| - -.. |image1| image:: media/image1.jpg - :width: 7.88889in - :height: 4.43750in Functional Decomposition: ========================= @@ -109,8 +102,3 @@ Functional Decomposition: :width: 7.88889in :height: 4.43750in -Controller design Studio Presentation: -====================================== - -Details about CDS Architecture and Design detail, Please click the link. -:download:`CDS_Architecture_Design.pptx`
\ No newline at end of file diff --git a/docs/CBA/CDS_Architecture_Design.pptx b/docs/CDS_Architecture_Design.pptx Binary files differindex a6c158d8d..a6c158d8d 100644 --- a/docs/CBA/CDS_Architecture_Design.pptx +++ b/docs/CDS_Architecture_Design.pptx diff --git a/docs/media/CDS_architecture.JPG b/docs/CDS_architecture.JPG Binary files differindex c8528ac1e..c8528ac1e 100644 --- a/docs/media/CDS_architecture.JPG +++ b/docs/CDS_architecture.JPG diff --git a/docs/bluePrintsProcessor.rst b/docs/bluePrintsProcessorMS.rst index 911f99945..911f99945 100644 --- a/docs/bluePrintsProcessor.rst +++ b/docs/bluePrintsProcessorMS.rst diff --git a/docs/controllerBlueprintStudioProcessor.rst b/docs/controllerBlueprintStudioProcessorMS.rst index 5c67d6c1d..5c67d6c1d 100644 --- a/docs/controllerBlueprintStudioProcessor.rst +++ b/docs/controllerBlueprintStudioProcessorMS.rst diff --git a/docs/datadictionary/complexResponse.rst b/docs/datadictionary/complexResponse.rst new file mode 100644 index 000000000..aa39ff235 --- /dev/null +++ b/docs/datadictionary/complexResponse.rst @@ -0,0 +1,20 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 +.. Copyright (C) 2019 IBM. + +complex Response code +===================== + +{ + "id": 4, + "address": "192.168.10.2/32", + "vrf": null, + "tenant": null, + "status": 1, + "role": null, + "interface": null, + "description": "", + "nat_inside": null, + "created": "2018-08-30", + "last_updated": "2018-08-30T14:59:05.277820Z" +} diff --git a/docs/datadictionary/create_netbox_ip_address.rst b/docs/datadictionary/create_netbox_ip_address.rst new file mode 100644 index 000000000..5d9a9be87 --- /dev/null +++ b/docs/datadictionary/create_netbox_ip_address.rst @@ -0,0 +1,36 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 +.. Copyright (C) 2019 IBM. + +create_netbox_ip_address code +============================= + +{ + "tags" : "oam-local-ipv4-address", + "name" : "create_netbox_ip", + "property" : { + "description" : "netbox ip", + "type" : "dt-netbox-ip" + }, + "updated-by" : "adetalhouet", + "sources" : { + "primary-config-data" : { + "type" : "source-rest", + "properties" : { + "type" : "JSON", + "verb" : "POST", + "endpoint-selector" : "ipam-1", + "url-path" : "/api/ipam/prefixes/$prefixId/available-ips/", + "path" : "", + "input-key-mapping" : { + "prefixId" : "prefix-id" + }, + "output-key-mapping" : { + "address" : "address", + "id" : "id" + }, + "key-dependencies" : [ "prefix-id" ] + } + } + } + }
\ No newline at end of file diff --git a/docs/datadictionary/dt-netbox-ip.rst b/docs/datadictionary/dt-netbox-ip.rst new file mode 100644 index 000000000..9410580fb --- /dev/null +++ b/docs/datadictionary/dt-netbox-ip.rst @@ -0,0 +1,22 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 +.. Copyright (C) 2019 IBM. + +dt-netbox-ip code +================= + +{ + "version": "1.0.0", + "description": "This is Netbox IP Data Type", + "properties": { + "address": { + "required": true, + "type": "string" + }, + "id": { + "required": true, + "type": "integer" + } + }, + "derived_from": "tosca.datatypes.Root" +} diff --git a/docs/datadictionary/index.rst b/docs/datadictionary/index.rst index 24050000e..64abdece0 100644 --- a/docs/datadictionary/index.rst +++ b/docs/datadictionary/index.rst @@ -13,12 +13,9 @@ A Resource definition models the how a specific resource can be resolved. 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. -A Resource definition can have multiple sources to handle resolution in different ways. - -The main goal of Resource definition is to define re-usable entity that could be shared. - -Creation of data dictionaries is a standalone activity, separated from the blueprint design. +A Resource definition can have multiple sources to handle resolution in different ways. The main goal of Resource definition is to define re-usable entity that could be shared. +Creation of Resource definition is a standalone activity, separated from the blueprint design. As part of modelling a Resource definition entry, the following generic information should be provided: @@ -28,7 +25,7 @@ As part of modelling a Resource definition entry, the following generic informat :width: 7.88889in :height: 4.43750in -Bellow are properties that all the resource source have will have +Below 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. @@ -45,33 +42,12 @@ vf-module-model-customization-uuid and vf-module-label are two data dictionaries Here is how input-key-mapping, output-key-mapping and key-dependencies can be used: -vf-module-label Resource definition - -{ - "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" ] - } - } - } -} +.. toctree:: + :maxdepth: 1 + +resourceDefintionCode + + Resource source: @@ -81,7 +57,7 @@ Defines the contract to resolve a resource. A resource source is modeled, following TOSCA_ node type definition and derives from the Resource_ source. -Also please click below for detailed resource source details +Also please click below for resource source available details .. toctree:: :maxdepth: 1 @@ -89,4 +65,4 @@ Also please click below for detailed resource source details resourcesource .. _TOSCA: 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 -.. _Resource_: https://wiki.onap.org/display/DW/Modeling+Concepts#ModelingConcepts-NodeResourceSource
\ No newline at end of file +.. _Resource: https://wiki.onap.org/display/DW/Modeling+Concepts#ModelingConcepts-NodeResourceSource
\ No newline at end of file diff --git a/docs/datadictionary/resourceDefinitionCode.rst b/docs/datadictionary/resourceDefinitionCode.rst new file mode 100644 index 000000000..a91767678 --- /dev/null +++ b/docs/datadictionary/resourceDefinitionCode.rst @@ -0,0 +1,48 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 +.. Copyright (C) 2019 IBM. + +Source Capability Code +====================== + +{ + "description": "This is Component Resource Source Node Type", + "version": "1.0.0", + "properties": { + "script-type": { + "required": true, + "type": "string", + "default": "kotlin", + "constraints": [ + { + "valid_values": [ + "kotlin", + "jython" + ] + } + ] + }, + "script-class-reference": { + "description": "Capability reference name for internal and kotlin, for jython script file path", + "required": true, + "type": "string" + }, + "instance-dependencies": { + "required": false, + "description": "Instance dependency Names to Inject to Kotlin / Jython Script.", + "type": "list", + "entry_schema": { + "type": "string" + } + }, + "key-dependencies": { + "description": "Resource Resolution dependency dictionary names.", + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "derived_from": "tosca.nodes.ResourceSource" +} diff --git a/docs/datadictionary/resourcesource.rst b/docs/datadictionary/resourcesource.rst index 2b60990ec..1bc0de4f1 100644 --- a/docs/datadictionary/resourcesource.rst +++ b/docs/datadictionary/resourcesource.rst @@ -49,14 +49,14 @@ CDS is currently deployed along the side of SDNC, hence the primary database con .. toctree:: :maxdepth: 1 - sourceprimarydbcode - +sourceprimarydbcode + 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 - dbsystemcode +dbsystemcode REST: @@ -108,3 +108,37 @@ Expects a script to be provided. :maxdepth: 1 sourcecapabilitycode + +Complex Type: +============= + +Value will be resolved through REST., and output will be a complex type. + +Modeling reference: Modeling Concepts#rest + +In this example, we're making a POST request to an IPAM system with no payload. + +Some ingredients are required to perform the query, in this case, $prefixId. Hence It is provided as an input-key-mapping and defined as a key-dependencies. Please refer to the modeling guideline for more in depth understanding. + +As part of this request, the expected response will be as below. + +.. toctree:: + :maxdepth: 1 + + complexResponse + +What is of interest is the address and id fields. For the process to return these two values, we need to create a custom data-type, as bellow + +.. toctree:: + :maxdepth: 1 + + dt-netbox-ip + +The type of the data dictionary will be dt-netbox-ip. + +To tell the resolution framework what is of interest in the response, the output-key-mapping section is used. The process will map the output-key-mapping to the defined data-type. + +.. toctree:: + :maxdepth: 1 + +create_netbox_ip_address
\ No newline at end of file diff --git a/docs/designtime.rst b/docs/designtime.rst new file mode 100644 index 000000000..304a98e2b --- /dev/null +++ b/docs/designtime.rst @@ -0,0 +1,56 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 +.. Copyright (C) 2019 IBM. + +Design Time User Guide +====================== + +Bellow are the requirements to enable automation for a service within ONAP. + +For instantiation, the goal is to be able to automatically resolve all the HEAT/Helm variables, called cloud parameters. + +For post-instantiation, the goal is to configure the VNF with initial configuration. + +Prerequisite +============ + +* Gather the cloud parameters: + +instantiation: + +Have the HEAT template along with the HEAT environment file. + +or + +Have the Helm chart along with the Values.yaml file + +(CDS supports, but whether SO → Multicloud support for Helm/K8S is different story) + + +Post-instantiation: + +Have the configuration template to apply on the VNF. + +* XML for NETCONF +* JSON / XML for RESTCONF +* not supported yet - CLI +* JSON for Ansible [not supported yet] + +*Identify which template parameters are static and dynamic +*Create and fill-in the a table for all the dynamic values + +While doing so, identify the resources using the same process to be resolved; for instance, if two IPs has to be resolved through the same IPAM, the process the resolve the IP is the same. + + +Services: +============= + +.. toctree:: + :maxdepth: 1 + + CBA/index + datadictionary/index + resourceassignment + component + template + resquirement diff --git a/docs/media/image0.jpg b/docs/image0.jpg Binary files differindex dce3cee25..dce3cee25 100644 --- a/docs/media/image0.jpg +++ b/docs/image0.jpg diff --git a/docs/index.rst b/docs/index.rst index 5f3902687..ed558bf59 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -27,7 +27,7 @@ Tosca Model Reference: |image0| -.. |image0| image:: media/image0.jpg +.. |image0| image:: image0.jpg :width: 7.88889in :height: 4.43750in @@ -46,8 +46,8 @@ MicroServices: :maxdepth: 1 :glob: - controllerBlueprintStudioProcessor - bluePrintsProcessor + controllerBlueprintStudioProcessorMS + bluePrintsProcessorMS Architecture: ============= @@ -58,7 +58,7 @@ The GUI handles direct user input and allows for displaying both design time and |image0| -.. |image0| image:: media/CDS_architecture.jpg +.. |image0| image:: CDS_architecture.jpg :height: 4.43750in :width: 7.88889in diff --git a/docs/installation.rst b/docs/installation.rst new file mode 100644 index 000000000..ac72b425f --- /dev/null +++ b/docs/installation.rst @@ -0,0 +1,63 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 +.. Copyright (C) 2019 IBM. + +Installation +============ + +ONAP is meant to be deployed within a Kubernetes environment. Hence, the de-facto way to deploy CDS is through Kubernetes. + +ONAP also package Kubernetes manifest as Chart, using Helm. + +Prerequisite +============ + +https://docs.onap.org/en/latest/guides/onap-developer/settingup/index.html + +Setup local Helm +================ + +helm repo + +* helm serve & +* helm repo add local http://127.0.0.1:8879 + +Get the chart +============= + +Make sure to checkout the release to use, by replacing $release-tag in bellow command + +git clone https://gerrit.onap.org/r/oom +git checkout tags/$release-tag +cd oom/kubernetes +make cds + +Install CDS +=========== + +helm install --name cds cds + +Result +====== + +$ kubectl get all --selector=release=cds +NAME READY STATUS RESTARTS AGE +pod/cds-blueprints-processor-54f758d69f-p98c2 0/1 Running 1 2m +pod/cds-cds-6bd674dc77-4gtdf 1/1 Running 0 2m +pod/cds-cds-db-0 1/1 Running 0 2m +pod/cds-controller-blueprints-545bbf98cf-zwjfc 1/1 Running 0 2m +NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE +service/blueprints-processor ClusterIP 10.43.139.9 <none> 8080/TCP,9111/TCP 2m +service/cds NodePort 10.43.254.69 <none> 3000:30397/TCP 2m +service/cds-db ClusterIP None <none> 3306/TCP 2m +service/controller-blueprints ClusterIP 10.43.207.152 <none> 8080/TCP 2m +NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE +deployment.apps/cds-blueprints-processor 1 1 1 0 2m +deployment.apps/cds-cds 1 1 1 1 2m +deployment.apps/cds-controller-blueprints 1 1 1 1 2m +NAME DESIRED CURRENT READY AGE +replicaset.apps/cds-blueprints-processor-54f758d69f 1 1 0 2m +replicaset.apps/cds-cds-6bd674dc77 1 1 1 2m +replicaset.apps/cds-controller-blueprints-545bbf98cf 1 1 1 2m +NAME DESIRED CURRENT AGE +statefulset.apps/cds-cds-db 1 1 2m
\ No newline at end of file diff --git a/docs/userguide.rst b/docs/userguide.rst new file mode 100644 index 000000000..fcc1b8882 --- /dev/null +++ b/docs/userguide.rst @@ -0,0 +1,13 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 +.. Copyright (C) 2019 IBM. + +User guide +---------- + +.. toctree:: + :maxdepth: 1 + + installation + designtime + diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt new file mode 100644 index 000000000..c5fbea80f --- /dev/null +++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt @@ -0,0 +1,128 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - CDS + * ================================================================================ + * Copyright (C) 2019 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts; + +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.node.ObjectNode +import io.mockk.every +import io.mockk.mockk +import kotlinx.coroutines.runBlocking +import org.junit.Test +import org.junit.runner.RunWith +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ActionIdentifiers +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.CommonHeader +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.StepData +import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive +import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext +import org.onap.ccsdk.cds.controllerblueprints.core.service.DefaultBluePrintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils +import org.springframework.test.context.junit4.SpringRunner +import kotlin.test.BeforeTest +import kotlin.test.assertEquals +import kotlin.test.assertNotNull + +/** + * Unit test cases for abstract component function. + */ +@RunWith(SpringRunner::class) +class AbstractComponentFunctionTest { + + lateinit var blueprintContext: BluePrintContext + + @BeforeTest + fun init() { + blueprintContext = mockk<BluePrintContext>() + every { blueprintContext.rootPath } returns normalizedPathName("target") + } + + /** + * Tests the abstract component functionality. + */ + @Test + fun testAbstractComponent() { + runBlocking { + val bluePrintRuntime = mockk<DefaultBluePrintRuntimeService>("1234") + val samp = SampleComponent() + val comp = samp as AbstractComponentFunction + + comp.bluePrintRuntimeService = bluePrintRuntime + comp.stepName = "sample-step" + assertNotNull(comp, "failed to get kotlin instance") + + val input = getMockedInput(bluePrintRuntime) + + val output = comp.applyNB(input) + + assertEquals(output.actionIdentifiers.actionName, "activate") + assertEquals(output.commonHeader.requestId, "1234") + assertEquals(output.stepData!!.name, "activate-restconf") + assertEquals(output.status.message, "success") + } + } + + + /** + * Mocked input for abstract function test. + */ + private fun getMockedInput(bluePrintRuntime: DefaultBluePrintRuntimeService): + ExecutionServiceInput { + val operationInputs = hashMapOf<String, JsonNode>() + operationInputs[BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE] = + "activate-restconf".asJsonPrimitive() + operationInputs[BluePrintConstants.PROPERTY_CURRENT_INTERFACE] = + "interfaceName".asJsonPrimitive() + operationInputs[BluePrintConstants.PROPERTY_CURRENT_OPERATION] = + "operationName".asJsonPrimitive() + + val stepInputData = StepData().apply { + name = "activate-restconf" + properties = operationInputs + } + val executionServiceInput = ExecutionServiceInput().apply { + commonHeader = CommonHeader().apply { + requestId = "1234" + } + actionIdentifiers = ActionIdentifiers().apply { + actionName = "activate" + } + payload = JacksonUtils.jsonNode("{}") as ObjectNode + } + executionServiceInput.stepData = stepInputData + + every { + bluePrintRuntime.resolveNodeTemplateInterfaceOperationInputs( + "activate-restconf", "interfaceName", "operationName") + } returns operationInputs + + val operationOutputs = hashMapOf<String, JsonNode>() + every { + bluePrintRuntime.resolveNodeTemplateInterfaceOperationOutputs( + "activate-restconf", "interfaceName", "operationName") + } returns operationOutputs + every { bluePrintRuntime.bluePrintContext() } returns blueprintContext + + return executionServiceInput + } +} diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt new file mode 100644 index 000000000..e09cbfb66 --- /dev/null +++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt @@ -0,0 +1,50 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - CDS + * ================================================================================ + * Copyright (C) 2019 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + + +package org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts + +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput +import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction +import org.slf4j.LoggerFactory + +open class SampleComponent : AbstractComponentFunction() { + + val log = LoggerFactory.getLogger(SampleComponent::class.java)!! + + + override suspend fun processNB(executionRequest: ExecutionServiceInput) { + } + + override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { + } +} + +open class SampleScriptComponent : AbstractComponentFunction() { + + val log = LoggerFactory.getLogger(SampleScriptComponent::class.java)!! + + + override suspend fun processNB(executionRequest: ExecutionServiceInput) { + } + + override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { + } +}
\ No newline at end of file diff --git a/ms/cds-sdc-listener/application/pom.xml b/ms/cds-sdc-listener/application/pom.xml deleted file mode 100644 index 3f8e1a319..000000000 --- a/ms/cds-sdc-listener/application/pom.xml +++ /dev/null @@ -1,215 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - - <parent> - <groupId>org.onap.ccsdk.parent</groupId> - <artifactId>spring-boot-starter-parent</artifactId> - <version>1.2.2-SNAPSHOT</version> - </parent> - - <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> - - <properties> - <grpc.version>1.17.1</grpc.version> - <protobuf.version>3.6.1</protobuf.version> - <image.name>onap/ccsdk-cds-sdc-listener</image.name> - <docker.push.phase>deploy</docker.push.phase> - <project.version>${parent.version}</project.version> - <!-- Start of Docker Related Properties --> - <docker.fabric.version>0.26.1</docker.fabric.version> - <ccsdk.project.version>${project.version}</ccsdk.project.version> - </properties> - - <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> - - <!-- SDC Distribution client dependency --> - <dependency> - <groupId>org.onap.sdc.sdc-distribution-client</groupId> - <artifactId>sdc-distribution-client</artifactId> - <version>1.3.0</version> - </dependency> - - <dependency> - <groupId>org.jmockit</groupId> - <artifactId>jmockit</artifactId> - <version>1.19</version> - <scope>test</scope> - </dependency> - - <!-- GRPC Dependencies --> - <dependency> - <groupId>io.grpc</groupId> - <artifactId>grpc-netty</artifactId> - <version>${grpc.version}</version> - </dependency> - <dependency> - <groupId>io.grpc</groupId> - <artifactId>grpc-protobuf</artifactId> - <version>${grpc.version}</version> - </dependency> - <dependency> - <groupId>io.grpc</groupId> - <artifactId>grpc-stub</artifactId> - <version>${grpc.version}</version> - </dependency> - <dependency> - <groupId>com.google.protobuf</groupId> - <artifactId>protobuf-java</artifactId> - <version>${protobuf.version}</version> - </dependency> - <dependency> - <groupId>io.grpc</groupId> - <artifactId>grpc-testing</artifactId> - <version>${grpc.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.onap.ccsdk.cds.components</groupId> - <artifactId>proto-definition</artifactId> - <version>${project.version}</version> - </dependency> - - <dependency> - <groupId>io.projectreactor</groupId> - <artifactId>reactor-core</artifactId> - <version>3.2.6.RELEASE</version> - <scope>compile</scope> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - <executions> - <execution> - <id>repackage</id> - <goals> - <goal>repackage</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <artifactId>maven-antrun-plugin</artifactId> - <version>1.8</version> - <executions> - <execution> - <id>copy</id> - <phase>package</phase> - <configuration> - <target> - <echo>ANT TASK - copying Docker files</echo> - <copy todir="${basedir}/target/docker-stage" overwrite="true" flatten="true"> - <fileset dir="${basedir}/src/main/docker"> - <include name="Dockerfile"/> - <include name="start.sh"/> - </fileset> - <fileset dir="${basedir}/target"> - <include name="*.jar"/> - </fileset> - <fileset dir="${basedir}/src/main/resources/"> - <include name="application.yml"/> - </fileset> - </copy> - </target> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.codehaus.groovy.maven</groupId> - <artifactId>gmaven-plugin</artifactId> - <version>1.0</version> - <executions> - <execution> - <phase>validate</phase> - <goals> - <goal>execute</goal> - </goals> - <configuration> - <source>${basedir}/../../../TagVersion.groovy</source> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - - <profiles> - <profile> - <id>docker</id> - <build> - <plugins> - <plugin> - <groupId>io.fabric8</groupId> - <artifactId>docker-maven-plugin</artifactId> - <version>${docker.fabric.version}</version> - <inherited>false</inherited> - <configuration> - <images> - <image> - <name>${image.name}</name> - <build> - <cleanup>try</cleanup> - <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir> - <tags> - <tag>${project.docker.latestminortag.version}</tag> - <tag>${project.docker.latestfulltag.version}</tag> - <tag>${project.docker.latesttagtimestamp.version}</tag> - </tags> - </build> - </image> - </images> - <verbose>true</verbose> - </configuration> - <executions> - <execution> - <id>generate-images</id> - <phase>package</phase> - <goals> - <goal>build</goal> - </goals> - </execution> - <execution> - <id>push-images</id> - <phase>${docker.push.phase}</phase> - <goals> - <goal>build</goal> - <goal>push</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - </profiles> - -</project> diff --git a/ms/cds-sdc-listener/application/src/main/docker/Dockerfile b/ms/cds-sdc-listener/application/src/main/docker/Dockerfile deleted file mode 100644 index 062f65767..000000000 --- a/ms/cds-sdc-listener/application/src/main/docker/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM openjdk:8-jdk-alpine - -ENV HTTP_PROXY ${HTTP_PROXY} -ENV HTTPS_PROXY ${HTTPS_PROXY} - -RUN mkdir -p /opt/app/onap/ /opt/app/onap/config -WORKDIR /opt/app/onap/ -COPY start.sh /opt/app/onap/ -COPY application.yml /opt/app/onap/config -RUN chmod 751 /opt/app/onap/start.sh -COPY cds-sdc-listener-application-0.4.2-SNAPSHOT.jar /opt/app/onap/cds-sdc-listener-distribution.jar -EXPOSE 9000 -ENTRYPOINT /opt/app/onap/start.sh diff --git a/ms/cds-sdc-listener/application/src/main/docker/start.sh b/ms/cds-sdc-listener/application/src/main/docker/start.sh deleted file mode 100755 index f24d15618..000000000 --- a/ms/cds-sdc-listener/application/src/main/docker/start.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -extraArgs=$@ -java -jar /opt/app/onap/cds-sdc-listener-distribution.jar \ --Dspring.config=/opt/app/onap/config/application.yml \ --Djava.security.egd=file:/dev/./urandom \ -${extraArgs} diff --git a/ms/pom.xml b/ms/pom.xml index d1c87c995..b97ebc03f 100644 --- a/ms/pom.xml +++ b/ms/pom.xml @@ -36,6 +36,6 @@ <module>controllerblueprints</module> <module>blueprintsprocessor</module> <module>command-executor</module> - <module>cds-sdc-listener</module> + <module>sdclistener</module> </modules> </project> diff --git a/ms/sdclistener/application/pom.xml b/ms/sdclistener/application/pom.xml new file mode 100644 index 000000000..5513279cc --- /dev/null +++ b/ms/sdclistener/application/pom.xml @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ 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. + --> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.ccsdk.cds.sdclistener</groupId> + <artifactId>parent</artifactId> + <version>0.4.2-SNAPSHOT</version> + <relativePath>../parent</relativePath> + </parent> + + <artifactId>application</artifactId> + <packaging>jar</packaging> + <version>0.4.2-SNAPSHOT</version> + <name>SDC Listener Application</name> + + <properties> + <protobuf.version>3.6.1</protobuf.version> + <project.version>${parent.version}</project.version> + </properties> + + <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> + + <!-- SDC Distribution client dependency --> + <dependency> + <groupId>org.onap.sdc.sdc-distribution-client</groupId> + <artifactId>sdc-distribution-client</artifactId> + <version>1.3.0</version> + </dependency> + + <dependency> + <groupId>org.jmockit</groupId> + <artifactId>jmockit</artifactId> + <scope>test</scope> + </dependency> + + <!-- GRPC Dependencies --> + <dependency> + <groupId>io.grpc</groupId> + <artifactId>grpc-netty</artifactId> + <version>${grpc.version}</version> + </dependency> + <dependency> + <groupId>io.grpc</groupId> + <artifactId>grpc-protobuf</artifactId> + <version>${grpc.version}</version> + </dependency> + <dependency> + <groupId>io.grpc</groupId> + <artifactId>grpc-stub</artifactId> + <version>${grpc.version}</version> + </dependency> + <dependency> + <groupId>com.google.protobuf</groupId> + <artifactId>protobuf-java</artifactId> + </dependency> + <dependency> + <groupId>io.grpc</groupId> + <artifactId>grpc-testing</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.cds.components</groupId> + <artifactId>proto-definition</artifactId> + </dependency> + + <dependency> + <groupId>io.projectreactor</groupId> + <artifactId>reactor-core</artifactId> + <scope>compile</scope> + </dependency> + </dependencies> +</project> diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerApplication.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerApplication.java index 6f0f65323..253b576d2 100644 --- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerApplication.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerApplication.java @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener; +package org.onap.ccsdk.cds.sdclistener; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.properties.EnableConfigurationProperties; @SpringBootApplication -@EnableConfigurationProperties(CdsSdcListenerConfiguration.class) -public class CdsSdcListenerApplication { +@EnableConfigurationProperties(SdcListenerConfiguration.class) +public class SdcListenerApplication { public static void main(String[] args) { - SpringApplication.run(CdsSdcListenerApplication.class, args); + SpringApplication.run(SdcListenerApplication.class, args); } } diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerConfiguration.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfiguration.java index 3dfb07eb8..06e2a0342 100644 --- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerConfiguration.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfiguration.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener; +package org.onap.ccsdk.cds.sdclistener; import java.util.List; import org.onap.sdc.api.consumer.IConfiguration; @@ -25,7 +25,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; * distribution client needs. */ @ConfigurationProperties("listenerservice") -public class CdsSdcListenerConfiguration implements IConfiguration { +public class SdcListenerConfiguration implements IConfiguration { public static final String TOSCA_CSAR = "TOSCA_CSAR"; diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerNotificationCallback.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerNotificationCallback.java index 58c667c26..eb339aef7 100644 --- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerNotificationCallback.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerNotificationCallback.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener; +package org.onap.ccsdk.cds.sdclistener; import static org.onap.sdc.utils.DistributionActionResultEnum.SUCCESS; import java.io.File; @@ -22,10 +22,10 @@ import java.nio.file.Paths; 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.ListenerService; -import org.onap.ccsdk.cds.cdssdclistener.status.CdsSdcListenerStatus; -import org.onap.ccsdk.cds.cdssdclistener.util.FileUtil; +import org.onap.ccsdk.cds.sdclistener.dto.SdcListenerDto; +import org.onap.ccsdk.cds.sdclistener.service.ListenerService; +import org.onap.ccsdk.cds.sdclistener.status.SdcListenerStatus; +import org.onap.ccsdk.cds.sdclistener.util.FileUtil; import org.onap.sdc.api.IDistributionClient; import org.onap.sdc.api.consumer.INotificationCallback; import org.onap.sdc.api.notification.IArtifactInfo; @@ -43,10 +43,10 @@ import org.springframework.stereotype.Component; @ConfigurationProperties("listenerservice") @Component @ComponentScan("org.onap.ccsdk.cds.cdssdclistener.dto") -public class CdsSdcListenerNotificationCallback implements INotificationCallback { +public class SdcListenerNotificationCallback implements INotificationCallback { @Autowired - private CdsSdcListenerDto cdsSdcListenerDto; + private SdcListenerDto sdcListenerDto; @Autowired private ListenerService listenerService; @@ -55,20 +55,20 @@ public class CdsSdcListenerNotificationCallback implements INotificationCallback private String pathToStoreArchives; @Autowired - private CdsSdcListenerStatus listenerStatus; + private SdcListenerStatus listenerStatus; - private static final Logger LOGGER = LoggerFactory.getLogger(CdsSdcListenerNotificationCallback.class); + private static final Logger LOGGER = LoggerFactory.getLogger(SdcListenerNotificationCallback.class); @Override public void activateCallback(INotificationData notificationData) { final String distributionId = notificationData.getDistributionID(); - cdsSdcListenerDto.setDistributionId(distributionId); + sdcListenerDto.setDistributionId(distributionId); LOGGER.info("Received service distribution from SDC with the id {}", distributionId); processNotification(notificationData); } private void processNotification(INotificationData notificationData) { - final IDistributionClient distributionClient = cdsSdcListenerDto.getDistributionClient(); + final IDistributionClient distributionClient = sdcListenerDto.getDistributionClient(); notificationData.getServiceArtifacts() .forEach(artifactInfo -> downloadCsarArtifacts(artifactInfo, distributionClient)); } @@ -83,7 +83,7 @@ public class CdsSdcListenerNotificationCallback implements INotificationCallback final String url = info.getArtifactURL(); final String id = info.getArtifactUUID(); - if (Objects.equals(info.getArtifactType(), CdsSdcListenerConfiguration.TOSCA_CSAR)) { + if (Objects.equals(info.getArtifactType(), SdcListenerConfiguration.TOSCA_CSAR)) { LOGGER.info("Trying to download the artifact from : {} and UUID is {} ", url, id); // Download the artifact @@ -92,7 +92,7 @@ public class CdsSdcListenerNotificationCallback implements INotificationCallback if (!Objects.equals(result.getDistributionActionResult(), SUCCESS)) { String errorMessage = String.format("Failed to download the artifact from : %s due to %s ", url, result.getDistributionActionResult()); - listenerStatus.sendResponseStatusBackToSDC(cdsSdcListenerDto.getDistributionId(), + listenerStatus.sendResponseStatusBackToSDC(sdcListenerDto.getDistributionId(), DistributionStatusEnum.COMPONENT_DONE_ERROR, errorMessage); LOGGER.error(errorMessage); } else { @@ -124,6 +124,6 @@ public class CdsSdcListenerNotificationCallback implements INotificationCallback } } - listenerService.saveBluePrintToCdsDatabase(cbaArchivePath, cdsSdcListenerDto.getManagedChannelForGrpc()); + listenerService.saveBluePrintToCdsDatabase(cbaArchivePath, sdcListenerDto.getManagedChannelForGrpc()); } } diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/client/CdsSdcListenerAuthClientInterceptor.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerAuthClientInterceptor.java index bae4a3754..6f782d10a 100644 --- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/client/CdsSdcListenerAuthClientInterceptor.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerAuthClientInterceptor.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener.client; +package org.onap.ccsdk.cds.sdclistener.client; import io.grpc.CallOptions; import io.grpc.Channel; @@ -33,7 +33,7 @@ import org.springframework.stereotype.Component; */ @ConfigurationProperties("listenerservice") @Component -public class CdsSdcListenerAuthClientInterceptor implements ClientInterceptor { +public class SdcListenerAuthClientInterceptor implements ClientInterceptor { @Value("${listenerservice.config.authHeader}") private String basicAuth; diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/client/CdsSdcListenerClient.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerClient.java index 8d6aca5cd..973f950bc 100644 --- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/client/CdsSdcListenerClient.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerClient.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener.client; +package org.onap.ccsdk.cds.sdclistener.client; import java.util.Optional; -import org.onap.ccsdk.cds.cdssdclistener.CdsSdcListenerConfiguration; -import org.onap.ccsdk.cds.cdssdclistener.dto.CdsSdcListenerDto; -import org.onap.ccsdk.cds.cdssdclistener.CdsSdcListenerNotificationCallback; -import org.onap.ccsdk.cds.cdssdclistener.exceptions.CdsSdcListenerException; +import org.onap.ccsdk.cds.sdclistener.SdcListenerConfiguration; +import org.onap.ccsdk.cds.sdclistener.dto.SdcListenerDto; +import org.onap.ccsdk.cds.sdclistener.SdcListenerNotificationCallback; +import org.onap.ccsdk.cds.sdclistener.exceptions.SdcListenerException; import org.onap.sdc.api.IDistributionClient; import org.onap.sdc.api.results.IDistributionClientResult; import org.onap.sdc.impl.DistributionClientFactory; @@ -34,18 +34,18 @@ import org.springframework.stereotype.Component; @Component @ComponentScan("org.onap.ccsdk.cds.cdssdclistener.dto") -public class CdsSdcListenerClient { +public class SdcListenerClient { - private static Logger LOG = LoggerFactory.getLogger(CdsSdcListenerClient.class); + private static Logger LOG = LoggerFactory.getLogger(SdcListenerClient.class); @Autowired - private CdsSdcListenerConfiguration configuration; + private SdcListenerConfiguration configuration; @Autowired - private CdsSdcListenerNotificationCallback notification; + private SdcListenerNotificationCallback notification; @Autowired - private CdsSdcListenerDto listenerDto; + private SdcListenerDto listenerDto; private IDistributionClient distributionClient; @@ -53,11 +53,11 @@ public class CdsSdcListenerClient { * This method initializes the SDC Distribution client. */ @EventListener(ApplicationReadyEvent.class) - public void initSdcClient() throws CdsSdcListenerException { + public void initSdcClient() throws SdcListenerException { LOG.info("Initialize the SDC distribution client"); distributionClient = Optional.of(DistributionClientFactory.createDistributionClient()) - .orElseThrow(() -> new CdsSdcListenerException("Could not able to create SDC Distribution client")); + .orElseThrow(() -> new SdcListenerException("Could not able to create SDC Distribution client")); listenerDto.setManagedChannelForGrpc(); @@ -67,9 +67,9 @@ public class CdsSdcListenerClient { startSdcClientBasedOnTheResult(result); } - private void startSdcClientBasedOnTheResult(IDistributionClientResult result) throws CdsSdcListenerException { + private void startSdcClientBasedOnTheResult(IDistributionClientResult result) throws SdcListenerException { if (!result.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) { - throw new CdsSdcListenerException( + throw new SdcListenerException( "SDC distribution client init failed with reason:" + result.getDistributionMessageResult()); } @@ -79,16 +79,16 @@ public class CdsSdcListenerClient { result = this.distributionClient.start(); if (!result.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) { - throw new CdsSdcListenerException( + throw new SdcListenerException( "Startup of the SDC distribution client failed with reason: " + result.getDistributionMessageResult()); } } - private void closeSdcDistributionclient() throws CdsSdcListenerException { + private void closeSdcDistributionclient() throws SdcListenerException { LOG.info("Closing SDC distribution client"); IDistributionClientResult status = this.distributionClient.stop(); if (status.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) { - throw new CdsSdcListenerException( + throw new SdcListenerException( "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/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/controller/HealthCheck.java index a1bb116bf..a9e51ac12 100644 --- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/controller/HealthCheck.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/controller/HealthCheck.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener.controller; +package org.onap.ccsdk.cds.sdclistener.controller; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/dto/CdsSdcListenerDto.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/dto/SdcListenerDto.java index 68669307e..c7c3d4829 100644 --- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/dto/CdsSdcListenerDto.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/dto/SdcListenerDto.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener.dto; +package org.onap.ccsdk.cds.sdclistener.dto; import io.grpc.ManagedChannel; import io.grpc.ManagedChannelBuilder; -import org.onap.ccsdk.cds.cdssdclistener.client.CdsSdcListenerAuthClientInterceptor; +import org.onap.ccsdk.cds.sdclistener.client.SdcListenerAuthClientInterceptor; import org.onap.sdc.api.IDistributionClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -26,7 +26,7 @@ import org.springframework.stereotype.Component; @Component @ConfigurationProperties("listenerservice") -public class CdsSdcListenerDto { +public class SdcListenerDto { @Value("${listenerservice.config.grpcAddress}") private String grpcAddress; @@ -35,7 +35,7 @@ public class CdsSdcListenerDto { private int grpcPort; @Autowired - private CdsSdcListenerAuthClientInterceptor cdsSdcListenerAuthClientInterceptor; + private SdcListenerAuthClientInterceptor sdcListenerAuthClientInterceptor; private IDistributionClient distributionClient; private ManagedChannel managedChannel; @@ -60,7 +60,7 @@ public class CdsSdcListenerDto { public void setManagedChannelForGrpc() { managedChannel = ManagedChannelBuilder.forAddress(grpcAddress, grpcPort) .usePlaintext() - .intercept(cdsSdcListenerAuthClientInterceptor) + .intercept(sdcListenerAuthClientInterceptor) .build(); } diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/exceptions/CdsSdcListenerException.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/exceptions/SdcListenerException.java index eff5ef050..23f669f1e 100644 --- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/exceptions/CdsSdcListenerException.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/exceptions/SdcListenerException.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener.exceptions; +package org.onap.ccsdk.cds.sdclistener.exceptions; -public class CdsSdcListenerException extends Exception { +public class SdcListenerException extends Exception { /** * @param message The message to dump */ - public CdsSdcListenerException(final String message) { + public SdcListenerException(final String message) { super(message); } @@ -28,7 +28,7 @@ public class CdsSdcListenerException extends Exception { * @param message The message to dump * @param cause The Throwable cause object */ - public CdsSdcListenerException(final String message, final Throwable cause) { + public SdcListenerException(final String message, final Throwable cause) { super(message, cause); } } diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/handler/BluePrintProcesssorHandler.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcesssorHandler.java index b05245392..96b2ff081 100644 --- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/handler/BluePrintProcesssorHandler.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcesssorHandler.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener.handler; +package org.onap.ccsdk.cds.sdclistener.handler; import io.grpc.ManagedChannel; import org.onap.ccsdk.cds.controllerblueprints.common.api.Status; diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/service/ListenerService.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerService.java index e55aeb134..446c3e621 100644 --- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/service/ListenerService.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerService.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener.service; +package org.onap.ccsdk.cds.sdclistener.service; import io.grpc.ManagedChannel; import java.nio.file.Path; diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/service/ListenerServiceImpl.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java index 1cf1a1bae..9a6ae8779 100644 --- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/service/ListenerServiceImpl.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener.service; +package org.onap.ccsdk.cds.sdclistener.service; import static java.nio.file.Files.walk; import static org.onap.sdc.utils.DistributionStatusEnum.COMPONENT_DONE_ERROR; @@ -33,17 +33,15 @@ import java.util.Enumeration; import java.util.List; import java.util.Optional; import java.util.regex.Pattern; -import java.util.stream.Collectors; -import java.util.stream.Stream; import java.util.zip.ZipEntry; 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.sdclistener.client.SdcListenerAuthClientInterceptor; +import org.onap.ccsdk.cds.sdclistener.dto.SdcListenerDto; +import org.onap.ccsdk.cds.sdclistener.handler.BluePrintProcesssorHandler; +import org.onap.ccsdk.cds.sdclistener.status.SdcListenerStatus; +import org.onap.ccsdk.cds.sdclistener.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; @@ -63,13 +61,13 @@ public class ListenerServiceImpl implements ListenerService { private BluePrintProcesssorHandler bluePrintProcesssorHandler; @Autowired - private CdsSdcListenerAuthClientInterceptor cdsSdcListenerAuthClientInterceptor; + private SdcListenerAuthClientInterceptor sdcListenerAuthClientInterceptor; @Autowired - private CdsSdcListenerStatus listenerStatus; + private SdcListenerStatus listenerStatus; @Autowired - private CdsSdcListenerDto cdsSdcListenerDto; + private SdcListenerDto sdcListenerDto; @Value("${listenerservice.config.grpcAddress}") private String grpcAddress; @@ -161,7 +159,7 @@ public class ListenerServiceImpl implements ListenerService { } private void prepareRequestForCdsBackend(List<File> files, ManagedChannel managedChannel, String path) { - final String distributionId = cdsSdcListenerDto.getDistributionId(); + final String distributionId = sdcListenerDto.getDistributionId(); files.forEach(zipFile -> { try { diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/status/DistributionStatusMessage.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/DistributionStatusMessage.java index 676c85c98..60463762b 100644 --- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/status/DistributionStatusMessage.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/DistributionStatusMessage.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener.status; +package org.onap.ccsdk.cds.sdclistener.status; import org.onap.sdc.api.consumer.IFinalDistrStatusMessage; import org.onap.sdc.utils.DistributionStatusEnum; diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/status/CdsSdcListenerStatus.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/SdcListenerStatus.java index 60d3127f9..ff64c0d0c 100644 --- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/status/CdsSdcListenerStatus.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/SdcListenerStatus.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener.status; +package org.onap.ccsdk.cds.sdclistener.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.ccsdk.cds.sdclistener.dto.SdcListenerDto; +import org.onap.ccsdk.cds.sdclistener.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; @@ -35,16 +34,16 @@ import org.springframework.stereotype.Component; @Component @ConfigurationProperties("listenerservice") @ComponentScan("org.onap.ccsdk.cds.cdssdclistener.dto") -public class CdsSdcListenerStatus { +public class SdcListenerStatus { - private static final Logger LOGGER = LoggerFactory.getLogger(CdsSdcListenerStatus.class); + private static final Logger LOGGER = LoggerFactory.getLogger(SdcListenerStatus.class); private static final String COMPONENT_NAME = "cds"; @Value("${listenerservice.config.consumerId}") private String consumerId; @Autowired - private CdsSdcListenerDto cdsSdcListenerDto; + private SdcListenerDto sdcListenerDto; /** * Send the response back to SDC. @@ -55,7 +54,7 @@ public class CdsSdcListenerStatus { */ public void sendResponseStatusBackToSDC(String distributionID, DistributionStatusEnum status, String errorReason) { - final IDistributionClient distributionClient = cdsSdcListenerDto.getDistributionClient(); + final IDistributionClient distributionClient = sdcListenerDto.getDistributionClient(); IFinalDistrStatusMessage finalDistribution = new BuilderUtil<>(new DistributionStatusMessage()) .build(builder -> { diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/util/BuilderUtil.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/BuilderUtil.java index 4df545c82..1f546d107 100644 --- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/util/BuilderUtil.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/BuilderUtil.java @@ -5,7 +5,7 @@ * 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; +package org.onap.ccsdk.cds.sdclistener.util; import java.util.function.Consumer; diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/util/FileUtil.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/FileUtil.java index 11f4eade1..967e854d7 100644 --- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/util/FileUtil.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/FileUtil.java @@ -6,7 +6,7 @@ * Unauthorized copying of this file, via any medium is strictly prohibited. */ -package org.onap.ccsdk.cds.cdssdclistener.util; +package org.onap.ccsdk.cds.sdclistener.util; import static java.nio.file.Files.walk; import java.io.File; diff --git a/ms/cds-sdc-listener/application/src/main/resources/application.yml b/ms/sdclistener/application/src/main/resources/application.yml index b3f8443eb..b3f8443eb 100644 --- a/ms/cds-sdc-listener/application/src/main/resources/application.yml +++ b/ms/sdclistener/application/src/main/resources/application.yml diff --git a/ms/cds-sdc-listener/application/src/main/resources/logback.xml b/ms/sdclistener/application/src/main/resources/logback.xml index b26cbcbe4..b26cbcbe4 100644 --- a/ms/cds-sdc-listener/application/src/main/resources/logback.xml +++ b/ms/sdclistener/application/src/main/resources/logback.xml diff --git a/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerClientTest.java b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerClientTest.java index e980c24c6..c9f2c5a39 100644 --- a/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerClientTest.java +++ b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerClientTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener; +package org.onap.ccsdk.cds.sdclistener; import mockit.Expectations; import mockit.Injectable; @@ -24,9 +24,9 @@ import mockit.VerificationsInOrder; import mockit.integration.junit4.JMockit; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.ccsdk.cds.cdssdclistener.client.CdsSdcListenerClient; -import org.onap.ccsdk.cds.cdssdclistener.dto.CdsSdcListenerDto; -import org.onap.ccsdk.cds.cdssdclistener.exceptions.CdsSdcListenerException; +import org.onap.ccsdk.cds.sdclistener.client.SdcListenerClient; +import org.onap.ccsdk.cds.sdclistener.dto.SdcListenerDto; +import org.onap.ccsdk.cds.sdclistener.exceptions.SdcListenerException; import org.onap.sdc.api.IDistributionClient; import org.onap.sdc.api.results.IDistributionClientResult; import org.onap.sdc.impl.DistributionClientFactory; @@ -34,16 +34,16 @@ import org.onap.sdc.impl.DistributionClientResultImpl; import org.onap.sdc.utils.DistributionActionResultEnum; @RunWith(JMockit.class) -public class CdsSdcListenerClientTest { +public class SdcListenerClientTest { @Tested - private CdsSdcListenerClient cdsSdcListenerClient; + private SdcListenerClient sdcListenerClient; @Test public void testInitCdsClientSuccesfully(@Injectable IDistributionClient distributionClient, - @Injectable CdsSdcListenerConfiguration configuration, - @Injectable CdsSdcListenerNotificationCallback notification, - @Injectable CdsSdcListenerDto cdsSdcListenerDto) throws CdsSdcListenerException { + @Injectable SdcListenerConfiguration configuration, + @Injectable SdcListenerNotificationCallback notification, + @Injectable SdcListenerDto sdcListenerDto) throws SdcListenerException { //Arrange new MockUp<DistributionClientFactory>() { @@ -64,7 +64,7 @@ public class CdsSdcListenerClientTest { }}; // Act - cdsSdcListenerClient.initSdcClient(); + sdcListenerClient.initSdcClient(); // Verify new VerificationsInOrder() {{ diff --git a/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerConfigurationTest.java b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfigurationTest.java index f940db2aa..01ffe1ba9 100644 --- a/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerConfigurationTest.java +++ b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfigurationTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener; +package org.onap.ccsdk.cds.sdclistener; import static org.junit.Assert.assertEquals; import org.junit.Test; @@ -24,12 +24,12 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) -@EnableConfigurationProperties(CdsSdcListenerConfiguration.class) -@SpringBootTest(classes = {CdsSdcListenerConfigurationTest.class}) -public class CdsSdcListenerConfigurationTest { +@EnableConfigurationProperties(SdcListenerConfiguration.class) +@SpringBootTest(classes = {SdcListenerConfigurationTest.class}) +public class SdcListenerConfigurationTest { @Autowired - private CdsSdcListenerConfiguration listenerConfiguration; + private SdcListenerConfiguration listenerConfiguration; @Test public void testCdsSdcListenerConfiguration() { diff --git a/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/handler/BluePrintProcessorHandlerTest.java b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcessorHandlerTest.java index f700a7dd2..ee20f8771 100644 --- a/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/handler/BluePrintProcessorHandlerTest.java +++ b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcessorHandlerTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener.handler; +package org.onap.ccsdk.cds.sdclistener.handler; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -31,7 +31,7 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.ccsdk.cds.cdssdclistener.client.CdsSdcListenerAuthClientInterceptor; +import org.onap.ccsdk.cds.sdclistener.client.SdcListenerAuthClientInterceptor; import org.onap.ccsdk.cds.controllerblueprints.common.api.Status; import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementOutput; import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementServiceGrpc.BluePrintManagementServiceImplBase; @@ -43,7 +43,7 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) -@EnableConfigurationProperties({BluePrintProcesssorHandler.class, CdsSdcListenerAuthClientInterceptor.class}) +@EnableConfigurationProperties({BluePrintProcesssorHandler.class, SdcListenerAuthClientInterceptor.class}) @SpringBootTest(classes = {BluePrintProcessorHandlerTest.class}) public class BluePrintProcessorHandlerTest { @@ -51,7 +51,7 @@ public class BluePrintProcessorHandlerTest { private BluePrintProcesssorHandler bluePrintProcesssorHandler; @Autowired - private CdsSdcListenerAuthClientInterceptor cdsSdcListenerAuthClientInterceptor; + private SdcListenerAuthClientInterceptor sdcListenerAuthClientInterceptor; @Rule public GrpcCleanupRule grpcCleanup = new GrpcCleanupRule(); diff --git a/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/service/ListenerServiceImplTest.java b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java index 359ee6cc4..f5ff2bdb8 100644 --- a/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/service/ListenerServiceImplTest.java +++ b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener.service; +package org.onap.ccsdk.cds.sdclistener.service; import static junit.framework.TestCase.assertTrue; import java.io.File; @@ -27,11 +27,11 @@ 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.ccsdk.cds.cdssdclistener.status.CdsSdcListenerStatus; +import org.onap.ccsdk.cds.sdclistener.SdcListenerConfiguration; +import org.onap.ccsdk.cds.sdclistener.client.SdcListenerAuthClientInterceptor; +import org.onap.ccsdk.cds.sdclistener.dto.SdcListenerDto; +import org.onap.ccsdk.cds.sdclistener.handler.BluePrintProcesssorHandler; +import org.onap.ccsdk.cds.sdclistener.status.SdcListenerStatus; import org.onap.sdc.api.results.IDistributionClientDownloadResult; import org.onap.sdc.impl.mock.DistributionClientResultStubImpl; import org.springframework.beans.factory.annotation.Autowired; @@ -40,9 +40,9 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) -@EnableConfigurationProperties({CdsSdcListenerAuthClientInterceptor.class, - BluePrintProcesssorHandler.class, CdsSdcListenerDto.class, ListenerServiceImpl.class, CdsSdcListenerStatus.class, - CdsSdcListenerConfiguration.class}) +@EnableConfigurationProperties({SdcListenerAuthClientInterceptor.class, + BluePrintProcesssorHandler.class, SdcListenerDto.class, ListenerServiceImpl.class, SdcListenerStatus.class, + SdcListenerConfiguration.class}) @SpringBootTest(classes = {ListenerServiceImplTest.class}) public class ListenerServiceImplTest { diff --git a/ms/cds-sdc-listener/application/src/test/resources/service-Testsvc140.csar b/ms/sdclistener/application/src/test/resources/service-Testsvc140.csar Binary files differindex 4aa0de72b..4aa0de72b 100644 --- a/ms/cds-sdc-listener/application/src/test/resources/service-Testsvc140.csar +++ b/ms/sdclistener/application/src/test/resources/service-Testsvc140.csar diff --git a/ms/cds-sdc-listener/application/src/test/resources/testcba.zip b/ms/sdclistener/application/src/test/resources/testcba.zip Binary files differindex c886fe6bc..c886fe6bc 100644 --- a/ms/cds-sdc-listener/application/src/test/resources/testcba.zip +++ b/ms/sdclistener/application/src/test/resources/testcba.zip diff --git a/ms/sdclistener/distribution/pom.xml b/ms/sdclistener/distribution/pom.xml new file mode 100755 index 000000000..a79a14c52 --- /dev/null +++ b/ms/sdclistener/distribution/pom.xml @@ -0,0 +1,183 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright © 2019 IBM, Bell Canada. + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.ccsdk.cds.sdclistener</groupId> + <artifactId>parent</artifactId> + <version>0.4.2-SNAPSHOT</version> + <relativePath>../parent</relativePath> + </parent> + <artifactId>distribution</artifactId> + <packaging>pom</packaging> + <name>SDC Listener Distribution</name> + <properties> + <assembly.id>maven</assembly.id> + <name.space>org.onap.ccsdk.cds</name.space> + <serviceArtifactName>sdclistener</serviceArtifactName> + <image.name>onap/ccsdk-sdclistener</image.name> + <!--disabled for now to mirror #85964 https://gerrit.onap.org/r/#/c/85964/2/ms/command-executor/pom.xml--> + <!--<docker.buildArg.https_proxy>${https_proxy}</docker.buildArg.https_proxy>--> + <docker.push.phase>deploy</docker.push.phase> + <docker.verbose>true</docker.verbose> + <ccsdk.project.version>${project.version}</ccsdk.project.version> + <ccsdk.build.timestamp>${maven.build.timestamp}</ccsdk.build.timestamp> + </properties> + + <dependencies> + <dependency> + <groupId>org.onap.ccsdk.cds.sdclistener</groupId> + <artifactId>application</artifactId> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <version>2.6</version> + <executions> + <execution> + <id>copy-dockerfile</id> + <goals> + <goal>copy-resources</goal> + </goals><!-- here the phase you need --> + <phase>validate</phase> + <configuration> + <outputDirectory>${basedir}/target/docker-stage</outputDirectory> + <resources> + <resource> + <directory>src/main/docker</directory> + <includes> + <include>*</include> + </includes> + <filtering>true</filtering> + </resource> + </resources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <executions> + <execution> + <id>ant-test</id> + <phase>package</phase> + <configuration> + <tasks> + <fixcrlf srcdir="${basedir}" eol="unix" includes="**/*.sh, **/*.source"/> + </tasks> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <!--build the final artifact for docker deployment --> + <artifactId>maven-assembly-plugin</artifactId> + <version>3.1.0</version> + <configuration> + <!-- <skipAssembly>${skip.assembly}</skipAssembly> --> + <outputDirectory>${basedir}/target/docker-stage</outputDirectory> + <descriptors> + <descriptor>src/main/docker/distribution.xml</descriptor> + </descriptors> + <tarLongFileMode>posix</tarLongFileMode> + </configuration> + <executions> + <execution> + <id>${assembly.id}</id> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.groovy.maven</groupId> + <artifactId>gmaven-plugin</artifactId> + <version>1.0</version> + <executions> + <execution> + <phase>validate</phase> + <goals> + <goal>execute</goal> + </goals> + <configuration> + <source>${basedir}/../../../TagVersion.groovy</source> + </configuration> + </execution> + </executions> + </plugin> + + </plugins> + </build> + + <profiles> + <profile> + <id>docker</id> + <build> + <plugins> + <plugin> + <groupId>io.fabric8</groupId> + <artifactId>docker-maven-plugin</artifactId> + <version>0.26.1</version> + <inherited>false</inherited> + <configuration> + <images> + <image> + <name>${image.name}</name> + <build> + <cleanup>try</cleanup> + <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir> + <tags> + <tag>${project.docker.latestminortag.version}</tag> + <tag>${project.docker.latestfulltag.version}</tag> + <tag>${project.docker.latesttagtimestamp.version}</tag> + </tags> + </build> + </image> + </images> + <verbose>true</verbose> + </configuration> + <executions> + <execution> + <id>generate-images</id> + <phase>package</phase> + <goals> + <goal>build</goal> + </goals> + </execution> + <execution> + <id>push-images</id> + <phase>${docker.push.phase}</phase> + <goals> + <goal>build</goal> + <goal>push</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> +</project> diff --git a/ms/cds-sdc-listener/application/src/main/docker/docker-compose.yaml b/ms/sdclistener/distribution/src/main/dc/docker-compose.yaml index 1e7384744..1c68f6cf3 100644..100755 --- a/ms/cds-sdc-listener/application/src/main/docker/docker-compose.yaml +++ b/ms/sdclistener/distribution/src/main/dc/docker-compose.yaml @@ -2,7 +2,7 @@ version: '3.3' services: cds-sdc-listener: - image: onap/cdssdclistener:latest + image: onap/ccsdk-sdclistener:latest container_name: cdssdclistener restart: always environment: diff --git a/ms/sdclistener/distribution/src/main/docker/Dockerfile b/ms/sdclistener/distribution/src/main/docker/Dockerfile new file mode 100755 index 000000000..e945188a8 --- /dev/null +++ b/ms/sdclistener/distribution/src/main/docker/Dockerfile @@ -0,0 +1,16 @@ +FROM openjdk:8-jdk-alpine + +ENV HTTP_PROXY ${HTTP_PROXY} +ENV HTTPS_PROXY ${HTTPS_PROXY} + +# add entrypoint +COPY startService.sh /startService.sh +RUN chmod 751 /startService.sh +# add application +COPY @project.build.finalName@-@assembly.id@.tar.gz /source.tar.gz +RUN tar -xzf /source.tar.gz -C /tmp \ + && cp -rf /tmp/@project.build.finalName@/opt / \ + && rm -rf /source.tar.gz \ + && rm -rf /tmp/@project.build.finalName@ + +ENTRYPOINT /startService.sh diff --git a/ms/sdclistener/distribution/src/main/docker/distribution.xml b/ms/sdclistener/distribution/src/main/docker/distribution.xml new file mode 100755 index 000000000..e9e8eefa5 --- /dev/null +++ b/ms/sdclistener/distribution/src/main/docker/distribution.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright © 2018-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. + --> + +<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd"> + <!-- create a tar.gz file containing the projects dependencies --> + <id>${assembly.id}</id> + <formats> + <format>tar.gz</format> + </formats> + <dependencySets> + <dependencySet> + <outputDirectory>/opt/app/onap/lib</outputDirectory> + <outputFileNameMapping>${artifact.groupId}-${artifact.artifactId}-${artifact.version}${dashClassifier?}.${artifact.extension}</outputFileNameMapping> + <excludes> + <exclude>org.slf4j:slf4j-simple</exclude> + </excludes> + </dependencySet> + </dependencySets> + <fileSets> + <fileSet> + <directory>${project.basedir}/../application/src/main/resources</directory> + <includes> + <include>application.properties</include> + <include>application.yml</include> + <include>logback.xml</include> + </includes> + <outputDirectory>/opt/app/onap/config</outputDirectory> + <useDefaultExcludes>true</useDefaultExcludes> + </fileSet> + </fileSets> +</assembly> diff --git a/ms/sdclistener/distribution/src/main/docker/startService.sh b/ms/sdclistener/distribution/src/main/docker/startService.sh new file mode 100644 index 000000000..7ad6171b8 --- /dev/null +++ b/ms/sdclistener/distribution/src/main/docker/startService.sh @@ -0,0 +1,12 @@ +#!/bin/sh +echo "Starting SDC Listener" + +export APP_HOME=/opt/app/onap +export APP_CONFIG_HOME=${APP_HOME}/config +echo "APP Config HOME : ${APP_CONFIG_HOME}" + +java -classpath "/etc:${APP_HOME}/lib/*:/lib/*:/src:/schema:/generated-sources:${APP_CONFIG_HOME}:${APP_HOME}" \ +-Dlogging.config=${APP_CONFIG_HOME}/logback.xml \ +-Djava.security.egd=file:/dev/./urandom \ +-Dspring.config.location=${APP_CONFIG_HOME}/ \ +org.onap.ccsdk.cds.sdclistener.SdcListenerApplication diff --git a/ms/sdclistener/parent/pom.xml b/ms/sdclistener/parent/pom.xml new file mode 100755 index 000000000..fabdc2530 --- /dev/null +++ b/ms/sdclistener/parent/pom.xml @@ -0,0 +1,246 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright © 2017-2018 AT&T Intellectual Property. + ~ + ~ Modifications Copyright © 2018 - 2019 IBM, Bell Canada + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.ccsdk.cds</groupId> + <artifactId>sdclistener</artifactId> + <version>0.4.2-SNAPSHOT</version> + </parent> + <groupId>org.onap.ccsdk.cds.sdclistener</groupId> + <artifactId>parent</artifactId> + <packaging>pom</packaging> + <name>SDC Listener Parent</name> + <description>SDC Listener Parent</description> + <properties> + <spring.boot.version>2.1.3.RELEASE</spring.boot.version> + <spring.version>5.1.5.RELEASE</spring.version> + <grpc.version>1.18.0</grpc.version> + <protobuff.java.utils.version>3.6.1</protobuff.java.utils.version> + <eelf.version>1.0.0</eelf.version> + <sli.version>0.4.2-SNAPSHOT</sli.version> + <guava.version>27.0.1-jre</guava.version> + <onap.logger.slf4j>1.2.2</onap.logger.slf4j> + <powermock.version>1.7.4</powermock.version> + <mockk.version>1.9</mockk.version> + <dmaap.client.version>1.1.5</dmaap.client.version> + <mockkserver.version>5.5.1</mockkserver.version> + <sdc-distribution-client.version>1.3.0</sdc-distribution-client.version> + <jmockit.version>1.19</jmockit.version> + <reactorcore.version>3.2.6.RELEASE</reactorcore.version> + </properties> + <dependencyManagement> + <dependencies> + <!-- Spring Boot --> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-parent</artifactId> + <version>${spring.boot.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + + <!-- Common Utils Dependencies --> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>3.2.1</version> + </dependency> + <dependency> + <groupId>commons-collections</groupId> + <artifactId>commons-collections</artifactId> + <version>3.2.2</version> + </dependency> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <version>2.6</version> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-compress</artifactId> + <version>1.15</version> + </dependency> + + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + <version>${guava.version}</version> + </dependency> + + <!-- GRPC Dependencies --> + <dependency> + <groupId>io.grpc</groupId> + <artifactId>grpc-core</artifactId> + <version>${grpc.version}</version> + </dependency> + <dependency> + <groupId>io.grpc</groupId> + <artifactId>grpc-netty</artifactId> + <version>${grpc.version}</version> + </dependency> + <dependency> + <groupId>io.grpc</groupId> + <artifactId>grpc-protobuf</artifactId> + <version>${grpc.version}</version> + </dependency> + <dependency> + <groupId>io.grpc</groupId> + <artifactId>grpc-stub</artifactId> + <version>${grpc.version}</version> + </dependency> + <dependency> + <groupId>com.google.protobuf</groupId> + <artifactId>protobuf-java</artifactId> + <version>${protobuff.java.utils.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.cds.components</groupId> + <artifactId>proto-definition</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>io.projectreactor</groupId> + <artifactId>reactor-core</artifactId> + <version>${reactorcore.version}</version> + </dependency> + + <!-- Blueprint Processor Application Module Dependencies --> + <dependency> + <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> + <artifactId>processor-core</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> + <artifactId>db-lib</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> + <artifactId>rest-lib</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> + <artifactId>dmaap-lib</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> + <artifactId>grpc-lib</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> + <artifactId>execution-service</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> + <artifactId>workflow-service</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> + <artifactId>resource-api</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> + <artifactId>selfservice-api</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> + <artifactId>application</artifactId> + <version>${project.version}</version> + </dependency> + + + <!-- Controller Blueprints Application Dependency --> + <dependency> + <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> + <artifactId>resource-dict</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> + <artifactId>blueprint-core</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> + <artifactId>blueprint-scripts</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> + <artifactId>db-resources</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> + <artifactId>blueprint-validation</artifactId> + <version>${project.version}</version> + </dependency> + + <!-- Test Dependency --> + <dependency> + <groupId>io.grpc</groupId> + <artifactId>grpc-testing</artifactId> + <version>${grpc.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.jmockit</groupId> + <artifactId>jmockit</artifactId> + <version>${jmockit.version}</version> + <scope>test</scope> + </dependency> + + <!-- SDC Distribution client dependency --> + <dependency> + <groupId>org.onap.ccsdk.cds.sdclistener</groupId> + <artifactId>application</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.sdc.sdc-distribution-client</groupId> + <artifactId>sdc-distribution-client</artifactId> + <version>${sdc-distribution-client.version}</version> + </dependency> + </dependencies> + </dependencyManagement> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.5.1</version> + <configuration> + <source>${maven.compiler.source}</source> + <target>${maven.compiler.target}</target> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/ms/cds-sdc-listener/pom.xml b/ms/sdclistener/pom.xml index 6c533e16b..70e8529f6 100644 --- a/ms/cds-sdc-listener/pom.xml +++ b/ms/sdclistener/pom.xml @@ -14,8 +14,8 @@ * See the License for the specific language governing permissions and * limitations under the License. --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.ccsdk.cds</groupId> <artifactId>ms</artifactId> @@ -23,17 +23,27 @@ <relativePath>..</relativePath> </parent> - <modelVersion>4.0.0</modelVersion> - <artifactId>cds-sdc-listener</artifactId> - <name>CDS-SDC Listener Root</name> - <description>A microservice to get the cba file from SDC and store it into database at runtime</description> + <artifactId>sdclistener</artifactId> + <name>SDC Listener Root</name> + <description>SDC Listener Root</description> <packaging>pom</packaging> + <properties> + <service.name>sdclistener</service.name> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format> + <build.number>${maven.build.timestamp}</build.number> + <java.version>1.8</java.version> + <maven.compiler.target>1.8</maven.compiler.target> + <maven.compiler.source>1.8</maven.compiler.source> + <ccsdk.project.version>${project.version}</ccsdk.project.version> + </properties> + <modules> + <module>parent</module> <module>application</module> - <!-- Module is not currently working <module>distribution</module> - --> </modules> </project> |