diff options
Diffstat (limited to 'vnfs')
-rw-r--r-- | vnfs/vCPE/kea-sdnc-notify-mod/etc/kea-sdnc-notify.conf | 3 | ||||
-rw-r--r-- | vnfs/vCPE/kea-sdnc-notify-mod/etc/kea-sdnc-notify.conf.test | 4 | ||||
-rw-r--r-- | vnfs/vCPE/kea-sdnc-notify-mod/src/pkt4_send.cc | 13 | ||||
-rw-r--r-- | vnfs/vCPE/scripts/kea-sdnc-notify.conf | 3 | ||||
-rw-r--r-- | vnfs/vCPE/scripts/v_dhcp_install.sh | 2 | ||||
-rw-r--r-- | vnfs/vLB/scripts/add_dns.sh | 2 | ||||
-rwxr-xr-x | vnfs/vLB/scripts/run_streams_dns.sh | 2 | ||||
-rw-r--r-- | vnfs/vLB/scripts/v_packetgen_init.sh | 7 | ||||
-rw-r--r-- | vnfs/vLB/scripts/v_packetgen_install.sh | 8 | ||||
-rw-r--r-- | vnfs/vLB/scripts/vdnspacketgen_change_streams_ports.sh | 11 |
10 files changed, 28 insertions, 27 deletions
diff --git a/vnfs/vCPE/kea-sdnc-notify-mod/etc/kea-sdnc-notify.conf b/vnfs/vCPE/kea-sdnc-notify-mod/etc/kea-sdnc-notify.conf index 1a8ee2e3..6fd09843 100644 --- a/vnfs/vCPE/kea-sdnc-notify-mod/etc/kea-sdnc-notify.conf +++ b/vnfs/vCPE/kea-sdnc-notify-mod/etc/kea-sdnc-notify.conf @@ -1,3 +1,4 @@ -{"url": "http://localhost/sdnc.php?macaddr=", +{ + "url": "http://DMAAP_IPADDR:3904/events/VCPE-DHCP-EVENT/", "siaddr": "siaddr" } diff --git a/vnfs/vCPE/kea-sdnc-notify-mod/etc/kea-sdnc-notify.conf.test b/vnfs/vCPE/kea-sdnc-notify-mod/etc/kea-sdnc-notify.conf.test new file mode 100644 index 00000000..beba0f15 --- /dev/null +++ b/vnfs/vCPE/kea-sdnc-notify-mod/etc/kea-sdnc-notify.conf.test @@ -0,0 +1,4 @@ +{ + "url": "http://localhost/sdnc.php", + "siaddr": "siaddr" +} diff --git a/vnfs/vCPE/kea-sdnc-notify-mod/src/pkt4_send.cc b/vnfs/vCPE/kea-sdnc-notify-mod/src/pkt4_send.cc index 231a0a8b..70d86289 100644 --- a/vnfs/vCPE/kea-sdnc-notify-mod/src/pkt4_send.cc +++ b/vnfs/vCPE/kea-sdnc-notify-mod/src/pkt4_send.cc @@ -84,10 +84,12 @@ int pkt4_send(CalloutHandle& handle) { hwaddr = hwaddr_ptr->toText(false); yiaddr = new_yiaddr.toText(); msg_name = response4_ptr->getName(); - post_data = "{ macaddr=" + hwaddr + "&yiaddr=" + yiaddr + "&msg=" + msg_name + "}"; - final_url = json_params[0] + hwaddr; + /* POST string for DMaaP */ + post_data = "{\n\"macaddr\":\"" + hwaddr + "\",\n\"yiaddr\":\"" + yiaddr + "\",\n\"msg_name\":\"" + msg_name + "\"\n}"; + final_url = json_params[0] ; LOG_DEBUG(logger, 0, "SNL_BASE").arg(final_url); LOG_DEBUG(logger, 0, "SNL_BASE").arg(yiaddr); + LOG_DEBUG(logger, 0, "SNL_BASE").arg(post_data); if ( msg_name == "DHCPACK") @@ -106,6 +108,7 @@ int pkt4_send(CalloutHandle& handle) { return(1); } + list = curl_slist_append(list, "Content-type: application/json"); list = curl_slist_append(list, "Accept: application/json"); if (list == NULL) { curl_easy_cleanup(curl); @@ -126,15 +129,11 @@ int pkt4_send(CalloutHandle& handle) { curl_opt_res += curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); curl_opt_res += curl_easy_setopt(curl, CURLOPT_HEADER, 1L); - // If we don't set a timeout, curl will try for 300 seconds by default. + // Default curl timeout is 300 seconds curl_opt_res += curl_easy_setopt(curl, CURLOPT_TIMEOUT, 1L); curl_opt_res += curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 1L); - // libcurl's docs say to cast as void, don't blame me. curl_opt_res += curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)response_memfile); - // CURLOPT_URL takes a char* curl_opt_res += curl_easy_setopt(curl, CURLOPT_URL, (final_url).c_str()); - - // let curl use strlen curl_opt_res += curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, -1L ); curl_opt_res += curl_easy_setopt(curl, CURLOPT_POSTFIELDS, post_data.c_str() ); curl_opt_res += curl_easy_setopt(curl, CURLOPT_HTTPHEADER, list); diff --git a/vnfs/vCPE/scripts/kea-sdnc-notify.conf b/vnfs/vCPE/scripts/kea-sdnc-notify.conf index 1a8ee2e3..6fd09843 100644 --- a/vnfs/vCPE/scripts/kea-sdnc-notify.conf +++ b/vnfs/vCPE/scripts/kea-sdnc-notify.conf @@ -1,3 +1,4 @@ -{"url": "http://localhost/sdnc.php?macaddr=", +{ + "url": "http://DMAAP_IPADDR:3904/events/VCPE-DHCP-EVENT/", "siaddr": "siaddr" } diff --git a/vnfs/vCPE/scripts/v_dhcp_install.sh b/vnfs/vCPE/scripts/v_dhcp_install.sh index d88ed509..f9ea25b7 100644 --- a/vnfs/vCPE/scripts/v_dhcp_install.sh +++ b/vnfs/vCPE/scripts/v_dhcp_install.sh @@ -5,6 +5,7 @@ REPO_URL_ARTIFACTS=$(cat /opt/config/repo_url_artifacts.txt) DEMO_ARTIFACTS_VERSION=$(cat /opt/config/demo_artifacts_version.txt) INSTALL_SCRIPT_VERSION=$(cat /opt/config/install_script_version.txt) CLOUD_ENV=$(cat /opt/config/cloud_env.txt) +MR_IP_ADDR=$(cat /opt/config/mr_ip_addr.txt) # Convert Network CIDR to Netmask cdr2mask () { @@ -78,6 +79,7 @@ update-rc.d v_dhcp.sh defaults # Configure DHCP cp kea-dhcp4.conf /etc/kea-dhcp4-server.conf mv kea-dhcp4.conf /etc/kea/kea-dhcp4.conf +sed -i "s/DMAAP_IPADDR/"$MR_IP_ADDR"/g" kea-sdnc-notify.conf mv kea-sdnc-notify.conf /etc/kea/kea-sdnc-notify.conf sleep 1 diff --git a/vnfs/vLB/scripts/add_dns.sh b/vnfs/vLB/scripts/add_dns.sh index b6ec17c8..3574e085 100644 --- a/vnfs/vLB/scripts/add_dns.sh +++ b/vnfs/vLB/scripts/add_dns.sh @@ -13,7 +13,7 @@ GRE_IPADDR=$(cat /opt/config/gre_ipaddr.txt) vppctl lb as $IP_TO_PKTGEN_NET"/32" $DNS_IPADDR GRE=$(vppctl create gre tunnel src $IP_TO_DNS_NET dst $DNS_IPADDR) -vppctl set int ip address $GRE $GRE_IPADDR"/24" +vppctl set int ip address $GRE $GRE_IPADDR"/32" vppctl set int state $GRE up # Update the number of vDNSs currently active diff --git a/vnfs/vLB/scripts/run_streams_dns.sh b/vnfs/vLB/scripts/run_streams_dns.sh index 4d4e5432..cf95fa53 100755 --- a/vnfs/vLB/scripts/run_streams_dns.sh +++ b/vnfs/vLB/scripts/run_streams_dns.sh @@ -3,7 +3,7 @@ vppctl packet-gen disable vppctl packet-gen enable-stream dns1 vppctl packet-gen enable-stream dns2 -sleep 300 +sleep 100 vppctl packet-gen enable-stream dns3 vppctl packet-gen enable-stream dns4 vppctl packet-gen enable-stream dns5 diff --git a/vnfs/vLB/scripts/v_packetgen_init.sh b/vnfs/vLB/scripts/v_packetgen_init.sh index c38d2baf..3e0de3e6 100644 --- a/vnfs/vLB/scripts/v_packetgen_init.sh +++ b/vnfs/vLB/scripts/v_packetgen_init.sh @@ -94,13 +94,6 @@ vppctl exec /opt/dns_streams/stream_dns10 vppctl set int ip address pg0 $(cat /opt/config/pg_int.txt)"/"$IPADDR1_CIDR sleep 1 -# Start HoneyComb -VERSION=$(cat /opt/config/demo_artifacts_version.txt) -echo "" > /var/lib/honeycomb/persist/context/data.json -echo "" > /var/lib/honeycomb/persist/config/data.json -/opt/honeycomb/sample-distribution-$VERSION/honeycomb &>/dev/null &disown -sleep 20 - # Enable traffic flows cd /opt chmod +x run_streams_dns.sh diff --git a/vnfs/vLB/scripts/v_packetgen_install.sh b/vnfs/vLB/scripts/v_packetgen_install.sh index 74b84854..621385ca 100644 --- a/vnfs/vLB/scripts/v_packetgen_install.sh +++ b/vnfs/vLB/scripts/v_packetgen_install.sh @@ -51,19 +51,14 @@ apt-get install -y make wget openjdk-8-jdk gcc libcurl4-openssl-dev python-pip b pip install jsonschema # Download vFirewall demo code for packet generator -mkdir /opt/honeycomb 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/sample-distribution/$DEMO_ARTIFACTS_VERSION/sample-distribution-$DEMO_ARTIFACTS_VERSION-hc.tar.gz 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 -zxvf vpp.tar.gz -tar -zxvf sample-distribution-$DEMO_ARTIFACTS_VERSION-hc.tar.gz -mv sample-distribution-$DEMO_ARTIFACTS_VERSION honeycomb -sed -i 's/"restconf-binding-address": "127.0.0.1",/"restconf-binding-address": "0.0.0.0",/g' honeycomb/sample-distribution-$DEMO_ARTIFACTS_VERSION/config/honeycomb.json tar -zxvf vlb_dns_streams-$DEMO_ARTIFACTS_VERSION-demo.tar.gz mv vlb_dns_streams-$DEMO_ARTIFACTS_VERSION dns_streams rm *.tar.gz @@ -98,4 +93,7 @@ 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 diff --git a/vnfs/vLB/scripts/vdnspacketgen_change_streams_ports.sh b/vnfs/vLB/scripts/vdnspacketgen_change_streams_ports.sh index 9bd77162..adfc1f1e 100644 --- a/vnfs/vLB/scripts/vdnspacketgen_change_streams_ports.sh +++ b/vnfs/vLB/scripts/vdnspacketgen_change_streams_ports.sh @@ -1,7 +1,7 @@ #!/bin/bash -#Disable all streams via Honeycomb (so that it will in consistent state) -curl -X PUT -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{"pg-streams":{"pg-stream": []}}' "http://localhost:8183/restconf/config/sample-plugin:sample-plugin/pg-streams" +#Disable all streams +killall -9 run_streams_dns.sh vppctl pac del dns1 vppctl pac del dns2 @@ -14,7 +14,6 @@ vppctl pac del dns8 vppctl pac del dns9 vppctl pac del dns10 - #Update destination (vLB) IP VLB_IPADDR=$(cat /opt/config/vlb_ipaddr.txt) IPADDR1=$(ifconfig br0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2) @@ -50,4 +49,8 @@ vppctl exec /opt/dns_streams/stream_dns6 vppctl exec /opt/dns_streams/stream_dns7 vppctl exec /opt/dns_streams/stream_dns8 vppctl exec /opt/dns_streams/stream_dns9 -vppctl exec /opt/dns_streams/stream_dns10
\ No newline at end of file +vppctl exec /opt/dns_streams/stream_dns10 + +#Resume stream execution +cd /opt +./run_streams_dns.sh &>/dev/null &disown
\ No newline at end of file |