2 * Copyright © 2016-2017 European Support Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 const {Then, When} = require('cucumber');
17 const assert = require('assert');
18 const util = require('../cucumber-common/utils/Utils.js');
19 const _ = require('lodash');
20 const fs = require('fs');
24 * @module NetworkPackage
25 * @description Uploads the NetworkPackage file to the VSP on the context
26 * @exampleFile Example_HEAT.feature
27 * @step I want to upload a NetworkPackage for this VSP from path {string}
29 Then('I want to upload a NetworkPackage for this VSP from path {string}', function (string) {
30 let path = '/vendor-software-products/' + this.context.item.id + '/versions/' + this.context.item.versionId + '/orchestration-template-candidate';
31 return util.requestBinaryFormData(this.context, 'POST', path, string, 'upload');
35 * @module NetworkPackage
36 * @description Downloads the network package to disk
37 * @exampleFile Example_HEAT.feature
38 * @step I want to download the NetworkPackage for this VSP to path {string}
40 When('I want to download the NetworkPackage for this VSP to path {string}', function (string) {
41 let path = '/vendor-software-products/' + this.context.item.id + '/versions/' + this.context.item.versionId + '/orchestration-template-candidate';
42 return util.download(this.context, path, string);
46 * @module NetworkPackage
47 * @description Processes the NetworkPackage file on the server
48 * @exampleFile Example_HEAT.feature
49 * @step I want to process the NetworkPackage file for this VSP
51 Then('I want to process the NetworkPackage file for this VSP', function () {
52 let path = '/vendor-software-products/' + this.context.item.id + '/versions/' + this.context.item.versionId + '/orchestration-template-candidate/process';
53 return util.request(this.context, 'PUT', path, this.context.inputData);