blob: fcf128b5e64bcbc0ebbb27f914d3c2eaafd06bdf [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">
Joao Pereira4e274ac2015-07-23 11:54:20 -04004<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat"/>
Chengyu Fan45d1a762014-07-08 14:21:32 -06005
6<xsl:template match="/">
7 <html>
8 <head>
9 <title>NFD Status</title>
Alexander Afanasyev8a093762014-07-16 18:43:09 -070010 <link rel="stylesheet" type="text/css" href="style.css" />
Chengyu Fan45d1a762014-07-08 14:21:32 -060011 </head>
12 <body>
Alexander Afanasyev8a093762014-07-16 18:43:09 -070013 <header>
14 <h1>NFD Status</h1>
15 </header>
16 <article>
17 <div id="content">
18 <xsl:apply-templates/>
19 </div>
20 </article>
21 <footer>
22 <xsl:variable name="version">
23 <xsl:apply-templates select="nfd:nfdStatus/nfd:generalStatus/nfd:version"/>
24 </xsl:variable>
Alexander Afanasyevd7bb88b2015-01-26 18:59:29 -080025 <span class="grey">Powered by </span><a target="_blank" href="http://named-data.net/doc/NFD/"><span class="green">NFD version <xsl:value-of select="$version"/></span></a><span class="grey">.</span>
Alexander Afanasyev8a093762014-07-16 18:43:09 -070026 </footer>
Chengyu Fan45d1a762014-07-08 14:21:32 -060027 </body>
28 </html>
29</xsl:template>
30
Alexander Afanasyev8a093762014-07-16 18:43:09 -070031
32<xsl:template name="formatDate">
33 <xsl:param name="date" />
34 <xsl:value-of select="substring($date, 0, 11)"/>&#160;<xsl:value-of select="substring($date, 12, 8)"/>
35</xsl:template>
36
37<xsl:template name="formatDuration">
38 <xsl:param name="duration" />
39 <xsl:variable name="seconds"><xsl:value-of select="substring($duration, 3, string-length($duration)-3)" /></xsl:variable>
Chengyu Fana55663d2014-08-13 20:31:03 -060040 <xsl:variable name="days"><xsl:value-of select="floor($seconds div 86400)" /></xsl:variable>
41 <xsl:variable name="hours"><xsl:value-of select="floor($seconds div 3600)" /></xsl:variable>
42 <xsl:variable name="minutes"><xsl:value-of select="floor($seconds div 60)" /></xsl:variable>
Alexander Afanasyev8a093762014-07-16 18:43:09 -070043 <xsl:choose>
Chengyu Fana55663d2014-08-13 20:31:03 -060044 <xsl:when test="$days = 1">
45 <xsl:value-of select="$days"/> day
46 </xsl:when>
47 <xsl:when test="$days > 1">
Alexander Afanasyev8a093762014-07-16 18:43:09 -070048 <xsl:value-of select="$days"/> days
49 </xsl:when>
Chengyu Fana55663d2014-08-13 20:31:03 -060050 <xsl:when test="$hours = 1">
51 <xsl:value-of select="$hours"/> hour
52 </xsl:when>
53 <xsl:when test="$hours > 1">
Alexander Afanasyev8a093762014-07-16 18:43:09 -070054 <xsl:value-of select="$hours"/> hours
55 </xsl:when>
Chengyu Fana55663d2014-08-13 20:31:03 -060056 <xsl:when test="$minutes = 1">
57 <xsl:value-of select="$minutes"/> minute
58 </xsl:when>
59 <xsl:when test="$minutes > 1">
Alexander Afanasyev8a093762014-07-16 18:43:09 -070060 <xsl:value-of select="$minutes"/> minutes
61 </xsl:when>
Chengyu Fana55663d2014-08-13 20:31:03 -060062 <xsl:when test="$seconds = 1">
63 <xsl:value-of select="$seconds"/> second
64 </xsl:when>
Alexander Afanasyev8a093762014-07-16 18:43:09 -070065 <xsl:otherwise>
66 <xsl:value-of select="$seconds"/> seconds
67 </xsl:otherwise>
68 </xsl:choose>
Alexander Afanasyev8a093762014-07-16 18:43:09 -070069</xsl:template>
70
Chengyu Fan45d1a762014-07-08 14:21:32 -060071<xsl:template match="nfd:generalStatus">
72 <h2>General NFD status</h2>
Alexander Afanasyev8a093762014-07-16 18:43:09 -070073 <table class="item-list">
74 <thead>
75 <tr>
Chengyu Fan8a53caf2014-08-01 14:08:37 -060076 <th>NFD ID</th>
Alexander Afanasyev8a093762014-07-16 18:43:09 -070077 <th>Version</th>
78 <th>Start time</th>
79 <th>Current time</th>
80 <th>Uptime</th>
81 <th>NameTree Entries</th>
82 <th>FIB entries</th>
83 <th>PIT entries</th>
84 <th>Measurements entries</th>
85 <th>CS entries</th>
86 <th>In Interests</th>
87 <th>Out Interests</th>
88 <th>In Data</th>
89 <th>Out Data</th>
90 </tr>
91 </thead>
92 <tbody>
93 <tr class="center">
Chengyu Fan8a53caf2014-08-01 14:08:37 -060094 <td><xsl:apply-templates select="nfd:nfdId"/></td>
Hila Ben Abraham2ef99572014-12-02 02:45:51 -060095 <td><xsl:value-of select="nfd:version"/></td>
Alexander Afanasyev8a093762014-07-16 18:43:09 -070096 <td><xsl:call-template name="formatDate"><xsl:with-param name="date" select="nfd:startTime" /></xsl:call-template></td>
97 <td><xsl:call-template name="formatDate"><xsl:with-param name="date" select="nfd:currentTime" /></xsl:call-template></td>
98 <td><xsl:call-template name="formatDuration"><xsl:with-param name="duration" select="nfd:uptime" /></xsl:call-template></td>
99 <td><xsl:value-of select="nfd:nNameTreeEntries"/></td>
100 <td><xsl:value-of select="nfd:nFibEntries"/></td>
101 <td><xsl:value-of select="nfd:nPitEntries"/></td>
102 <td><xsl:value-of select="nfd:nMeasurementsEntries"/></td>
103 <td><xsl:value-of select="nfd:nCsEntries"/></td>
104 <td><xsl:value-of select="nfd:packetCounters/nfd:incomingPackets/nfd:nInterests"/></td>
105 <td><xsl:value-of select="nfd:packetCounters/nfd:outgoingPackets/nfd:nInterests"/></td>
106 <td><xsl:value-of select="nfd:packetCounters/nfd:incomingPackets/nfd:nDatas"/></td>
107 <td><xsl:value-of select="nfd:packetCounters/nfd:outgoingPackets/nfd:nDatas"/></td>
108 </tr>
109 </tbody>
Chengyu Fan45d1a762014-07-08 14:21:32 -0600110 </table>
111</xsl:template>
112
113<xsl:template match="nfd:channels">
114 <h2>Channels</h2>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700115 <table class="item-list">
116 <thead>
117 <tr>
118 <th>Channel URI</th>
119 </tr>
120 </thead>
121 <tbody>
122 <xsl:for-each select="nfd:channel">
123 <xsl:variable name="style">
124 <xsl:choose>
125 <xsl:when test="position() mod 2 = 1">
126 <xsl:text>odd</xsl:text>
127 </xsl:when>
128 <xsl:otherwise>even</xsl:otherwise>
129 </xsl:choose>
130 </xsl:variable>
131 <tr class="{$style}">
132 <td><xsl:value-of select="nfd:localUri"/></td>
133 </tr>
134 </xsl:for-each>
135 </tbody>
Chengyu Fan45d1a762014-07-08 14:21:32 -0600136 </table>
137</xsl:template>
138
139<xsl:template match="nfd:faces">
140 <h2>Faces</h2>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700141 <table class="item-list">
142 <thead>
143 <tr>
144 <th>Face ID</th>
145 <th>Remote URI</th>
146 <th>Local URI</th>
Chengyu Fan27d570a2014-10-09 11:52:17 -0600147 <th>Scope</th>
148 <th>Persistency</th>
149 <th>LinkType</th>
Chengyu Fan67179642014-08-15 16:00:43 -0600150 <th>Expires in</th>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700151 <th>In Interests</th>
152 <th>In Data</th>
Chengyu Fan3331cfa2014-07-25 17:36:31 -0600153 <th>In Bytes</th>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700154 <th>Out Interests</th>
155 <th>Out Data</th>
Chengyu Fan3331cfa2014-07-25 17:36:31 -0600156 <th>Out Bytes</th>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700157 </tr>
158 </thead>
159 <tbody>
160 <xsl:for-each select="nfd:face">
161 <xsl:variable name="style">
162 <xsl:choose>
163 <xsl:when test="position() mod 2 = 1">
164 <xsl:text>odd</xsl:text>
165 </xsl:when>
166 <xsl:otherwise>even</xsl:otherwise>
167 </xsl:choose>
168 </xsl:variable>
169 <tr class="{$style}">
170 <td><xsl:value-of select="nfd:faceId"/></td>
171 <td><xsl:value-of select="nfd:remoteUri"/></td>
172 <td><xsl:value-of select="nfd:localUri"/></td>
Chengyu Fan27d570a2014-10-09 11:52:17 -0600173 <td><xsl:value-of select="nfd:faceScope"/></td>
174 <td><xsl:value-of select="nfd:facePersistency"/></td>
175 <td><xsl:value-of select="nfd:linkType"/></td>
Chengyu Fan67179642014-08-15 16:00:43 -0600176 <td>
177 <xsl:choose>
178 <xsl:when test="nfd:expirationPeriod">
179 <xsl:call-template name="formatDuration"><xsl:with-param name="duration" select="nfd:expirationPeriod" /></xsl:call-template>
180 </xsl:when>
181 <xsl:otherwise>
182 Never
183 </xsl:otherwise>
184 </xsl:choose>
185 </td>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700186 <td><xsl:value-of select="nfd:packetCounters/nfd:incomingPackets/nfd:nInterests"/></td>
187 <td><xsl:value-of select="nfd:packetCounters/nfd:incomingPackets/nfd:nDatas"/></td>
Chengyu Fan3331cfa2014-07-25 17:36:31 -0600188 <td><xsl:value-of select="nfd:byteCounters/nfd:incomingBytes"/></td>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700189 <td><xsl:value-of select="nfd:packetCounters/nfd:outgoingPackets/nfd:nInterests"/></td>
190 <td><xsl:value-of select="nfd:packetCounters/nfd:outgoingPackets/nfd:nDatas"/></td>
Chengyu Fan3331cfa2014-07-25 17:36:31 -0600191 <td><xsl:value-of select="nfd:byteCounters/nfd:outgoingBytes"/></td>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700192 </tr>
193 </xsl:for-each>
194 </tbody>
Chengyu Fan45d1a762014-07-08 14:21:32 -0600195 </table>
196</xsl:template>
197
198<xsl:template match="nfd:fib">
199 <h2>FIB</h2>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700200 <table class="item-list">
201 <thead>
202 <tr>
Chengyu Fan30aa2072014-07-20 13:52:32 -0600203 <th width="20%">Prefix</th>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700204 <th>NextHops</th>
205 </tr>
206 </thead>
207 <tbody>
208 <xsl:for-each select="nfd:fibEntry">
209 <xsl:variable name="style">
210 <xsl:choose>
211 <xsl:when test="position() mod 2 = 1">
212 <xsl:text>odd</xsl:text>
213 </xsl:when>
214 <xsl:otherwise>even</xsl:otherwise>
215 </xsl:choose>
216 </xsl:variable>
217 <tr class="{$style}">
218 <td style="text-align:left;vertical-align:top;padding:0"><xsl:value-of select="nfd:prefix"/></td>
219 <td>
Chengyu Fan30aa2072014-07-20 13:52:32 -0600220 <table class="item-sublist">
221 <tr>
222 <th>FaceId</th>
223 <xsl:for-each select="nfd:nextHops/nfd:nextHop">
224 <td><xsl:value-of select="nfd:faceId"/></td>
225 </xsl:for-each>
226 </tr>
227 <tr>
228 <th>Cost</th>
229 <xsl:for-each select="nfd:nextHops/nfd:nextHop">
230 <td><xsl:value-of select="nfd:cost"/></td>
231 </xsl:for-each>
232 </tr>
233 </table>
234 </td>
235 </tr>
236 </xsl:for-each>
237 </tbody>
238 </table>
239</xsl:template>
240
241<xsl:template match="nfd:rib">
242 <h2>RIB</h2>
243 <table class="item-list">
244 <thead>
245 <tr>
246 <th width="20%">Prefix</th>
247 <th>Routes</th>
248 </tr>
249 </thead>
250 <tbody>
251 <xsl:for-each select="nfd:ribEntry">
252 <xsl:variable name="style">
253 <xsl:choose>
254 <xsl:when test="position() mod 2 = 1">
255 <xsl:text>odd</xsl:text>
256 </xsl:when>
257 <xsl:otherwise>even</xsl:otherwise>
258 </xsl:choose>
259 </xsl:variable>
260 <tr class="{$style}">
261 <td style="text-align:left;vertical-align:top;padding:0"><xsl:value-of select="nfd:prefix"/></td>
262 <td>
263 <table class="item-sublist">
264 <tr>
265 <th>FaceId</th>
266 <xsl:for-each select="nfd:routes/nfd:route">
267 <td><xsl:value-of select="nfd:faceId"/></td>
268 </xsl:for-each>
269 </tr>
270 <tr>
271 <th>Origin</th>
272 <xsl:for-each select="nfd:routes/nfd:route">
273 <td><xsl:value-of select="nfd:origin"/></td>
274 </xsl:for-each>
275 </tr>
276 <tr>
277 <th>Cost</th>
278 <xsl:for-each select="nfd:routes/nfd:route">
279 <td><xsl:value-of select="nfd:cost"/></td>
280 </xsl:for-each>
281 </tr>
282 <tr>
Chengyu Fan1c630ba2014-08-20 13:27:58 -0500283 <th>ChildInherit</th>
Chengyu Fan30aa2072014-07-20 13:52:32 -0600284 <xsl:for-each select="nfd:routes/nfd:route">
Chengyu Fan1c630ba2014-08-20 13:27:58 -0500285 <td>
286 <xsl:if test="nfd:flags/nfd:childInherit">
287 Y
288 </xsl:if>
289 </td>
290 </xsl:for-each>
291 </tr>
292 <tr>
293 <th>RibCapture</th>
294 <xsl:for-each select="nfd:routes/nfd:route">
295 <td>
296 <xsl:if test="nfd:flags/nfd:ribCapture">
297 Y
298 </xsl:if>
299 </td>
Chengyu Fan30aa2072014-07-20 13:52:32 -0600300 </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>