summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuo Ruijing <ruijing.guo@intel.com>2016-05-31 13:37:01 +0800
committerGuo Ruijing <ruijing.guo@intel.com>2016-05-31 13:37:52 +0800
commit37cc96b2fabc42931a4969cd4992af44054fd0f7 (patch)
treea872852ea447b422838f38bc2def03817f9cb798
parent10894a064c73b9d06cd340bdd21c5f947ecfb349 (diff)
Add Fuel OVS plugin demo script
Change-Id: I558e8ade392f7649ca938f8eb841de285b69bf6b Signed-off-by: Guo Ruijing <ruijing.guo@intel.com>
Notes
Notes (review): Code-Review+2: Ruijing <ruijing.guo@intel.com> Workflow+1: Ruijing <ruijing.guo@intel.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Tue, 31 May 2016 05:38:14 +0000 Reviewed-on: https://review.openstack.org/323127 Project: openstack/fuel-plugin-ovs Branch: refs/heads/master
-rwxr-xr-xdemo/01_setup_network.sh64
-rwxr-xr-xdemo/02_install_packages.sh28
-rwxr-xr-xdemo/03_setup_vnc.sh25
-rwxr-xr-xdemo/04_setup_fuel.sh69
-rwxr-xr-xdemo/05_destroy_fuel.sh13
-rw-r--r--demo/README.md42
-rw-r--r--demo/fuel-master.xml94
-rw-r--r--demo/fuel-slave.xml92
8 files changed, 427 insertions, 0 deletions
diff --git a/demo/01_setup_network.sh b/demo/01_setup_network.sh
new file mode 100755
index 0000000..694eca2
--- /dev/null
+++ b/demo/01_setup_network.sh
@@ -0,0 +1,64 @@
1#!/bin/sh
2HTTP_PROXY=http://10.19.8.225:911
3DNS_SERVER=10.248.2.1
4SOCK5_IP=10.7.211.16
5SOCK5_PORT=1080
6
7cat <<EOF | sudo tee /etc/apt/apt.conf
8Acquire::http::Proxy "$HTTP_PROXY";
9EOF
10
11sudo apt-get update -y
12sudo apt-get install redsocks -y
13
14cat <<EOF | sudo tee /etc/redsocks.conf
15base {
16 log_debug = on;
17 log_info = on;
18 log = "file:/root/proxy.log";
19 daemon = on;
20 redirector = iptables;
21}
22
23redsocks {
24 local_ip = 0.0.0.0;
25 local_port = 6666;
26 ip = $SOCK5_IP;
27 port = $SOCK5_PORT;
28 type = socks5;
29}
30
31EOF
32
33sudo apt-get install iptables -y
34
35echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
36
37sudo iptables -t filter -F
38sudo iptables -t mangle -F
39sudo iptables -t nat -F
40
41#DNS DNAT
42sudo iptables -t nat -A PREROUTING -p udp --dport 53 -j DNAT --to-destination $DNS_SERVER
43
44#NTP DNAT
45sudo iptables -t nat -A PREROUTING -p udp --dport 123 -j DNAT --to-destination 10.20.0.1
46
47sudo iptables -t nat -A POSTROUTING -s 10.20.0.0/24 -j MASQUERADE
48sudo iptables -t nat -A POSTROUTING -s 172.16.0.0/24 -j MASQUERADE
49
50sudo iptables -t nat -N REDSOCKS
51sudo iptables -t nat -A REDSOCKS -d 0.0.0.0/8 -j RETURN
52sudo iptables -t nat -A REDSOCKS -d 10.0.0.0/8 -j RETURN
53sudo iptables -t nat -A REDSOCKS -d 127.0.0.0/8 -j RETURN
54sudo iptables -t nat -A REDSOCKS -d 169.254.0.0/16 -j RETURN
55sudo iptables -t nat -A REDSOCKS -d 172.16.0.0/12 -j RETURN
56sudo iptables -t nat -A REDSOCKS -d 192.168.0.0/16 -j RETURN
57sudo iptables -t nat -A REDSOCKS -d 224.0.0.0/4 -j RETURN
58sudo iptables -t nat -A REDSOCKS -d 240.0.0.0/4 -j RETURN
59sudo iptables -t nat -A REDSOCKS -p tcp -j REDIRECT --to-ports 6666
60sudo iptables -t nat -A REDSOCKS -p udp -j REDIRECT --to-ports 9999
61sudo iptables -t nat -A OUTPUT -p tcp -j REDSOCKS
62sudo iptables -t nat -A PREROUTING -p tcp -j REDSOCKS
63
64sudo service redsocks restart
diff --git a/demo/02_install_packages.sh b/demo/02_install_packages.sh
new file mode 100755
index 0000000..d523305
--- /dev/null
+++ b/demo/02_install_packages.sh
@@ -0,0 +1,28 @@
1#!/bin/sh
2
3cat << EOF | sudo tee /etc/sudoers.d/fuel
4fuel ALL = (root) NOPASSWD:ALL
5EOF
6
7sudo apt-get update -y
8sudo apt-get install openssh-server -y
9sudo apt-get autoremove gnome-settings-daemon-schemas -y
10sudo apt-get autoremove libmetacity-private0a metacity-common -y
11sudo apt-get install gnome-session gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal -y
12sudo apt-get install virt-manager libvirt-bin qemu-system -y
13sudo virsh net-destroy default
14sudo virsh net-undefine default
15sudo rm -rf /etc/libvirt/qemu/networks/autostart/default.xml
16sudo service libvirt-bin restart
17sudo ifconfig virbr0 down
18sudo brctl delbr virbr0
19sudo apt-get install putty-tools -y
20sudo service ntp stop
21sudo apt-get autoremove ntp -y
22sudo rm -rf /etc/ntp.conf.dpkg-old
23sudo rm -rf /etc/ntp.conf
24sudo apt-get install ntp -y --force-yes
25sudo bash -c 'cat << EOF >> /etc/ntp.conf
26server 127.127.1.0
27fudge 127.127.1.0 stratum 10
28EOF'
diff --git a/demo/03_setup_vnc.sh b/demo/03_setup_vnc.sh
new file mode 100755
index 0000000..46fc7ce
--- /dev/null
+++ b/demo/03_setup_vnc.sh
@@ -0,0 +1,25 @@
1#!/bin/sh
2rm -rf ~/.vnc; mkdir ~/.vnc
3echo "123456\n123456\n" | vncpasswd
4
5cat << EOF > ~/.vnc/xstartup
6#!/bin/bash
7DESK_TYPE=gnome
8export XKL_XMODMAP_DISABLE=1
9unset SESSION_MANAGER
10unset DBUS_SESSION_BUS_ADDRESS
11[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
12xsetroot -solid grey
13vncconfig -iconic &
14vncconfig -nowin &
15gnome-session &
16gnome-panel &
17gnome-settings-daemon &
18metacity &
19nautilus -n &
20gnome-terminal &
21EOF
22
23chmod 755 ~/.vnc/xstartup
24vnc4server -geometry 1650x950 -depth 16 &
25echo "vnc password is 123456"
diff --git a/demo/04_setup_fuel.sh b/demo/04_setup_fuel.sh
new file mode 100755
index 0000000..acb884c
--- /dev/null
+++ b/demo/04_setup_fuel.sh
@@ -0,0 +1,69 @@
1#!/bin/bash
2
3#setup ntp server
4sudo service ntp restart
5
6#setup network
7
8sudo ifconfig br-eth0 down
9sudo brctl delbr br-eth0
10sudo brctl addbr br-eth0
11sudo ifconfig br-eth0 10.20.0.1/24 up
12
13sudo ifconfig br-eth1 down
14sudo brctl delbr br-eth1
15sudo brctl addbr br-eth1
16sudo ifconfig br-eth1 172.16.0.1/24 up
17
18sudo ifconfig br-dpdk down
19sudo brctl delbr br-dpdk
20sudo brctl addbr br-dpdk
21
22#setup master
23
24sudo virt-manager
25sudo virsh destroy fuel-master
26sudo rm -rf /var/lib/libvirt/images/fuel-master.img
27sudo qemu-img create -f qcow2 /var/lib/libvirt/images/fuel-master.img 200G
28
29mkdir -p vms
30
31iso=`pwd`/`ls *.iso`
32sed "s~ISO_FILE~$iso~g" fuel-master.xml > vms/fuel-master.xml
33
34sudo virsh create vms/fuel-master.xml
35
36#login fuel master
37sleep 30
38rm -rf ~/.ssh/known_hosts
39sudo rm -rf ~/.putty
40inprog=1
41while [ $inprog -ne 0 ]
42do
43 echo "y\n" | plink -ssh -pw r00tme root@10.20.0.2 "echo y" >& /dev/null
44 inprog=$?
45 sleep 20
46done
47
48#cat astute.yaml | plink -ssh -pw r00tme root@10.20.0.2 "dd of=/etc/fuel/astute.yaml"
49#echo plink -ssh -pw r00tme root@10.20.0.2 "pkill fuelmenu"
50
51inprog=1
52while [ $inprog -ne 0 ]
53do
54 echo "y\n" | plink -ssh -pw r00tme root@10.20.0.2 "grep 'Fuel node deployment complete' /var/log/puppet/bootstrap_admin_node.log " >& /dev/null
55 inprog=$?
56 sleep 20
57done
58
59#setup slave
60for i in {1..4}; do
61 sudo virsh destroy fuel-slave-$i
62 sudo rm -rf /var/lib/libvirt/images/fuel-slave-${i}.img
63 sudo qemu-img create -f qcow2 /var/lib/libvirt/images/fuel-slave-${i}.img 200G
64 sed "s/FUEL_SLAVE/fuel-slave-$i/g" fuel-slave.xml > vms/fuel-slave-${i}.xml
65 sudo virsh create vms/fuel-slave-${i}.xml
66done
67
68#setup web browser
69firefox https://10.20.0.2:8443 >& /dev/null &
diff --git a/demo/05_destroy_fuel.sh b/demo/05_destroy_fuel.sh
new file mode 100755
index 0000000..53946c7
--- /dev/null
+++ b/demo/05_destroy_fuel.sh
@@ -0,0 +1,13 @@
1#!/bin/bash
2
3sudo virt-manager
4
5#destroy master
6sudo virsh destroy fuel-master
7sudo rm -rf /var/lib/libvirt/images/fuel-master.img
8
9#destroy slave
10for i in {1..4}; do
11 sudo virsh destroy fuel-slave-$i
12 sudo rm -rf /var/lib/libvirt/images/fuel-slave-${i}.img
13done
diff --git a/demo/README.md b/demo/README.md
new file mode 100644
index 0000000..4d1f6b0
--- /dev/null
+++ b/demo/README.md
@@ -0,0 +1,42 @@
1Fuel OVS Plugin Demo Script
2===========================
3
4Overview
5--------
6
7This directory includes scripts to setup fuel ovs plugin demo.
8
9The scripts are ONLY tested in new installation of Ubuntu 14.04.03 Desktop
1064bit. Extra configuration or Extra packages such as virtualbox may break
11functionality. All packages or network configuration are provided by the
12the following scripts.
13
14Scripts
15-------
16
171. 01_setup_network.sh
18
19The script is to setup socks5 proxy. You may change the script to support
20NAT. The following network setting is updated before running the script:
21
22a. HTTP_PROXY: proxy for package installation
23b. DNS_SERVER: DNS for fuel VM
24c. SOCK5_IP: socks5 proxy for fuel VM
25d. SOCK5_PORT: socks5 proxy for fuel VM
26
272. 02_install_packages.sh
28
29The script is to install all packages
30
313. 03_setup_vnc.sh
32
33The script is to setup vnc. Default vnc password is 123456.
34
354. 04_setup_fuel.sh
36
37The script is to create 1 master VM and 4 slave VMs. Fuel ISO is copied to this
38directory before running the script.
39
405. 05_destroy_fuel.sh
41
42The script is to destroy 1 master VM and 4 slave VMs.
diff --git a/demo/fuel-master.xml b/demo/fuel-master.xml
new file mode 100644
index 0000000..647beca
--- /dev/null
+++ b/demo/fuel-master.xml
@@ -0,0 +1,94 @@
1<domain type='kvm' id='5'>
2 <name>fuel-master</name>
3 <memory unit='KiB'>4194304</memory>
4 <currentMemory unit='KiB'>4194304</currentMemory>
5 <vcpu placement='static'>4</vcpu>
6 <resource>
7 <partition>/machine</partition>
8 </resource>
9 <os>
10 <type arch='x86_64' machine='pc-i440fx-trusty'>hvm</type>
11 <boot dev='hd'/>
12 <boot dev='cdrom'/>
13 <bootmenu enable='yes'/>
14 </os>
15 <features>
16 <acpi/>
17 <apic/>
18 <pae/>
19 </features>
20 <clock offset='utc'/>
21 <on_poweroff>destroy</on_poweroff>
22 <on_reboot>restart</on_reboot>
23 <on_crash>restart</on_crash>
24 <devices>
25 <emulator>/usr/bin/qemu-system-x86_64</emulator>
26 <disk type='file' device='disk'>
27 <driver name='qemu' type='qcow2'/>
28 <source file='/var/lib/libvirt/images/fuel-master.img'/>
29 <target dev='hda' bus='ide'/>
30 <alias name='ide0-0-0'/>
31 <address type='drive' controller='0' bus='0' target='0' unit='0'/>
32 </disk>
33 <disk type='file' device='cdrom'>
34 <driver name='qemu' type='raw'/>
35 <source file='ISO_FILE' />
36 <target dev='hdc' bus='ide'/>
37 <readonly/>
38 <alias name='ide0-1-0'/>
39 <address type='drive' controller='0' bus='1' target='0' unit='0'/>
40 </disk>
41 <controller type='usb' index='0'>
42 <alias name='usb0'/>
43 <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
44 </controller>
45 <controller type='pci' index='0' model='pci-root'>
46 <alias name='pci.0'/>
47 </controller>
48 <controller type='ide' index='0'>
49 <alias name='ide0'/>
50 <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
51 </controller>
52 <interface type='bridge'>
53 <source bridge='br-eth0'/>
54 <target dev='vnet0'/>
55 <model type='virtio'/>
56 <alias name='net0'/>
57 <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
58 </interface>
59 <serial type='pty'>
60 <source path='/dev/pts/16'/>
61 <target port='0'/>
62 <alias name='serial0'/>
63 </serial>
64 <console type='pty' tty='/dev/pts/16'>
65 <source path='/dev/pts/16'/>
66 <target type='serial' port='0'/>
67 <alias name='serial0'/>
68 </console>
69 <input type='tablet' bus='usb'>
70 <alias name='input0'/>
71 </input>
72 <input type='mouse' bus='ps2'/>
73 <input type='keyboard' bus='ps2'/>
74 <graphics type='vnc' port='5900' autoport='yes' listen='127.0.0.1'>
75 <listen type='address' address='127.0.0.1'/>
76 </graphics>
77 <sound model='ich6'>
78 <alias name='sound0'/>
79 <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
80 </sound>
81 <video>
82 <model type='cirrus' vram='9216' heads='1'/>
83 <alias name='video0'/>
84 <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
85 </video>
86 <memballoon model='virtio'>
87 <alias name='balloon0'/>
88 <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
89 </memballoon>
90 </devices>
91 <seclabel type='dynamic' model='apparmor' relabel='yes'>
92 </seclabel>
93</domain>
94
diff --git a/demo/fuel-slave.xml b/demo/fuel-slave.xml
new file mode 100644
index 0000000..b45e475
--- /dev/null
+++ b/demo/fuel-slave.xml
@@ -0,0 +1,92 @@
1<domain type='kvm' id='75'>
2 <name>FUEL_SLAVE</name>
3 <memory unit='KiB'>4194304</memory>
4 <currentMemory unit='KiB'>4194304</currentMemory>
5 <vcpu placement='static'>4</vcpu>
6 <resource>
7 <partition>/machine</partition>
8 </resource>
9 <os>
10 <type arch='x86_64' machine='pc-i440fx-trusty'>hvm</type>
11 <boot dev='network'/>
12 <boot dev='hd'/>
13 <bootmenu enable='no' />
14 </os>
15 <features>
16 <acpi/>
17 <apic/>
18 <pae/>
19 </features>
20 <cpu mode='custom' match='exact'>
21 <model fallback='allow'>SandyBridge</model>
22 <vendor>Intel</vendor>
23 <feature policy='require' name='vmx'/>
24 </cpu>
25 <clock offset='utc'/>
26 <on_poweroff>destroy</on_poweroff>
27 <on_reboot>restart</on_reboot>
28 <on_crash>restart</on_crash>
29 <devices>
30 <emulator>/usr/bin/qemu-system-x86_64</emulator>
31 <disk type='file' device='disk'>
32 <driver name='qemu' type='qcow2'/>
33 <source file='/var/lib/libvirt/images/FUEL_SLAVE.img'/>
34 <target dev='vda' bus='virtio'/>
35 <alias name='virtio-disk0'/>
36 <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
37 </disk>
38 <controller type='usb' index='0'>
39 <alias name='usb0'/>
40 <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
41 </controller>
42 <controller type='pci' index='0' model='pci-root'>
43 <alias name='pci.0'/>
44 </controller>
45 <interface type='bridge'>
46 <source bridge='br-eth0'/>
47 <model type='e1000' />
48 <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
49 </interface>
50 <interface type='bridge'>
51 <source bridge='br-eth1'/>
52 <model type='e1000' />
53 <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
54 </interface>
55 <interface type='bridge'>
56 <source bridge='br-dpdk'/>
57 <model type='e1000' />
58 <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
59 </interface>
60 <serial type='pty'>
61 <source path='/dev/pts/20'/>
62 <target port='0'/>
63 <alias name='serial0'/>
64 </serial>
65 <console type='pty' tty='/dev/pts/20'>
66 <source path='/dev/pts/20'/>
67 <target type='serial' port='0'/>
68 <alias name='serial0'/>
69 </console>
70 <input type='mouse' bus='ps2'/>
71 <input type='keyboard' bus='ps2'/>
72 <graphics type='vnc' port='5900' autoport='yes' listen='127.0.0.1'>
73 <listen type='address' address='127.0.0.1'/>
74 </graphics>
75 <sound model='ich6'>
76 <alias name='sound0'/>
77 <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
78 </sound>
79 <video>
80 <model type='cirrus' vram='9216' heads='1'/>
81 <alias name='video0'/>
82 <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
83 </video>
84 <memballoon model='virtio'>
85 <alias name='balloon0'/>
86 <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
87 </memballoon>
88 </devices>
89 <seclabel type='dynamic' model='apparmor' relabel='yes'>
90 </seclabel>
91</domain>
92