blob: 07b0faaa7d42a1738056053e38d89014f4a1d331 [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>
Chengyu Fana55663d2014-08-13 20:31:03 -060048 <xsl:variable name="days"><xsl:value-of select="floor($seconds div 86400)" /></xsl:variable>
49 <xsl:variable name="hours"><xsl:value-of select="floor($seconds div 3600)" /></xsl:variable>
50 <xsl:variable name="minutes"><xsl:value-of select="floor($seconds div 60)" /></xsl:variable>
Alexander Afanasyev8a093762014-07-16 18:43:09 -070051 <xsl:choose>
Chengyu Fana55663d2014-08-13 20:31:03 -060052 <xsl:when test="$days = 1">
53 <xsl:value-of select="$days"/> day
54 </xsl:when>
55 <xsl:when test="$days > 1">
Alexander Afanasyev8a093762014-07-16 18:43:09 -070056 <xsl:value-of select="$days"/> days
57 </xsl:when>
Chengyu Fana55663d2014-08-13 20:31:03 -060058 <xsl:when test="$hours = 1">
59 <xsl:value-of select="$hours"/> hour
60 </xsl:when>
61 <xsl:when test="$hours > 1">
Alexander Afanasyev8a093762014-07-16 18:43:09 -070062 <xsl:value-of select="$hours"/> hours
63 </xsl:when>
Chengyu Fana55663d2014-08-13 20:31:03 -060064 <xsl:when test="$minutes = 1">
65 <xsl:value-of select="$minutes"/> minute
66 </xsl:when>
67 <xsl:when test="$minutes > 1">
Alexander Afanasyev8a093762014-07-16 18:43:09 -070068 <xsl:value-of select="$minutes"/> minutes
69 </xsl:when>
Chengyu Fana55663d2014-08-13 20:31:03 -060070 <xsl:when test="$seconds = 1">
71 <xsl:value-of select="$seconds"/> second
72 </xsl:when>
Alexander Afanasyev8a093762014-07-16 18:43:09 -070073 <xsl:otherwise>
74 <xsl:value-of select="$seconds"/> seconds
75 </xsl:otherwise>
76 </xsl:choose>
Alexander Afanasyev8a093762014-07-16 18:43:09 -070077</xsl:template>
78
Chengyu Fan45d1a762014-07-08 14:21:32 -060079<xsl:template match="nfd:generalStatus">
80 <h2>General NFD status</h2>
Alexander Afanasyev8a093762014-07-16 18:43:09 -070081 <table class="item-list">
82 <thead>
83 <tr>
Chengyu Fan8a53caf2014-08-01 14:08:37 -060084 <th>NFD ID</th>
Alexander Afanasyev8a093762014-07-16 18:43:09 -070085 <th>Version</th>
86 <th>Start time</th>
87 <th>Current time</th>
88 <th>Uptime</th>
89 <th>NameTree Entries</th>
90 <th>FIB entries</th>
91 <th>PIT entries</th>
92 <th>Measurements entries</th>
93 <th>CS entries</th>
94 <th>In Interests</th>
95 <th>Out Interests</th>
96 <th>In Data</th>
97 <th>Out Data</th>
98 </tr>
99 </thead>
100 <tbody>
101 <tr class="center">
Chengyu Fan8a53caf2014-08-01 14:08:37 -0600102 <td><xsl:apply-templates select="nfd:nfdId"/></td>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700103 <td><xsl:apply-templates select="nfd:version"/></td>
104 <td><xsl:call-template name="formatDate"><xsl:with-param name="date" select="nfd:startTime" /></xsl:call-template></td>
105 <td><xsl:call-template name="formatDate"><xsl:with-param name="date" select="nfd:currentTime" /></xsl:call-template></td>
106 <td><xsl:call-template name="formatDuration"><xsl:with-param name="duration" select="nfd:uptime" /></xsl:call-template></td>
107 <td><xsl:value-of select="nfd:nNameTreeEntries"/></td>
108 <td><xsl:value-of select="nfd:nFibEntries"/></td>
109 <td><xsl:value-of select="nfd:nPitEntries"/></td>
110 <td><xsl:value-of select="nfd:nMeasurementsEntries"/></td>
111 <td><xsl:value-of select="nfd:nCsEntries"/></td>
112 <td><xsl:value-of select="nfd:packetCounters/nfd:incomingPackets/nfd:nInterests"/></td>
113 <td><xsl:value-of select="nfd:packetCounters/nfd:outgoingPackets/nfd:nInterests"/></td>
114 <td><xsl:value-of select="nfd:packetCounters/nfd:incomingPackets/nfd:nDatas"/></td>
115 <td><xsl:value-of select="nfd:packetCounters/nfd:outgoingPackets/nfd:nDatas"/></td>
116 </tr>
117 </tbody>
Chengyu Fan45d1a762014-07-08 14:21:32 -0600118 </table>
119</xsl:template>
120
121<xsl:template match="nfd:channels">
122 <h2>Channels</h2>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700123 <table class="item-list">
124 <thead>
125 <tr>
126 <th>Channel URI</th>
127 </tr>
128 </thead>
129 <tbody>
130 <xsl:for-each select="nfd:channel">
131 <xsl:variable name="style">
132 <xsl:choose>
133 <xsl:when test="position() mod 2 = 1">
134 <xsl:text>odd</xsl:text>
135 </xsl:when>
136 <xsl:otherwise>even</xsl:otherwise>
137 </xsl:choose>
138 </xsl:variable>
139 <tr class="{$style}">
140 <td><xsl:value-of select="nfd:localUri"/></td>
141 </tr>
142 </xsl:for-each>
143 </tbody>
Chengyu Fan45d1a762014-07-08 14:21:32 -0600144 </table>
145</xsl:template>
146
147<xsl:template match="nfd:faces">
148 <h2>Faces</h2>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700149 <table class="item-list">
150 <thead>
151 <tr>
152 <th>Face ID</th>
153 <th>Remote URI</th>
154 <th>Local URI</th>
Chengyu Fan67179642014-08-15 16:00:43 -0600155 <th>Local</th>
156 <th>OnDemand</th>
157 <th>Expires in</th>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700158 <th>In Interests</th>
159 <th>In Data</th>
Chengyu Fan3331cfa2014-07-25 17:36:31 -0600160 <th>In Bytes</th>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700161 <th>Out Interests</th>
162 <th>Out Data</th>
Chengyu Fan3331cfa2014-07-25 17:36:31 -0600163 <th>Out Bytes</th>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700164 </tr>
165 </thead>
166 <tbody>
167 <xsl:for-each select="nfd:face">
168 <xsl:variable name="style">
169 <xsl:choose>
170 <xsl:when test="position() mod 2 = 1">
171 <xsl:text>odd</xsl:text>
172 </xsl:when>
173 <xsl:otherwise>even</xsl:otherwise>
174 </xsl:choose>
175 </xsl:variable>
176 <tr class="{$style}">
177 <td><xsl:value-of select="nfd:faceId"/></td>
178 <td><xsl:value-of select="nfd:remoteUri"/></td>
179 <td><xsl:value-of select="nfd:localUri"/></td>
Chengyu Fan67179642014-08-15 16:00:43 -0600180 <td>
181 <xsl:if test="nfd:flags/nfd:local">
182 Y
183 </xsl:if>
184 </td>
185 <td>
186 <xsl:if test="nfd:flags/nfd:on-demand">
187 Y
188 </xsl:if>
189 </td>
190 <td>
191 <xsl:choose>
192 <xsl:when test="nfd:expirationPeriod">
193 <xsl:call-template name="formatDuration"><xsl:with-param name="duration" select="nfd:expirationPeriod" /></xsl:call-template>
194 </xsl:when>
195 <xsl:otherwise>
196 Never
197 </xsl:otherwise>
198 </xsl:choose>
199 </td>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700200 <td><xsl:value-of select="nfd:packetCounters/nfd:incomingPackets/nfd:nInterests"/></td>
201 <td><xsl:value-of select="nfd:packetCounters/nfd:incomingPackets/nfd:nDatas"/></td>
Chengyu Fan3331cfa2014-07-25 17:36:31 -0600202 <td><xsl:value-of select="nfd:byteCounters/nfd:incomingBytes"/></td>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700203 <td><xsl:value-of select="nfd:packetCounters/nfd:outgoingPackets/nfd:nInterests"/></td>
204 <td><xsl:value-of select="nfd:packetCounters/nfd:outgoingPackets/nfd:nDatas"/></td>
Chengyu Fan3331cfa2014-07-25 17:36:31 -0600205 <td><xsl:value-of select="nfd:byteCounters/nfd:outgoingBytes"/></td>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700206 </tr>
207 </xsl:for-each>
208 </tbody>
Chengyu Fan45d1a762014-07-08 14:21:32 -0600209 </table>
210</xsl:template>
211
212<xsl:template match="nfd:fib">
213 <h2>FIB</h2>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700214 <table class="item-list">
215 <thead>
216 <tr>
Chengyu Fan30aa2072014-07-20 13:52:32 -0600217 <th width="20%">Prefix</th>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700218 <th>NextHops</th>
219 </tr>
220 </thead>
221 <tbody>
222 <xsl:for-each select="nfd:fibEntry">
223 <xsl:variable name="style">
224 <xsl:choose>
225 <xsl:when test="position() mod 2 = 1">
226 <xsl:text>odd</xsl:text>
227 </xsl:when>
228 <xsl:otherwise>even</xsl:otherwise>
229 </xsl:choose>
230 </xsl:variable>
231 <tr class="{$style}">
232 <td style="text-align:left;vertical-align:top;padding:0"><xsl:value-of select="nfd:prefix"/></td>
233 <td>
Chengyu Fan30aa2072014-07-20 13:52:32 -0600234 <table class="item-sublist">
235 <tr>
236 <th>FaceId</th>
237 <xsl:for-each select="nfd:nextHops/nfd:nextHop">
238 <td><xsl:value-of select="nfd:faceId"/></td>
239 </xsl:for-each>
240 </tr>
241 <tr>
242 <th>Cost</th>
243 <xsl:for-each select="nfd:nextHops/nfd:nextHop">
244 <td><xsl:value-of select="nfd:cost"/></td>
245 </xsl:for-each>
246 </tr>
247 </table>
248 </td>
249 </tr>
250 </xsl:for-each>
251 </tbody>
252 </table>
253</xsl:template>
254
255<xsl:template match="nfd:rib">
256 <h2>RIB</h2>
257 <table class="item-list">
258 <thead>
259 <tr>
260 <th width="20%">Prefix</th>
261 <th>Routes</th>
262 </tr>
263 </thead>
264 <tbody>
265 <xsl:for-each select="nfd:ribEntry">
266 <xsl:variable name="style">
267 <xsl:choose>
268 <xsl:when test="position() mod 2 = 1">
269 <xsl:text>odd</xsl:text>
270 </xsl:when>
271 <xsl:otherwise>even</xsl:otherwise>
272 </xsl:choose>
273 </xsl:variable>
274 <tr class="{$style}">
275 <td style="text-align:left;vertical-align:top;padding:0"><xsl:value-of select="nfd:prefix"/></td>
276 <td>
277 <table class="item-sublist">
278 <tr>
279 <th>FaceId</th>
280 <xsl:for-each select="nfd:routes/nfd:route">
281 <td><xsl:value-of select="nfd:faceId"/></td>
282 </xsl:for-each>
283 </tr>
284 <tr>
285 <th>Origin</th>
286 <xsl:for-each select="nfd:routes/nfd:route">
287 <td><xsl:value-of select="nfd:origin"/></td>
288 </xsl:for-each>
289 </tr>
290 <tr>
291 <th>Cost</th>
292 <xsl:for-each select="nfd:routes/nfd:route">
293 <td><xsl:value-of select="nfd:cost"/></td>
294 </xsl:for-each>
295 </tr>
296 <tr>
297 <th>Flags</th>
298 <xsl:for-each select="nfd:routes/nfd:route">
299 <td><xsl:value-of select="nfd:flags"/></td>
300 </xsl:for-each>
301 </tr>
302 <tr>
303 <th>Expires in</th>
304 <xsl:for-each select="nfd:routes/nfd:route">
305 <td>
306 <xsl:choose>
307 <xsl:when test="nfd:expirationPeriod">
308 <xsl:call-template name="formatDuration"><xsl:with-param name="duration" select="nfd:expirationPeriod" /></xsl:call-template>
309 </xsl:when>
310 <xsl:otherwise>
311 Never
312 </xsl:otherwise>
313 </xsl:choose>
314 </td>
315 </xsl:for-each>
316 </tr>
317 </table>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700318 </td>
319 </tr>
Chengyu Fan45d1a762014-07-08 14:21:32 -0600320 </xsl:for-each>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700321 </tbody>
Chengyu Fan45d1a762014-07-08 14:21:32 -0600322 </table>
323</xsl:template>
324
325<xsl:template match="nfd:strategyChoices">
326 <h2>Strategy Choices</h2>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700327 <table class="item-list">
328 <thead>
329 <tr>
Chengyu Fan30aa2072014-07-20 13:52:32 -0600330 <th width="20%">Namespace</th>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700331 <th>Strategy Name</th>
332 </tr>
333 </thead>
334 <tbody>
335 <xsl:for-each select="nfd:strategyChoice">
336 <tr>
337 <td><xsl:value-of select="nfd:namespace"/></td>
338 <td><xsl:value-of select="nfd:strategy/nfd:name"/></td>
339 </tr>
340 </xsl:for-each>
341 </tbody>
Chengyu Fan45d1a762014-07-08 14:21:32 -0600342 </table>
343</xsl:template>
344
345</xsl:stylesheet>