blob: 731d5b8470963c92737c530f4fce04a292bd3021 [file] [log] [blame]
ilanap637206b2018-02-04 17:06:22 +02001/*
2 * Copyright © 2016-2017 European Support Limited
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16const {Then, When} = require('cucumber');
17const assert = require('assert');
18const util = require('./Utils.js');
19const _ = require('lodash');
20const fs = require('fs');
21require('node-zip');
22
23/**
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}
28 **/
29Then('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.request(this.context, 'POST', path, string, true);
32});
33
34/**
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}
39 **/
40When('I want to download the NetworkPackage for this VSP to path {string}', function (string, callback) {
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, callback)];
43});
44
45/**
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
50 **/
51Then('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);
54});