blob: 8451cedd8a5669e6e2b3dd7da890c0cc0a08ae24 [file] [log] [blame]
Andrew Yourtchenko843ea7c2020-01-27 11:09:17 +00001---
2title: Home
3---
4
5# VPP Status
6
7### Here's the version...
8
9VPP version: <div id="VPPversion"></div>
10
11build date: <div id="VPPbuilddate"></div>
12
13<div id="like_button_container"></div>
14
15### Show Interface
16
17<p>Enter the interface name, then click "Submit" to display interface stats:</p>
18
19<input id="ifacename" type="text"></input>
20<button onclick="getStats()">Get Stats</button>
21
22<div id="ifacestats"></div>
23
24{{< rawhtml >}}
25
26<script>
27function getStats() {
28 var url="http://192.168.10.1:1234/interface_stats.json?";
29 var iface=document.getElementById("ifacename").value;
30 url=url.concat(iface);
31 fetch(url, {
32 method: 'POST',
33 mode: 'no-cors',
34 cache: 'no-cache',
35 headers: {
36 'Content-Type': 'application/json',
37 },
38})
39.then((response) => response.json())
40.then(function(obj) {
41 console.log(obj)
42 var result=obj.interface_stats.name;
43 result = result.concat(": rx-pkts: ");
44 result = result.concat(obj.interface_stats.rx_packets);
45 result = result.concat(" rx-bytes: ");
46 result = result.concat(obj.interface_stats.rx_bytes);
47 result = result.concat(": tx-pkts: ");
48 result = result.concat(obj.interface_stats.tx_packets);
49 result = result.concat(" tx-bytes: ");
50 result = result.concat(obj.interface_stats.tx_bytes);
51 result = result.concat(" drops: ");
52 result = result.concat(obj.interface_stats.drops);
53 result = result.concat(" ip4: ");
54 result = result.concat(obj.interface_stats.ip4);
55 result = result.concat(" ip6: ");
56 result = result.concat(obj.interface_stats.ip6);
57
58 document.getElementById("ifacestats").innerHTML=result;
59})
60.catch(function(error) {
61 console.log(error);
62})}
63// unconditionally populate vpp version info ->
64fetch('http://192.168.10.1:1234/version.json', {
65 method: 'GET',
66 mode: 'no-cors',
67 cache: 'no-cache',
68 headers: {
69 'Content-Type': 'application/json',
70 },
71})
72.then((response) => response.json())
73.then(function(obj) {
74 document.getElementById("VPPbuilddate").innerHTML=obj.vpp_details.build_date;
75 document.getElementById("VPPversion").innerHTML=obj.vpp_details.version;
76})
77.catch(function(error) {
78 console.log(error);
79});
80</script>
81
82{{< /rawhtml >}}