update README and script/deploy.sh
[demo.git] / README.md
1 Content
2 ---
3
4 This repository contains all the HEAT templates for the instantiation of the ONAP platform, and the vFirewall and vLoadBalancer/vDNS demo applications.
5
6 The repository includes:
7  - README.md: this file
8  
9  - LICENSE.TXT: the license text
10  
11  - The "boot" directory: the scripts to instantiate ONAP. 
12  
13  - The "heat" directory: contains the following three directories:
14  
15         - OpenECOMP: contains the HEAT template for the installation of the ONAP platform (openecomp_rackspace.yaml) and the environment file (openecomp_rackspace.env)
16         
17         - vFW: contains the HEAT template for the instantiation of the vFirewall VNF (base_vfw.yaml) and the environment file (base_vfw.env)
18         
19         - vLB: contains the HEAT template for the instantiation of the vLoadBalancer/vDNS VNF (base_vlb.yaml) and the environment file (base_vlb.env). The folder also contains the HEAT template for the DNS scaling-up scenario (dnsscaling.yaml) with its environment file (dnsscaling.env), and the HEAT template for the vLB packet generator (packet_gen_vlb.yaml) and its environment file (packet_gen_vlb.env).
20         
21  - The "vnfs" directory: contains the following directories:
22  
23         - honeycomb_plugin: Honeycomb plugin that allows upstream systems to change VNF configuration via RESTCONF or NETCONF protocols.
24         
25         - VES: source code of the ECOMP Vendor Event Listener (VES) Library. The VES library used here has been cloned from the GitHub repository at https://github.com/att/evel-library on February 1, 2017.
26         
27         - VESreporting_vFW: VES client for vFirewall demo application.
28         
29         - VESreporting_vLB: VES client for vLoadBalancer/vDNS demo application.
30         
31         - vFW: scripts that download, install and run packages for the vFirewall demo application.
32         
33         - vLB: scripts that download, install and run packages for the vLoadBalancer/vDNS demo application.
34  
35
36 ONAP HEAT Template
37 ---
38
39 The ONAP HEAT template spins up the entire ONAP platform. The template, openecomp_rackspace.yaml, comes with an environment file, openecomp_rackspace.env, in which all the default values are defined.
40
41 The HEAT template is composed of two sections: (i) parameters, and (ii) resources. The parameter section contains the declaration and description of the parameters that will be used to spin up OpenECOMP, such as public network identifier, URLs of code and artifacts repositories, etc.
42 The default values of these parameters can be found in the environment file. The resource section contains the definition of:
43  - ONAP Private Management Network, which ONAP components use to communicate with each other and with VNFs
44  - ONAP Virtual Machines (VMs)
45  - Public/private key pair used to access OpenECOMP VMs
46  - Virtual interfaces towards the ONAP Private Management Network
47  - Disk volumes. 
48
49 Each VM specification includes Operating System image name, VM size (i.e. flavor), VM name, etc. Each VM has two virtual network interfaces: one towards the public network and one towards the ONAP Private Management network, as described above. 
50 Furthermore, each VM runs a post-instantiation script that downloads and installs software dependencies (e.g. Java JDK, gcc, make, Python, ...) and ONAP software packages and docker containers from remote repositories.
51
52 When the HEAT template is executed, the Openstack HEAT engine creates the resources defined in the HEAT template, based on the parameters values defined in the environment file.
53
54 Before running HEAT, it is necessary to customize the environment file. Indeed, some parameters, namely public_net_id, pub_key, openstack_tenant_id, openstack_username, and openstack_api_key, need to be set depending on the user's environment:
55
56         public_net_id:       INSERT YOUR NETWORK ID/NAME HERE
57         pub_key:             INSERT YOUR PUBLIC KEY HERE
58         openstack_tenant_id: INSERT YOUR TENANT ID HERE
59         openstack_username:  INSERT YOUR USERNAME HERE
60         openstack_api_key:   INSERT YOUR API KEY HERE
61
62 public_net_id is the unique identifier (UUID) or name of the public network of the cloud provider. Note that for Rackspace template, this value is already set to
63    
64         00000000-0000-0000-0000-000000000000
65
66
67 pub_key is string value of the public key that will be installed in each OpenECOMP VM. To create a public/private key pair in Linux, execute the following instruction:
68    
69         user@ubuntu:~$ ssh-keygen -t rsa
70
71 The following operations to create the public/private key pair occur:
72    
73         Generating public/private rsa key pair.
74         Enter file in which to save the key (/home/user/.ssh/id_rsa): 
75         Created directory '/home/user/.ssh'.
76         Enter passphrase (empty for no passphrase): 
77         Enter same passphrase again: 
78         Your identification has been saved in /home/user/.ssh/id_rsa.
79         Your public key has been saved in /home/user/.ssh/id_rsa.pub.
80
81 openstack_username, openstack_tenant_id (password), and openstack_api_key are user's credentials to access the Openstack-based cloud. Note that in the Rackspace web interface, openstack_api_key can be found by clicking on the username and then "Account Settings".
82
83
84 The OpenECOMP platform can be instantiated via Rackspace GUI or command line.
85
86 Instantiation via Rackspace GUI:
87  - Login to Rackspace with your personal credentials
88  - Click "Stack Templates" from the "Orchestration" menu
89  - Click "Create Custom Template"
90  - Paste or manually upload the HEAT template (openecomp.yaml)
91  - Specify a name for your template in the "Template Name" form
92  - Click "Create Template and Launch Stack" at the bottom of the page
93  - In the "Create Stack" page, specify a name for your stack in the "Stack Name" form and select the Rackspace Region
94  - In the "Advanced Option" menu, insert the values of the parameters specified in the environment file (openecomp.env)
95  - Click "Create Stack"
96
97
98 Instantiation via Command Line:
99  - Install the HEAT client on your machine, e.g. in Ubuntu (ref. http://docs.openstack.org/user-guide/common/cli-install-openstack-command-line-clients.html):
100
101         apt-get install python-dev python-pip
102         pip install python-heatclient        # Install heat client
103         pip install python-openstackclient   # Install the Openstack client to support multiple services
104  
105  - Create a file (named i.e. ~/rackspace/openrc) that sets all the environmental variables required to access Rackspace:
106
107         export OS_AUTH_URL=https://identity.api.rackspacecloud.com/v2.0/
108         export OS_USERNAME=INSERT YOUR USERNAME HERE
109         export OS_TENANT_ID=INSERT YOUR TENANT ID HERE
110         export OS_REGION_NAME=INSERT THE RACKSPACE REGION ID [IAD | DFW | SYD | HKG]
111         export OS_PASSWORD=INSERT YOUR PASSWORD HERE
112         
113  - Run the script from command line:
114
115         source ~/rackspace/openrc
116         
117  - In order to install the OpenECOMP platform, type:
118
119         heat stack-create STACK_NAME -f PATH_TO_HEAT_TEMPLATE(YAML FILE) -e PATH_TO_ENV_FILE       # Old HEAT client, OR
120         openstack stack create -t PATH_TO_HEAT_TEMPLATE(YAML FILE) -e PATH_TO_ENV_FILE STACK_NAME  # New Openstack client
121
122
123 VNFs HEAT Templates
124 ---
125
126 The HEAT templates for the demo apps are stored in vFW and vLB directories. 
127
128 vFW contains the HEAT template, base_vfw.yaml, and the environment file, base_vfw.env, that are used to instantiate a virtual firewall. The VNF is composed of three VMs:
129   - Packet generator
130   - Firewall
131   - Sink
132
133 The packet generator generates traffic that passes through the firewall and reaches the sink. The firewall periodically reports the number of packets received in a unit of time to the DCAE collector. If the reported number of packets received on the firewall is above a high-water mark or below a low-water mark, OpenECOMP will enforce a configuration change on the packet generator, reducing or augmenting the quantity of traffic generated, respectively.
134
135 vLB contains the HEAT template, base_vlb.yaml, and the environment file, base_vlb.env, that are used to spin up a virtual load balancer and a virtual DNS. vLB also contains the HEAT template, packet_gen_vlb.yaml, and the environment file packet_gen_vlb.env, of a packet generator that generates DNS queries.
136 The load balancer periodically reports the number of DNS query packets received in a time unit to the DCAE collector. If the reported number of received packets crosses a threshold, then OpenECOMP will spin up a new DNS based on the dnsscaling.yaml HEAT template and dnsscaling.env to better balance the load of incoming DNS queries.
137
138 The vFW and vLB HEAT templates and environment files are onboarded into ONAP SDC and run automatically. The user is not required to run these templates manually.
139 However, before onboarding the templates following the instructions in the ONAP documentation, the user should set the following values in the environment files:
140
141         public_net_id:       INSERT YOUR NETWORK ID/NAME HERE
142         pub_key:             INSERT YOUR PUBLIC KEY HERE
143         
144
145 ONAP Demo applications
146 ---
147
148 Demo applications are installed and run automatically when the VNFs are instantiated. The user is not supposed to download and install the demo applications manually.
149
150 Two demo applications, vFirewall and vLoadBalancer/vDNS are included. 
151
152 vFirewall
153 ---
154
155 The vFirewall application contains 3 VMs: a firewall, a packet generator, and a packet sink. 
156
157 The packet generator sends packets to the packet sink through the firewall. The firewall reports the volume of traffic from the packet generator to the sink to OpenECOMP DCAE’s collector. To check the traffic volume to the sink, you can access the link http://sink_IP:667 through your browser. You can see the traffic volume in the charts. 
158
159 The packet generator includes a script that periodically generates different volumes of traffic. 
160
161 The closed-loop policy has been configured to re-adjust the traffic volume when it is needed.
162
163 __Closedloop for vFirewall demo:__
164
165 Through the ONAP Portal’s Policy Portal, we can find the configuration and operation policies that is currently enabled for the vFirewall application. 
166 + The configuration policy sets the thresholds for generating an onset event from DCAE to the Policy engine. Currently the threshold is set to below 300 packets or above 700 packets per 10 seconds. 
167 + Once the threshold is crossed, the Policy engine executes the operational policy to request APP-C to change the configuration of the packet gen. 
168 + APP-C sends a request to the packet generator to adjust the traffic volume to 500 packets per 10 seconds. 
169 + The traffic volume can be observed through the link http://sink_IP:667.
170
171 __Adjust packet generator:__
172
173 The packet generator contains 10 streams: fw_udp1, fw_udp2, fw_udp3,...fw_udp10. Each stream generates 100 packets per 10 seconds. 
174
175 To enable a stream, include *{"id":"fw_udp1", "is-enabled":"true"}* in the *pg-stream* bracket. 
176
177 To adjust the traffic volume sending from the packet generator, run the following command that enable 5 streams in a shell with localhost or the correct packet generator IP address in the http argument:
178
179 ```
180 curl -X PUT -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{"pg-streams":{"pg-stream": [{"id":"fw_udp1", "is-enabled":"true"},{"id":"fw_udp2", "is-enabled":"true"},{"id":"fw_udp3", "is-enabled":"true"},{"id":"fw_udp4", "is-enabled":"true"},{"id":"fw_udp5", "is-enabled":"true"}]}}' "http://PacketGen_IP:8183/restconf/config/sample-plugin:sample-plugin/pg-streams"
181 ```
182
183 A script in /opt/run_traffic_fw_demo.sh on the packet generator VM starts automatically and alternate the volume of traffic every 10 minutes. 
184
185 vLoadBalancer/vDNS
186 ---
187
188 The vLoadBalancer/vDNS app contains 2 VMs in the base model: a load balancer and a DNS instance. When there are too many DNS queries, the closed-loop is triggered and a new DNS instance will be spun up. 
189
190 To test the application, in the command prompt:
191
192 ``` 
193 # nslookup host1.dnsdemo.openecomp.org *vLoadBalancer_IP*
194
195 Server:     *vLoadBalancer_IP*
196 Address:    *vLoadBalancer_IP*
197
198 Name:     host1.dnsdemo.openecomp.org
199 Address:  10.0.100.101
200
201 ```
202
203 That means the load balancer has been set up correctly and has forwarded the DNS queries to the DNS instance. 
204
205 __Closedloop for vLoadBalancer/vDNS:__
206
207 Through the OpenECOMP Portal’s Policy Portal, we can find the configuration and operation policies that is currently enabled for the vLoadBalancer/vDNS application. 
208 + The configuration policy sets the thresholds for generating an onset event from DCAE to the Policy engine. Currently the threshold is set to above 200 packets per 10 seconds. 
209 + Once the threshold is crossed, the Policy engine executes the operational policy to query A&AI and send a request to MSO for spinning up a new DNS instance. 
210 + A new DNS instance will be spun up after the threshold is crossed. It can take a few minutes for this to happen. 
211
212
213 __Generate DNS queries:__
214
215 To generate DNS queries to the vLoadBalancer/vDNS instance, a separate packet generator is prepared for this purpose. 
216
217 1. Spin up the heat template in the repository: https://link_to_repo/demo/heat/vLB/packet_gen_vlb.yaml. 
218
219 2. Log in to the packet generator instance through ssh.
220
221 3. Change the IP address in the config file /opt/config/vlb_ipaddr.txt to the public IP address of the LoadBalancer instance. 
222
223 4. Execute the script /opt/vdnspacketgen_change_streams_ports.sh to restart sending the DNS queries to the new LoadBalancer address. 
224
225 5. To change the volume of queries, execute the following command in a command prompt with the updated vLoadBalancer_IP address or localhost in the http argument:
226  
227 ```  
228 curl -X PUT -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{"pg-streams":{"pg-stream": [{"id":"dns1", "is-enabled":"true"}]}}' "http://vLoadBalancer_IP:8183/restconf/config/sample-plugin:sample-plugin/pg-streams"  
229 ```  
230 + *{"id":"dns1", "is-enabled":"true"}* shows the stream *dns1* is enabled. The packet gen sends requests in the rate of 100 packets per 10 seconds.  
231
232 + To increase the amount of traffic, we can enable more streams. The packet gen has total 10 streams, *dns1*, *dns2*, *dns3* to *dns10*. Each of them produces 100 packets per 10 seconds. To enable the streams, includes *{"id":"dnsX", "is-enabled":"true"}* where *X* is the stream ID in the pg-stream bracket of the curl command.  
233 For example, if we want to enable 3 streams, the curl command should be:
234
235 ```
236 curl -X PUT -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{"pg-streams":{"pg-stream": [{"id":"dns1", "is-enabled":"true"}, {"id":"dns2", "is-enabled":"true"},{"id":"dns3", "is-enabled":"true"}]}}' "http://vLoadBalancer_IP:8183/restconf/config/sample-plugin:sample-plugin/pg-streams"
237 ```
238
239