diff options
-rwxr-xr-x | vnfs/vCPE/scripts/v_brgemu_install.sh | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/vnfs/vCPE/scripts/v_brgemu_install.sh b/vnfs/vCPE/scripts/v_brgemu_install.sh index 94ed76d2..a0a16c76 100755 --- a/vnfs/vCPE/scripts/v_brgemu_install.sh +++ b/vnfs/vCPE/scripts/v_brgemu_install.sh @@ -201,6 +201,7 @@ EOF BRG_BNG_NIC=GigabitEthernet`echo ${NICS} | cut -d " " -f 2` # second interface in list echo $BRG_BNG_NIC > /opt/config/brg_nic.txt + cat > /etc/vpp/setup.gate << EOF set int state ${BRG_BNG_NIC} up set dhcp client intfc ${BRG_BNG_NIC} hostname brg-emulator @@ -212,9 +213,9 @@ set interface l2 bridge tap-0 10 0 set bridge-domain arp term 10 EOF - cat >> /opt/config/ip.txt << EOF -hcip: 192.168.4.20 -EOF +echo "sdnc_ip: $(cat /opt/config/sdnc_ip.txt)" > /opt/config/ip.txt +echo "hcip: 192.168.4.20" >> /opt/config/ip.txt + cat > /opt/bind_nic.sh << 'EOF' #!/bin/bash @@ -228,6 +229,7 @@ do fi done + BRG_BNG_NIC=$(cat /opt/config/brg_nic.txt) sdnc_ip=$(cat /opt/config/sdnc_ip.txt) @@ -242,7 +244,14 @@ vppctl ip route add 192.168.4.0/24 via tap-1 vppctl set interface snat in tap-1 out ${BRG_BNG_NIC} vppctl snat add interface address ${BRG_BNG_NIC} +#Get vBNG ip addr +output=$(vppctl show dhcp client) +vbng_ip=${output##*gw } +vppctl ip route add $vbng_ip/32 via $vbng_ip ${BRG_BNG_NIC} +vppctl ip route add $sdnc_ip/32 via $vbng_ip ${BRG_BNG_NIC} + +#Get HW addr of tap-1 while read -r hw do if [[ "$hw" = tap-1* ]]; @@ -253,6 +262,16 @@ do fi done < <(vppctl show hardware) arp -s $sdnc_ip $hw_addr +arp -s 20.0.0.40 $hw_addr + +#Get HW addr of tap0 +var=$(ifconfig tap0) +var=${var##*HWaddr} +var=${var%inet*} +tap0_addr=${var%inet*} + +vppctl set ip arp tap-1 192.168.4.20 $tap0_addr + EOF chmod +x /opt/bind_nic.sh |