summaryrefslogtreecommitdiffstats
path: root/vnfs/vCPE/kea-sdnc-notify-mod
diff options
context:
space:
mode:
Diffstat (limited to 'vnfs/vCPE/kea-sdnc-notify-mod')
-rw-r--r--vnfs/vCPE/kea-sdnc-notify-mod/etc/kea-sdnc-notify.conf3
-rw-r--r--vnfs/vCPE/kea-sdnc-notify-mod/etc/kea-sdnc-notify.conf.test4
-rw-r--r--vnfs/vCPE/kea-sdnc-notify-mod/src/pkt4_send.cc13
3 files changed, 12 insertions, 8 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..9538ec6d 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://10.0.11.1: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);