Adding demo setup files
authorTinku Mannan <tmannan@ti.com>
Fri, 8 Aug 2014 18:42:37 +0000 (14:42 -0400)
committerTinku Mannan <tmannan@ti.com>
Fri, 8 Aug 2014 18:42:37 +0000 (14:42 -0400)
ti/runtime/netapi/demo/demo_setup_files/dpicgi1.sh [new file with mode: 0755]
ti/runtime/netapi/demo/demo_setup_files/dpicgi2.sh [new file with mode: 0755]
ti/runtime/netapi/demo/demo_setup_files/dpicgi3.sh [new file with mode: 0755]
ti/runtime/netapi/demo/demo_setup_files/dpicgi4.sh [new file with mode: 0755]
ti/runtime/netapi/demo/demo_setup_files/index.html [new file with mode: 0755]
ti/runtime/netapi/demo/demo_setup_files/stats1.awk [new file with mode: 0644]
ti/runtime/netapi/demo/demo_setup_files/stats2.awk [new file with mode: 0644]
ti/runtime/netapi/demo/demo_setup_files/stats3.awk [new file with mode: 0644]
ti/runtime/netapi/demo/demo_setup_files/transport_dpi_demo_setup.sh [new file with mode: 0755]

diff --git a/ti/runtime/netapi/demo/demo_setup_files/dpicgi1.sh b/ti/runtime/netapi/demo/demo_setup_files/dpicgi1.sh
new file mode 100755 (executable)
index 0000000..e817deb
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/bash
+#dump mac addresses from switch
+echo Content-type: text/html
+echo
+echo
+echo "<HTML>"
+echo "<HEAD>"
+echo "</HEAD>"
+echo "<BODY>"
+echo "<H2> MAC Addresses From Switch ALE </H2>"
+echo "<PRE>"
+cat /sys/devices/soc.0/24000000.netcp/ale_table | grep "touched" | grep "addr" | cut -d ' ' -f 10-
+echo "</PRE>"
+echo "<A href=\"\index.html\"> <p><u>RETURN</u></p> </A>"
+echo "</BODY>"
+echo "</HTML>"
\ No newline at end of file
diff --git a/ti/runtime/netapi/demo/demo_setup_files/dpicgi2.sh b/ti/runtime/netapi/demo/demo_setup_files/dpicgi2.sh
new file mode 100755 (executable)
index 0000000..3eaa0bc
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/bash
+echo Content-type: text/html
+echo
+echo
+#dump proto seen stat
+#awk -f ../stats1.awk  ../stats2.txt
+/sbin/transport_dpi_demo stats | awk -f ../stats1.awk
\ No newline at end of file
diff --git a/ti/runtime/netapi/demo/demo_setup_files/dpicgi3.sh b/ti/runtime/netapi/demo/demo_setup_files/dpicgi3.sh
new file mode 100755 (executable)
index 0000000..45bf5d7
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/bash
+echo Content-type: text/html
+echo
+echo
+#dump proto cycles stats
+#awk -f ../stats2.awk  ../stats1.txt
+/sbin/transport_dpi_demo stats | awk -f ../stats2.awk
\ No newline at end of file
diff --git a/ti/runtime/netapi/demo/demo_setup_files/dpicgi4.sh b/ti/runtime/netapi/demo/demo_setup_files/dpicgi4.sh
new file mode 100755 (executable)
index 0000000..51ebca4
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/bash
+echo Content-type: text/html
+echo
+echo
+#dump mem stat
+awk -f ../stats3.awk  ../stats1.txt
+#dpidemo stats | awk -f ../stats3.awk
\ No newline at end of file
diff --git a/ti/runtime/netapi/demo/demo_setup_files/index.html b/ti/runtime/netapi/demo/demo_setup_files/index.html
new file mode 100755 (executable)
index 0000000..9440abc
--- /dev/null
@@ -0,0 +1,23 @@
+<html>
+<script type="text/javascript">
+function  hello(msg) {
+       var msg= "this is the net_test_dpi home page";
+       document.open();
+       document.write(msg);
+       document.writeln("<A href=\"/index.html\"> <p><u>RETURN</u></p> </A>");
+       document.close();
+}
+</script>
+<head><title> NET_TEST_DPI </title></head>
+<body >
+<img src="tilogo.gif">
+<text> <p> Hi there. Welcome to the <b>Texas Instruments DPI</b> demo </p>
+<p>
+featuring <b> Procera Networks Deep Packet Inspection Library </b> and TI Transp
+xt>
+<A href="cgi-bin/dpicgi1.sh"> <p>List of Mac Addresses</p> </A>
+<A href="cgi-bin/dpicgi5.sh"> <p>Packet Forwarding Stats</p> </A>
+<A href="cgi-bin/dpicgi2.sh"> <p>Protocols Seen</p> </A>
+<A href="cgi-bin/dpicgi3.sh"> <p>Cycles by Protocol</p> </A>
+<A href="cgi-bin/dpicgi4.sh"> <p>Memory Usage</p> </A>
+</body>
\ No newline at end of file
diff --git a/ti/runtime/netapi/demo/demo_setup_files/stats1.awk b/ti/runtime/netapi/demo/demo_setup_files/stats1.awk
new file mode 100644 (file)
index 0000000..5fd71d8
--- /dev/null
@@ -0,0 +1,52 @@
+#--------------------------------------
+# awk script to process stats
+#  output from dpidemo and build
+#  web page
+#  stats1->  dump navl proto stats (part1)
+#_____________________________________
+
+
+BEGIN { state=0;
+        printf("<HTML>\n");
+        printf("</HEAD>\n");
+        printf("<BODY>\n");
+        printf("<H2> DPI Protocol Statistics </H2>\n");
+
+ }
+
+$0 ~ "NAVL DPI stats"  {
+  if (state==0)
+  {
+  state=1;
+  printf("<table>\n");
+  printf("<tr>\n");
+#  printf("<th> colspan="6" <b>Results</b> </th> </tr> \n");
+  }
+}
+ // {
+ if ((state==1)&&(NF>=8))
+ {
+    printf("<tr> ");
+    for(i=1;i<=6;i++) printf("<td> <b> %s </b> </td> ",$i);
+    printf("</tr> \n");
+ }
+ else if ((state==2) && (NF>=6))
+ {
+    printf("<tr> ");
+    for(i=1;i<=6;i++)  if (i==1) printf("<td> <b>%s</b> </td> ", $i); else  printf("<td> %s </td> ", $i);
+    printf("</tr> \n");
+ }
+}
+/--------/ { if (state==1) state=2}
+/packets captured/ {if (state==2) {state=3; printf("</table>\n");}}
+
+
+
+END {
+ printf("</PRE>\n");
+ printf("<A href=\"\\index.html\"> <p><u> RETURN </u> </p> </A>\n");
+ printf("</BODY>\n");
+ printf("</HTML>\n");
+
+
+}
\ No newline at end of file
diff --git a/ti/runtime/netapi/demo/demo_setup_files/stats2.awk b/ti/runtime/netapi/demo/demo_setup_files/stats2.awk
new file mode 100644 (file)
index 0000000..a3431ef
--- /dev/null
@@ -0,0 +1,52 @@
+#--------------------------------------
+# awk script to process stats
+#  output from dpidemo and build
+#  web page
+#  stats2->  dump navl proto stats (part2)
+#_____________________________________
+
+
+BEGIN { state=0;
+        printf("<HTML>\n");
+        printf("</HEAD>\n");
+        printf("<BODY>\n");
+        printf("<H2> DPI Cycle Statistics by Protocol </H2>\n");
+
+ }
+
+$0 ~ "NAVL DPI stats"  {
+  if (state==0)
+  {
+  state=1;
+  printf("<table>\n");
+  printf("<tr>\n");
+#  printf("<th> colspan="6" <b>Results</b> </th> </tr> \n");
+  }
+}
+ // {
+ if ((state==1)&&(NF>=8))
+ {
+    printf("<tr> ");
+    printf("<td> <b> %s </b> </td> ",$1);
+    for(i=7;i<=19;i++) printf("<td> <b> %s </b> </td> ",$i);
+    printf("</tr> \n");
+ }
+ else if ((state==2) && (NF>=6))
+ {
+    printf("<tr> ");
+    printf("<td> <b> %s </b> </td> ",$1);
+    for(i=7;i<=19;i++)   printf("<td> %s </td> ", $i);
+    printf("</tr> \n");
+ }
+}
+/--------/ { if (state==1) state=2}
+/packets captured/ {if (state==2) {state=3; printf("</table>\n");}}
+
+
+
+END {
+ printf("</PRE>\n");
+ printf("<A href=\"\\index.html\"> <p><u> RETURN </u> </p> </A>\n");
+ printf("</BODY>\n");
+ printf("</HTML>\n");
+}
\ No newline at end of file
diff --git a/ti/runtime/netapi/demo/demo_setup_files/stats3.awk b/ti/runtime/netapi/demo/demo_setup_files/stats3.awk
new file mode 100644 (file)
index 0000000..4650d32
--- /dev/null
@@ -0,0 +1,62 @@
+#--------------------------------------
+# awk script to process stats
+#  output from dpidemo and build
+#  web page
+#  stats3->  dump navl  mem stata
+#_____________________________________
+
+
+BEGIN { state=0;
+        printf("<HTML>\n");
+        printf("</HEAD>\n");
+        printf("<BODY>\n");
+        printf("<H2> DPI Memory Utilization Statistics </H2>\n");
+
+ }
+
+ // {
+ if (state==1)
+ {
+    if ($0 ~"-------------")
+    {
+    }
+    else if (NF==1)
+    {
+       printf("<tr> ");
+       printf("<td> %s </td> ",$1);
+       printf("</tr> \n");
+    }
+    else if (NF==3)
+   {
+    printf("<tr> ");
+    printf("<td>  </td>  \n");
+    printf("<td>  </td>  \n");
+    for(i=1;i<=NF;i++) {
+      printf("<td> <b> %s </b> </td> ",$i);
+    }
+    printf("</tr> \n");
+   }
+
+
+    else
+    {
+    printf("<tr> ");
+    printf("<td>  </td>  \n");
+    for(i=1;i<=NF;i++) {
+      printf("<td> %s </td> ",$i);
+    }
+    printf("</tr> \n");
+   }
+}
+}
+/packets captured/ {if (state==0) {state=1; printf("<table>\n");}}
+/Peak allocated/ {if(state==1) {state=2; printf("</table>");}}
+
+
+
+END {
+ printf("</PRE>\n");
+ printf("<A href=\"\\index.html\"> <p><u> RETURN </u> </p> </A>\n");
+ printf("</BODY>\n");
+ printf("</HTML>\n");
+}
\ No newline at end of file
diff --git a/ti/runtime/netapi/demo/demo_setup_files/transport_dpi_demo_setup.sh b/ti/runtime/netapi/demo/demo_setup_files/transport_dpi_demo_setup.sh
new file mode 100755 (executable)
index 0000000..61b2b4b
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+export KERNEL_VER=$(uname -r)
+#copy over web files
+
+cp /etc/transportnetlib/demo_setup_files/index.html /srv/www/index.html
+cp /etc/transportnetlib/demo_setup_/files/stats1.awk /srv/www/stats1.awk
+cp /etc/transportnetlib/demo_setup_/files/stats2.awk /srv/www/stats2.awk
+cp /etc/transportnetlib/demo_setup_/files/stats3.awk /srv/www/stats3.awk
+cp /etc/transportnetlib/demo_setup_/files/dpicgi1.sh /srv/www/dpicgi1.sh
+cp /etc/transportnetlib/demo_setup_/files/dpicgi2.sh /srv/www/dpicgi2.sh
+cp /etc/transportnetlib/demo_setup_/files/dpicgi3.sh /srv/www/dpicgi3.sh
+cp /etc/transportnetlib/demo_setup_/files/dpicgi4.sh /srv/www/dpicgi4.sh
+
+#install kernel module
+echo $KERNEL_VER
+insmod /lib/modules/$KERNEL_VER/extra/hplibmod.ko
+#
+# setup linux kernel bridge to handle broadcast packets
+ifconfig eth0 0.0.0.0
+#
+ifconfig eth1 0.0.0.0
+#create bridge
+brctl addbr br0
+#add i/fs to bridge
+brctl addif br0 eth0
+#
+brctl addif br0 eth1
+#
+dhclient br0
+# run transport_dpi_demo application
+/usr/bin/transport_dpi_demo
+