aboutsummaryrefslogtreecommitdiffstats
path: root/extras/configs/http/sample.md.hugo
diff options
context:
space:
mode:
authorAndrew Yourtchenko <ayourtch@gmail.com>2020-05-21 17:05:41 +0000
committerDave Wallace <dwallacelf@gmail.com>2020-05-28 17:06:27 +0000
commite7df8cbb6d83533d0204bfbc1a0fe341f07d9741 (patch)
treeaa6f9b90637158d7ba64587cd82eb8cbbda91016 /extras/configs/http/sample.md.hugo
parent04f4d91c9fe6c8d639e28edb5dd3df2c82f92428 (diff)
misc: Avoid sample.md from in the VPP docs, clean up the extraneous copy
I had cleaned up the sample.md previously for 20.01, but when later that was merged to master, the file was renamed. So, fix this issue. Change-Id: I6347685af216901fbfdd445606735b9bf79f8fe5 Type: docs Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com> (cherry picked from commit e2e3c38be6d91c3deb15373992cd5a764e773060)
Diffstat (limited to 'extras/configs/http/sample.md.hugo')
-rw-r--r--extras/configs/http/sample.md.hugo82
1 files changed, 82 insertions, 0 deletions
diff --git a/extras/configs/http/sample.md.hugo b/extras/configs/http/sample.md.hugo
new file mode 100644
index 00000000000..8451cedd8a5
--- /dev/null
+++ b/extras/configs/http/sample.md.hugo
@@ -0,0 +1,82 @@
+---
+title: Home
+---
+
+# VPP Status
+
+### Here's the version...
+
+VPP version: <div id="VPPversion"></div>
+
+build date: <div id="VPPbuilddate"></div>
+
+<div id="like_button_container"></div>
+
+### Show Interface
+
+<p>Enter the interface name, then click "Submit" to display interface stats:</p>
+
+<input id="ifacename" type="text"></input>
+<button onclick="getStats()">Get Stats</button>
+
+<div id="ifacestats"></div>
+
+{{< rawhtml >}}
+
+<script>
+function getStats() {
+ var url="http://192.168.10.1:1234/interface_stats.json?";
+ var iface=document.getElementById("ifacename").value;
+ url=url.concat(iface);
+ fetch(url, {
+ method: 'POST',
+ mode: 'no-cors',
+ cache: 'no-cache',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+})
+.then((response) => response.json())
+.then(function(obj) {
+ console.log(obj)
+ var result=obj.interface_stats.name;
+ result = result.concat(": rx-pkts: ");
+ result = result.concat(obj.interface_stats.rx_packets);
+ result = result.concat(" rx-bytes: ");
+ result = result.concat(obj.interface_stats.rx_bytes);
+ result = result.concat(": tx-pkts: ");
+ result = result.concat(obj.interface_stats.tx_packets);
+ result = result.concat(" tx-bytes: ");
+ result = result.concat(obj.interface_stats.tx_bytes);
+ result = result.concat(" drops: ");
+ result = result.concat(obj.interface_stats.drops);
+ result = result.concat(" ip4: ");
+ result = result.concat(obj.interface_stats.ip4);
+ result = result.concat(" ip6: ");
+ result = result.concat(obj.interface_stats.ip6);
+
+ document.getElementById("ifacestats").innerHTML=result;
+})
+.catch(function(error) {
+ console.log(error);
+})}
+// unconditionally populate vpp version info ->
+fetch('http://192.168.10.1:1234/version.json', {
+ method: 'GET',
+ mode: 'no-cors',
+ cache: 'no-cache',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+})
+.then((response) => response.json())
+.then(function(obj) {
+ document.getElementById("VPPbuilddate").innerHTML=obj.vpp_details.build_date;
+ document.getElementById("VPPversion").innerHTML=obj.vpp_details.version;
+})
+.catch(function(error) {
+ console.log(error);
+});
+</script>
+
+{{< /rawhtml >}}