Skip to content

Commit 9117c45

Browse files
committed
Resolve some issues about ansible scripts
1. Update README.md 2. More flexible HOME_LOCATION in ansible 3. Add some "automatic yes" in install.sh
1 parent 620db0b commit 9117c45

7 files changed

Lines changed: 38 additions & 14 deletions

File tree

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ Feature
1111

1212
Build OpenNet on your own - Use install.sh
1313
------------------------------------------
14-
Support Ubuntu 14.04.1
14+
Supports Ubuntu 14.04.1
1515

1616
$ git clone https://github.com/dlinknctu/OpenNet.git
17-
$ sudo ./install.sh -a
17+
$ cd OpenNet
18+
$ sudo ./configure.sh
19+
$ sudo ./install.sh master
1820
After a successful installation, the script will show "OpenNet installation complete."
1921

2022
Run OpenNet
@@ -26,6 +28,8 @@ Please try following commands to run the simulation:
2628
# cd $ROOT_PATH/mininet/examples/opennet
2729
# python wifiroaming.py
2830

31+
Do not add "sudo" at the head of the third line.
32+
2933
Run NetAnim
3034
-----------
3135
Use NetAnim to open the XML file in the directory /tmp/xml.

ansible/group_vars/all

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ NS3_VERSION: 3.22
55
PYGCCXML_VERSION: 1.0.0
66
NETANIM_VERSION: 3.105
77
temp_location: "/tmp"
8-
home_location: "/root/opennet"

ansible/roles/apt/tasks/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,5 @@
4444
- uuid-runtime
4545
- qt4-dev-tools
4646
- python-networkx
47-
tags: apt
47+
- librdmacm-dev
48+
tags: apt

ansible/roles/help/templates/help.txt.j2

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ OpenNet installation complete.
33
Before using OpenNet, you need to prepare SDN controller by yourself.
44
=======================================================================
55
Please try following commands to run the simulation
6-
$ ./waf_shell.sh
7-
$ cd {{ home_location }}/mininet/examples/opennet
8-
$ python wifiroaming.py
6+
$ sudo ./waf_shell.sh
7+
# cd {{ home_location }}/mininet/examples/opennet
8+
# python wifiroaming.py
99

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/sh
22
cd "{{ home_location }}/ns-allinone-{{ NS3_VERSION }}/ns-{{ NS3_VERSION }}"
3-
./waf shell
3+
./waf shell

configure.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
# This script can help users to configure the /etc/hosts file
4+
# Currently only support local installation
5+
6+
set -e
7+
HOSTS_COMMENT='# The following lines are desirable for OpenNet'
8+
FIRST_LOCAL_IP=`ifconfig | grep inet | awk 'NR==1 {gsub("addr:","",$2); print $2}'`
9+
10+
function LOCAL_INSTALL {
11+
echo >> /etc/hosts
12+
echo "$HOSTS_COMMENT" >> /etc/hosts
13+
echo "$FIRST_LOCAL_IP master" >> /etc/hosts
14+
}
15+
16+
if [ $# -eq 0 ]; then
17+
LOCAL_INSTALL
18+
exit
19+
fi

install.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
#!/bin/bash
22

33
set -e
4-
PWD=$(pwd)
5-
OPENNET_PATH=$HOME/opennet
4+
OPENNET_PATH=$PWD
65
ANSIBLE_PATH=$OPENNET_PATH/ansible
76
USERDIR=$HOME/.ssh
87
user=$(whoami)
98

109
function Install_Ansible {
1110

1211
apt-get update
13-
apt-get install software-properties-common
14-
apt-add-repository ppa:ansible/ansible
12+
apt-get install -y software-properties-common
13+
apt-add-repository -y ppa:ansible/ansible
1514
apt-get update
16-
apt-get install ansible
15+
apt-get install -y ansible
1716

1817
}
1918

@@ -32,6 +31,7 @@ function SSH_Config_Setup {
3231
fi
3332
for host in $hosts; do
3433
echo "***copying public key to $host"
34+
ssh-keyscan -H $host >> ~/.ssh/known_hosts
3535
ssh-copy-id -i $USERDIR/cluster_key.pub $user@$host &> /dev/null
3636
echo "***copying key pair to remote host"
3737
scp $USERDIR/{cluster_key,cluster_key.pub,config} $user@$host:$USERDIR
@@ -80,6 +80,7 @@ function Test_Network {
8080
function Install_OpenNet {
8181

8282
cd $ANSIBLE_PATH
83+
echo "home_location: \"$OPENNET_PATH\"\n" >> group_vars/all
8384
ansible-playbook playbook.yml
8485

8586
}
@@ -125,4 +126,4 @@ SSH_Config_Setup
125126
SSH_Daemon_Setup
126127
Test_Network
127128
Install_OpenNet
128-
cat opennet_help.txt
129+
cat $OPENNET_PATH/opennet_help.txt

0 commit comments

Comments
 (0)