blob: fb255996926a52d936ca239f5ed7e578d0fd88c4 [file] [log] [blame]
Chengyu Fan45d1a762014-07-08 14:21:32 -06001<xsl:stylesheet version="1.0"
Chengyu Fan45d1a762014-07-08 14:21:32 -06002xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3xmlns:nfd="ndn:/localhost/nfd/status/1">
Alexander Afanasyev8a093762014-07-16 18:43:09 -07004<xsl:output method="html" encoding="utf-8" indent="yes" />
Chengyu Fan45d1a762014-07-08 14:21:32 -06005
6<xsl:template match="/">
Alexander Afanasyev8a093762014-07-16 18:43:09 -07007 <xsl:text disable-output-escaping='yes'>&lt;!DOCTYPE html></xsl:text>
Chengyu Fan45d1a762014-07-08 14:21:32 -06008 <html>
9 <head>
10 <title>NFD Status</title>
Alexander Afanasyev8a093762014-07-16 18:43:09 -070011 <link rel="stylesheet" type="text/css" href="style.css" />
Chengyu Fan45d1a762014-07-08 14:21:32 -060012 </head>
13 <body>
Alexander Afanasyev8a093762014-07-16 18:43:09 -070014 <header>
15 <h1>NFD Status</h1>
16 </header>
17 <article>
18 <div id="content">
19 <xsl:apply-templates/>
20 </div>
21 </article>
22 <footer>
23 <xsl:variable name="version">
24 <xsl:apply-templates select="nfd:nfdStatus/nfd:generalStatus/nfd:version"/>
25 </xsl:variable>
26 <span class="grey">Powered by </span><a target="_blank" href="http://named-data.net/doc/NFD/{$version}/"><span class="green">NFD version <xsl:value-of select="$version"/></span></a><span class="grey">.</span>
27 </footer>
Chengyu Fan45d1a762014-07-08 14:21:32 -060028 </body>
29 </html>
30</xsl:template>
31
Alexander Afanasyev8a093762014-07-16 18:43:09 -070032<xsl:template match="nfd:version">
33 <xsl:variable name="major"><xsl:value-of select="floor(. div 1000000) mod 1000"/></xsl:variable>
34 <xsl:variable name="minor"><xsl:value-of select="floor(. div 1000) mod 1000"/></xsl:variable>
35 <xsl:variable name="patch"><xsl:value-of select=". mod 1000"/></xsl:variable>
36
37 <xsl:value-of select="$major"/>.<xsl:value-of select="$minor"/>.<xsl:value-of select="$patch"/>
38</xsl:template>
39
40<xsl:template name="formatDate">
41 <xsl:param name="date" />
42 <xsl:value-of select="substring($date, 0, 11)"/>&#160;<xsl:value-of select="substring($date, 12, 8)"/>
43</xsl:template>
44
45<xsl:template name="formatDuration">
46 <xsl:param name="duration" />
47 <xsl:variable name="seconds"><xsl:value-of select="substring($duration, 3, string-length($duration)-3)" /></xsl:variable>
48 <xsl:variable name="days"><xsl:value-of select="round($seconds div 86400)" /></xsl:variable>
49 <xsl:variable name="hours"><xsl:value-of select="round($seconds div 3600)" /></xsl:variable>
50 <xsl:variable name="minutes"><xsl:value-of select="round($seconds div 60)" /></xsl:variable>
51 <xsl:variable name="uptime">
52 <xsl:choose>
53 <xsl:when test="$days > 0">
54 <xsl:value-of select="$days"/> days
55 </xsl:when>
56 <xsl:when test="$hours > 0">
57 <xsl:value-of select="$hours"/> hours
58 </xsl:when>
59 <xsl:when test="$minutes > 0">
60 <xsl:value-of select="$minutes"/> minutes
61 </xsl:when>
62 <xsl:otherwise>
63 <xsl:value-of select="$seconds"/> seconds
64 </xsl:otherwise>
65 </xsl:choose>
66 </xsl:variable>
67 <xsl:value-of select="$uptime"/>
68</xsl:template>
69
Chengyu Fan45d1a762014-07-08 14:21:32 -060070<xsl:template match="nfd:generalStatus">
71 <h2>General NFD status</h2>
Alexander Afanasyev8a093762014-07-16 18:43:09 -070072 <table class="item-list">
73 <thead>
74 <tr>
75 <th>Version</th>
76 <th>Start time</th>
77 <th>Current time</th>
78 <th>Uptime</th>
79 <th>NameTree Entries</th>
80 <th>FIB entries</th>
81 <th>PIT entries</th>
82 <th>Measurements entries</th>
83 <th>CS entries</th>
84 <th>In Interests</th>
85 <th>Out Interests</th>
86 <th>In Data</th>
87 <th>Out Data</th>
88 </tr>
89 </thead>
90 <tbody>
91 <tr class="center">
92 <td><xsl:apply-templates select="nfd:version"/></td>
93 <td><xsl:call-template name="formatDate"><xsl:with-param name="date" select="nfd:startTime" /></xsl:call-template></td>
94 <td><xsl:call-template name="formatDate"><xsl:with-param name="date" select="nfd:currentTime" /></xsl:call-template></td>
95 <td><xsl:call-template name="formatDuration"><xsl:with-param name="duration" select="nfd:uptime" /></xsl:call-template></td>
96 <td><xsl:value-of select="nfd:nNameTreeEntries"/></td>
97 <td><xsl:value-of select="nfd:nFibEntries"/></td>
98 <td><xsl:value-of select="nfd:nPitEntries"/></td>
99 <td><xsl:value-of select="nfd:nMeasurementsEntries"/></td>
100 <td><xsl:value-of select="nfd:nCsEntries"/></td>
101 <td><xsl:value-of select="nfd:packetCounters/nfd:incomingPackets/nfd:nInterests"/></td>
102 <td><xsl:value-of select="nfd:packetCounters/nfd:outgoingPackets/nfd:nInterests"/></td>
103 <td><xsl:value-of select="nfd:packetCounters/nfd:incomingPackets/nfd:nDatas"/></td>
104 <td><xsl:value-of select="nfd:packetCounters/nfd:outgoingPackets/nfd:nDatas"/></td>
105 </tr>
106 </tbody>
Chengyu Fan45d1a762014-07-08 14:21:32 -0600107 </table>
108</xsl:template>
109
110<xsl:template match="nfd:channels">
111 <h2>Channels</h2>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700112 <table class="item-list">
113 <thead>
114 <tr>
115 <th>Channel URI</th>
116 </tr>
117 </thead>
118 <tbody>
119 <xsl:for-each select="nfd:channel">
120 <xsl:variable name="style">
121 <xsl:choose>
122 <xsl:when test="position() mod 2 = 1">
123 <xsl:text>odd</xsl:text>
124 </xsl:when>
125 <xsl:otherwise>even</xsl:otherwise>
126 </xsl:choose>
127 </xsl:variable>
128 <tr class="{$style}">
129 <td><xsl:value-of select="nfd:localUri"/></td>
130 </tr>
131 </xsl:for-each>
132 </tbody>
Chengyu Fan45d1a762014-07-08 14:21:32 -0600133 </table>
134</xsl:template>
135
136<xsl:template match="nfd:faces">
137 <h2>Faces</h2>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700138 <table class="item-list">
139 <thead>
140 <tr>
141 <th>Face ID</th>
142 <th>Remote URI</th>
143 <th>Local URI</th>
144 <th>In Interests</th>
145 <th>In Data</th>
146 <th>Out Interests</th>
147 <th>Out Data</th>
148 </tr>
149 </thead>
150 <tbody>
151 <xsl:for-each select="nfd:face">
152 <xsl:variable name="style">
153 <xsl:choose>
154 <xsl:when test="position() mod 2 = 1">
155 <xsl:text>odd</xsl:text>
156 </xsl:when>
157 <xsl:otherwise>even</xsl:otherwise>
158 </xsl:choose>
159 </xsl:variable>
160 <tr class="{$style}">
161 <td><xsl:value-of select="nfd:faceId"/></td>
162 <td><xsl:value-of select="nfd:remoteUri"/></td>
163 <td><xsl:value-of select="nfd:localUri"/></td>
164 <td><xsl:value-of select="nfd:packetCounters/nfd:incomingPackets/nfd:nInterests"/></td>
165 <td><xsl:value-of select="nfd:packetCounters/nfd:incomingPackets/nfd:nDatas"/></td>
166 <td><xsl:value-of select="nfd:packetCounters/nfd:outgoingPackets/nfd:nInterests"/></td>
167 <td><xsl:value-of select="nfd:packetCounters/nfd:outgoingPackets/nfd:nDatas"/></td>
168 </tr>
169 </xsl:for-each>
170 </tbody>
Chengyu Fan45d1a762014-07-08 14:21:32 -0600171 </table>
172</xsl:template>
173
174<xsl:template match="nfd:fib">
175 <h2>FIB</h2>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700176 <table class="item-list">
177 <thead>
178 <tr>
179 <th>Prefix</th>
180 <th>NextHops</th>
181 </tr>
182 </thead>
183 <tbody>
184 <xsl:for-each select="nfd:fibEntry">
185 <xsl:variable name="style">
186 <xsl:choose>
187 <xsl:when test="position() mod 2 = 1">
188 <xsl:text>odd</xsl:text>
189 </xsl:when>
190 <xsl:otherwise>even</xsl:otherwise>
191 </xsl:choose>
192 </xsl:variable>
193 <tr class="{$style}">
194 <td style="text-align:left;vertical-align:top;padding:0"><xsl:value-of select="nfd:prefix"/></td>
195 <td>
196 <xsl:for-each select="nfd:nextHops/nfd:nextHop">
197 faceid=<xsl:value-of select="nfd:faceId"/> (cost=<xsl:value-of select="nfd:cost"/>);
198 </xsl:for-each>
199 </td>
200 </tr>
Chengyu Fan45d1a762014-07-08 14:21:32 -0600201 </xsl:for-each>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700202 </tbody>
Chengyu Fan45d1a762014-07-08 14:21:32 -0600203 </table>
204</xsl:template>
205
206<xsl:template match="nfd:strategyChoices">
207 <h2>Strategy Choices</h2>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700208 <table class="item-list">
209 <thead>
210 <tr>
211 <th>Namespace</th>
212 <th>Strategy Name</th>
213 </tr>
214 </thead>
215 <tbody>
216 <xsl:for-each select="nfd:strategyChoice">
217 <tr>
218 <td><xsl:value-of select="nfd:namespace"/></td>
219 <td><xsl:value-of select="nfd:strategy/nfd:name"/></td>
220 </tr>
221 </xsl:for-each>
222 </tbody>
Chengyu Fan45d1a762014-07-08 14:21:32 -0600223 </table>
224</xsl:template>
225
226</xsl:stylesheet>