From 6c11ccaa5e9f036a1b56926d80aaccb3dc5e3d78 Mon Sep 17 00:00:00 2001 From: Venkata Harshavardhan Reddy Allu Date: Fri, 26 Oct 2018 20:01:37 +0530 Subject: Improve ansible tasks and fix license headers This patch does two things: 1. improve the ansible tasks: - register Openstack as VIM - create osmrc file - install OSM (master) 2. fix license headers in unit tests installer-type:osa deploy-scenario:os-odl-sfc_osm Change-Id: I02297dae2b0108397541cedeb2f47183f1df99fc Signed-off-by: Venkata Harshavardhan Reddy Allu --- .../os-odl-sfc_osm/role/os-odl-sfc_osm/README | 2 +- .../os-odl-sfc_osm/role/os-odl-sfc_osm/files/osmrc | 2 -- .../role/os-odl-sfc_osm/tasks/install-osm.yml | 22 ++++++++++++---------- .../role/os-odl-sfc_osm/tasks/post-deployment.yml | 3 +-- .../role/os-odl-sfc_osm/tasks/register-vim.yml | 16 ++++++++-------- .../role/os-odl-sfc_osm/vars/main.yml | 7 ++++--- sfc/unit_tests/unit/lib/test_odl_utils.py | 4 ++-- sfc/unit_tests/unit/lib/test_openstack_utils.py | 4 ++-- sfc/unit_tests/unit/lib/test_test_utils.py | 4 ++-- 9 files changed, 32 insertions(+), 32 deletions(-) delete mode 100644 scenarios/os-odl-sfc_osm/role/os-odl-sfc_osm/files/osmrc diff --git a/scenarios/os-odl-sfc_osm/role/os-odl-sfc_osm/README b/scenarios/os-odl-sfc_osm/role/os-odl-sfc_osm/README index 7ae8b9f6..b65c1d52 100644 --- a/scenarios/os-odl-sfc_osm/role/os-odl-sfc_osm/README +++ b/scenarios/os-odl-sfc_osm/role/os-odl-sfc_osm/README @@ -5,7 +5,7 @@ This role currently works with: - OpenStack stable/rocky - ODL Fluorine - OVS 2.9.2 -- OSM Release FOUR +- OSM master - Ubuntu 16.04 Follow this link: diff --git a/scenarios/os-odl-sfc_osm/role/os-odl-sfc_osm/files/osmrc b/scenarios/os-odl-sfc_osm/role/os-odl-sfc_osm/files/osmrc deleted file mode 100644 index d9028b2f..00000000 --- a/scenarios/os-odl-sfc_osm/role/os-odl-sfc_osm/files/osmrc +++ /dev/null @@ -1,2 +0,0 @@ -export OSM_HOSTNAME=127.0.0.1 -export OSM_SOL005=True diff --git a/scenarios/os-odl-sfc_osm/role/os-odl-sfc_osm/tasks/install-osm.yml b/scenarios/os-odl-sfc_osm/role/os-odl-sfc_osm/tasks/install-osm.yml index 4f6b990a..5c12e333 100644 --- a/scenarios/os-odl-sfc_osm/role/os-odl-sfc_osm/tasks/install-osm.yml +++ b/scenarios/os-odl-sfc_osm/role/os-odl-sfc_osm/tasks/install-osm.yml @@ -1,30 +1,32 @@ --- # SPDX-license-identifier: Apache-2.0 ############################################################################## -# Copyright (c) 2018 Venkata Harshavardhan Reddy Allu and others. +# Copyright (c) 2018 Ericsson AB and others. # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -- name: get OSM installer {{ osm_release_version }} +- name: clone OSM devops repo and checkout version {{ osm_devops_version }} become_user: "{{ osm_install_user }}" become: yes - get_url: - url: "https://osm-download.etsi.org/ftp/{{ osm_release_version }}/install_osm.sh" - dest: "/home/{{ osm_install_user }}/install_osm.sh" - mode: u+x + git: + repo: "{{ osm_devops_git_url }}" + dest: "{{ osm_devops_clone_location }}" + version: "{{ osm_devops_version }}" - name: install OSM become_user: "{{ osm_install_user }}" become: yes - command: "/bin/bash ./install_osm.sh --nolxd -y " + command: "/bin/bash ./full_install_osm.sh --test -b {{ osm_devops_version }} --nolxd -y" args: - chdir: "/home/{{ osm_install_user }}" + chdir: "{{ osm_devops_clone_location }}/installers" creates: "/usr/bin/osm" -- name: Create osmrc file +- name: create osmrc file copy: - src: osmrc dest: "{{ osmrc_file_dest }}" + content: | + export OSM_HOSTNAME=127.0.0.1 + export OSM_OL005=True diff --git a/scenarios/os-odl-sfc_osm/role/os-odl-sfc_osm/tasks/post-deployment.yml b/scenarios/os-odl-sfc_osm/role/os-odl-sfc_osm/tasks/post-deployment.yml index c462065e..a181ce77 100644 --- a/scenarios/os-odl-sfc_osm/role/os-odl-sfc_osm/tasks/post-deployment.yml +++ b/scenarios/os-odl-sfc_osm/role/os-odl-sfc_osm/tasks/post-deployment.yml @@ -18,11 +18,10 @@ include: register-vim.yml # fetch ODL variables for functest -- name: "Fetch the ip of the neutron server container" +- name: Fetch the ip of the neutron server container shell: 'grep controller00_neutron_server_container -n1 /etc/openstack_deploy/openstack_inventory.json | grep ansible_host | cut -d":" -f2 | cut -d "\"" -f2' register: ip changed_when: False - - name: Fetch the ml2_conf.ini to process ODL variables command: "scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no {{ ip.stdout }}:/etc/neutron/plugins/ml2/ml2_conf.ini /tmp/ml2_conf.ini" changed_when: False diff --git a/scenarios/os-odl-sfc_osm/role/os-odl-sfc_osm/tasks/register-vim.yml b/scenarios/os-odl-sfc_osm/role/os-odl-sfc_osm/tasks/register-vim.yml index 25b238ab..07e044bf 100644 --- a/scenarios/os-odl-sfc_osm/role/os-odl-sfc_osm/tasks/register-vim.yml +++ b/scenarios/os-odl-sfc_osm/role/os-odl-sfc_osm/tasks/register-vim.yml @@ -10,15 +10,16 @@ # This is a simple fix to wait for the OSM services in # the docker containers to start functioning as expected. -# TO DO: Once healthchecks are added to the OSM -# container stack, we'll use them to identify that -# they were started functioning and modify this task. +# TODO: Once healthchecks are added to the OSM +# container stack, use them to identify the status +# of the containers and modify this task. - name: Wait till the OSM services are ready - pause: - minutes: 2 + wait_for: timeout=120 + delegate_to: localhost - name: Register OpenStack as VIM - shell: "osm vim-create \ + shell: ". {{ osmrc_file_dest }} ; + osm vim-create \ --name openstack-site \ --user admin \ --password {{ openrc_os_password }} \ @@ -26,5 +27,4 @@ --account_type openstack \ --auth_url {{ openrc_os_auth_url }} \ --config='{insecure: true}'" - environment: - OSM_HOSTNAME: 127.0.0.1 + changed_when: False diff --git a/scenarios/os-odl-sfc_osm/role/os-odl-sfc_osm/vars/main.yml b/scenarios/os-odl-sfc_osm/role/os-odl-sfc_osm/vars/main.yml index e46cf193..41051830 100644 --- a/scenarios/os-odl-sfc_osm/role/os-odl-sfc_osm/vars/main.yml +++ b/scenarios/os-odl-sfc_osm/role/os-odl-sfc_osm/vars/main.yml @@ -19,8 +19,9 @@ osm_required_packages: - snapd - lxd -osm_release_version: "osm-4.0-four" +osm_devops_version: "master" +osm_devops_git_url: "https://osm.etsi.org/gerrit/osm/devops.git" +osm_devops_clone_location: "/home/{{ osm_install_user }}/osm-devops" osm_install_user: "devuser" -## Create osmrc file -osmrc_file_dest: "{{ ansible_env.HOME }}/osmrc" +osmrc_file_dest: "/root/osmrc" diff --git a/sfc/unit_tests/unit/lib/test_odl_utils.py b/sfc/unit_tests/unit/lib/test_odl_utils.py index 043c7bbe..04eeeff2 100644 --- a/sfc/unit_tests/unit/lib/test_odl_utils.py +++ b/sfc/unit_tests/unit/lib/test_odl_utils.py @@ -1,9 +1,9 @@ #!/usr/bin/env python ############################################################################### -# Copyright (c) 2018 All rights reserved. +# Copyright (c) 2018 Venkata Harshavardhan Reddy Allu and others. # -# This program and the accompanying materials +# All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 diff --git a/sfc/unit_tests/unit/lib/test_openstack_utils.py b/sfc/unit_tests/unit/lib/test_openstack_utils.py index 595aed0e..eca9316d 100644 --- a/sfc/unit_tests/unit/lib/test_openstack_utils.py +++ b/sfc/unit_tests/unit/lib/test_openstack_utils.py @@ -1,9 +1,9 @@ #!/usr/bin/env python ############################################################################### -# Copyright (c) 2018 All rights reserved. +# Copyright (c) 2018 Venkata Harshavardhan Reddy Allu and others. # -# This program and the accompanying materials +# All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 diff --git a/sfc/unit_tests/unit/lib/test_test_utils.py b/sfc/unit_tests/unit/lib/test_test_utils.py index f26f8df9..a7d2bfde 100644 --- a/sfc/unit_tests/unit/lib/test_test_utils.py +++ b/sfc/unit_tests/unit/lib/test_test_utils.py @@ -1,9 +1,9 @@ #!/usr/bin/env python ############################################################################### -# Copyright (c) 2018 All rights reserved. +# Copyright (c) 2018 Venkata Harshavardhan Reddy Allu and others. # -# This program and the accompanying materials +# All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 -- cgit 1.2.3-korg