Skip to content
Snippets Groups Projects
Commit d54dfe22 authored by Wes Felter's avatar Wes Felter
Browse files

UI: Display errors and dropped packets on each port.

parent 3a50b3a2
No related branches found
No related tags found
No related merge requests found
......@@ -21,6 +21,8 @@ window.Port = Backbone.Model.extend({
receivePackets: 0,
transmitBytes: 0,
transmitPackets: 0,
dropped: 0,
errors: 0,
},
initialize:function () {
......
......@@ -65,27 +65,30 @@ window.Switch = Backbone.Model.extend({
},
loadPorts:function () {
if (this.ports.length == 0) {
var self = this;
//console.log("fetching switch " + this.id + " ports")
$.ajax({
url:hackBase + "/wm/core/switch/" + self.id + '/port/json',
dataType:"json",
success:function (data) {
//console.log("fetched switch " + self.id + " ports");
// console.log(data[self.id]);
// create port models
// TODO maybe clean up the errors
_.each(data[self.id], function(p) {
p.id = self.id+'-'+p.portNumber;
self.ports.add(p, {silent: true});
// console.log(p);
});
self.ports.trigger('add'); // batch redraws
}
});
// TODO maybe load /features/json here
}
if (this.ports.length == 0) {
var self = this;
//console.log("fetching switch " + this.id + " ports")
$.ajax({
url:hackBase + "/wm/core/switch/" + self.id + '/port/json',
dataType:"json",
success:function (data) {
//console.log("fetched switch " + self.id + " ports");
//console.log(data[self.id]);
// create port models
// TODO maybe clean up the errors
_.each(data[self.id], function(p) {
p.id = self.id+'-'+p.portNumber;
p.dropped = p.receiveDropped + p.transmitDropped;
p.errors = p.receiveCRCErrors + p.receiveErrors + p.receiveOverrunErrors +
p.receiveFrameErrors + p.transmitErrors;
self.ports.add(p, {silent: true});
//console.log(p);
});
self.ports.trigger('add'); // batch redraws
}
});
// TODO maybe load /features/json here
}
},
loadFlows:function () {
......
<td><a id="<%= portNumber %>"><%= portNumber %></a></td><td><!-- link status --> </td><td><%= transmitBytes %></td><td><%= receiveBytes %></td><td><%= transmitPackets %></td><td><%= receivePackets %></td><td><!-- errors --> </td>
<td><a id="<%= portNumber %>"><%= portNumber %></a></td><td><!-- link status --> </td><td><%= transmitBytes %></td><td><%= receiveBytes %></td><td><%= transmitPackets %></td><td><%= receivePackets %></td><td><%= dropped %></td><td><%= errors %></td>
......@@ -2,7 +2,7 @@
<h1>Ports (<%= nports %>)</h1>
</div>
<table class="table striped-table port-table">
<thead><tr><th>#</th><th>Link Status</th><th>TX Bytes</th><th>RX Bytes</th><th>TX Pkts</th><th>RX Pkts</th><th>Errors</th></tr></thead>
<thead><tr><th>#</th><th>Link Status</th><th>TX Bytes</th><th>RX Bytes</th><th>TX Pkts</th><th>RX Pkts</th><th>Dropped</th><th>Errors</th></tr></thead>
<tbody>
<!-- ports will be inserted here by PortListView:render -->
</tbody>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment