aboutsummaryrefslogtreecommitdiffstats
path: root/vnfs
diff options
context:
space:
mode:
Diffstat (limited to 'vnfs')
-rw-r--r--vnfs/vCPE/scripts/v_brgemu_init.sh4
-rwxr-xr-xvnfs/vCPE/scripts/v_brgemu_install.sh30
-rwxr-xr-xvnfs/vLB/scripts/run_streams_dns.sh50
-rw-r--r--vnfs/vLB/scripts/v_packetgen_install.sh5
4 files changed, 76 insertions, 13 deletions
diff --git a/vnfs/vCPE/scripts/v_brgemu_init.sh b/vnfs/vCPE/scripts/v_brgemu_init.sh
index fdeb4395..e9697992 100644
--- a/vnfs/vCPE/scripts/v_brgemu_init.sh
+++ b/vnfs/vCPE/scripts/v_brgemu_init.sh
@@ -2,6 +2,4 @@
systemctl start vpp
systemctl start honeycomb
-
-/opt/bind_nic.sh
-/opt/set_nat.sh
+systemctl start nat
diff --git a/vnfs/vCPE/scripts/v_brgemu_install.sh b/vnfs/vCPE/scripts/v_brgemu_install.sh
index 0f2b06f5..f8824f97 100755
--- a/vnfs/vCPE/scripts/v_brgemu_install.sh
+++ b/vnfs/vCPE/scripts/v_brgemu_install.sh
@@ -197,7 +197,6 @@ EOF
NICS=$(get_nic_pci_list)
NICS=`echo ${NICS} | sed 's/[0]\+\([0-9]\)/\1/g' | sed 's/[.:]/\//g'`
- echo $NICS
BRG_BNG_NIC=GigabitEthernet`echo ${NICS} | cut -d " " -f 2` # second interface in list
echo $BRG_BNG_NIC > /opt/config/brg_nic.txt
@@ -330,6 +329,17 @@ EOF
chmod +x /opt/set_nat.sh
fi # endif BUILD_STATE != "build"
+#Create script to run bind_nic.sh and set_nat.sh
+ cat > /opt/nat_service.sh << 'EOF'
+#! /bin/bash
+
+sleep 15
+/opt/bind_nic.sh
+/opt/set_nat.sh
+
+EOF
+ chmod +x /opt/nat_service.sh
+
if [[ $BUILD_STATE != "done" ]]
then
@@ -484,6 +494,24 @@ WantedBy=multi-user.target
EOF
systemctl enable /etc/systemd/system/honeycomb.service
+
+ # Create systemctl service for nat script
+ cat > /etc/systemd/system/nat.service << EOF
+[Unit]
+Description=Runs vbrg scripts for nat configuration
+Requires=vpp.service
+After=vpp.service
+
+[Service]
+RemainAfterExit=True
+ExecStart=/opt/nat_service.sh
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
+EOF
+ systemctl enable /etc/systemd/system/nat.service
+
# Download DHCP config files
cd /opt
wget $REPO_URL_BLOB/org.onap.demo/vnfs/vcpe/$INSTALL_SCRIPT_VERSION/v_brgemu_init.sh
diff --git a/vnfs/vLB/scripts/run_streams_dns.sh b/vnfs/vLB/scripts/run_streams_dns.sh
index cf95fa53..b73c9ee7 100755
--- a/vnfs/vLB/scripts/run_streams_dns.sh
+++ b/vnfs/vLB/scripts/run_streams_dns.sh
@@ -1,9 +1,51 @@
#!/bin/bash
+#Disable all the running streams
vppctl packet-gen disable
+
+#Initial configuration: run only two streams
vppctl packet-gen enable-stream dns1
vppctl packet-gen enable-stream dns2
-sleep 100
-vppctl packet-gen enable-stream dns3
-vppctl packet-gen enable-stream dns4
-vppctl packet-gen enable-stream dns5
+
+sleep 180
+
+#Rehash port numbers and re-run five streams every minute
+while true; do
+ vppctl packet-gen disable
+ vppctl pac del dns1
+ vppctl pac del dns2
+ vppctl pac del dns3
+ vppctl pac del dns4
+ vppctl pac del dns5
+
+ #Update destination (vLB) IP
+ VLB_IPADDR=$(cat /opt/config/vlb_ipaddr.txt)
+ IPADDR1=$(cat /opt/config/local_private_ipaddr.txt)
+ sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns1
+ sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns2
+ sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns3
+ sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns4
+ sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns5
+
+ #Update source ports (make them random)
+ sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns1
+ sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns2
+ sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns3
+ sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns4
+ sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns5
+
+ vppctl exec /opt/dns_streams/stream_dns1
+ vppctl exec /opt/dns_streams/stream_dns2
+ vppctl exec /opt/dns_streams/stream_dns3
+ vppctl exec /opt/dns_streams/stream_dns4
+ vppctl exec /opt/dns_streams/stream_dns5
+
+ #Resume stream execution
+ vppctl packet-gen enable-stream dns1
+ vppctl packet-gen enable-stream dns2
+ vppctl packet-gen enable-stream dns3
+ vppctl packet-gen enable-stream dns4
+ vppctl packet-gen enable-stream dns5
+
+ sleep 60
+done \ No newline at end of file
diff --git a/vnfs/vLB/scripts/v_packetgen_install.sh b/vnfs/vLB/scripts/v_packetgen_install.sh
index ca2957a7..6dce05ec 100644
--- a/vnfs/vLB/scripts/v_packetgen_install.sh
+++ b/vnfs/vLB/scripts/v_packetgen_install.sh
@@ -56,7 +56,6 @@ cd /opt
wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlb/$INSTALL_SCRIPT_VERSION/v_packetgen_init.sh
wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlb/$INSTALL_SCRIPT_VERSION/vpacketgen.sh
wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlb/$INSTALL_SCRIPT_VERSION/run_streams_dns.sh
-wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlb/$INSTALL_SCRIPT_VERSION/vdnspacketgen_change_streams_ports.sh
wget $REPO_URL_ARTIFACTS/org/onap/demo/vnf/vlb/vlb_dns_streams/$DEMO_ARTIFACTS_VERSION/vlb_dns_streams-$DEMO_ARTIFACTS_VERSION-demo.tar.gz
tar -zmxvf vlb_dns_streams-$DEMO_ARTIFACTS_VERSION-demo.tar.gz
@@ -65,7 +64,6 @@ rm *.tar.gz
chmod +x v_packetgen_init.sh
chmod +x vpacketgen.sh
chmod +x run_streams_dns.sh
-chmod +x vdnspacketgen_change_streams_ports.sh
# Install VPP
export UBUNTU="xenial"
@@ -93,7 +91,4 @@ then
reboot
fi
-# Install a cron job that restart streams every minute. This allows to map streams to different vDNSs when we scale out the VNF
-echo "* * * * * /opt/vdnspacketgen_change_streams_ports.sh" | crontab
-
./v_packetgen_init.sh