</tr>
</table>
+ {% if profile.network %}
+ <h4>{{ _("Network") }}</h4>
+ <table class="fireinfo">
+ <tr>
+ <td class="key">
+ {{ _("Network configuration") }}
+ </td>
+ <td class="value">
+ <table class="cpufeatures">
+ <tr>
+ {% for zone in ("GREEN", "RED", "BLUE", "ORANGE") %}
+ {% if profile.network.has_zone(zone.lower()) %}
+ <td class="enabled">
+ {% else %}
+ <td class="disabled">
+ {% end %}
+ {{ _(zone) }}
+ <td>
+ {% end %}
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ {% end %}
+
{% if profile.hypervisor %}
<h4>{{ _("Hypervisor") }}</h4>
<p>
--- /dev/null
+{% extends "stasy-base-2.html" %}
+
+{% block title %}{% end block %}
+
+{% block content %}
+ <h3>{{ _("Network configuration") }}</h3>
+ <p>
+ This chart shows us which is the most favourite network configuration.
+ </p>
+ {{ modules.StasyTable(network_zones, sortby="percentage") }}ยด
+{% end block %}
+
<td><a href="/stats/virtual">{{ _("Virtualization") }}</a></td>
<td><a href="/stats/geo">{{ _("Geographical information") }}</a></td>
</tr>
+ <tr>
+ <td><a href="/stats/network">{{ _("Network") }}</a></td>
+ <td> </td>
+ <td> </td>
+ </tr>
</table>
{% end block %}
return self._data.get("type")
+class ProfileNetwork(ProfileDict):
+ def has_zone(self, name):
+ return self._data.get(name)
+
+ @property
+ def green(self):
+ return self._data.get("green")
+
+ @property
+ def red(self):
+ return self._data.get("red")
+
+ @property
+ def blue(self):
+ return self._data.get("blue")
+
+ @property
+ def orange(self):
+ return self._data.get("orange")
+
+
class ProfileDevice(ProfileDict):
subsystem2class = {
"pci" : hwdata.PCI,
return "unknown"
+ @property
+ def network(self):
+ network = self._data.get("network", None)
+ if network:
+ return ProfileNetwork(network)
+
class Stasy(object):
__metaclass__ = Singleton
return devices
+ def get_network_zones_map(self):
+ zones = { "green" : 0, "blue" : 0, "orange" : 0, "red" : 0 }
+
+ for zone in zones.keys():
+ zones[zone] = self.query({
+ "profile.network.%s" % zone : True,
+ }).count()
+
+ return zones
+
if __name__ == "__main__":
s = Stasy()
geo_locations = self.stasy.get_geo_location_map())
+class StasyStatsNetworkHandler(StasyBaseHandler):
+ def get(self):
+ return self.render("stasy-stats-network.html",
+ network_zones=self.stasy.get_network_zones_map())
+
+
class StasyStatsVendorDetail(StasyBaseHandler):
def get(self, bus, vendor_id):
# XXX some way ugly