Matteo Scandolo | aca8665 | 2017-08-08 13:05:27 -0700 | [diff] [blame] | 1 | |
| 2 | # Copyright 2017-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | |
AyumuUeha | 76a01bc | 2017-05-18 13:34:13 +0900 | [diff] [blame] | 17 | #!/bin/bash |
| 18 | #************************************************************/ |
| 19 | #** File: nova_pppoe_setup.sh */ |
| 20 | #** Contents: Contains shell script to install apps, */ |
| 21 | #** start Nova Consolidator app, call */ |
| 22 | #** nova_vsg_monitor.sh */ |
| 23 | #************************************************************/ |
| 24 | |
| 25 | # IP address of prod VM that can be accessed from |
| 26 | # nova-compute, vSG and vcpe-docker instances. |
| 27 | # Need to replace the hard coded value with |
| 28 | # some script that can dynamically pickup the |
| 29 | # IP address that is reachable from vSG and docker instances |
| 30 | # running inside vSG. |
| 31 | # |
| 32 | # ONOS_VM Public IP is same as virbr4 IP address in |
| 33 | # the prod VM |
| 34 | |
| 35 | function create_env_file() { |
| 36 | echo "ONOS_VM_PUBLIC_IP=$ONOS_VM_PUBLIC_IP; export ONOS_VM_PUBLIC_IP" >$HOME_DIR/$VSG_ENV_FILE |
| 37 | echo "NETCFG_CONSOLIDATOR_IP=$NETCFG_CONSOLIDATOR_IP;export NETCFG_CONSOLIDATOR_IP " >>$HOME_DIR/$VSG_ENV_FILE |
| 38 | echo "VCPEGW_BR_IP=$VCPEGW_BR_IP;export VCPEGW_BR_IP" >>$HOME_DIR/$VSG_ENV_FILE |
| 39 | echo "VCPEGW_BR_NAME=$VCPEGW_BR_NAME;export VCPEGW_BR_NAME" >>$HOME_DIR/$VSG_ENV_FILE |
| 40 | echo "VCPEGW_BR_SUBNET=$VCPEGW_BR_SUBNET;export VCPEGW_BR_SUBNET" >>$HOME_DIR/$VSG_ENV_FILE |
| 41 | echo "VSG_WAN_BR_NAME=$VSG_WAN_BR_NAME;export VSG_WAN_BR_NAME" >>$HOME_DIR/$VSG_ENV_FILE |
| 42 | echo "NETCFG_UP_IFACE=$NETCFG_UP_IFACE;export NETCFG_UP_IFACE" >>$HOME_DIR/$VSG_ENV_FILE |
| 43 | echo "VCPEGW_DOCKER_IMAGE=$VCPEGW_DOCKER_IMAGE;export VCPEGW_DOCKER_IMAGE" >>$HOME_DIR/$VSG_ENV_FILE |
| 44 | echo "PPPOE_INSTALL_DIR=$PPPOE_INSTALL_DIR;export PPPOE_INSTALL_DIR" >>$HOME_DIR/$VSG_ENV_FILE |
| 45 | echo "VSG_ENV_FILE=$VSG_ENV_FILE;export VSG_ENV_FILE" >>$HOME_DIR/$VSG_ENV_FILE |
| 46 | echo "VCPEPROXY_WAN_IFACE=$VCPEPROXY_WAN_IFACE;export VCPEPROXY_WAN_IFACE" >>$HOME_DIR/$VSG_ENV_FILE |
| 47 | echo "VCPEPROXY_WAN_IP=$VCPEPROXY_WAN_IP;export VCPEPROXY_WAN_IP" >>$HOME_DIR/$VSG_ENV_FILE |
| 48 | echo "VCPEPROXY_IP_PREFIX=$VCPEPROXY_IP_PREFIX;export VCPEPROXY_IP_PREFIX" >>$HOME_DIR/$VSG_ENV_FILE |
| 49 | echo "VCPEPROXY_DHCP_BASE=$VCPEPROXY_DHCP_BASE;export VCPEPROXY_DHCP_BASE" >>$HOME_DIR/$VSG_ENV_FILE |
| 50 | echo "VCPEPROXY_PREFIX=$VCPEPROXY_PREFIX;export VCPEPROXY_PREFIX" >>$HOME_DIR/$VSG_ENV_FILE |
| 51 | echo "VSG_CP_IFACE=$VSG_CP_IFACE;export VSG_CP_IFACE" >>$HOME_DIR/$VSG_ENV_FILE |
| 52 | echo "VCPEPROXY_CP_IFACE=$VCPEPROXY_CP_IFACE;export VCPEPROXY_CP_IFACE" >>$HOME_DIR/$VSG_ENV_FILE |
| 53 | echo "VCPEPROXY_CP_MAC_PREFIX=$VCPEPROXY_CP_MAC_PREFIX;export VCPEPROXY_CP_MAC_PREFIX" >>$HOME_DIR/$VSG_ENV_FILE |
| 54 | echo "VCPEPROXY_LOCAL_IP=$VCPEPROXY_LOCAL_IP;export VCPEPROXY_LOCAL_IP" >>$HOME_DIR/$VSG_ENV_FILE |
| 55 | echo "VCPEPROXY_LOCAL_IP_PREFIX=$VCPEPROXY_LOCAL_IP_PREFIX;export VCPEPROXY_LOCAL_IP_PREFIX" >>$HOME_DIR/$VSG_ENV_FILE |
| 56 | echo "VCPEPROXY_CP_IP_PREFIX=$VCPEPROXY_CP_IP_PREFIX;export VCPEPROXY_CP_IP_PREFIX" >>$HOME_DIR/$VSG_ENV_FILE |
| 57 | echo "VCPEPROXY_CP_IP_START=$VCPEPROXY_CP_IP_START;export VCPEPROXY_CP_IP_START" >>$HOME_DIR/$VSG_ENV_FILE |
| 58 | echo "VCPEGW_WAN_IP_PREFIX=$VCPEGW_WAN_IP_PREFIX;export VCPEGW_WAN_IP_PREFIX" >>$HOME_DIR/$VSG_ENV_FILE |
| 59 | echo "VCPEGW_NETMASK_BITS=$VCPEGW_NETMASK_BITS;export VCPEGW_NETMASK_BITS" >>$HOME_DIR/$VSG_ENV_FILE |
| 60 | echo "VCPEPROXY_DVAL_START=$VCPEPROXY_DVAL_START;export VCPEPROXY_DVAL_START" >>$HOME_DIR/$VSG_ENV_FILE |
| 61 | echo "MAX_IP_PER_VSG=$MAX_IP_PER_VSG;export MAX_IP_PER_VSG" >>$HOME_DIR/$VSG_ENV_FILE |
| 62 | echo "VCPEPROXY_DHCP_LISTEN_ADDRESS=$VCPEPROXY_DHCP_LISTEN_ADDRESS;export VCPEPROXY_DHCP_LISTEN_ADDRESS" >>$HOME_DIR/$VSG_ENV_FILE |
| 63 | echo "VCPEPROXY_DHCP_LOW=$VCPEPROXY_DHCP_LOW;export VCPEPROXY_DHCP_LOW" >>$HOME_DIR/$VSG_ENV_FILE |
| 64 | echo "VCPEPROXY_NUM_HOSTS=$VCPEPROXY_NUM_HOSTS;export VCPEPROXY_NUM_HOSTS" >>$HOME_DIR/$VSG_ENV_FILE |
| 65 | echo "VSG_NUM_ONUS=$VSG_NUM_ONUS;export VSG_NUM_ONUS" >>$HOME_DIR/$VSG_ENV_FILE |
| 66 | echo "VSG_LAN_IFACE=$VSG_LAN_IFACE;export VSG_LAN_IFACE" >>$HOME_DIR/$VSG_ENV_FILE |
| 67 | echo "VCPEPROXY_DOCKER_HOME=$VCPEPROXY_DOCKER_HOME;export VCPEPROXY_DOCKER_HOME" >>$HOME_DIR/$VSG_ENV_FILE |
| 68 | echo "VSG_DOCKER_IPV4=$VSG_DOCKER_IPV4;export VSG_DOCKER_IPV4" >>$HOME_DIR/$VSG_ENV_FILE |
| 69 | echo "VCPEGW_WAN_IP_START=$VCPEGW_WAN_IP_START;export VCPEGW_WAN_IP_START" >>$HOME_DIR/$VSG_ENV_FILE |
| 70 | echo "VCPEGW_WAN_MAC_PREFIX=$VCPEGW_WAN_MAC_PREFIX;export VCPEGW_WAN_MAC_PREFIX" >>$HOME_DIR/$VSG_ENV_FILE |
| 71 | echo "VCPEGW_DOCKER_HOME=$VCPEGW_DOCKER_HOME;export VCPEGW_DOCKER_HOME" >>$HOME_DIR/$VSG_ENV_FILE |
| 72 | |
| 73 | echo "VCPEGW_WAN_IFACE=$VCPEGW_WAN_IFACE;export VCPEGW_WAN_IFACE" >>$HOME_DIR/$VSG_ENV_FILE |
| 74 | echo "VCPEGW_LOCAL_IFACE=$VCPEGW_LOCAL_IFACE;export VCPEGW_LOCAL_IFACE" >>$HOME_DIR/$VSG_ENV_FILE |
| 75 | |
| 76 | echo "AP_RESTAPI_PORT=$AP_RESTAPI_PORT;export AP_RESTAPI_PORT" >>$HOME_DIR/$VSG_ENV_FILE |
| 77 | echo "AP_REST_NETCFG=$AP_REST_NETCFG;export AP_REST_NETCFG" >>$HOME_DIR/$VSG_ENV_FILE |
| 78 | echo "APMGMT_TAR_FILE=$APMGMT_TAR_FILE;export APMGMT_TAR_FILE" >>$HOME_DIR/$VSG_ENV_FILE |
| 79 | echo "IPV6_TAR_FILE=$IPV6_TAR_FILE;export IPV6_TAR_FILE" >>$HOME_DIR/$VSG_ENV_FILE |
| 80 | echo "OnosIP=$OnosIP;export OnosIP" >>$HOME_DIR/$VSG_ENV_FILE |
| 81 | echo "NETCFG_RESTAPI_PORT=$NETCFG_RESTAPI_PORT;export NETCFG_RESTAPI_PORT" >>$HOME_DIR/$VSG_ENV_FILE |
| 82 | |
| 83 | echo "PPPOE_APPS_DIR=$PPPOE_APPS_DIR;export PPPOE_APPS_DIR" >>$HOME_DIR/$VSG_ENV_FILE |
| 84 | echo "PPPOE_AP_MGMT_DIR=$PPPOE_AP_MGMT_DIR;export PPPOE_AP_MGMT_DIR" >>$HOME_DIR/$VSG_ENV_FILE |
| 85 | echo "IPV6_AP_DIR=$IPV6_AP_DIR;export IPV6_AP_DIR" >>$HOME_DIR/$VSG_ENV_FILE |
| 86 | echo "NODEJS_MODULES_DIR=$NODEJS_MODULES_DIR;export NODEJS_MODULES_DIR" >>$HOME_DIR/$VSG_ENV_FILE |
| 87 | echo "VCPEPROXY_BASE_IP=$VCPEPROXY_BASE_IP;export VCPEPROXY_BASE_IP" >>$HOME_DIR/$VSG_ENV_FILE |
| 88 | echo "PPPOE_VCPE_TAR_FILE=$PPPOE_VCPE_TAR_FILE;export PPPOE_VCPE_TAR_FILE" >>$HOME_DIR/$VSG_ENV_FILE |
| 89 | } |
| 90 | |
| 91 | function create_pppoe_server_script() { |
| 92 | echo "#!/bin/bash" > $HOME_DIR/$PPPOE_SERVER_ADD_SCRIPT |
| 93 | echo "PPPOE_SERVER_IP=\$1" >> $HOME_DIR/$PPPOE_SERVER_ADD_SCRIPT |
| 94 | echo "curl -X POST http://$NETCFG_CONSOLIDATOR_IP:$NETCFG_RESTAPI_PORT/rest:\$PPPOE_SERVER_IP:$AP_RESTAPI_PORT" >> $HOME_DIR/$PPPOE_SERVER_ADD_SCRIPT |
| 95 | chmod +x $HOME_DIR/$PPPOE_SERVER_ADD_SCRIPT |
| 96 | |
| 97 | echo "#!/bin/bash" > $HOME_DIR/$PPPOE_SERVER_DELETE_SCRIPT |
| 98 | echo "PPPOE_SERVER_IP=\$1" >> $HOME_DIR/$PPPOE_SERVER_DELETE_SCRIPT |
| 99 | echo "curl -X DELETE http://$NETCFG_CONSOLIDATOR_IP:$NETCFG_RESTAPI_PORT/rest:\$PPPOE_SERVER_IP:$AP_RESTAPI_PORT" >> $HOME_DIR/$PPPOE_SERVER_DELETE_SCRIPT |
| 100 | chmod +x $HOME_DIR/$PPPOE_SERVER_DELETE_SCRIPT |
| 101 | } |
| 102 | |
| 103 | echo "nova_pppoe_setup.sh: Execution Begin" |
| 104 | # |
| 105 | # NOVA-COMPUTE Node/VSG Globals. |
| 106 | # |
| 107 | # NOVA PPPoE Params |
| 108 | NOVA_PPPOE_IFACE=eth3 |
| 109 | NOVA_PPPOE_IFACE_IP=10.200.200.200 |
| 110 | NOVA_PPPOE_PEER_IP=10.200.200.100 |
| 111 | NOVA_PPPOE_VXLAN_NAME=vxlanp |
| 112 | NOVA_PPPOE_VXLAN_ID=42 |
| 113 | # NOVA PPPoE Params End |
| 114 | ONOS_VM_PUBLIC_IP=10.100.198.201; export ONOS_VM_PUBLIC_IP |
| 115 | OnosIP=$ONOS_VM_PUBLIC_IP; export OnosIP |
| 116 | NETCFG_CONSOLIDATOR_IP=10.3.0.1; export NETCFG_CONSOLIDATOR_IP |
| 117 | VCPEGW_BR_IP=10.3.0.2; export VCPEGW_BR_IP |
| 118 | VCPEGW_BR_NAME=vcpe_gwbr; export VCPEGW_BR_NAME |
| 119 | VCPEGW_BR_SUBNET=10.3.0.0; export VCPEGW_BR_SUBNET |
| 120 | VSG_WAN_BR_NAME=br-wan; export VSG_WAN_BR_NAME |
| 121 | VCPEGW_DOCKER_IMAGE=vcpe_gwdocker.tar; export VCPEGW_DOCKER_IMAGE |
| 122 | VSG_LAN_IFACE=eth0; export VSG_LAN_IFACE |
| 123 | VCPEGW_DOCKER_HOME=/home/ubuntu; export VCPEGW_DOCKER_HOME |
| 124 | VSGGW_BR_NAME=vsg_gwbr; export VSGGW_BR_NAME |
| 125 | VCPEGW_WAN_IFACE=eth0; export VCPEGW_WAN_IFACE |
| 126 | VCPEGW_LOCAL_IFACE=eth1; export VCPEGW_LOCAL_IFACE |
| 127 | VCPEGW_WAN_MAC_PREFIX=00:17:38; export VCPEGW_WAN_MAC_PREFIX |
| 128 | VCPEGW_NETMASK_BITS=16; export VCPEGW_NETMASK_BITS |
| 129 | # |
| 130 | # The VCPEGW_WAN_IP_PREFIX should be in the same subnet as |
| 131 | # as the VCPEGW_BR_SUBNET |
| 132 | # If it is moved to Class-C subnet then the prefix should be |
| 133 | # adjusted. |
| 134 | VCPEGW_WAN_IP_PREFIX=10.3; export VCPEGW_WAN_IP_PREFIX |
| 135 | |
| 136 | # |
| 137 | # No specific reason to start at 128. Just to keep addresses |
| 138 | # in non-overlapping range. |
| 139 | VCPEGW_WAN_IP_START=128; export VCPEGW_WAN_IP_START |
| 140 | # |
| 141 | # Interface that would be connecting the VSG instance to |
| 142 | # the vcpegw_br in the nova-compute node. |
| 143 | # |
| 144 | NETCFG_UP_IFACE=eth2; export NETCFG_UP_IFACE |
| 145 | HOME_DIR=`pwd`; export HOME_DIR |
| 146 | |
| 147 | PPPOE_INSTALL_DIR=/usr/local/pppoe; export PPPOE_INSTALL_DIR |
| 148 | PPPOE_VSG_ID_FILE_NAME=vsg_id.txt; export PPPOE_VSG_ID_FILE_NAME |
| 149 | VSG_ENV_FILE=vsg_env.txt; export VSG_ENV_FILE |
| 150 | |
| 151 | ### Env. variables used in setting up VCPEPROXY. |
| 152 | ## |
| 153 | ## |
| 154 | VCPEPROXY_WAN_IFACE=eth0; export VCPEPROXY_WAN_IFACE |
| 155 | VCPEPROXY_WAN_IP=0.0.0.0;export VCPEPROXY_WAN_IP |
| 156 | VCPEPROXY_IP_PREFIX=192.168.0;export VCPEPROXY_IP_PREFIX |
| 157 | VCPEPROXY_DHCP_BASE=50;export VCPEPROXY_DHCP_BASE |
| 158 | VCPEPROXY_BASE_IP=`echo $VCPEPROXY_IP_PREFIX.$VCPEPROXY_DHCP_BASE`; export VCPEPROXY_BASE_IP |
| 159 | VCPEPROXY_PREFIX=vcpe; export VCPEPROXY_PREFIX |
| 160 | VSG_CP_IFACE=$VCPEGW_BR_NAME; export VSG_CP_IFACE |
| 161 | VCPEPROXY_CP_IFACE=eth2; export VCPEPROXY_CP_IFACE |
| 162 | VCPEPROXY_CP_MAC_PREFIX=00:16:3E;export VCPEPROXY_CP_MAC |
| 163 | # |
| 164 | # LOCAL IP is hardcoded since it has to sink up with the XOS assigned |
| 165 | # IP address. May be later we can relax this restriction. |
| 166 | VCPEPROXY_LOCAL_IP="192.168.0.1"; export VCPEPROXY_LOCAL_IP |
| 167 | VCPEPROXY_LOCAL_IP_PREFIX="192.168.0"; export VCPEPROXY_LOCAL_IP_PREFIX |
| 168 | VCPEPROXY_CP_IP_PREFIX=$VCPEGW_WAN_IP_PREFIX; export VCPEPROXY_CP_IP_PREFIX |
| 169 | VCPEPROXY_CP_IP_START=2; export VCPEPROXY_CP_IP_START |
| 170 | VCPEPROXY_DHCP_LISTEN_ADDRESS=$VCPEPROXY_LOCAL_IP;export VCPEPROXY_DHCP_LISTEN_ADDRESS |
| 171 | VCPEPROXY_DHCP_LOW=$(( VCPEPROXY_DHCP_BASE + 1 ));export VCPEPROXY_DHCP_LOW |
| 172 | VCPEPROXY_NUM_HOSTS=100; export VCPEPROXY_NUM_HOSTS |
| 173 | VCPEPROXY_DHCP_HIGH=$(( VCPEPROXY_DHCP_LOW + VCPEPROXY_NUM_HOSTS ));export VCPEPROXY_DHCP_HIGH |
| 174 | VCPEPROXY_DOCKER_HOME=/home/ubuntu; export VCPEPROXY_DOCKER_HOME |
| 175 | VSG_NUM_ONUS=64; export VSG_NUM_ONUS |
| 176 | |
| 177 | # The number of hosts is restricted to 4 for the project(4 APs per ONU). |
| 178 | # For other projects, the number of hosts may be increased to a value upto 62 |
| 179 | # |
| 180 | MAX_NUM_VSG=4; export MAX_NUM_VSG |
| 181 | VCPEPROXY_DVAL_START=$(( MAX_NUM_VSG+2 )); export VCPEPROXY_DVAL_START |
| 182 | MAX_IP_PER_VSG=$(( VSG_NUM_ONUS *(VCPEPROXY_NUM_HOSTS+1) )); export MAX_IP_PER_VSG |
| 183 | |
| 184 | NETCFG_RESTAPI_PORT=24000; export NETCFG_RESTAPI_PORT |
| 185 | AP_RESTAPI_PORT=3000; export AP_RESTAPI_PORT |
| 186 | AP_REST_NETCFG=netcfg.sh; export AP_REST_NETCFG |
| 187 | APMGMT_TAR_DIR="/tmp"; export APMGMT_TAR_DIR |
| 188 | IPV6_TAR_DIR="/tmp"; export APMGMT_TAR_DIR |
| 189 | APMGMT_TAR_FILE_NAME=apmgmt_js.tar;export APMGMT_TAR_FILE_NAME |
| 190 | IPV6_TAR_FILE_NAME=ipv6.tar;export IPV6_TAR_FILE_NAME |
| 191 | APMGMT_TAR_FILE=`echo $APMGMT_TAR_DIR/$APMGMT_TAR_FILE_NAME`; export APMGMT_TAR_FILE |
| 192 | IPV6_TAR_FILE=`echo $IPV6_TAR_DIR/$IPV6_TAR_FILE_NAME`; export IPV6_TAR_FILE |
| 193 | PPPOE_VCPE_TAR_FILE=pppoe_vcpe_docker.tar;export PPPOE_VCPE_TAR_FILE |
| 194 | PPPOE_VCPE_TAR_GZ_FILE=pppoe_vcpe_docker.tar.gz |
| 195 | PPPOE_SERVER_ADD_SCRIPT=pppoe_server_add.sh |
| 196 | PPPOE_SERVER_DELETE_SCRIPT=pppoe_server_delete.sh |
| 197 | VSG_DOCKER_IPV4="" |
| 198 | |
| 199 | if [[ "$1" == "ipv4" ]]; then |
| 200 | echo "vsg vcpe supports $1" |
| 201 | VSG_DOCKER_IPV4="ipv4" |
| 202 | else |
| 203 | echo "vsg vcpe supports ipv6" |
| 204 | fi |
| 205 | |
| 206 | if ping -c 3 $ONOS_VM_PUBLIC_IP >/dev/null; then |
| 207 | reachable=1 |
| 208 | else |
| 209 | echo "ONOS VM ($ONOS_VM_PUBLIC_IP) is not reachable!!!" |
| 210 | echo "$0 : Script execution failed!!!!!Bailing out..." |
| 211 | exit 0 |
| 212 | fi |
| 213 | |
| 214 | if brctl show |grep $VSGGW_BR_NAME ; then |
| 215 | echo "$VSGGW_BR_NAME exists,...Cleaning up $VSGGW_BR_NAME" |
| 216 | sudo ip link set dev $VSGGW_BR_NAME down |
| 217 | sudo brctl delbr $VSGGW_BR_NAME |
| 218 | sleep 1 |
| 219 | fi |
| 220 | sudo brctl addbr $VSGGW_BR_NAME |
| 221 | sudo ip link set dev $VSGGW_BR_NAME up |
| 222 | sudo ip link set dev $VSGGW_BR_NAME dynamic off |
| 223 | sudo ip addr add $NETCFG_CONSOLIDATOR_IP/$VCPEGW_NETMASK_BITS dev $VSGGW_BR_NAME |
| 224 | #PPPoE |
| 225 | if ifconfig -a |grep $NOVA_PPPOE_VXLAN_NAME; then |
| 226 | sudo ip link set dev $NOVA_PPPOE_VXLAN_NAME down |
| 227 | sudo ip link delete $NOVA_PPPOE_VXLAN_NAME |
| 228 | sleep 1 |
| 229 | fi |
| 230 | sudo ifconfig $NOVA_PPPOE_IFACE up |
| 231 | sudo ifconfig $NOVA_PPPOE_IFACE $NOVA_PPPOE_IFACE_IP/24 |
| 232 | sudo ip link add $NOVA_PPPOE_VXLAN_NAME type vxlan id $NOVA_PPPOE_VXLAN_ID remote $NOVA_PPPOE_PEER_IP local $NOVA_PPPOE_IFACE_IP dev $NOVA_PPPOE_IFACE |
| 233 | sudo ip link set up dev $NOVA_PPPOE_VXLAN_NAME |
| 234 | sudo brctl addif $VSGGW_BR_NAME $NOVA_PPPOE_VXLAN_NAME |
| 235 | #PPPoE End |
| 236 | ifconfig $VSGGW_BR_NAME |
| 237 | echo "Clearing VSG ID file.." |
| 238 | rm -f ${HOME_DIR}/$PPPOE_VSG_ID_FILE_NAME |
| 239 | touch ${HOME_DIR}/$PPPOE_VSG_ID_FILE_NAME |
| 240 | echo "ONOS VM Reachable=$reachable" |
| 241 | echo "VCPEGW_BR setup..." |
| 242 | |
| 243 | if [ ! -f ~/admin-openrc.sh ]; then |
| 244 | echo "admin-openrc.sh is not found under /home/ubuntu directory" |
| 245 | scp vagrant@prod:admin-openrc.sh ~/ |
| 246 | sudo chmod +x ~/admin-openrc.sh |
| 247 | fi |
| 248 | cp ~/admin-openrc.sh ${HOME_DIR} |
| 249 | |
| 250 | sudo apt list --installed | grep sshpass > /dev/null 2>&1 |
| 251 | if [ "$?" == 1 ]; then |
| 252 | sudo apt-get install sshpass -y |
| 253 | fi |
| 254 | |
| 255 | if [ -d ${HOME_DIR}/apps ]; then |
| 256 | echo "Using ${HOME_DIR}/apps to install REST server applications" |
| 257 | else |
| 258 | echo "apps directory is missing..." |
| 259 | echo "$0: Script execution failed!!!.Bailing out.." |
| 260 | exit 0 |
| 261 | fi |
| 262 | |
| 263 | # |
| 264 | # Update NetcfgConfig.json with ONOS_VM_PUBLIC_IP |
| 265 | # |
| 266 | echo "{\"OnosIP\":\"$ONOS_VM_PUBLIC_IP\"}" > $HOME_DIR/apps/netcfgConsolidator/NetcfgConfig.json |
| 267 | |
| 268 | |
| 269 | PPPOE_APPS_DIR="$PPPOE_INSTALL_DIR/utils/"; export PPPOE_APPS_DIR |
| 270 | PPPOE_AP_MGMT_DIR=pppoeMgmt; export PPPOE_AP_MGMT_DIR |
| 271 | IPV6_AP_DIR=ipv6Apps; export IPV6_AP_DIR |
| 272 | NODEJS_MODULES_DIR=/usr/local/lib/node_modules/; export NODEJS_MODULES_DIR |
| 273 | if [ -d "$PPPOE_APPS_DIR" ]; then |
| 274 | echo "$PPPOE_APPS_DIR exists, removing..." |
| 275 | sudo rm -rf $PPPOE_APPS_DIR |
| 276 | sudo rm -rf $PPPOE_INSTALL_DIR |
| 277 | fi |
| 278 | |
| 279 | if [ ! -f $HOME_DIR/apps/$PPPOE_AP_MGMT_DIR/authwebapp/js/jquery.js ]; then |
| 280 | wget https://code.jquery.com/jquery-1.11.1.js |
| 281 | mv jquery-1.11.1.js $HOME_DIR/apps/$PPPOE_AP_MGMT_DIR/authwebapp/js/jquery.js |
| 282 | fi |
| 283 | |
| 284 | if [ ! -f $HOME_DIR/apps/$IPV6_AP_DIR/tayga ]; then |
| 285 | wget http://www.litech.org/tayga/tayga-0.9.2.tar.bz2 |
| 286 | tar xvf tayga-0.9.2.tar.bz2 |
| 287 | cd tayga-0.9.2 |
| 288 | ./configure |
| 289 | make |
| 290 | cp tayga $HOME_DIR/apps/$IPV6_AP_DIR |
| 291 | fi |
| 292 | |
| 293 | if [ ! -f $HOME_DIR/apps/$IPV6_AP_DIR/totd ]; then |
| 294 | wget https://launchpad.net/ubuntu/+archive/primary/+files/totd_1.5.1.orig.tar.gz |
| 295 | tar xvf totd_1.5.1.orig.tar.gz |
| 296 | cd totd-1.5.1 |
| 297 | ./configure OPTFLAGS="-Wno-error" |
| 298 | make |
| 299 | cp totd $HOME_DIR/apps/$IPV6_AP_DIR |
| 300 | fi |
| 301 | |
| 302 | if [ ! -f $PPPOE_VCPE_TAR_FILE ]; then |
| 303 | if [ -f $PPPOE_VCPE_TAR_GZ_FILE ]; then |
| 304 | gzip -d $PPPOE_VCPE_TAR_GZ_FILE |
| 305 | fi |
| 306 | fi |
| 307 | sudo mkdir $PPPOE_INSTALL_DIR |
| 308 | sudo mkdir $PPPOE_APPS_DIR |
| 309 | |
| 310 | sudo cp -r $HOME_DIR/apps/* $PPPOE_APPS_DIR |
| 311 | echo $ONOS_VM_PUBLIC_IP >$PPPOE_INSTALL_DIR/onos_vm_public_ip |
| 312 | # |
| 313 | # Create environment file. |
| 314 | # |
| 315 | echo "Creating environment file" |
| 316 | create_env_file |
| 317 | create_pppoe_server_script |
| 318 | |
| 319 | sudo $HOME_DIR/nova_consolidator_setup.sh |
| 320 | sudo $HOME_DIR/nova_consolidator_stop.sh |
| 321 | sleep 2 |
| 322 | sudo $HOME_DIR/nova_consolidator_start.sh |
| 323 | $HOME_DIR/nova_vsg_monitor.sh > $HOME_DIR/nova_vsg_monitor.log 2>&1 & |
| 324 | echo "nova_pppoe_setup.sh: Execution End" |
| 325 | |