Issue-ID: INT-1178
[integration.git] / test / postman / README.md
1 # Postman Collections
2
3 ## Using Postman
4
5 That repository contains several Postman collections and 2 environment files.
6
7 They have been tested with Onap Dublin (they are not compatible with
8   Casablanca, and there is not guaranty about ONAP "master" as API definition
9   can change)
10
11 You first need to import all those files into your Postman.
12 ![postman](./images/import.png)
13
14 And you should see all the collections
15 ![postman](./images/collections.png)
16
17 Each collection is made of several API operations
18 ![postman](./images/collection-detail.png)
19
20 Running all those collections, in the order, from 1 to 10 will create a lot of
21 objects in ONAP components :
22
23 - SDC : vendor, VSP, zip file upload, VF from VSP, Service, add VF to Service
24 - VID : OwningEntity, LineOfBusiness, Project, Platform
25 - AAI : customer, subscription, cloud region, tenant
26 - NBI : serviceOrder to add a service instance, serviceOrder to delete a service
27  instance
28
29 The order is very important because a lot of API requests will need the API
30  response from the previous operation.
31 ![postman](./images/collection-detail-test.png)
32
33 It is possible to run the complete collection using Postman
34 ![postman](./images/run.png)
35
36 You need, a zip file that contains Heat files for a VNF.
37
38 Collection 3 is about uploading that file into ONAP SDC.
39 ![postman](./images/zipfile.png)
40
41 Before running those collections, once in Postman, you need to have a look
42 at "globals" environment parameters.
43 ![postman](./images/globals.png)
44
45 All variables that begin by "auto_" must NOT be changed (they will be modified
46  using API response)
47 All other variables must be adapted to your needs.
48 In particular, you need to put your own values for cloud_region_id, tenant_name
49  and tenant_id to fit with the place where you will instantiate the VNF
50
51 ```yaml
52  service:freeradius
53  vf_name:integration_test_VF_freeradius
54  vsp_name:integration_test_VSP
55  vendor_name:onap_integration_vendor
56  owning_entity:integration_test_OE
57  platform:integration_test_platform
58  project:integration_test_project
59  lineofbusiness:integration_test_LOB
60  customer_name:generic
61  cloud_owner_name:OPNFV
62  cloud_region_id:RegionOne
63  tenant_name:openlab-vnfs
64  tenant_id:234a9a2dc4b643be9812915b214cdbbb
65  externalId:integration_test_BSS-001
66  service_instance_name:integration_test_freeradius_instance_001
67  listener_url:http://10.4.2.65:8080/externalapi/listener/v1/listener
68 ```
69
70 ## Using Newman
71
72 Newman is a tool that allow to run postman collections via CLI
73
74 Using a Linux server, just run those lines:
75
76 ```shell
77 git clone https://gitlab.com/Orange-OpenSource/lfn/onap/onap-tests.git
78 cd onap-tests/postman
79 sudo apt-get -y install zip
80 USECASE=$'ubuntu16'
81 zip -j $USECASE.zip ../onap_tests/templates/heat_files/$USECASE/*
82 TAB=$'\t\t\t\t\t\t\t'
83 sed -i -e "s/.*src.*/$TAB\"src\": \"$USECASE.zip\"/" 03_Onboard_VSP_part2.postman_collection.json
84 docker pull postman/newman:alpine
85 docker run --network="host" --volume="/home/debian/rene/onap-tests/postman:/etc/newman" postman/newman:alpine run 01_Onboard_Vendor.postman_collection.json --environment integration_test_urls.postman_environment.json --globals globals.postman_globals.json --export-globals globals.postman_globals.json --reporters cli,json --reporter-cli-no-assertions --reporter-cli-no-console
86 docker run --network="host" --volume="/home/debian/rene/onap-tests/postman:/etc/newman" postman/newman:alpine run 02_Onboard_VSP_part1.postman_collection.json --environment integration_test_urls.postman_environment.json --globals globals.postman_globals.json --export-globals globals.postman_globals.json
87 docker run --network="host" --volume="/home/debian/rene/onap-tests/postman:/etc/newman" postman/newman:alpine run 03_Onboard_VSP_part2.postman_collection.json --environment integration_test_urls.postman_environment.json --globals globals.postman_globals.json --export-globals globals.postman_globals.json
88 docker run --network="host" --volume="/home/debian/rene/onap-tests/postman:/etc/newman" postman/newman:alpine run 04_Onboard_VSP_part3.postman_collection.json --environment integration_test_urls.postman_environment.json --globals globals.postman_globals.json --export-globals globals.postman_globals.json
89 docker run --network="host" --volume="/home/debian/rene/onap-tests/postman:/etc/newman" postman/newman:alpine run 05_Onboard_VF.postman_collection.json --environment integration_test_urls.postman_environment.json --globals globals.postman_globals.json --export-globals globals.postman_globals.json
90 docker run --network="host" --volume="/home/debian/rene/onap-tests/postman:/etc/newman" postman/newman:alpine run 06_Onboard_Service.postman_collection.json --environment integration_test_urls.postman_environment.json --globals globals.postman_globals.json --export-globals globals.postman_globals.json
91 docker run --network="host" --volume="/home/debian/rene/onap-tests/postman:/etc/newman" postman/newman:alpine run 07_Declare_owningEntity_LineOfBusiness_project_platform.postman_collection.json --environment integration_test_urls.postman_environment.json --globals globals.postman_globals.json --export-globals globals.postman_globals.json
92 docker run --network="host" --volume="/home/debian/rene/onap-tests/postman:/etc/newman" postman/newman:alpine run 08_Declare_Customer_Service_Subscription_Cloud.postman_collection.json --insecure --environment integration_test_urls.postman_environment.json --globals globals.postman_globals.json --export-globals globals.postman_globals.json
93 docker run --network="host" --volume="/home/debian/rene/onap-tests/postman:/etc/newman" postman/newman:alpine run 10_Service_Order.postman_collection.json --environment integration_test_urls.postman_environment.json --globals globals.postman_globals.json --export-globals globals.postman_globals.json --reporters cli,json --reporter-cli-no-assertions --reporter-cli-no-console
94 ```
95
96 All collections are processed, then you can see results and you will also obtain result json files in the onap-tests/postamn/newman directory
97
98 Of course you can adapt globals variables in globals.postman_globals.json or change the USECASE=$'ubuntu16' value to onboard any heat template located in onap_tests/templates/heat_files directory