diff options
Diffstat (limited to 'vnfs/vCPE/scripts')
-rw-r--r-- | vnfs/vCPE/scripts/kea-dhcp4-web.conf | 63 | ||||
-rw-r--r-- | vnfs/vCPE/scripts/kea-dhcp4.conf | 9 | ||||
-rw-r--r-- | vnfs/vCPE/scripts/kea-dhcp4_no_hook.conf | 14 | ||||
-rw-r--r-- | vnfs/vCPE/scripts/v_bng_init.sh | 10 | ||||
-rw-r--r-- | vnfs/vCPE/scripts/v_bng_install.sh | 10 | ||||
-rw-r--r-- | vnfs/vCPE/scripts/v_gmux_install.sh | 7 | ||||
-rw-r--r-- | vnfs/vCPE/scripts/v_gw_install.sh | 16 | ||||
-rw-r--r-- | vnfs/vCPE/scripts/v_web_init.sh | 1 | ||||
-rw-r--r-- | vnfs/vCPE/scripts/v_web_install.sh | 15 |
9 files changed, 124 insertions, 21 deletions
diff --git a/vnfs/vCPE/scripts/kea-dhcp4-web.conf b/vnfs/vCPE/scripts/kea-dhcp4-web.conf new file mode 100644 index 00000000..4bf07044 --- /dev/null +++ b/vnfs/vCPE/scripts/kea-dhcp4-web.conf @@ -0,0 +1,63 @@ +{ +"Dhcp4": + { +# For testing, you can use veth pair as described in README.md +# vDHCP needs to lisetn on eth1 + "interfaces-config": { + "interfaces": ["eth1" ] + }, + +# How to load the hook library. + + "lease-database": { + "type": "memfile" + }, + + "expired-leases-processing": { + "reclaim-timer-wait-time": 10, + "flush-reclaimed-timer-wait-time": 25, + "hold-reclaimed-time": 3600, + "max-reclaim-leases": 100, + "max-reclaim-time": 250, + "unwarned-reclaim-cycles": 5 + }, + + "valid-lifetime": 3600, + +# Ensure you set some sensible defaults for the siaddr and option-data, +# otherwise the options won't be added at all. +# Also keep in mind that if kea doesn't receive the desired values for some +# reason, these values will be sent to the client. + "subnet4": [ + { "subnet": "10.2.0.0/24", + "pools" : [ { "pool": "10.2.0.2 - 10.2.0.255"} ], + "next-server": "10.2.0.1", + "option-data": [ + { + "name": "routers", + "data": "10.2.0.1" + } + ] + + } + ] + +}, + +"Logging": +{ + "loggers": [ + { + "name": "kea-dhcp4", + "output_options": [ + { + "output": "/var/log/kea-dhcp4.log" + } + ], + "severity": "DEBUG", + "debuglevel": 0 + }, + ] +} + +} diff --git a/vnfs/vCPE/scripts/kea-dhcp4.conf b/vnfs/vCPE/scripts/kea-dhcp4.conf index 508c0e62..d965072b 100644 --- a/vnfs/vCPE/scripts/kea-dhcp4.conf +++ b/vnfs/vCPE/scripts/kea-dhcp4.conf @@ -36,11 +36,12 @@ "pools" : [ { "pool": "10.3.0.2 - 10.3.0.255"} ], "next-server": "10.3.0.1", "option-data": [ - {"name": "tftp-server-name", - "data": "10.4.0.1"}, - {"name": "boot-file-name", - "data": "/dev/null"} + { + "name": "routers", + "data": "10.3.0.1" + } ] + } ] diff --git a/vnfs/vCPE/scripts/kea-dhcp4_no_hook.conf b/vnfs/vCPE/scripts/kea-dhcp4_no_hook.conf index 3e2287d1..170b8f3c 100644 --- a/vnfs/vCPE/scripts/kea-dhcp4_no_hook.conf +++ b/vnfs/vCPE/scripts/kea-dhcp4_no_hook.conf @@ -26,14 +26,14 @@ # Also keep in mind that if kea doesn't receive the desired values for some # reason, these values will be sent to the client. "subnet4": [ - { "subnet": "10.2.0.0/24", - "pools" : [ { "pool": "10.2.0.2 - 10.2.0.255"} ], - "next-server": "10.2.0.1", + { "subnet": "10.3.0.0/24", + "pools" : [ { "pool": "10.3.0.2 - 10.3.0.255"} ], + "next-server": "10.3.0.1", "option-data": [ - {"name": "tftp-server-name", - "data": "10.2.0.1"}, - {"name": "boot-file-name", - "data": "/dev/null"} + { + "name": "routers", + "data": "10.3.0.1" + } ] } ] diff --git a/vnfs/vCPE/scripts/v_bng_init.sh b/vnfs/vCPE/scripts/v_bng_init.sh index 6fb2eadc..ce20dc57 100644 --- a/vnfs/vCPE/scripts/v_bng_init.sh +++ b/vnfs/vCPE/scripts/v_bng_init.sh @@ -2,3 +2,13 @@ systemctl start vpp +# wait for TAP_DEV to become active before setting a route +TAP_DEV=tap0 +STATUS=$(ip link show $TAP_DEV 2> /dev/null) +while [ -z "$STATUS" ]; do + echo "$(date) v_bng_init.sh: $TAP_DEV is not yet ready..." + sleep 1 + STATUS=$(ip link show $TAP_DEV 2> /dev/null) +done +ip route add 10.3.0.0/24 via 192.168.40.41 dev $TAP_DEV + diff --git a/vnfs/vCPE/scripts/v_bng_install.sh b/vnfs/vCPE/scripts/v_bng_install.sh index e20128c5..49bca161 100644 --- a/vnfs/vCPE/scripts/v_bng_install.sh +++ b/vnfs/vCPE/scripts/v_bng_install.sh @@ -16,6 +16,7 @@ BRGEMU_BNG_NET_CIDR=$(cat /opt/config/brgemu_bng_net_cidr.txt) BRGEMU_BNG_NET_IPADDR=$(cat /opt/config/brgemu_bng_net_ipaddr.txt) CPE_SIGNAL_NET_CIDR=$(cat /opt/config/cpe_signal_net_cidr.txt) CPE_SIGNAL_NET_IPADDR=$(cat /opt/config/cpe_signal_net_ipaddr.txt) +SDNC_IP_ADDR=$(cat /opt/config/sdnc_ip_addr.txt) # Build states are: # 'build' - just build the code @@ -64,6 +65,10 @@ fi # endif BUILD_STATE != "build" if [[ $BUILD_STATE != "done" ]] then + # Enable IPV4 forwarding through kernel + sed -i 's/^.*\(net.ipv4.ip_forward\).*/\1=1/g' /etc/sysctl.conf + sysctl -p /etc/sysctl.conf + # Download required dependencies echo "deb http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list echo "deb-src http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list @@ -250,6 +255,11 @@ set interface ip address ${BNG_GMUX_NIC} ${BNG_GMUX_NET_IPADDR}/${BNG_GMUX_NET_C set vbng dhcp4 remote 10.4.0.1 local ${CPE_SIGNAL_NET_IPADDR} set vbng aaa config /etc/vpp/vbng-aaa.cfg nas-port 5060 +tap connect tap0 address 192.168.40.40/24 +set int state tap-0 up +set int ip address tap-0 192.168.40.41/24 +ip route add ${SDNC_IP_ADDR}/32 via 192.168.40.40 tap-0 + EOF cat > /etc/vpp/vbng-aaa.cfg << EOF diff --git a/vnfs/vCPE/scripts/v_gmux_install.sh b/vnfs/vCPE/scripts/v_gmux_install.sh index 50f754da..5e98fe1b 100644 --- a/vnfs/vCPE/scripts/v_gmux_install.sh +++ b/vnfs/vCPE/scripts/v_gmux_install.sh @@ -14,8 +14,10 @@ LIBEVEL_PATCH_URL=$(cat /opt/config/libevel_patch_url.txt) CLOUD_ENV=$(cat /opt/config/cloud_env.txt) MUX_GW_IP=$(cat /opt/config/mux_gw_net_ipaddr.txt) MUX_GW_CIDR=$(cat /opt/config/mux_gw_net_cidr.txt) -BNG_MUX_IP=$(cat /opt/config/bng_mux_net_ipaddr.txt) +MUX_TO_BNG_IP=$(cat /opt/config/mux_to_bng_net_ipaddr.txt) BNG_MUX_CIDR=$(cat /opt/config/bng_mux_net_cidr.txt) +BRG_BNG_CIDR=$(cat /opt/config/brg_bng_net_cidr.txt) +BNG_TO_MUX_IP=$(cat /opt/config/bng_to_mux_net_ipaddr.txt) # Build states are: # 'build' - just build the code @@ -234,10 +236,11 @@ EOF cat > /etc/vpp/setup.gate << EOF set int state ${BNG_MUX_NIC} up -set int ip address ${BNG_MUX_NIC} ${BNG_MUX_IP}/${BNG_MUX_CIDR#*/} +set int ip address ${BNG_MUX_NIC} ${MUX_TO_BNG_IP}/${BNG_MUX_CIDR#*/} set int state ${MUX_GW_NIC} up set int ip address ${MUX_GW_NIC} ${MUX_GW_IP}/${MUX_GW_CIDR#*/} +ip route add ${BRG_BNG_CIDR} via ${BNG_TO_MUX_IP} ${BNG_MUX_NIC} EOF fi # endif BUILD_STATE != "build" diff --git a/vnfs/vCPE/scripts/v_gw_install.sh b/vnfs/vCPE/scripts/v_gw_install.sh index 6074cdfa..4b4a7686 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,10 +209,9 @@ 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 @@ -218,7 +219,7 @@ 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 +create vxlan tunnel src ${MUX_GW_IP} dst ${MUX_IP_ADDR} vni ${VG_VGMUX_TUNNEL_VNI} set interface l2 bridge tap-0 10 0 set interface l2 bridge vxlan_tunnel0 10 1 @@ -361,6 +362,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" ]] @@ -403,7 +410,7 @@ EOF 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 + sed -i '/# Provides:/ s/$/ v_gw/' /etc/init.d/v_gw.sh update-rc.d v_gw.sh defaults # Rename network interface in openstack Ubuntu 16.04 images. Then, reboot the VM to pick up changes @@ -414,7 +421,6 @@ 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 diff --git a/vnfs/vCPE/scripts/v_web_init.sh b/vnfs/vCPE/scripts/v_web_init.sh index a9bf588e..fce6aaf6 100644 --- a/vnfs/vCPE/scripts/v_web_init.sh +++ b/vnfs/vCPE/scripts/v_web_init.sh @@ -1 +1,2 @@ #!/bin/bash +service kea-dhcp4-server start diff --git a/vnfs/vCPE/scripts/v_web_install.sh b/vnfs/vCPE/scripts/v_web_install.sh index e207dd09..685d675a 100644 --- a/vnfs/vCPE/scripts/v_web_install.sh +++ b/vnfs/vCPE/scripts/v_web_install.sh @@ -51,13 +51,22 @@ fi echo "deb http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list echo "deb-src http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list apt-get update -apt-get install --allow-unauthenticated -y wget openjdk-8-jdk apt-transport-https ca-certificates g++ libcurl4-gnutls-dev +apt-get install --allow-unauthenticated -y wget openjdk-8-jdk apt-transport-https ca-certificates kea-dhcp4-server g++ libcurl4-gnutls-dev sleep 1 -# Download DHCP config files +# Download DHCP config and init files cd /opt +wget $REPO_URL_BLOB/org.onap.demo/vnfs/vcpe/$INSTALL_SCRIPT_VERSION/kea-dhcp4-web.conf wget $REPO_URL_BLOB/org.onap.demo/vnfs/vcpe/$INSTALL_SCRIPT_VERSION/v_web_init.sh wget $REPO_URL_BLOB/org.onap.demo/vnfs/vcpe/$INSTALL_SCRIPT_VERSION/v_web.sh + + + +# Configure DHCP +cp kea-dhcp4-web.conf /etc/kea-dhcp4-server.conf +mv kea-dhcp4-web.conf /etc/kea/kea-dhcp4.conf + + chmod +x v_web_init.sh chmod +x v_web.sh mv v_web.sh /etc/init.d @@ -88,4 +97,4 @@ then reboot fi -./v_web_init.sh
\ No newline at end of file +./v_web_init.sh |