ecc629c1bc8ad40f61ddbee8e5efabea4a3c34dc
[cli.git] /
1 # Copyright 2019 Huawei Technologies Co., Ltd.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 open_cli_schema_version: 1.0
16 name: vnf-tosca-provision
17 description: |
18   ONAP TOSCA VNF validation using ONAP CLI and Open Command Platform (OCOMP)
19
20   This command runs in 4 mode:
21   1. setup:    Create requires Vendor, Service Subscription and VNF cloud in ONAP
22   2. standup:  From the given VSP csar, VNF csar and NS csar, it creates VF Model, NS Model and NS service
23   3. cleanup:  Remove those entries provided in onap-objects parameter
24   4. validate: Run setup -> standup -> cleanup
25
26   On every execution, it reports the ONAP managed object's ids in result onap-objects attribute. so
27   if requires, these attribute value could be passed in input parameter onap-objects on subsequent
28   executions to avoid recreation of these ONA managed objects
29
30   prerequisites
31   -------------
32   1. Setup the OCOMP profile to configure the ONAP service URL and creadentials as given below
33
34   a. Run command 'oclip' to go to OCOMP interactive mode
35
36   b. Type 'use onap-dublin' to choose the onap-dublin product
37
38   c. Type 'profile onap-dublin' to create or to use existing onap-dublin profile
39
40   d. Set following entries:
41     set sdc.onboarding:host-url=https://159.138.8.8:30280
42     set sdc.onboarding:host-username=cs0008
43     set sdc.onboarding:host-password=demo123456!
44     set sdc.catalog:host-url=https://159.138.8.8:30205
45     set sdc.catalog:host-password=demo123456\!
46     set sdc.catalog:host-username=cs0008
47     set sdc.catalog:service-model-approve:host-username=gv0001
48     set sdc.catalog:service-model-distribute:host-username=op0001
49     set sdc.catalog:service-model-test-start:host-username=jm0007
50     set sdc.catalog:service-model-test-accept:host-username=jm0007
51     set sdc.catalog:service-model-add-artifact:host-username=ocomp
52     set sdc.catalog:vf-model-add-artifact:host-username=ocomp
53     set aai:host-url=https://159.138.8.8:30233
54     set aai:host-username=AAI
55     set aai:host-password=AAI
56     set vfc:host-url=http://159.138.8.8:30280
57     set multicloud:host-url=http://159.138.8.8:30280
58
59     NOTE:
60     By default, SDC onboarding service does not provide node port, which is available to access from external ONAP network.
61     so to enable for external access, register the SDC onboarding service into MSB and use MSB url for sdc.onboarding:host-url.
62
63       oclip --product onap-dublin microservice-create --host-url http://159.138.8.8:30280 --service-name sdcob --service-version v1.0 --service-url /onboarding-api/v1.0 --path /onboarding-api/v1.0  --node-ip 172.16.1.0 --node-port 8081
64
65       oclip --product onap-dublin microservice-create --host-url http://159.138.8.8:30280 --service-name sdcobs --service-version v1.0 --service-url /onboarding-api/v1.0 --path /onboarding-api/v1.0  --node-ip 172.16.1.0 --node-port 8445 --enable-ssl
66
67       Find out SDC onboarding service IP and port details as given here:
68         [root@onap-dublin-vfw-93996-50c1z ~]# kubectl get pods -n onap -o wide | grep sdc-onboarding-be
69         dev-sdc-sdc-onboarding-be-5564b877c8-vpwr5                        2/2     Running            0          29d   172.16.1.0     192.168.2.163   <none>           <none>
70         dev-sdc-sdc-onboarding-be-cassandra-init-mtvz6                    0/1     Completed          0          29d   172.16.0.220   192.168.2.163   <none>           <none>
71         [root@onap-dublin-vfw-93996-50c1z ~]#
72
73         Note down the IP address for sdc-onboarding-be 172.16.1.0
74
75         [root@onap-dublin-vfw-93996-50c1z ~]# kubectl get services -n onap -o wide | grep sdc-onboarding-be
76         sdc-onboarding-be                                           ClusterIP      10.247.198.92    <none>                                 8445/TCP,8081/TCP                                             29d   app=sdc-onboarding-be,release=dev-sdc
77         [root@onap-dublin-vfw-93996-50c1z ~]#
78
79         Note down the port for sdc-onboarding-be 8445 8081
80
81         Similarly, other service IP and Port could be discovered like above, in case not know earlier :)
82
83      This profile would be used while running the command with ONAP setup configured in it, as below
84        oclip --profile onap-dublin vnf-tosca-provision .....
85
86   e. Verify these details once by typing 'set'
87
88   e. Exit from the interactive console by typing 'exit'
89
90   2. Setup SDC consumer
91     oclip --product onap-dublin --profile onap-dublin sdc-consumer-create --consumer-name ocomp
92
93   3. Update the cloud and vnfm driver details in the configuration file $OPEN_CLI_HOME/conf/vnf-tosca-provision.json
94
95 info:
96   product: onap-dublin
97   service: vnf-validation
98   author: ONAP VTP Team kanagaraj.manickam@huawei.com
99
100 parameters:
101   - name: config-json
102     description: Configuration file path
103     type: string
104     short_option: x
105     long_option: config-json
106     default_value: $s{env:OPEN_CLI_HOME}/conf/vnf-tosca-provision.json
107     is_optional: false
108   - name: vsp
109     description: Path to the ONAP vendor service product (VSP) for the VNF to provision
110     type: binary
111     short_option: y
112     long_option: vsp
113     is_optional: false
114   - name: vnf-csar
115     description: Path to the TOSCA CSAR for the VNF to provision
116     type: binary
117     short_option: r
118     long_option: vnf-csar
119     is_optional: false
120   - name: ns-csar
121     description: Path to the TOSCA CSAR for the NS service to provision
122     type: binary
123     short_option: b
124     long_option: ns-csar
125     is_optional: true
126     default: false
127   - name: vnfm-driver
128     description: VNFM driver to use. One of gvnfmdriver or hwvnfmdriver
129     type: string
130     short_option: c
131     long_option: vnfm-driver
132     is_optional: false
133   - name: onap-objects
134     description: Existing ONAP object ids to use instead of creating them while running this task
135     type: json
136     short_option: Z
137     long_option: onap-objects
138     is_optional: true
139     default_value: {}
140   - name: mode
141     description: setup or standup or cleanup
142     type: string
143     short_option: Y
144     long_option: mode
145     is_optional: true
146     default_value: validate
147   - name: vnf-name
148     description: VNF Name
149     type: string
150     short_option: A
151     long_option: vnf-name
152     is_optional: false
153   - name: vnf-vendor-name
154     description: VNF Vendor Name
155     type: string
156     short_option: B
157     long_option: vnf-vendor-name
158     is_optional: false
159 results:
160   direction: portrait
161   attributes:
162     - name: vnf-id
163       description: ONAP VNF instance id
164       scope: short
165       type: string
166     - name: vnf-status
167       description: Onap VNF status
168       scope: short
169       type: string
170     - name: ns-id
171       description: Onap NS service instance id
172       scope: short
173       type: string
174     - name: ns-status
175       description: Onap NS status
176       scope: short
177       type: string
178     - name: vnfm-driver
179       description: VNFM driver used
180       type: string
181       scope: short
182     - name: onap-objects
183       description: ONAP object used
184       type: json
185       scope: short
186     - name: vnf-vendor-name
187       description: VNF Vendor Name
188       type: string
189       scope: short
190     - name: vnf-name
191       description: VNF Name
192       type: string
193       scope: short
194 cmd:
195   command:
196     -  python $s{env:OPEN_CLI_HOME}/script/vnf-tosca-provision.py --vendor-name ${vnf-vendor-name} --vnf-name ${vnf-name} --mode ${mode} --result-json $s{tmp:result.json:onap-objects} --conf ${config-json} --vsp ${vsp} --vnf-csar ${vnf-csar} --ns-csar ${ns-csar} --vnfm-driver ${vnfm-driver}
197   success_codes:
198     - 0
199   working_directory: .
200   output: $s{tmp:result.json}
201   result_map:
202     vnf-id: $o{$.vnf_id}
203     vnf-status: $o{$.vnf_status}
204     ns-id: $o{$.ns_instance_id}
205     ns-status: $o{$.ns_instance_status}
206     vnfm-driver: ${vnfm-driver}
207     vnf-name: ${vnf-name}
208     vnf-vendor-name: ${vnf-vendor-name}
209     onap-objects: $o{$}