blob: e7cc55a3ceffc59e9a66476beb547585c60bab8e [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>
Chengyu Fan3331cfa2014-07-25 17:36:31 -0600146 <th>In Bytes</th>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700147 <th>Out Interests</th>
148 <th>Out Data</th>
Chengyu Fan3331cfa2014-07-25 17:36:31 -0600149 <th>Out Bytes</th>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700150 </tr>
151 </thead>
152 <tbody>
153 <xsl:for-each select="nfd:face">
154 <xsl:variable name="style">
155 <xsl:choose>
156 <xsl:when test="position() mod 2 = 1">
157 <xsl:text>odd</xsl:text>
158 </xsl:when>
159 <xsl:otherwise>even</xsl:otherwise>
160 </xsl:choose>
161 </xsl:variable>
162 <tr class="{$style}">
163 <td><xsl:value-of select="nfd:faceId"/></td>
164 <td><xsl:value-of select="nfd:remoteUri"/></td>
165 <td><xsl:value-of select="nfd:localUri"/></td>
166 <td><xsl:value-of select="nfd:packetCounters/nfd:incomingPackets/nfd:nInterests"/></td>
167 <td><xsl:value-of select="nfd:packetCounters/nfd:incomingPackets/nfd:nDatas"/></td>
Chengyu Fan3331cfa2014-07-25 17:36:31 -0600168 <td><xsl:value-of select="nfd:byteCounters/nfd:incomingBytes"/></td>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700169 <td><xsl:value-of select="nfd:packetCounters/nfd:outgoingPackets/nfd:nInterests"/></td>
170 <td><xsl:value-of select="nfd:packetCounters/nfd:outgoingPackets/nfd:nDatas"/></td>
Chengyu Fan3331cfa2014-07-25 17:36:31 -0600171 <td><xsl:value-of select="nfd:byteCounters/nfd:outgoingBytes"/></td>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700172 </tr>
173 </xsl:for-each>
174 </tbody>
Chengyu Fan45d1a762014-07-08 14:21:32 -0600175 </table>
176</xsl:template>
177
178<xsl:template match="nfd:fib">
179 <h2>FIB</h2>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700180 <table class="item-list">
181 <thead>
182 <tr>
Chengyu Fan30aa2072014-07-20 13:52:32 -0600183 <th width="20%">Prefix</th>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700184 <th>NextHops</th>
185 </tr>
186 </thead>
187 <tbody>
188 <xsl:for-each select="nfd:fibEntry">
189 <xsl:variable name="style">
190 <xsl:choose>
191 <xsl:when test="position() mod 2 = 1">
192 <xsl:text>odd</xsl:text>
193 </xsl:when>
194 <xsl:otherwise>even</xsl:otherwise>
195 </xsl:choose>
196 </xsl:variable>
197 <tr class="{$style}">
198 <td style="text-align:left;vertical-align:top;padding:0"><xsl:value-of select="nfd:prefix"/></td>
199 <td>
Chengyu Fan30aa2072014-07-20 13:52:32 -0600200 <table class="item-sublist">
201 <tr>
202 <th>FaceId</th>
203 <xsl:for-each select="nfd:nextHops/nfd:nextHop">
204 <td><xsl:value-of select="nfd:faceId"/></td>
205 </xsl:for-each>
206 </tr>
207 <tr>
208 <th>Cost</th>
209 <xsl:for-each select="nfd:nextHops/nfd:nextHop">
210 <td><xsl:value-of select="nfd:cost"/></td>
211 </xsl:for-each>
212 </tr>
213 </table>
214 </td>
215 </tr>
216 </xsl:for-each>
217 </tbody>
218 </table>
219</xsl:template>
220
221<xsl:template match="nfd:rib">
222 <h2>RIB</h2>
223 <table class="item-list">
224 <thead>
225 <tr>
226 <th width="20%">Prefix</th>
227 <th>Routes</th>
228 </tr>
229 </thead>
230 <tbody>
231 <xsl:for-each select="nfd:ribEntry">
232 <xsl:variable name="style">
233 <xsl:choose>
234 <xsl:when test="position() mod 2 = 1">
235 <xsl:text>odd</xsl:text>
236 </xsl:when>
237 <xsl:otherwise>even</xsl:otherwise>
238 </xsl:choose>
239 </xsl:variable>
240 <tr class="{$style}">
241 <td style="text-align:left;vertical-align:top;padding:0"><xsl:value-of select="nfd:prefix"/></td>
242 <td>
243 <table class="item-sublist">
244 <tr>
245 <th>FaceId</th>
246 <xsl:for-each select="nfd:routes/nfd:route">
247 <td><xsl:value-of select="nfd:faceId"/></td>
248 </xsl:for-each>
249 </tr>
250 <tr>
251 <th>Origin</th>
252 <xsl:for-each select="nfd:routes/nfd:route">
253 <td><xsl:value-of select="nfd:origin"/></td>
254 </xsl:for-each>
255 </tr>
256 <tr>
257 <th>Cost</th>
258 <xsl:for-each select="nfd:routes/nfd:route">
259 <td><xsl:value-of select="nfd:cost"/></td>
260 </xsl:for-each>
261 </tr>
262 <tr>
263 <th>Flags</th>
264 <xsl:for-each select="nfd:routes/nfd:route">
265 <td><xsl:value-of select="nfd:flags"/></td>
266 </xsl:for-each>
267 </tr>
268 <tr>
269 <th>Expires in</th>
270 <xsl:for-each select="nfd:routes/nfd:route">
271 <td>
272 <xsl:choose>
273 <xsl:when test="nfd:expirationPeriod">
274 <xsl:call-template name="formatDuration"><xsl:with-param name="duration" select="nfd:expirationPeriod" /></xsl:call-template>
275 </xsl:when>
276 <xsl:otherwise>
277 Never
278 </xsl:otherwise>
279 </xsl:choose>
280 </td>
281 </xsl:for-each>
282 </tr>
283 </table>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700284 </td>
285 </tr>
Chengyu Fan45d1a762014-07-08 14:21:32 -0600286 </xsl:for-each>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700287 </tbody>
Chengyu Fan45d1a762014-07-08 14:21:32 -0600288 </table>
289</xsl:template>
290
291<xsl:template match="nfd:strategyChoices">
292 <h2>Strategy Choices</h2>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700293 <table class="item-list">
294 <thead>
295 <tr>
Chengyu Fan30aa2072014-07-20 13:52:32 -0600296 <th width="20%">Namespace</th>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700297 <th>Strategy Name</th>
298 </tr>
299 </thead>
300 <tbody>
301 <xsl:for-each select="nfd:strategyChoice">
302 <tr>
303 <td><xsl:value-of select="nfd:namespace"/></td>
304 <td><xsl:value-of select="nfd:strategy/nfd:name"/></td>
305 </tr>
306 </xsl:for-each>
307 </tbody>
Chengyu Fan45d1a762014-07-08 14:21:32 -0600308 </table>
309</xsl:template>
310
311</xsl:stylesheet>