Enable configuration of compute node interfaces by MaaS
Move testclient LXC contaner to the head node
Remove simulate-fabric role
Remove maas-simulate-fabric role
Remove onos-load-apps role
Remove test-client-install role (replaced by maas-test-client-install)
Remove single-node-pod.sh (replaced by cord-in-a-box.sh in cord repo)
Change-Id: I0fcf108ab674bb5473556e78a401837c161f5ea9
diff --git a/cord-compute-playbook.yml b/cord-compute-playbook.yml
index 72b0e04..cdcd81e 100644
--- a/cord-compute-playbook.yml
+++ b/cord-compute-playbook.yml
@@ -34,8 +34,6 @@
become: yes
roles:
- compute-prep
- - { role: maas-simulate-fabric, when: cord_in_a_box }
- - { role: maas-test-client-install, when: cord_in_a_box }
- name: Deploy compute nodes
hosts: head
diff --git a/cord-post-deploy-playbook.yml b/cord-post-deploy-playbook.yml
index c0d6a69..4341ae3 100644
--- a/cord-post-deploy-playbook.yml
+++ b/cord-post-deploy-playbook.yml
@@ -15,5 +15,6 @@
hosts: head
become: no
roles:
+ - maas-test-client-install
- test-vsg
- test-exampleservice
diff --git a/roles/automation-integration/tasks/main.yml b/roles/automation-integration/tasks/main.yml
index c76dadd..1d2c11e 100644
--- a/roles/automation-integration/tasks/main.yml
+++ b/roles/automation-integration/tasks/main.yml
@@ -57,8 +57,6 @@
- head-prep
- juju-compute-setup
- xos-compute-setup
- - maas-simulate-fabric
- - maas-test-client-install
- name: Copy Required Ansible Variables
become: yes
diff --git a/roles/maas-simulate-fabric/defaults/main.yml b/roles/maas-simulate-fabric/defaults/main.yml
deleted file mode 100755
index c86c5ee..0000000
--- a/roles/maas-simulate-fabric/defaults/main.yml
+++ /dev/null
@@ -1,36 +0,0 @@
----
-# maas-simulate-fabric/defaults/main.yml
-
-simfabric_bridges:
- - name: databr
- addresses:
- - "10.168.0.1/24"
- - "10.168.1.1/24"
- interfaces:
- - veth0
-
-simfabric_links:
- - type: veth
- dev: veth0
- peer: fabric
- mac: "02:42:0a:a8:00:01"
-
-# see note in playbook, won't apply until ansible gets module support
-simfabric_iptables:
- - table: nat
- chain: POSTROUTING
- source: "10.168.0.0/16"
- dest: "! 10.168.0.0/16"
- jump: MASQUERADE
-
-simfabric_sysctl:
- - name: net.ipv4.ip_forward
- value: 1
- - name: net.ipv4.conf.all.send_redirects
- value: 0
- - name: net.ipv4.conf.default.send_redirects
- value: 0
- - name: net.ipv4.conf.eth0.send_redirects
- value: 0
- - name: net.ipv4.conf.databr.send_redirects
- value: 0
diff --git a/roles/maas-simulate-fabric/tasks/main.yml b/roles/maas-simulate-fabric/tasks/main.yml
deleted file mode 100755
index 08cbafe..0000000
--- a/roles/maas-simulate-fabric/tasks/main.yml
+++ /dev/null
@@ -1,83 +0,0 @@
----
-- name: Install prerequisites
- apt:
- name={{ item }}
- update_cache=yes
- cache_valid_time=3600
- become: yes
- register: result
- until: result | success
- retries: 15
- delay: 60
- with_items:
- - bridge-utils
-
-- name: Create bridges
- when: "ansible_{{ item.name }} is not defined"
- command: brctl addbr "{{ item.name }}"
- with_items: "{{ simfabric_bridges }}"
-
-# note, not idempotent if failed between prior step and this step
-- name: Set IP addresses to bridges
- when: "ansible_{{ item.0.name }} is not defined"
- command: "ip addr add {{ item.1 }} dev {{ item.0.name }}"
- with_subelements:
- - "{{ simfabric_bridges }}"
- - addresses
-
-- name: Run setup again to obtain bridge info
- setup:
-
-- name: Start bridges
- when: "not ansible_{{ item.name }}.active"
- command: "ip link set dev {{ item.name }} up"
- with_items: "{{ simfabric_bridges }}"
-
-- name: Create ip links
- when: "ansible_{{ item.dev }} is not defined"
- command: "ip link add dev {{ item.dev }} address {{ item.mac }} type {{ item.type }} peer name {{ item.peer }}"
- with_items: "{{ simfabric_links }}"
-
-- name: Run setup again to obtain link info
- setup:
-
-- name: Start interfaces
- when: "not ansible_{{ item }}.active"
- command: "ip link set dev {{ item }} up"
- with_items:
- - "{{ simfabric_links | map(attribute='dev') | list }}"
- - "{{ simfabric_links | map(attribute='peer') | list }}"
-
-- name: Add interfaces to bridges
- when: "not item.1 in ansible_{{ item.0.name }}.interfaces"
- command: "brctl addif {{ item.0.name }} {{ item.1 }}"
- with_subelements:
- - "{{ simfabric_bridges }}"
- - interfaces
-
-- name: Check for iptables rule
- command: "iptables -t nat -C POSTROUTING -s 10.168.0.0/16 ! -d 10.168.0.0/16 -j MASQUERADE"
- register: iptables_check
- failed_when: "iptables_check|failed and 'No chain/target/match by that name' not in iptables_check.stderr"
- tags:
- - skip_ansible_lint # FIXME: should use iptables module when it supports inversion of ranges
-
-- name: Create iptables rule
- when: "iptables_check.rc != 0"
- command: "iptables -t nat -A POSTROUTING -s 10.168.0.0/16 ! -d 10.168.0.0/16 -j MASQUERADE"
-
-# the below will likely work when this pull makes it into ansible:
-# https://github.com/ansible/ansible-modules-extras/pull/1685
-# - name: Configure iptables
-# iptables: "table={{ item.table }} chain={{ item.chain }} source={{ item.source }} destination={{ item.dest }} jump={{ item.jump }}"
-# with_items: "{{ simfabric_iptables }}"
-
-- name: Set kernel sysctl values
- sysctl:
- name="{{ item.name }}"
- value="{{ item.value }}"
- sysctl_set=yes
- state=present
- reload=yes
- with_items: "{{ simfabric_sysctl }}"
-
diff --git a/roles/maas-test-client-install/tasks/main.yml b/roles/maas-test-client-install/tasks/main.yml
index 8e90c9e..e7fbc6a 100644
--- a/roles/maas-test-client-install/tasks/main.yml
+++ b/roles/maas-test-client-install/tasks/main.yml
@@ -11,33 +11,16 @@
delay: 60
with_items:
- lxc
+ - lxc-dev
+ - python-dev
-- name: set lxc bridge interface to be databr
+- name: Install PIP packages
+ pip:
+ name={{ item }}
become: yes
- lineinfile:
- dest: /etc/lxc/default.conf
- regexp: "^lxc.network.link ="
- line: "lxc.network.link = databr"
-
-- name: Create testclient
- become: yes
- shell: lxc-ls | grep testclient || lxc-create -t ubuntu -n testclient
- tags:
- - skip_ansible_lint # FIXME: should used lxc_container module
-
-- name: Start testclient
- become: yes
- shell: lxc-info -n testclient -s | grep RUNNING || lxc-start -d -n testclient
- tags:
- - skip_ansible_lint # FIXME: should used lxc_container module
-
-- name: Set up networking inside the testclient for testing sample CORD subscriber
- become: yes
- shell: "{{ item }}"
+ register: result
+ until: result | success
+ retries: 15
+ delay: 60
with_items:
- - "lxc-attach -n testclient -- bash -c 'ip link show eth0.222 || ip link add link eth0 name eth0.222 type vlan id 222'"
- - "lxc-attach -n testclient -- bash -c 'ip link show eth0.222.111 || ip link add link eth0.222 name eth0.222.111 type vlan id 111'"
- - "lxc-attach -n testclient -- ifconfig eth0.222 up"
- - "lxc-attach -n testclient -- ifconfig eth0.222.111 up"
- tags:
- - skip_ansible_lint # non-trivial use case
+ - lxc-python2
diff --git a/roles/onos-load-apps/defaults/main.yml b/roles/onos-load-apps/defaults/main.yml
deleted file mode 100644
index e8a818e..0000000
--- a/roles/onos-load-apps/defaults/main.yml
+++ /dev/null
@@ -1,16 +0,0 @@
----
-# onos-load-apps/defaults/main.yml
-
-onos_cord_vm_hostname: "onos-cord-1"
-onos_web_user: "onos"
-onos_web_pass: "rocks"
-
-cord_apps:
- - name: cord-config
- onos_name: org.opencord.config
- - name: vtn
- onos_name: org.opencord.vtn
-
-cord_apps_repo_url: "https://oss.sonatype.org/content/repositories/public"
-cord_apps_version: "1.1-SNAPSHOT"
-
diff --git a/roles/onos-load-apps/files/onos-app b/roles/onos-load-apps/files/onos-app
deleted file mode 100644
index fb6fff6..0000000
--- a/roles/onos-load-apps/files/onos-app
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/bin/bash
-# -----------------------------------------------------------------------------
-# Tool to manage ONOS applications using REST API.
-# -----------------------------------------------------------------------------
-
-node=${1:-$OCI}
-cmd=${2:-list}
-app=${3}
-
-export URL=http://$node:8181/onos/v1/applications
-export HDR="-HContent-Type:application/octet-stream"
-export HAJ="-HContent-Type:application/json"
-export curl="curl -sS --user $ONOS_WEB_USER:$ONOS_WEB_PASS"
-
-# Prints usage help
-function usage {
- echo "usage: onos-app <node-ip> list" >&2
- echo " onos-app <node-ip> {install|install!} <app-file>" >&2
- echo " onos-app <node-ip> {reinstall|reinstall!} [<app-name>] <app-file>" >&2
- echo " onos-app <node-ip> {activate|deactivate|uninstall} <app-name>" >&2
- exit 1
-}
-
-# Extract app name from the specified *.oar file
-function appName {
- aux=/tmp/aux$$.jar
- cp $1 $aux
- pushd /tmp >/dev/null
- jar xf $aux app.xml && grep name= app.xml | cut -d\" -f2
- rm -f $aux /tmp/app.xml
- popd >/dev/null
-}
-
-[ -z $node -o "$node" = "-h" -o "$node" = "--help" -o "$node" = "-?" ] && usage
-
-case $cmd in
- list) $curl -X GET $URL;;
- installUrl!|installUrl)
- activate="false"
- [ $cmd = "installUrl!" ] && activate="true"
- [ $# -lt 3 ] && usage
- appurl=$3
- $curl -X POST $HAJ -d '{"url" : "'"$appurl"'", "activate" : "'$activate'" }' $URL
- ;;
- install!|install)
- [ $cmd = "install!" ] && activate="?activate=true"
- [ $# -lt 3 -o ! -f $app ] && usage
- $curl -X POST $HDR $URL$activate --data-binary @$app
- ;;
-
- reinstall!|reinstall)
- [ $cmd = "reinstall!" ] && activate="?activate=true"
- [ $# -lt 4 -a ! -f "$3" ] && usage
- [ $# -eq 4 -a ! -f "$4" ] && usage
- oar=$4
- [ $# -lt 4 ] && oar=$3 && app=$(appName $oar)
- $curl -X DELETE $URL/$app
- $curl -X POST $HDR $URL$activate --data-binary @$oar
- ;;
-
- uninstall)
- [ $# -lt 3 ] && usage
- $curl -X DELETE $URL/$app
- ;;
- activate)
- [ $# -lt 3 ] && usage
- $curl -X POST $URL/$app/active
- ;;
- deactivate)
- [ $# -lt 3 ] && usage
- $curl -X DELETE $URL/$app/active
- ;;
-
- *) usage;;
-esac
-
-
-status=$?
-echo # new line for prompt
-exit $status
diff --git a/roles/onos-load-apps/tasks/main.yml b/roles/onos-load-apps/tasks/main.yml
deleted file mode 100644
index 515c3c4..0000000
--- a/roles/onos-load-apps/tasks/main.yml
+++ /dev/null
@@ -1,51 +0,0 @@
----
-# onos-load-apps/tasks/main.yml
-
-- name: Disable loading of CORD apps from Maven repo
- command: ansible xos-1 -u ubuntu -m lineinfile \
- -a "dest=~/service-profile/{{ xos_configuration }}/make-vtn-external-yaml.sh state=absent regexp='install_dependencies'"
- tags:
- - skip_ansible_lint # running a sub-job
-
-- name: Create directory for CORD apps and load script
- file:
- state: directory
- dest: "{{ ansible_user_dir }}/cord_apps/"
-
-- name: Create cord_app_loader.sh script to load CORD apps
- template:
- src: "{{ item }}.j2"
- dest: "{{ ansible_user_dir }}/cord_apps/{{ item }}"
- mode: 0755
- with_items:
- - cord_app_loader.sh
-
-- name: Copy onos-app REST API app loader tool
- copy:
- src: "{{ item }}"
- dest: "{{ ansible_user_dir }}/cord_apps/{{ item }}"
- mode: 0755
- with_items:
- - onos-app
-
-- name: Wait for ONOS to be ready
- wait_for:
- host: "{{ onos_cord_vm_hostname }}"
- port: 8181
-
-- name: Download CORD apps from maven repo
- maven_artifact:
- repository_url: "{{ cord_apps_repo_url }}"
- group_id: "org.opencord"
- artifact_id: "{{ item.name }}"
- version: "{{ cord_apps_version }}"
- extension: "oar"
- dest: "{{ ansible_user_dir }}/cord_apps/{{ item.name }}.oar"
- with_items: "{{ cord_apps }}"
- register: maven_artifact_dl
-
-# assumes no interruption between this and previous steps...
-- name: Install CORD apps
- when: maven_artifact_dl.changed
- command: "{{ ansible_user_dir }}/cord_apps/cord_app_loader.sh"
-
diff --git a/roles/onos-load-apps/templates/cord_app_loader.sh.j2 b/roles/onos-load-apps/templates/cord_app_loader.sh.j2
deleted file mode 100644
index 742f2d3..0000000
--- a/roles/onos-load-apps/templates/cord_app_loader.sh.j2
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/usr/bin/env bash
-# onos-vm-install/templates/cord_loader.sh.j2
-# loads/activates .oar CORD app files into ONOS instance
-
-export ONOS_WEB_USER={{ onos_web_user }}
-export ONOS_WEB_PASS={{ onos_web_pass }}
-
-BASEDIR=$(dirname "$0") # current directory of script
-
-{% for cord_app in cord_apps %}
-${BASEDIR}/onos-app {{ onos_cord_vm_hostname }} install ${BASEDIR}/{{ cord_app.name }}.oar
-${BASEDIR}/onos-app {{ onos_cord_vm_hostname }} activate {{ cord_app.onos_name }}
-{% endfor %}
-
diff --git a/roles/simulate-fabric/defaults/main.yml b/roles/simulate-fabric/defaults/main.yml
deleted file mode 100644
index c52e0c0..0000000
--- a/roles/simulate-fabric/defaults/main.yml
+++ /dev/null
@@ -1,36 +0,0 @@
----
-# simulate-fabric/defaults/main.yml
-
-simfabric_bridges:
- - name: databr
- addresses:
- - "10.168.0.1/24"
- - "10.168.1.1/24"
- interfaces:
- - veth0
-
-simfabric_links:
- - type: veth
- dev: veth0
- peer: fabric
- mac: "02:42:0a:a8:00:01"
-
-# see note in playbook, won't apply until ansible gets module support
-simfabric_iptables:
- - table: nat
- chain: POSTROUTING
- source: "10.168.0.0/16"
- dest: "! 10.168.0.0/16"
- jump: MASQUERADE
-
-simfabric_sysctl:
- - name: net.ipv4.ip_forward
- value: 1
- - name: net.ipv4.conf.all.send_redirects
- value: 0
- - name: net.ipv4.conf.default.send_redirects
- value: 0
- - name: net.ipv4.conf.eth0.send_redirects
- value: 0
- - name: net.ipv4.conf.databr.send_redirects
- value: 0
diff --git a/roles/simulate-fabric/files/simulate-fabric-playbook.yml b/roles/simulate-fabric/files/simulate-fabric-playbook.yml
deleted file mode 100644
index ad326e1..0000000
--- a/roles/simulate-fabric/files/simulate-fabric-playbook.yml
+++ /dev/null
@@ -1,91 +0,0 @@
----
-- hosts: nova-compute-1
- remote_user: ubuntu
- become: yes
-
- tasks:
- - name: Include configuration vars
- include_vars: simulate-fabric-vars.yml
-
- - name: Install prerequisites
- apt:
- name={{ item }}
- update_cache=yes
- cache_valid_time=3600
- become: yes
- register: result
- until: result | success
- retries: 15
- delay: 60
- with_items:
- - bridge-utils
-
- - name: Create bridges
- when: "ansible_{{ item.name }} is not defined"
- command: brctl addbr "{{ item.name }}"
- with_items: "{{ simfabric_bridges }}"
-
- # note, not idempotent if failed between prior step and this step
- - name: Set IP addresses to bridges
- when: "ansible_{{ item.0.name }} is not defined"
- command: "ip addr add {{ item.1 }} dev {{ item.0.name }}"
- with_subelements:
- - "{{ simfabric_bridges }}"
- - addresses
-
- - name: Run setup again to obtain bridge info
- setup:
-
- - name: Start bridges
- when: "not ansible_{{ item.name }}.active"
- command: "ip link set dev {{ item.name }} up"
- with_items: "{{ simfabric_bridges }}"
-
- - name: Create ip links
- when: "ansible_{{ item.dev }} is not defined"
- command: "ip link add dev {{ item.dev }} address {{ item.mac }} type {{ item.type }} peer name {{ item.peer }}"
- with_items: "{{ simfabric_links }}"
-
- - name: Run setup again to obtain link info
- setup:
-
- - name: Start interfaces
- when: "not ansible_{{ item }}.active"
- command: "ip link set dev {{ item }} up"
- with_items:
- - "{{ simfabric_links | map(attribute='dev') | list }}"
- - "{{ simfabric_links | map(attribute='peer') | list }}"
-
- - name: Add interfaces to bridges
- when: "not item.1 in ansible_{{ item.0.name }}.interfaces"
- command: "brctl addif {{ item.0.name }} {{ item.1 }}"
- with_subelements:
- - "{{ simfabric_bridges }}"
- - interfaces
-
- - name: Check for iptables rule
- command: "iptables -t nat -C POSTROUTING -s 10.168.0.0/16 ! -d 10.168.0.0/16 -j MASQUERADE"
- register: iptables_check
- failed_when: "iptables_check|failed and 'No chain/target/match by that name' not in iptables_check.stderr"
- tags:
- - skip_ansible_lint # FIXME: should use iptables module when it supports inversion of ranges
-
- - name: Create iptables rule
- when: "iptables_check.rc != 0"
- command: "iptables -t nat -A POSTROUTING -s 10.168.0.0/16 ! -d 10.168.0.0/16 -j MASQUERADE"
-
-# the below will likely work when this pull makes it into ansible:
-# https://github.com/ansible/ansible-modules-extras/pull/1685
-# - name: Configure iptables
-# iptables: "table={{ item.table }} chain={{ item.chain }} source={{ item.source }} destination={{ item.dest }} jump={{ item.jump }}"
-# with_items: "{{ simfabric_iptables }}"
-
- - name: Set kernel sysctl values
- sysctl:
- name="{{ item.name }}"
- value="{{ item.value }}"
- sysctl_set=yes
- state=present
- reload=yes
- with_items: "{{ simfabric_sysctl }}"
-
diff --git a/roles/simulate-fabric/tasks/main.yml b/roles/simulate-fabric/tasks/main.yml
deleted file mode 100644
index 3f919ff..0000000
--- a/roles/simulate-fabric/tasks/main.yml
+++ /dev/null
@@ -1,18 +0,0 @@
----
-# simulate-fabric/tasks/main.yml
-
-- name: Create a vars file from template
- template:
- src=simulate-fabric-vars.yml.j2
- dest={{ ansible_user_dir }}/simulate-fabric-vars.yml
-
-- name: Copy over simulate-fabric ansible playbook
- copy:
- src=simulate-fabric-playbook.yml
- dest={{ ansible_user_dir }}/simulate-fabric-playbook.yml
-
-- name: Setup simulated fabric on nova-compute-1 using playbook
- command: ansible-playbook {{ ansible_user_dir }}/simulate-fabric-playbook.yml
- tags:
- - skip_ansible_lint # running a sub-job
-
diff --git a/roles/simulate-fabric/templates/simulate-fabric-vars.yml.j2 b/roles/simulate-fabric/templates/simulate-fabric-vars.yml.j2
deleted file mode 100644
index 0d183a2..0000000
--- a/roles/simulate-fabric/templates/simulate-fabric-vars.yml.j2
+++ /dev/null
@@ -1,14 +0,0 @@
----
-
-simfabric_bridges:
-{{ simfabric_bridges | to_nice_yaml }}
-
-simfabric_links:
-{{ simfabric_links | to_nice_yaml }}
-
-simfabric_iptables:
-{{ simfabric_iptables | to_nice_yaml }}
-
-simfabric_sysctl:
-{{ simfabric_sysctl | to_nice_yaml }}
-
diff --git a/roles/test-client-install/files/test-client-playbook.yml b/roles/test-client-install/files/test-client-playbook.yml
deleted file mode 100644
index c802a83..0000000
--- a/roles/test-client-install/files/test-client-playbook.yml
+++ /dev/null
@@ -1,48 +0,0 @@
----
-- hosts: nova-compute-1
- remote_user: ubuntu
-
- tasks:
- - name: Install software
- apt:
- name={{ item }}
- update_cache=yes
- cache_valid_time=3600
- become: yes
- register: result
- until: result | success
- retries: 15
- delay: 60
- with_items:
- - lxc
-
- # replaces: sudo sed -i 's/lxcbr0/databr/' /etc/lxc/default.conf
- - name: set lxc bridge interface to be databr
- become: yes
- lineinfile:
- dest: /etc/lxc/default.conf
- regexp: "^lxc.network.link ="
- line: "lxc.network.link = databr"
-
- - name: Create testclient
- become: yes
- shell: lxc-ls | grep testclient || lxc-create -t ubuntu -n testclient
- tags:
- - skip_ansible_lint # FIXME: should used lxc_container module
-
- - name: Start testclient
- become: yes
- shell: lxc-info -n testclient -s | grep RUNNING || lxc-start -n testclient
- tags:
- - skip_ansible_lint # FIXME: should used lxc_container module
-
- - name: Set up networking inside the testclient for testing sample CORD subscriber
- become: yes
- shell: "{{ item }}"
- with_items:
- - "lxc-attach -n testclient -- bash -c 'ip link show eth0.222 || ip link add link eth0 name eth0.222 type vlan id 222'"
- - "lxc-attach -n testclient -- bash -c 'ip link show eth0.222.111 || ip link add link eth0.222 name eth0.222.111 type vlan id 111'"
- - "lxc-attach -n testclient -- ifconfig eth0.222 up"
- - "lxc-attach -n testclient -- ifconfig eth0.222.111 up"
- tags:
- - skip_ansible_lint # non-trivial use case
diff --git a/roles/test-client-install/tasks/main.yml b/roles/test-client-install/tasks/main.yml
deleted file mode 100644
index fdf4eaf..0000000
--- a/roles/test-client-install/tasks/main.yml
+++ /dev/null
@@ -1,16 +0,0 @@
----
-# test-client-install/tasks/main.yml
-
-- name: Copy over test-client ansible playbook
- copy:
- src=test-client-playbook.yml
- dest={{ ansible_user_dir }}/test-client-playbook.yml
-
-- name: Run the test-client ansible playbook
- command: ansible-playbook {{ ansible_user_dir }}/test-client-playbook.yml
- async: 3600
- poll: 0
- register: test_client_playbook
- tags:
- - skip_ansible_lint # running a sub-job
-
diff --git a/roles/test-exampleservice/tasks/main.yml b/roles/test-exampleservice/tasks/main.yml
index 279a9d0..4cca9f5 100644
--- a/roles/test-exampleservice/tasks/main.yml
+++ b/roles/test-exampleservice/tasks/main.yml
@@ -40,7 +40,7 @@
- skip_ansible_lint # running a sub job
- name: Get public IP of VM
- shell: bash -c "source ~/admin-openrc.sh; nova interface-list {{ nova_id.stdout }}|grep -o -m 1 10.168.[[:digit:]]*.[[:digit:]]*"
+ shell: bash -c "source ~/admin-openrc.sh; nova interface-list {{ nova_id.stdout }}|grep -o -m 1 10.6.[[:digit:]]*.[[:digit:]]*"
register: public_ip
tags:
- skip_ansible_lint # running a sub job
@@ -61,12 +61,17 @@
- skip_ansible_lint # running a sub job
- name: Install curl in testclient
- command: ssh -l ubuntu {{ node_name.stdout }} "sudo lxc-attach -n testclient -- apt-get -y install curl"
+ become: yes
+ lxc_container:
+ name: testclient
+ container_command: apt-get -y install curl
tags:
- skip_ansible_lint # running a sub job
+# Don't use lxc_container in order to get output
- name: Test connectivity to ExampleService from test client
- command: ssh -l ubuntu {{ node_name.stdout }} "sudo lxc-attach -n testclient -- curl -s http://{{ public_ip.stdout }}"
+ become: yes
+ command: lxc-attach -n testclient -- curl -s http://{{ public_ip.stdout }}
register: curltest
tags:
- skip_ansible_lint # running a sub job
diff --git a/roles/test-vsg/defaults/main.yml b/roles/test-vsg/defaults/main.yml
new file mode 100644
index 0000000..45c23ec
--- /dev/null
+++ b/roles/test-vsg/defaults/main.yml
@@ -0,0 +1,4 @@
+---
+
+fabric_bridge_on_head_node: "virbr3"
+
diff --git a/roles/test-vsg/tasks/main.yml b/roles/test-vsg/tasks/main.yml
index 9eb08a9..10fa0f5 100644
--- a/roles/test-vsg/tasks/main.yml
+++ b/roles/test-vsg/tasks/main.yml
@@ -1,7 +1,7 @@
---
# test-vsg/tasks/main.yml
#
-# Run tests to check that the single-node deployment has worked
+# Run tests to check that the CORD-in-a-Box deployment has worked.
- name: Create a sample CORD subscriber
command: ansible xos-1 -u ubuntu -m shell \
@@ -54,16 +54,37 @@
tags:
- skip_ansible_lint # running a sub job
-- name: Run dhclient inside testclient to get IP address from vSG
- command: ssh -l ubuntu {{ node_name.stdout }} "sudo lxc-attach -n testclient -- dhclient eth0.222.111"
- tags:
- - skip_ansible_lint # running a sub job
+# Specifying this through container_config below was not working...
+- name: set lxc bridge interface
+ become: yes
+ lineinfile:
+ dest: /etc/lxc/default.conf
+ regexp: "^lxc.network.link ="
+ line: "lxc.network.link = {{ fabric_bridge_on_head_node }}"
+- name: Create testclient
+ become: yes
+ lxc_container:
+ name: testclient
+ container_log: true
+ template: ubuntu
+ state: started
+ template_options: --release trusty
+ container_command: |
+ ifdown eth0
+ sed -i 's/eth0 inet dhcp/eth0 inet manual/g' /etc/network/interfaces
+ ifup eth0
+ ip link show eth0.222 || ip link add link eth0 name eth0.222 type vlan id 222
+ ip link show eth0.222.111 || ip link add link eth0.222 name eth0.222.111 type vlan id 111
+ ifconfig eth0.222 up
+ ifconfig eth0.222.111 up
+ dhclient eth0.222.111
+
+# Don't use lxc_container so that we can get output
- name: Test external connectivity in test client
- command: ssh -l ubuntu {{ node_name.stdout }} "sudo lxc-attach -n testclient -- ping -c 3 8.8.8.8"
+ become: yes
+ command: lxc-attach -n testclient -- ping -c 3 8.8.8.8
register: pingtest
- tags:
- - skip_ansible_lint # running a sub job
- name: Output from ping test
debug: var=pingtest.stdout_lines
diff --git a/scripts/single-node-pod.sh b/scripts/single-node-pod.sh
deleted file mode 100755
index a7c7b1c..0000000
--- a/scripts/single-node-pod.sh
+++ /dev/null
@@ -1,146 +0,0 @@
-#!/usr/bin/env bash
-
-function cleanup_from_previous_test() {
- echo "## Cleanup ##"
-
- echo "Destroying juju environment"
- juju destroy-environment --force -y manual
-
- VMS=$( sudo uvt-kvm list )
- for VM in $VMS
- do
- echo "Destroying $VM"
- sudo uvt-kvm destroy $VM
- done
-
- echo "Cleaning up files"
- rm -rf ~/.juju
- rm -f ~/.ssh/known_hosts
- rm -rf ~/platform-install
- rm -rf ~/cord_apps
- rm -rf ~/.ansible_async
-
- echo "Cleaning up libvirt/dnsmasq"
- sudo rm -f /var/lib/libvirt/dnsmasq/xos-mgmtbr.leases
- sudo killall dnsmasq
- sudo service libvirt-bin restart
-}
-
-function bootstrap() {
- cd ~
- sudo apt-get update
- sudo apt-get -y install software-properties-common curl git tmux dnsutils python-netaddr python-dnspython
- sudo add-apt-repository -y ppa:ansible/ansible
- sudo apt-get update
- sudo apt-get install -y ansible
-
- [ -e ~/.ssh/id_rsa ] || ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa
- cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
-
- [ -d ~/platform-install ] || git clone -b $SETUP_BRANCH $SETUP_REPO_URL ~/platform-install
- cd ~/platform-install
-
- sed -i "s/replaceme/`whoami`/" $INVENTORY
-
- # Log into the local node once to get host key
- ssh -o StrictHostKeyChecking=no localhost "ls > /dev/null"
-}
-
-function setup_openstack() {
- cd ~/platform-install
-
- extra_vars="single_node_pod_script=true"
-
- if [[ "$XOS_REPO_URL" != "" ]]; then
- extra_vars="$extra_vars xos_repo_url=$XOS_REPO_URL"
- fi
- if [[ "$XOS_BRANCH" != "" ]]; then
- extra_vars="$extra_vars xos_repo_branch=$XOS_BRANCH"
- fi
-
- # check if running on cloudlab
- if [[ -x /usr/testbed/bin/mkextrafs ]]
- then
- extra_vars="$extra_vars on_cloudlab=True"
- fi
-
- ansible-playbook -i $INVENTORY cord-single-playbook.yml --extra-vars="$extra_vars"
-}
-
-function run_e2e_test () {
- ansible-playbook -i $INVENTORY cord-post-deploy-playbook.yml
-}
-
-function run_diagnostics() {
- echo "*** COLLECTING DIAGNOSTIC INFO - check ~/diag-* on the head node"
- ansible-playbook -i $INVENTORY cord-diag-playbook.yml
-}
-
-# Parse options
-RUN_TEST=0
-SETUP_BRANCH="master"
-SETUP_REPO_URL="https://github.com/opencord/platform-install"
-INVENTORY="inventory/single-localhost"
-DIAGNOSTICS=1
-CLEANUP=0
-
-while getopts "b:cdehi:p:r:ts:" opt; do
- case ${opt} in
- b ) XOS_BRANCH=$OPTARG
- ;;
- c ) CLEANUP=1
- ;;
- d ) DIAGNOSTICS=0
- ;;
- h ) echo "Usage:"
- echo " $0 install OpenStack and prep XOS and ONOS VMs [default]"
- echo " $0 -b <branch> checkout <branch> of the xos git repo"
- echo " $0 -c cleanup from previous test"
- echo " $0 -d don't run diagnostic collector"
- echo " $0 -h display this help message"
- echo " $0 -i <inv_file> specify an inventory file (default is inventory/single-localhost)"
- echo " $0 -p <git_url> use <git_url> to obtain the platform-install git repo"
- echo " $0 -r <git_url> use <git_url> to obtain the xos git repo"
- echo " $0 -s <branch> checkout <branch> of the platform-install git repo"
- echo " $0 -t do install, bring up cord-pod configuration, run E2E test"
- exit 0
- ;;
- i ) INVENTORY=$OPTARG
- ;;
- p ) SETUP_REPO_URL=$OPTARG
- ;;
- r ) XOS_REPO_URL=$OPTARG
- ;;
- t ) RUN_TEST=1
- ;;
- s ) SETUP_BRANCH=$OPTARG
- ;;
- \? ) echo "Invalid option: -$OPTARG"
- exit 1
- ;;
- esac
-done
-
-# What to do
-if [[ $CLEANUP -eq 1 ]]
-then
- cleanup_from_previous_test
-fi
-
-set -e
-
-bootstrap
-setup_openstack
-
-if [[ $RUN_TEST -eq 1 ]]
-then
- run_e2e_test
-fi
-
-if [[ $DIAGNOSTICS -eq 1 ]]
-then
- run_diagnostics
-fi
-
-exit 0
-