diff options
author | Manuel Buil <mbuil@suse.com> | 2018-10-04 15:56:42 +0200 |
---|---|---|
committer | Manuel Buil <mbuil@suse.com> | 2018-10-18 09:02:56 +0200 |
commit | 428833bf9fa1fd3910517d39499329ff27444694 (patch) | |
tree | 388618b5285a6f5d02fd656e9d5d0ed8c7fe1fa2 /xci/playbooks | |
parent | 4597bb3c4ff273a68d73883a9d87520517d60876 (diff) |
Add ODL variables to env file
ODL testcases in functest require new variables:
https://git.opnfv.org/functest/tree/functest/utils/env.py#n22
Otherwise the test fails because it cannot contact ODL
To find those variables, we fetch the ml2_conf.ini file from the neutron
container and then we parse the values. This is only run when the
scenario has odl
deploy-scenario:os-odl-sfc
installer-type:osa
Change-Id: If175bb7642e66e151b30e1ccd1b9040aa3481d8f
Signed-off-by: Manuel Buil <mbuil@suse.com>
Diffstat (limited to 'xci/playbooks')
-rw-r--r-- | xci/playbooks/roles/prepare-tests/tasks/main.yml | 4 | ||||
-rw-r--r-- | xci/playbooks/roles/prepare-tests/tasks/process_neutron_conf.yml | 19 | ||||
-rw-r--r-- | xci/playbooks/roles/prepare-tests/templates/env.j2 | 8 |
3 files changed, 31 insertions, 0 deletions
diff --git a/xci/playbooks/roles/prepare-tests/tasks/main.yml b/xci/playbooks/roles/prepare-tests/tasks/main.yml index 45a23a3a..b4e566c2 100644 --- a/xci/playbooks/roles/prepare-tests/tasks/main.yml +++ b/xci/playbooks/roles/prepare-tests/tasks/main.yml @@ -26,6 +26,10 @@ state: present extra_args: '-c https://raw.githubusercontent.com/openstack/requirements/{{ requirements_git_install_branch }}/upper-constraints.txt' +# odl scenarios require to add odl variables to env +- include_tasks: process_neutron_conf.yml + when: "'-odl-' in deploy_scenario" + - name: prepare environment file for tests template: src: env.j2 diff --git a/xci/playbooks/roles/prepare-tests/tasks/process_neutron_conf.yml b/xci/playbooks/roles/prepare-tests/tasks/process_neutron_conf.yml new file mode 100644 index 00000000..45608df3 --- /dev/null +++ b/xci/playbooks/roles/prepare-tests/tasks/process_neutron_conf.yml @@ -0,0 +1,19 @@ +--- +- name: Collecting ODL variables + block: + - name: Fetch odl_password variable + shell: "cat /tmp/ml2_conf.ini | grep password | cut -d ' ' -f3" + register: odl_password + + - name: Fetch odl_username variable + shell: "cat /tmp/ml2_conf.ini | grep username | cut -d ' ' -f3" + register: odl_username + + - name: Fetch odl_port variable + shell: "cat /tmp/ml2_conf.ini | grep url | cut -d ':' -f3 | cut -d '/' -f1" + register: odl_port + + - name: Fetch odl_ip variable + shell: "cat /tmp/ml2_conf.ini | grep url | cut -d ':' -f2 | cut -d '/' -f3" + register: odl_ip + when: "'-odl-' in deploy_scenario" diff --git a/xci/playbooks/roles/prepare-tests/templates/env.j2 b/xci/playbooks/roles/prepare-tests/templates/env.j2 index d9a3bf32..d4f8f86c 100644 --- a/xci/playbooks/roles/prepare-tests/templates/env.j2 +++ b/xci/playbooks/roles/prepare-tests/templates/env.j2 @@ -5,3 +5,11 @@ ENERGY_RECORDER_API_URL=http://energy.opnfv.fr/resources {% if 'os-' in deploy_scenario %} EXTERNAL_NETWORK={{ external_network }} {% endif %} +{% if '-odl-' in deploy_scenario %} +SDN_CONTROLLER_IP={{ odl_ip.stdout }} +SDN_CONTROLLER_USER={{ odl_username.stdout }} +SDN_CONTROLLER_PASSWORD={{ odl_password.stdout }} +SDN_CONTROLLER_RESTCONFPORT={{ odl_port.stdout }} +SDN_CONTROLLER_WEBPORT={{ odl_port.stdout }} +{% endif %} + |