diff options
Diffstat (limited to 'vnfs/vCPE/scripts/v_gw_install.sh')
-rw-r--r-- | vnfs/vCPE/scripts/v_gw_install.sh | 69 |
1 files changed, 50 insertions, 19 deletions
diff --git a/vnfs/vCPE/scripts/v_gw_install.sh b/vnfs/vCPE/scripts/v_gw_install.sh index 6074cdfa..53ac6903 100644 --- a/vnfs/vCPE/scripts/v_gw_install.sh +++ b/vnfs/vCPE/scripts/v_gw_install.sh @@ -11,6 +11,8 @@ HC2VPP_SOURCE_REPO_BRANCH=$(cat /opt/config/hc2vpp_source_repo_branch.txt) CLOUD_ENV=$(cat /opt/config/cloud_env.txt) MUX_GW_IP=$(cat /opt/config/mux_gw_private_net_ipaddr.txt) MUX_GW_CIDR=$(cat /opt/config/mux_gw_private_net_cidr.txt) +MUX_IP_ADDR=$(cat /opt/config/mux_ip_addr.txt) +VG_VGMUX_TUNNEL_VNI=$(cat /opt/config/vg_vgmux_tunnel_vni.txt) # Build states are: # 'build' - just build the code @@ -207,20 +209,14 @@ EOF MUX_GW_NIC=GigabitEthernet`echo ${NICS} | cut -d " " -f 2` # second interface in list GW_PUB_NIC=GigabitEthernet`echo ${NICS} | cut -d " " -f 4` # fourth interface in list -touch /etc/vpp/setup.gate cat > /etc/vpp/setup.gate << EOF set int state ${MUX_GW_NIC} up -set int ip address ${MUX_GW_NIC} 10.5.0.21/24 +set int ip address ${MUX_GW_NIC} ${MUX_GW_IP}/${MUX_GW_CIDR#*/} set int state ${GW_PUB_NIC} up set dhcp client intfc ${GW_PUB_NIC} hostname vg-1 -tap connect lstack address 192.168.1.1/24 -set int state tap-0 up - -create vxlan tunnel src 10.5.0.21 dst 10.5.0.20 vni 100 - -set interface l2 bridge tap-0 10 0 +create vxlan tunnel src ${MUX_GW_IP} dst ${MUX_IP_ADDR} vni ${VG_VGMUX_TUNNEL_VNI} set interface l2 bridge vxlan_tunnel0 10 1 set bridge-domain arp term 10 @@ -238,7 +234,7 @@ fi # endif BUILD_STATE != "build" if [[ $BUILD_STATE != "done" ]] then - # Download and install HC2VPP from source + # Download and install HC2VPP from source cd /opt git clone ${HC2VPP_SOURCE_REPO_URL} -b ${HC2VPP_SOURCE_REPO_BRANCH} hc2vpp @@ -361,6 +357,12 @@ EOF mv vpp-integration/minimal-distribution/target/vpp-integration-distribution-${l_version}-hc/vpp-integration-distribution-${l_version} /opt/honeycomb sed -i 's/127.0.0.1/0.0.0.0/g' /opt/honeycomb/config/honeycomb.json + # Disable automatic upgrades + if [[ $CLOUD_ENV != "rackspace" ]] + then + echo "APT::Periodic::Unattended-Upgrade \"0\";" >> /etc/apt/apt.conf.d/10periodic + sed -i 's/\(APT::Periodic::Unattended-Upgrade\) "1"/\1 "0"/' /etc/apt/apt.conf.d/20auto-upgrades + fi fi # endif BUILD_STATE != "done if [[ $BUILD_STATE != "build" ]] @@ -396,15 +398,46 @@ subnet 192.168.1.0 netmask 255.255.255.0 { } EOF - # Download DHCP config files - cd /opt - wget $REPO_URL_BLOB/org.onap.demo/vnfs/vcpe/$INSTALL_SCRIPT_VERSION/v_gw_init.sh - wget $REPO_URL_BLOB/org.onap.demo/vnfs/vcpe/$INSTALL_SCRIPT_VERSION/v_gw.sh +echo '#!/bin/bash +STATUS=$(ip link show lstack) +if [ -z "$STATUS" ] +then + vppctl tap connect lstack address 192.168.1.1/24 + vppctl set int state tap-0 up + vppctl set interface l2 bridge tap-0 10 0 +fi +IP=$(/sbin/ifconfig lstack | grep "inet addr:" | cut -d: -f2 | awk "{ print $1 }") +if [ ! -z "$STATUS" ] && [ -z "$IP" ] +then + ip link delete lstack + vppctl tap delete tap-0 + vppctl tap connect lstack address 192.168.1.1/24 + vppctl set int state tap-0 up + vppctl set interface l2 bridge tap-0 10 0 +fi' > /opt/v_gw_init.sh + chmod +x v_gw_init.sh - chmod +x v_gw.sh - mv v_gw.sh /etc/init.d - sed "s/Provides:/$/ v_gw" /etc/init.d/v_gw.sh - update-rc.d v_gw.sh defaults + + cat > /etc/systemd/system/vgw.service << EOF +[Unit] +Description=vGW service to run after honeycomb service +Requires=honeycomb.service +After=honeycomb.service + +[Service] +ExecStart=/opt/v_gw_init.sh +Restart=always +RestartSec=10 + +[Install] +WantedBy=multi-user.target +EOF + + systemctl enable /etc/systemd/system/vgw.service + + cp /etc/systemd/system/multi-user.target.wants/isc-dhcp-server.service /etc/systemd/system/ + sed -i '/Documentation/a Wants=vgw.service\nAfter=vgw.service' /etc/systemd/system/isc-dhcp-server.service + sed -i '/exec dhcpd/a Restart=always\nRestartSec=10' /etc/systemd/system/isc-dhcp-server.service # Rename network interface in openstack Ubuntu 16.04 images. Then, reboot the VM to pick up changes if [[ $CLOUD_ENV != "rackspace" ]] @@ -414,9 +447,7 @@ EOF sed -i "s/ens[0-9]*/eth0/g" /etc/network/interfaces.d/*.cfg sed -i "s/ens[0-9]*/eth0/g" /etc/udev/rules.d/70-persistent-net.rules echo 'network: {config: disabled}' >> /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg - echo "APT::Periodic::Unattended-Upgrade \"0\";" >> /etc/apt/apt.conf.d/10periodic reboot fi - ./v_gw_init.sh fi # endif BUILD_STATE != "build" |