Skip to content

Commit 620db0b

Browse files
committed
Ansible Ready
1. Use Ansible DSL 2. Design folder structure 3. Support opennet-master and opennet-slave 4. Roles - apt - ez_setup - ntp - pygccxml - gccxml - openvswitch - ns3 - netanim - dlinknctu-mininet - help
1 parent 7dafbe4 commit 620db0b

20 files changed

Lines changed: 565 additions & 257 deletions

File tree

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ openvswitch-*
33
ns-allinone-*/*
44
openflow/*
55
mininet/*
6-
pygccxml*
6+
pygccxml/*
77
gccxml/*
88
.idea/*
99
*.ropeproject*
1010
*.tar.bz2
1111
*.zip
1212
*.deb
1313
waf_shell.sh
14-
14+
opennet_help.txt

ansible/ansible.cfg

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[defaults]
2+
hostfile = hosts
3+
remote_user = root
4+
forks = 5
5+
log_path = /var/log/ansible.log
6+
private_key_file = ~/.ssh/cluster_key
7+
8+
# uncomment this to disable SSH key host checking
9+
host_key_checking=False

ansible/group_vars/all

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
OVS_VERSION: 2.4.0
3+
MININET_VERSION: 2.2.1
4+
NS3_VERSION: 3.22
5+
PYGCCXML_VERSION: 1.0.0
6+
NETANIM_VERSION: 3.105
7+
temp_location: "/tmp"
8+
home_location: "/root/opennet"

ansible/hosts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[opennet-master]
2+
master ansible_ssh_user=root
3+
4+
#[opennet-slave]
5+
#slave1 ansible_ssh_user=root

ansible/playbook.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
- hosts: all
3+
remote_user: root
4+
any_errors_fatal: true
5+
vars_files:
6+
- group_vars/all
7+
roles:
8+
- apt
9+
- ez_setup
10+
- ntp
11+
- openvswitch
12+
- qperf
13+
14+
- hosts: opennet-slave
15+
remote_user: root
16+
any_errors_fatal: true
17+
vars_files:
18+
- group_vars/all
19+
roles:
20+
- dlinknctu-mininet
21+
22+
- hosts: opennet-master
23+
remote_user: root
24+
any_errors_fatal: true
25+
vars_files:
26+
- group_vars/all
27+
roles:
28+
- pygccxml
29+
- gccxml
30+
- ns3
31+
- netanim
32+
- dlinknctu-mininet
33+
- help

ansible/roles/apt/tasks/main.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
- name: Replace APT source list
3+
replace:
4+
dest=/etc/apt/sources.list
5+
regexp=us.archive.ubuntu.com
6+
replace=ubuntu.cs.nctu.edu.tw
7+
backup=yes
8+
tags: apt
9+
- name: Update APT Cache
10+
apt: update_cache=yes
11+
tags: apt
12+
- name: Install required package
13+
apt: name={{ item }} state=present
14+
with_items:
15+
- vim
16+
- tmux
17+
- git
18+
- htop
19+
- gcc
20+
- g++
21+
- python
22+
- python-dev
23+
- make
24+
- cmake
25+
- gcc-4.8-multilib
26+
- g++-4.8-multilib
27+
- python-setuptools
28+
- unzip
29+
- curl
30+
- build-essential
31+
- debhelper
32+
- autoconf
33+
- automake
34+
- patch
35+
- dpkg-dev
36+
- libssl-dev
37+
- libncurses5-dev
38+
- libpcre3-dev
39+
- graphviz
40+
- python-all
41+
- python-qt4
42+
- python-zopeinterface
43+
- python-twisted-conch
44+
- uuid-runtime
45+
- qt4-dev-tools
46+
- python-networkx
47+
tags: apt
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
- name: Set dlinknctu-mininet
2+
set_fact:
3+
mininet_repos: "https://github.com/dlinknctu/mininet.git"
4+
mininet_dir_path: "{{ home_location }}/mininet"
5+
tags: mininet
6+
- name: Clone dlinknctu-mininet
7+
git:
8+
repo: "{{ mininet_repos }}"
9+
dest: "{{ mininet_dir_path }}"
10+
update: no
11+
accept_hostkey: true
12+
version: "opennet"
13+
tags: mininet
14+
- name: Add exmaples from OpenNet
15+
copy:
16+
src: "{{ home_location }}/mininet-patch/examples/"
17+
dest: "{{ home_location }}/mininet/examples/"
18+
tags: mininet
19+
- name: Add new module from OpenNet
20+
copy:
21+
src: "{{ home_location }}/mininet-patch/mininet/"
22+
dest: "{{ home_location }}/mininet/mininet"
23+
tags: mininet
24+
- name: Install dlinknctu-mininet
25+
command: "./util/install.sh -n"
26+
args:
27+
chdir: "{{ home_location }}/mininet"
28+
poll: 0
29+
retries: 3
30+
tags: mininet
31+
- name: Check mininet version
32+
command: "mn --version"
33+
register: mn_version
34+
tags: mininet
35+
- debug: msg="Mininet Version {{ mn_version.stdout }}"
36+
tags: mininet
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
- name: Set ez_setup
3+
set_fact:
4+
ez_setup_url: "https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py"
5+
file_path: "/tmp"
6+
tags: ez_setup
7+
- name: Download ez_setup.py
8+
get_url:
9+
url: "{{ ez_setup_url }}"
10+
dest: "{{ file_path }}"
11+
tags: ez_setup
12+
- name: Install ez_setup.py
13+
command: "python ez_setup.py"
14+
args:
15+
chdir: "{{ file_path }}"
16+
register: gg
17+
tags: ez_setup
18+
- name: Remove ez_setup source code
19+
command: "rm ez_setup.py"
20+
args:
21+
chdir: "{{ file_path }}"
22+
tags: ez_setup
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
- name: Set gccxml
3+
set_fact:
4+
gccxml_repos: "https://github.com/gccxml/gccxml.git"
5+
gccxml_dir_path: "{{ temp_location }}/gccxml"
6+
tags: gccxml
7+
- name: Clone gccxml
8+
git:
9+
repo: "{{ gccxml_repos }}"
10+
dest: "{{ gccxml_dir_path }}"
11+
update: no
12+
accept_hostkey: true
13+
tags: gccxml
14+
- name: Create gccxml-build directory
15+
file:
16+
path: "{{ gccxml_dir_path }}/gccxml-build"
17+
state: directory
18+
tags: gccxml
19+
- name: cmake gccxml
20+
command: "cmake ../"
21+
args:
22+
chdir: "{{ gccxml_dir_path }}/gccxml-build"
23+
tags: gccxml
24+
- name: make gccxml
25+
command: "make"
26+
args:
27+
chdir: "{{ gccxml_dir_path }}/gccxml-build"
28+
tags: gccxml
29+
- name: make install gccxml
30+
command: "make install"
31+
args:
32+
chdir: "{{ gccxml_dir_path }}/gccxml-build"
33+
tags: gccxml
34+
- name: Create gccxml link from /usr/local/bin/gccxml /bin/gccxml
35+
file:
36+
src: "/usr/local/bin/gccxml"
37+
dest: "/bin/gccxml"
38+
state: link
39+
tags: gccxml
40+
- name: Remove gccxml source code
41+
file:
42+
path: "{{ gccxml_dir_path }}"
43+
state: absent
44+
tags: gccxml

ansible/roles/help/tasks/main.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
- name: Create help
3+
template:
4+
src: "help.txt.j2"
5+
dest: "{{ home_location }}/opennet_help.txt"
6+
mode: 0444
7+
tags: help

0 commit comments

Comments
 (0)