aboutsummaryrefslogtreecommitdiffstats
path: root/asdctool
AgeCommit message (Expand)AuthorFilesLines
2021-01-20Remove dead codeJulienBe1-5/+3
2021-01-19Add basic auth headerxuegao1-0/+6
2021-01-12Improve test coverageJulien Bertozzi1-15/+14
2020-11-05Update master to HonoluluChrisC1-1/+1
2020-10-30Remove the Log4j 1.2.15sebdet1-0/+4
2020-10-26Fix broken local build1.7.2vasraz1-1/+1
2020-10-20Upgrade to 1.7.2sebdet1-1/+1
2020-09-25Standardize docker tagging1.7.1sebdet1-1/+2
2020-09-18Introduce a new docker for be pluginssebdet1-1/+1
2020-09-08Upgrade to java 11sebdet2-3/+32
2020-09-07Update version to 1.7.1sebdet1-1/+1
2020-09-07Template design (NSSTs) for slice sub-nets (RAN, Core, Transport).hekeguang1-0/+418
2020-07-29Improve Utils coverage and improve Sonar scoreJulienBe3-202/+165
2020-07-15Align onap/base_sdc-xyz versionsvasraz1-1/+1
2020-07-09Clean ValidatorExecutor hierarchyFrancis Toth15-484/+133
2020-07-07Add test contracts for ValidatorExecutor and TopologyTemplateValidatorExecutorFrancis Toth7-103/+76
2020-07-05Fix sonar issuessebdet1-43/+25
2020-07-05Fix sonar issuessebdet3-63/+45
2020-07-05Fix sonar issuessebdet1-22/+16
2020-07-05Clean CsarUtils::MainYamlWithDependenciesFrancis Toth3-8/+4
2020-06-30Fix typo in package name and classesFrancis Toth24-66/+66
2020-06-30Fix test coverage drop introduced by #109510vasraz1-8/+6
2020-06-25Rationalize maven dependenciesJulienBe1-21/+0
2020-06-25Cleaned up ArtifactValidatorExecuter and IArtifactValidatorExecutorFrancis Toth19-286/+189
2020-06-25add a new profil for fast buildJulienBe1-0/+1
2020-06-23-20/+23
2020-06-21Toggletalio1-1/+1
2020-06-21Fix sonar issuessebdet4-33/+24
2020-06-21Decouple TXT Report file writing and formatting logic (2/6)Francis Toth4-14/+15
2020-06-19Decouple TXT Report file writing and formatting logic (1/6)Francis Toth15-49/+138
2020-06-18Decouple CSV Report file writing and formatting logicFrancis Toth11-62/+303
2020-06-15Fix 'not running Junit5 tests'-issuevasraz1-0/+6
2020-06-15Fix Critical security vulnerabilityvasraz1-5/+39
2020-06-15Fix bug in UpdateIsVnfMenuxuegao1-2/+2
2020-06-10Set properties on XML parsers to prevent XXE attackNeil Derraugh1-0/+4
2020-05-28Encapsulate ReportManager's failedVerticesPerTask and resultsPerVertex in ReportFrancis Toth22-113/+197
2020-05-24Fix potential NullPointer in SchemaFileImportandre.schmid1-10/+17
2020-05-19remove powermock dependency from pom xmlsRodrigo Lima1-6/+0
2020-05-17Remove powermock from ValidationConfigManagerTestRodrigo Lima1-8/+2
2020-05-17Remove powermock from ArtifactValidationUtilsTestRodrigo Lima1-24/+17
2020-05-17Remove powermock from ReportManagerTestRodrigo Lima1-19/+9
2020-05-12Remove outputFullFilePath from ValidationConfigManagerFrancis Toth35-673/+629
2020-05-07Reduce scope from 'compile' to 'test' for 'junit-vintage-engine'vasraz1-0/+1
2020-05-06Prepare for Junit5vasraz1-8/+14
2020-05-05Remove all thrift's dependenciesvasraz1-5/+0
2020-04-28Remove csvReportFilePath from ValidationConfigManagerFrancis Toth9-106/+109
2020-04-23Added early check for null value for `containerV`Chris André1-33/+48
/span>, @param.query.string('sortType') sortType: string) { return await this.bpservice.getPagedBlueprints(limit, offset, sort, sortType); } @get('/controllerblueprint/metadata/paged/{keyword}', { responses: { '200': { description: 'Blueprint model instance with pagination', content: { 'application/json': { schema: { 'x-ts-type': Blueprint } } }, }, }, }) async getMetaDataPagedBlueprints( @param.path.string('keyword') keyword: string, @param.query.number('limit') limit: number, @param.query.number('offset') offset: number, @param.query.string('sort') sort: string, @param.query.string('sortType') sortType: string) { return await this.bpservice.getMetaDataPagedBlueprints(limit, offset, sort, keyword, sortType); } @get('/controllerblueprint/meta-data/{keyword}', { responses: { '200': { description: 'Blueprint model instance', content: { 'application/json': { schema: { 'x-ts-type': Blueprint } } }, }, }, }) async getAllPacakgesByKeword(@param.path.string('keyword') keyword: string) { return await this.bpservice.getBlueprintsByKeyword(keyword); } @get('/controllerblueprint/by-name/{name}/version/{version}', { responses: { '200': { description: 'Blueprint model instance', content: { 'application/json': { schema: { 'x-ts-type': Blueprint } } }, }, }, }) async getPacakgesByNameAndVersion(@param.path.string('name') name: string, @param.path.string('version') version: string) { return await this.bpservice.getBlueprintByNameAndVersion(name, version); } @get('/controllerblueprint/searchByTags/{tags}', { responses: { '200': { content: { 'application/json': {} }, }, }, }) async getByTags(@param.path.string('tags') tags: string) { return await this.bpservice.getByTags(tags); } @post('/controllerblueprint/create-blueprint') async upload( @requestBody({ description: 'multipart/form-data value.', required: true, content: { 'multipart/form-data': { // Skip body parsing 'x-parser': 'stream', schema: { type: 'object' }, }, }, }) request: Request, @inject(RestBindings.Http.RESPONSE) response: Response, ): Promise<Response> { return new Promise((resolve, reject) => { this.getFileFromMultiPartForm(request).then(file => { // if (appConfig.action.deployBlueprint.grpcEnabled) if (appConfig.action.grpcEnabled) return this.uploadFileToBlueprintProcessorGrpc(file, 'DRAFT', response); else return this.uploadFileToBlueprintController(file, '/blueprint-model/', response); }, err => { reject(err); }); }); // return new Promise((resolve, reject) => { // this.getFileFromMultiPartForm(request).then(file => { // this.uploadFileToBlueprintController(file, "/blueprint-model/", response).then(resp => { // resolve(resp); // }, err => { // reject(err); // }); // }, err => { // reject(err); // }); // }); } @post('/controllerblueprint/publish') async publish( @requestBody({ description: 'multipart/form-data value.', required: true, content: { 'multipart/form-data': { // Skip body parsing 'x-parser': 'stream', schema: { type: 'object' }, }, }, }) request: Request, @inject(RestBindings.Http.RESPONSE) response: Response, ): Promise<Response> { return new Promise((resolve, reject) => { this.getFileFromMultiPartForm(request).then(file => { // if (appConfig.action.deployBlueprint.grpcEnabled) if (appConfig.action.grpcEnabled) return this.uploadFileToBlueprintProcessorGrpc(file, 'PUBLISH', response); else return this.uploadFileToBlueprintController(file, '/blueprint-model/publish/', response); }, err => { reject(err); }); }); // return new Promise((resolve, reject) => { // this.getFileFromMultiPartForm(request).then(file => { // this.uploadFileToBlueprintController(file, "/blueprint-model/publish/", response).then(resp => { // resolve(resp); // }, err => { // reject(err); // }); // }, err => { // reject(err); // }); // }); } @post('/controllerblueprint/enrich-blueprint') async enrich( @requestBody({ description: 'multipart/form-data value.', required: true, content: { 'multipart/form-data': { // Skip body parsing 'x-parser': 'stream', schema: { type: 'object' }, }, }, }) request: Request, @inject(RestBindings.Http.RESPONSE) response: Response, ): Promise<Response> { return new Promise((resolve, reject) => { this.getFileFromMultiPartForm(request).then(file => { if (appConfig.action.grpcEnabled) return this.uploadFileToBlueprintProcessorGrpc(file, 'ENRICH', response); else return this.uploadFileToBlueprintController(file, '/blueprint-model/enrich/', response); // this.uploadFileToBlueprintController(file, "/blueprint-model/enrich/", response).then(resp => { // resolve(resp); // }, err => { // reject(err); // }); // }, err => { // reject(err); }); }); } @post('/controllerblueprint/enrichandpublish') async enrichAndPublish( @requestBody({ description: 'multipart/form-data value.', required: true, content: { 'multipart/form-data': { // Skip body parsing 'x-parser': 'stream', schema: { type: 'object' }, }, }, }) request: Request, @inject(RestBindings.Http.RESPONSE) response: Response, ): Promise<Response> { return new Promise((resolve, reject) => { this.getFileFromMultiPartForm(request).then(file => { if (appConfig.action.grpcEnabled) return this.uploadFileToBlueprintProcessorGrpc(file, 'ENRICH', response); else return this.uploadFileToBlueprintController(file, '/blueprint-model/enrichandpublish/', response); }); }); } @get('/controllerblueprint/download-blueprint/{name}/{version}') async download( @param.path.string('name') name: string, @param.path.string('version') version: string, @inject(RestBindings.Http.RESPONSE) response: Response, ): Promise<Response> { if (appConfig.action.grpcEnabled) return this.downloadFileFromBlueprintProcessorGrpc(name, version, response); else return this.downloadFileFromBlueprintController('/blueprint-model/download/by-name/' + name + '/version/' + version, response); } async getFileFromMultiPartForm(request: Request): Promise<multiparty.File> { return new Promise((resolve, reject) => { let form = new multiparty.Form(); form.parse(request, (err: any, fields: any, files: { [x: string]: any[]; }) => { if (err) reject(err); let file = files['file'][0]; // get the file from the returned files object if (!file) { reject('File was not found in form data.'); } else { resolve(file); } }); }); } @post('/controllerblueprint/deploy-blueprint') async deploy( @requestBody({ description: 'multipart/form-data value.', required: true, content: { 'multipart/form-data': { // Skip body parsing 'x-parser': 'stream', schema: { type: 'object' }, }, }, }) request: Request, @inject(RestBindings.Http.RESPONSE) response: Response, ): Promise<Response> { return new Promise((resolve, reject) => { this.getFileFromMultiPartForm(request).then(file => { // if (appConfig.action.deployBlueprint.grpcEnabled) if (appConfig.action.grpcEnabled) return this.uploadFileToBlueprintProcessorGrpc(file, 'PUBLISH', response); else return this.uploadFileToBlueprintProcessor(file, '/blueprint-model/publish', response); }, err => { reject(err); }); }); } async uploadFileToBlueprintController(file: multiparty.File, uri: string, response: Response): Promise<Response> { return this.uploadFileToBlueprintService(file, processorApiConfig.http.url + uri, processorApiConfig.http.authToken, response); } async uploadFileToBlueprintProcessor(file: multiparty.File, uri: string, response: Response): Promise<Response> { return this.uploadFileToBlueprintService(file, processorApiConfig.http.url + uri, processorApiConfig.http.authToken, response); } async uploadFileToBlueprintService(file: multiparty.File, url: string, authToken: string, response: Response): Promise<Response> { let options = { url: url, headers: { Authorization: authToken, 'content-type': 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW', }, formData: { file: { value: fs.createReadStream(file.path), options: { filename: 'cba.zip', contentType: 'application/zip', }, }, }, }; var removeTempFile = () => { fs.unlink(file.path, (err: any) => { if (err) { console.error(err); } }); }; return new Promise((resolve, reject) => { request_lib.post(options) .on('error', err => { reject(err); }) .pipe(response) .once('finish', () => { removeTempFile(); resolve(response); }); }); } async downloadFileFromBlueprintController(uri: string, response: Response): Promise<Response> { return this.downloadFileFromBlueprintService(processorApiConfig.http.url + uri, processorApiConfig.http.authToken, response); } async downloadFileFromBlueprintService(url: string, authToken: string, response: Response): Promise<Response> { let options = { url: url, headers: { Authorization: authToken, }, }; return new Promise((resolve, reject) => { request_lib.get(options) .on('error', err => { reject(err); }) .pipe(response) .once('finish', () => { resolve(response); }); }); } async uploadFileToBlueprintProcessorGrpc(file: multiparty.File, actionName: string, response: Response): Promise<Response> { return new Promise<Response>((resolve, reject) => { bluePrintManagementServiceGrpcClient.uploadBlueprint(file.path, actionName).then(output => { response.send(output.status.message); resolve(response); }, err => { response.status(500).send(err); resolve(response); }); }); } async downloadFileFromBlueprintProcessorGrpc(blueprintName: string, blueprintVersion: string, response: Response): Promise<Response> { return new Promise<Response>((resolve, reject) => { bluePrintManagementServiceGrpcClient.downloadBlueprint(blueprintName, blueprintVersion) .then(output => { response.send(output.status.message); resolve(response); }, err => { response.status(500).send(err); resolve(response); }); }); } }