From bdf7d9355acd712d2824aa40adbccce6921bd338 Mon Sep 17 00:00:00 2001 From: yaohelan Date: Wed, 3 May 2017 15:22:29 +0800 Subject: [PATCH] NFV workload This workload accomplishes the following: 1. Pull OPNFV Opera code 2. Leverage Opera code to install OPEN-O, deploy Clearwater vIMS by OPEN-O 3. Pull OPNFV Functest 4. Run the Functest vIMS test cases to ensure vIMS is working 5. Generate calling information The previous patch[1] was merged by accident and it did not follow community rule. Thus it was reverted by patch[2]. Resubmit the NFV workload. [1] https://review.openstack.org/#/c/439492/ [2] https://review.openstack.org/#/c/459557 Change-Id: I615acc5cc19a3ae71f3d8a5023b6fda6e29e7602 Signed-off-by: yaohelan --- .gitignore | 6 +- requirements.txt | 1 + tox.ini | 8 ++ workloads/ansible/openo/nfv/README.md | 121 ++++++++++++++++++ workloads/ansible/openo/nfv/group_vars/all | 21 +++ workloads/ansible/openo/nfv/nfv_launch.yml | 116 +++++++++++++++++ .../openo/nfv/templates/admin-openrc.sh.j2 | 20 +++ 7 files changed, 289 insertions(+), 4 deletions(-) create mode 100644 workloads/ansible/openo/nfv/README.md create mode 100644 workloads/ansible/openo/nfv/group_vars/all create mode 100644 workloads/ansible/openo/nfv/nfv_launch.yml create mode 100644 workloads/ansible/openo/nfv/templates/admin-openrc.sh.j2 diff --git a/.gitignore b/.gitignore index a752346..88a6cce 100644 --- a/.gitignore +++ b/.gitignore @@ -23,10 +23,8 @@ setuptools*.egg/ !/.mailmap !/.pylintrc !/.testr.conf +run/ +*.retry # Files created by releasenotes build releasenotes/build - - Contact GitHub API Training Shop Blog About - - diff --git a/requirements.txt b/requirements.txt index 48c2f4f..8c39620 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,3 +5,4 @@ pbr>=1.8 # Apache-2.0 ansible>=2.0.0.0 # GNU LGPL 3.0 shade==1.13.2 # Apache-2.0 +docker-py==1.9.0 # Apache-2.0 diff --git a/tox.ini b/tox.ini index 844f5ba..1139c24 100755 --- a/tox.ini +++ b/tox.ini @@ -54,3 +54,11 @@ setenv = ANSIBLE_INVENTORY = {env:K8S_DIR}/hosts ANSIBLE_CONFIG = {env:K8S_DIR}/ansible.cfg commands = ansible-playbook -e "action=apply {posargs}" {env:K8S_DIR}/site.yml + +[testenv:nfv] +deps = + {[testenv:ansible]deps} +setenv = + {[testenv:ansible]setenv} + NFV_DIR = {toxinidir}/workloads/ansible/openo/nfv +commands = ansible-playbook {env:NFV_DIR}/nfv_launch.yml diff --git a/workloads/ansible/openo/nfv/README.md b/workloads/ansible/openo/nfv/README.md new file mode 100644 index 0000000..822181e --- /dev/null +++ b/workloads/ansible/openo/nfv/README.md @@ -0,0 +1,121 @@ +# NFV Ansible deployments on OpenStack Cloud + +This ansible playbook will install an OPEN-O first then deploy +Clearwater vIMS by OPEN-O. + +Once the script finishes, a vIMS is ready to be used. + +## Status + +Complete + +## Requirements + +- [Install Ansible](http://docs.ansible.com/ansible/intro_installation.html) +- [Install docker-py 1.9.0](https://github.com/docker/docker-py) +- Make sure there is a VM to be used to install OPEN-O. + + It should meet the requirements below + + - at least 4 CPUs, 64G RAM, 100G Disk + +- Make sure the OpenStack cloud is able to deploy at least 7 nodes. + + Each node requires resources as below + + - 1 CPU, 2G RAM, 2G RAM, 20G Disk + +- Clone this project into a directory to the VM + +## Ansible + +Ansible will be used to orchestrate the whole process + +### Prep + +#### General OpenStack Settings + +Before running the script, cloud environment authentication needs to be +provided. Please update the file under group_vars/all + +There is one example for your reference + + ##### group_vars/all:: + + os_project_domain_name: default + os_user_domain_name: default + os_username: admin + os_password: password + os_project_name: admin + os_auth_url: http://205.156.212.201:5000/v3 + os_identity_api_version: 3 + os_region_name: RegionOne + +## Run the script to deploy vIMS with the help of OPEN-O + +With your cloud environment set, you should be able to run the script:: + + tox -e nfv + +The above command will firstly install Ansible and other required packages. + +Then, it will deploy OPEN-O, and a vIMS will be set up by +OPEN-O. This step is done by OPNFV Opera Project. + +[OPNFV Opera Project](https://github.com/opnfv/opera) + +Also, OPNFV Functest is leveraged to test the vIMS to make sure it is +working. + +[OPNFV Functest Project](https://github.com/opnfv/functest) + +## The results of the work load successful run + +If everything goes well, it will accomplish the following:: + + 1. Deploy OPEN-O docker containers + 2. Create security group + 3. Add security rules to allow icmp, tcp and ucp ports + 4. Deploy a VM on OpenStack and install Juju + 5. Connect Juju with OPEN-O and OpenStack + 6. Configure OPEN-O with vIMS topology definition + 7. Deploy vIMS Clearwater via OPEN-O + 8. Test the vIMS Clearwater by leveraging OPNFV Functest + 9. Create user on Ellis of vIMS Clearwater + 10. Create calling number on Ellis of vIMS Clearwater + +### Environment Information + +- OPEN-O can be accessed through + +http://VM_host_IP/openoui/common/default.html + +- Calling information is put under {{ playbook_dir }}/run/results/ellis.info + +- Log is put under {{ playbook_dir }}/run/results/opera.log + + +## Execution Duration + +The process involves pulling 20+ docker images and downloading about nearly 4G +OpenStack images. The time it takes can be impacted by the network enormously. +Thus the duration varies from lab to lab. If this step is once run, it will be +skipped in the future round of execution. One suggestion is to run this step +in advance to decrease the whole execution duration. + +The deployment and configuration of OPEN-O takes approximately 30~40 minutes. + +The deployment of vIMS Clearwater takes about 30~40 minutes. It also depends on +the network as vIMS downloads quite a number of packages. + + +## Next Steps + +### Make a call via SIP client + +Install the SIP client, e.g. jitsi and configure the client with calling +information. + +### Cleanup + +Script is needed to clean up the environment. diff --git a/workloads/ansible/openo/nfv/group_vars/all b/workloads/ansible/openo/nfv/group_vars/all new file mode 100644 index 0000000..6773403 --- /dev/null +++ b/workloads/ansible/openo/nfv/group_vars/all @@ -0,0 +1,21 @@ +--- +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +os_project_domain_name: default +os_user_domain_name: default +os_username: admin +os_password: password +os_project_name: admin +os_auth_url: http://205.156.212.201:5000/v3 +os_identity_api_version: 3 +os_region_name: RegionOne diff --git a/workloads/ansible/openo/nfv/nfv_launch.yml b/workloads/ansible/openo/nfv/nfv_launch.yml new file mode 100644 index 0000000..a142109 --- /dev/null +++ b/workloads/ansible/openo/nfv/nfv_launch.yml @@ -0,0 +1,116 @@ +--- +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +- hosts: localhost + remote_user: root + max_fail_percentage: 0 + tasks: + - set_fact: + starttime: "{{ ansible_date_time }}" + + - set_fact: + exec_dir: "{{ playbook_dir }}/run" + + - set_fact: + opera_dir: "{{ exec_dir }}/opera" + + - set_fact: + results_dir: "{{ exec_dir }}/results" + + - name: Creates execution directory + file: path={{ exec_dir }} state=directory + + - name: pull OPNFV Opera code + git: + repo: https://github.com/opnfv/opera.git + dest: "{{ opera_dir }}" + update: no + + - name: config admin-openrc.sh + template: + src: admin-openrc.sh.j2 + dest: "{{ opera_dir }}/conf/admin-openrc.sh" + + - name: pull OPNFV Functest docker image to test vIMS + docker_image: + name: yaohelan/functest:stable + state: present + force: yes + + - name: Creates result directory + file: path={{ results_dir }} state=directory + + - name: create the opera log file + file: dest={{ results_dir }}/opera.log state=touch + + - name: deploy OPEN-O and vIMS + shell: "{{ opera_dir }}/opera_launch.sh > opera.log" + args: + chdir: "{{ results_dir }}" + + - name: create openstack.creds + shell: cp {{ opera_dir }}/conf/admin-openrc.sh {{ opera_dir }}/conf/openstack.creds + + - name: remove OPNFV Functest docker container + shell: "docker rm -f functest-opera || true" + + - name: get open-o endpoint + shell: . {{ opera_dir }}/work/scripts/open-o.conf; echo $OPENO_IP:$COMMON_SERVICES_MSB_PORT + register: openo_endpoint + + - name: Creates Functest result directory + file: path={{ results_dir }}/functest state=directory + + - name: run OPNFV Functest docker container + command: "docker run -id + -v {{ opera_dir }}/conf/openstack.creds:/home/opnfv/functest/conf/openstack.creds + -v {{ results_dir }}/functest:/home/opnfv/functest/results + -e INSTALLER_TYPE=unknown + -e DEPLOY_SCENARIO=unknown + -e OPENO_MSB_ENDPOINT={{ item }} + -e CI_DEBUG=false + --name=functest-opera + yaohelan/functest:stable /bin/bash" + with_items: "{{ openo_endpoint.stdout_lines }}" + + - name: start OPNFV Functest docker container + command: "docker start functest-opera" + + - name: run vIMS test on OPNFV Functest + command: docker exec functest-opera python /home/opnfv/repos/functest/functest/ci/run_tests.py -t opera_ims + + - name: copy call information + command: docker cp functest-opera:/home/opnfv/functest/results/opera_ims/ellis.info {{ results_dir }}/ellis.info + + - name: get end time + shell: date '+%H:%M:%S' + register: end_time + + - debug: + msg: >- + Access OPEN-O dashboard at + http://{{ openo_endpoint.stdout_lines }} + + - name: get Ellis call information + command: /bin/cat {{ results_dir }}/ellis.info + register: details + + - debug: + msg: >- + Ellis details + {{ details.stdout_lines }} + + - debug: + msg: >- + The work load started at {{ starttime.time }}, + ended at {{ end_time.stdout }} diff --git a/workloads/ansible/openo/nfv/templates/admin-openrc.sh.j2 b/workloads/ansible/openo/nfv/templates/admin-openrc.sh.j2 new file mode 100644 index 0000000..bbf8bfa --- /dev/null +++ b/workloads/ansible/openo/nfv/templates/admin-openrc.sh.j2 @@ -0,0 +1,20 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +export OS_PROJECT_DOMAIN_NAME={{ os_project_domain_name }} +export OS_USER_DOMAIN_NAME={{ os_user_domain_name }} +export OS_USERNAME={{ os_username }} +export OS_PASSWORD={{ os_password }} +export OS_PROJECT_NAME={{ os_project_name }} +export OS_AUTH_URL={{ os_auth_url }} +export OS_IDENTITY_API_VERSION={{ os_identity_api_version }} +export OS_REGION_NAME={{ os_region_name }}