Jonathan Hart | 6ccaec8 | 2015-04-01 14:43:40 -0700 | [diff] [blame] | 1 | #!/bin/bash |
Jonathan Hart | 445aa5c | 2015-04-02 16:34:22 -0700 | [diff] [blame] | 2 | # sdnip-setup.sh |
Jonathan Hart | a509f47 | 2015-04-02 16:19:47 -0700 | [diff] [blame] | 3 | # |
| 4 | # Runs as sdnip user. |
| 5 | # |
| 6 | # Sets up the SDN-IP tutorial. |
Jonathan Hart | 6ccaec8 | 2015-04-01 14:43:40 -0700 | [diff] [blame] | 7 | |
| 8 | export USER=sdnip |
| 9 | |
| 10 | echo "Creating SDN-IP tutorial" |
| 11 | |
| 12 | #--------------- Copy SDNIP code to home ----- |
| 13 | |
| 14 | cp -r /home/mininet/onos/tools/tutorials/sdnip /home/sdnip/ |
Jonathan Hart | 6b051d9 | 2015-04-01 17:04:35 -0700 | [diff] [blame] | 15 | cp -r /home/sdnip/sdnip/configs /home/sdnip/ |
Jonathan Hart | d2a5262 | 2015-04-01 16:46:18 -0700 | [diff] [blame] | 16 | sudo -u mininet sh -c 'cp -r /home/sdnip/sdnip/configs/addresses.json /home/mininet/onos/tools/package/config' |
| 17 | sudo -u mininet sh -c 'cp -r /home/sdnip/sdnip/configs/sdnip.json /home/mininet/onos/tools/package/config' |
Jonathan Hart | 6ccaec8 | 2015-04-01 14:43:40 -0700 | [diff] [blame] | 18 | |
Jonathan Hart | f16c122 | 2015-04-01 19:38:49 -0700 | [diff] [blame] | 19 | |
| 20 | #--------------- Add iptables rule for BGP-ONOS communication ----- |
| 21 | |
Jonathan Hart | 5cf990e | 2015-04-02 14:47:36 -0700 | [diff] [blame] | 22 | echo "sudo iptables -A PREROUTING -t nat -i root-eth0 -p tcp --dport 2000 -j DNAT --to 10.0.3.11:2000 " >> /home/sdnip/.xprofile |
Jonathan Hart | f16c122 | 2015-04-01 19:38:49 -0700 | [diff] [blame] | 23 | |
Jonathan Hart | 6ccaec8 | 2015-04-01 14:43:40 -0700 | [diff] [blame] | 24 | DESKTOP=/home/${USER}/Desktop |
| 25 | |
| 26 | mkdir -p ${DESKTOP} |
| 27 | |
| 28 | cat > ${DESKTOP}/ONOS << EOF |
| 29 | [Desktop Entry] |
| 30 | Encoding=UTF-8 |
| 31 | Type=Application |
| 32 | Name=ONOS |
| 33 | Name[en_US]=ONOS |
| 34 | Icon=konsole |
Jonathan Hart | f648acd | 2015-07-07 03:16:47 -0700 | [diff] [blame] | 35 | Exec=/usr/bin/lxterminal -e '/home/mininet/apache-karaf-3.0.3/bin/client -u karaf -h 10.0.3.11' |
Jonathan Hart | 6ccaec8 | 2015-04-01 14:43:40 -0700 | [diff] [blame] | 36 | Comment[en_US]= |
| 37 | EOF |
| 38 | |
| 39 | cat > "${DESKTOP}/SDN-IP Mininet" << EOF |
| 40 | [Desktop Entry] |
| 41 | Encoding=UTF-8 |
| 42 | Type=Application |
| 43 | Name=SDN-IP Mininet |
| 44 | Name[en_US]=SDN-IP Mininet |
| 45 | Icon=konsole |
| 46 | Exec=/usr/bin/lxterminal -e 'sudo mn --custom /home/sdnip/sdnip/tutorial.py --topo sdnip --controller remote,10.0.3.11 --nolistenport' |
| 47 | Comment[en_US]= |
| 48 | EOF |
| 49 | |
| 50 | cat > ${DESKTOP}/Tutorial << EOF |
| 51 | [Desktop Entry] |
| 52 | Encoding=UTF-8 |
| 53 | Type=Application |
| 54 | Name=SDN-IP Tutorial |
| 55 | Name[en_US]=SDN-IP Tutorial |
| 56 | Icon=internet-web-browser |
| 57 | Exec=/usr/bin/chromium-browser https://wiki.onosproject.org/display/ONOS/SDN-IP+Tutorial |
| 58 | Comment[en_US]= |
| 59 | EOF |
| 60 | |
| 61 | cat > ${DESKTOP}/GUI << EOF |
| 62 | [Desktop Entry] |
| 63 | Encoding=UTF-8 |
| 64 | Type=Application |
| 65 | Name=ONOS GUI |
| 66 | Name[en_US]=ONOS GUI |
| 67 | Icon=internet-web-browser |
| 68 | Exec=/usr/bin/chromium-browser http://10.0.3.11:8181/onos/ui/index.html#topo |
| 69 | Comment[en_US]= |
| 70 | EOF |
| 71 | |
| 72 | cat > ${DESKTOP}/Wireshark << EOF |
| 73 | [Desktop Entry] |
| 74 | Encoding=UTF-8 |
| 75 | Type=Application |
| 76 | Name=Wireshark |
| 77 | Name[en_US]=Wireshark |
| 78 | Icon=wireshark |
| 79 | Exec=/usr/bin/wireshark |
| 80 | Comment[en_US]= |
| 81 | EOF |
| 82 | |
| 83 | cat > ${DESKTOP}/Reset << EOF |
| 84 | [Desktop Entry] |
| 85 | Encoding=UTF-8 |
| 86 | Type=Application |
| 87 | Name=Reset |
| 88 | Name[en_US]=Reset |
| 89 | Icon=konsole |
| 90 | Exec=/usr/bin/lxterminal -t 'Resetting; please wait' -e '/bin/bash -c /home/mininet/reset-to-1.sh' |
| 91 | Comment[en_US]= |
| 92 | EOF |