Committed by
Gerrit Code Review
Vagrant box for development use.
vagrant up onosdev sets up a vm with three lxc instances which should be used with the lxc cell. Change-Id: I18b5cc5366efc61f05063798b498559eb49a8eff
Showing
17 changed files
with
308 additions
and
0 deletions
tools/dev/vagrant/Vagrantfile
0 → 100644
1 | +# -*- mode: ruby -*- | ||
2 | +# vi: set ft=ruby : | ||
3 | + | ||
4 | +Vagrant.configure(2) do |config| | ||
5 | + | ||
6 | + if (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil | ||
7 | + config.vm.synced_folder ".", "/vagrant", mount_options: ["dmode=700,fmode=600"] | ||
8 | + else | ||
9 | + config.vm.synced_folder ".", "/vagrant" | ||
10 | + end | ||
11 | + | ||
12 | + config.vm.define "onosdev" do |d| | ||
13 | + d.vm.box = "ubuntu/trusty64" | ||
14 | + d.vm.hostname = "onosdev" | ||
15 | + d.vm.network "private_network", ip: "10.100.198.200" | ||
16 | + d.vm.provision :shell, path: "scripts/bootstrap_ansible.sh" | ||
17 | + d.vm.provision :shell, inline: "PYTHONUNBUFFERED=1 ansible-playbook /vagrant/ansible/onosdev.yml -c local" | ||
18 | + d.vm.provider "virtualbox" do |v| | ||
19 | + v.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"] | ||
20 | + v.memory = 8192 | ||
21 | + v.cpus = 2 | ||
22 | + end | ||
23 | + end | ||
24 | +end |
tools/dev/vagrant/ansible/ansible.cfg
0 → 100644
tools/dev/vagrant/ansible/onosdev.retry
0 → 100644
1 | +localhost |
tools/dev/vagrant/ansible/onosdev.yml
0 → 100644
1 | +- name: Bridge onosbr0 is present | ||
2 | + become: yes | ||
3 | + template: | ||
4 | + src: templates/create_bridge.j2 | ||
5 | + dest: /etc/network/if-pre-up.d/create_bridge_{{ networks.bridge_name }} | ||
6 | + owner: root | ||
7 | + group: root | ||
8 | + mode: 0755 | ||
9 | + | ||
10 | +- name: eth1 is in onosbr0 | ||
11 | + become: yes | ||
12 | + template: | ||
13 | + src: templates/add_iface.j2 | ||
14 | + dest: /etc/network/if-pre-up.d/add_iface_{{ interfaces.hostonly }} | ||
15 | + owner: root | ||
16 | + group: root | ||
17 | + mode: 0755 | ||
18 | + | ||
19 | +- name: Activate onos bridge | ||
20 | + become: yes | ||
21 | + command: /etc/network/if-pre-up.d/create_bridge_{{ networks.bridge_name }} report-changed | ||
22 | + register: bridge_changed | ||
23 | + changed_when: bridge_changed.stdout == 'true' | ||
24 | + | ||
25 | +- name: Activate eth1 in bridge | ||
26 | + become: yes | ||
27 | + command: /etc/network/if-pre-up.d/add_iface_{{ interfaces.hostonly }} report-changed | ||
28 | + register: bridge_iface_changed | ||
29 | + changed_when: bridge_iface_changed == 'true' | ||
30 | + | ||
31 | +- name: Flush ip of eth1 | ||
32 | + become: yes | ||
33 | + command: /sbin/ip addr flush {{ interfaces.hostonly }} | ||
34 | + | ||
35 | +- name: bring onosbr0 up | ||
36 | + become: yes | ||
37 | + command: /sbin/ifconfig onosbr0 up |
1 | +#!/bin/bash | ||
2 | + | ||
3 | +REPORT_CHANGED=0 | ||
4 | +if [ $# -gt 0 ]; then | ||
5 | + REPORT_CHANGED=1 | ||
6 | +fi | ||
7 | +CHANGED='false' | ||
8 | + | ||
9 | +FOUND=$(brctl show | grep "^{{ interfaces.hostonly }}" | wc -l) | ||
10 | +if [ $FOUND -eq 0 ]; then | ||
11 | + CHANGED='true' | ||
12 | + brctl addif {{ networks.bridge_name }} {{ interfaces.hostonly }} | ||
13 | +fi | ||
14 | + | ||
15 | +if [ $REPORT_CHANGED -ne 0 ]; then | ||
16 | + echo -n $CHANGED | ||
17 | +fi |
1 | +#!/bin/bash | ||
2 | + | ||
3 | +REPORT_CHANGED=0 | ||
4 | +if [ $# -gt 0 ]; then | ||
5 | + REPORT_CHANGED=1 | ||
6 | +fi | ||
7 | +CHANGED='false' | ||
8 | + | ||
9 | +FOUND=$(brctl show | grep "^{{ networks.bridge_name }}" | wc -l) | ||
10 | +if [ $FOUND -eq 0 ]; then | ||
11 | + CHANGED='true' | ||
12 | + brctl addbr {{ networks.bridge_name }} | ||
13 | +fi | ||
14 | + | ||
15 | +if [ $REPORT_CHANGED -ne 0 ]; then | ||
16 | + echo -n $CHANGED | ||
17 | +fi |
1 | +interfaces: | ||
2 | + hostonly: "{{ hostonly_iface | default('eth1') }}" | ||
3 | + | ||
4 | +networks: | ||
5 | + # CHANGE: | ||
6 | + # 'bridge' name of the bridge to create that is used when connecting | ||
7 | + # the LXC containers | ||
8 | + bridge_name: "{{ bridge_name | default('onosbr0') }}" | ||
9 | + bridge: "{{ bridge_network | default('10.100.198.200/24') }}" |
1 | +- name: bridge-utils is present | ||
2 | + apt: | ||
3 | + name: bridge-utils | ||
4 | + force: yes | ||
5 | + tags: [common] | ||
6 | + | ||
7 | +- name: lxc is present | ||
8 | + apt: | ||
9 | + name: lxc | ||
10 | + force: yes | ||
11 | + tags: [common] | ||
12 | + | ||
13 | +- name: python-dev is present | ||
14 | + apt: | ||
15 | + name: python-dev | ||
16 | + force: yes | ||
17 | + tags: [common] | ||
18 | + | ||
19 | +- name: lxc-dev is present | ||
20 | + apt: | ||
21 | + name: lxc-dev | ||
22 | + force: yes | ||
23 | + tags: [common] | ||
24 | + | ||
25 | +- name: python-pip is present | ||
26 | + apt: | ||
27 | + name: python-pip | ||
28 | + force: yes | ||
29 | + tags: [common] | ||
30 | + | ||
31 | +- name: python3-lxc is present | ||
32 | + pip: | ||
33 | + name: lxc-python2 | ||
34 | + state: present | ||
35 | + tags: [common] | ||
36 | +- name: Host is present | ||
37 | + lineinfile: | ||
38 | + dest: /etc/hosts | ||
39 | + regexp: "^{{ item.host_ip }}" | ||
40 | + line: "{{ item.host_ip }} {{ item.host_name }}" | ||
41 | + with_items: hosts | ||
42 | + tags: [common] |
1 | +--- | ||
2 | +galaxy_info: | ||
3 | + author: Ciena Blueplanet | ||
4 | + description: Java 8 from Oracle | ||
5 | + company: Ciena Blueplanet | ||
6 | + license: Apache 2.0 | ||
7 | + min_ansible_version: 2.0 | ||
8 | + platforms: | ||
9 | + - name: Ubuntu | ||
10 | + versions: | ||
11 | + - trusty | ||
12 | + galaxy_tags: | ||
13 | + - development | ||
14 | + - system | ||
15 | +dependencies: [] |
1 | +--- | ||
2 | +- name: Install add-apt-repostory | ||
3 | + become: yes | ||
4 | + apt: name=software-properties-common state=latest update_cache=yes | ||
5 | + | ||
6 | +- name: Add Oracle Java Repository | ||
7 | + become: yes | ||
8 | + apt_repository: repo='ppa:webupd8team/java' | ||
9 | + | ||
10 | +- name: Accept Java 8 License | ||
11 | + become: yes | ||
12 | + debconf: name='oracle-java8-installer' question='shared/accepted-oracle-license-v1-1' value='true' vtype='select' | ||
13 | + | ||
14 | +- name: Install Oracle Java 8 | ||
15 | + become: yes | ||
16 | + apt: name={{item}} state=latest | ||
17 | + with_items: | ||
18 | + - oracle-java8-installer | ||
19 | + - ca-certificates | ||
20 | + - oracle-java8-set-default |
1 | +ubuntu ALL=(ALL:ALL) NOPASSWD:ALL |
1 | +lxc.mount.entry = /usr/lib/jvm/java-8-oracle usr/lib/jvm/java none bind,create=dir 0 0 | ||
2 | + | ||
3 | +lxc.network.type = veth | ||
4 | +lxc.network.link = lxcbr0 | ||
5 | +lxc.network.flags = up | ||
6 | +lxc.network.name = eth0 | ||
7 | + | ||
8 | +lxc.network.type = veth | ||
9 | +lxc.network.link = onosbr0 | ||
10 | +lxc.network.flags = up | ||
11 | +lxc.network.name = eth1 |
1 | +- name: Remove lxc default config | ||
2 | + become: yes | ||
3 | + file: path=/etc/lxc/default.conf state=absent | ||
4 | + | ||
5 | +- name: Copy default lxc file | ||
6 | + become: yes | ||
7 | + copy: | ||
8 | + src: files/default.conf | ||
9 | + dest: /etc/lxc/default.conf | ||
10 | + mode: 644 | ||
11 | + | ||
12 | +- name: Create onos1 container | ||
13 | + lxc_container: | ||
14 | + name: onos1 | ||
15 | + container_log: true | ||
16 | + template: ubuntu | ||
17 | + state: started | ||
18 | + template_options: --release trusty | ||
19 | + container_config: | ||
20 | + - "lxc.network.ipv4=10.100.198.201/24" | ||
21 | + container_command: | | ||
22 | + ln -s /usr/lib/jvm/java/bin/java /usr/bin/java | ||
23 | + apt-get update | ||
24 | + apt-get install -y openssh-server | ||
25 | + echo "ubuntu ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers.d/99-onos-sudoers | ||
26 | + | ||
27 | +- name: Create onos2 container | ||
28 | + lxc_container: | ||
29 | + name: onos2 | ||
30 | + container_log: true | ||
31 | + template: ubuntu | ||
32 | + state: started | ||
33 | + template_options: --release trusty | ||
34 | + container_config: | ||
35 | + - "lxc.network.ipv4=10.100.198.202/24" | ||
36 | + container_command: | | ||
37 | + ln -s /usr/lib/jvm/java/bin/java /usr/bin/java | ||
38 | + apt-get update | ||
39 | + apt-get install -y openssh-server | ||
40 | + echo "ubuntu ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers.d/99-onos-sudoers | ||
41 | + | ||
42 | +- name: Create onos3 container | ||
43 | + lxc_container: | ||
44 | + name: onos3 | ||
45 | + container_log: true | ||
46 | + template: ubuntu | ||
47 | + state: started | ||
48 | + template_options: --release trusty | ||
49 | + container_config: | ||
50 | + - "lxc.network.ipv4=10.100.198.203/24" | ||
51 | + container_command: | | ||
52 | + ln -s /usr/lib/jvm/java/bin/java /usr/bin/java | ||
53 | + apt-get update | ||
54 | + apt-get install -y openssh-server | ||
55 | + echo "ubuntu ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers.d/99-onos-sudoers |
1 | +#!/bin/bash | ||
2 | +# | ||
3 | +# Copyright 2012 the original author or authors. | ||
4 | +# | ||
5 | +# Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | +# you may not use this file except in compliance with the License. | ||
7 | +# You may obtain a copy of the License at | ||
8 | +# | ||
9 | +# http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | +# | ||
11 | +# Unless required by applicable law or agreed to in writing, software | ||
12 | +# distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | +# See the License for the specific language governing permissions and | ||
15 | +# limitations under the License. | ||
16 | +# | ||
17 | + | ||
18 | +set -e | ||
19 | + | ||
20 | +echo "Installing Ansible..." | ||
21 | +apt-get install -y software-properties-common ca-certificates | ||
22 | +apt-add-repository ppa:ansible/ansible | ||
23 | +apt-get update | ||
24 | +apt-get install -y ansible | ||
25 | +cp /vagrant/ansible/ansible.cfg /etc/ansible/ansible.cfg |
tools/test/cells/lxc
0 → 100644
1 | +export OCI=10.100.198.201 | ||
2 | +export OC1=10.100.198.201 | ||
3 | +export OC2=10.100.198.202 | ||
4 | +export OC3=10.100.198.203 | ||
5 | +export ONOS_APPS=drivers,openflow,proxyarp | ||
6 | +export ONOS_NIC=10.100.198.* | ||
7 | +export ONOS_SCENARIOS=$HOME/work/onos-next/tools/test/scenarios | ||
8 | +export ONOS_USER=ubuntu | ||
9 | +export ONOS_GROUP=ubuntu | ||
10 | +export ONOS_WEB_PASS=rocks | ||
11 | +export ONOS_WEB_USER=onos |
-
Please register or login to post a comment