blob: 031f27307ad09dde41bafb35c597733b8269a92c [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>
Chengyu Fan8a53caf2014-08-01 14:08:37 -060075 <th>NFD ID</th>
Alexander Afanasyev8a093762014-07-16 18:43:09 -070076 <th>Version</th>
77 <th>Start time</th>
78 <th>Current time</th>
79 <th>Uptime</th>
80 <th>NameTree Entries</th>
81 <th>FIB entries</th>
82 <th>PIT entries</th>
83 <th>Measurements entries</th>
84 <th>CS entries</th>
85 <th>In Interests</th>
86 <th>Out Interests</th>
87 <th>In Data</th>
88 <th>Out Data</th>
89 </tr>
90 </thead>
91 <tbody>
92 <tr class="center">
Chengyu Fan8a53caf2014-08-01 14:08:37 -060093 <td><xsl:apply-templates select="nfd:nfdId"/></td>
Alexander Afanasyev8a093762014-07-16 18:43:09 -070094 <td><xsl:apply-templates select="nfd:version"/></td>
95 <td><xsl:call-template name="formatDate"><xsl:with-param name="date" select="nfd:startTime" /></xsl:call-template></td>
96 <td><xsl:call-template name="formatDate"><xsl:with-param name="date" select="nfd:currentTime" /></xsl:call-template></td>
97 <td><xsl:call-template name="formatDuration"><xsl:with-param name="duration" select="nfd:uptime" /></xsl:call-template></td>
98 <td><xsl:value-of select="nfd:nNameTreeEntries"/></td>
99 <td><xsl:value-of select="nfd:nFibEntries"/></td>
100 <td><xsl:value-of select="nfd:nPitEntries"/></td>
101 <td><xsl:value-of select="nfd:nMeasurementsEntries"/></td>
102 <td><xsl:value-of select="nfd:nCsEntries"/></td>
103 <td><xsl:value-of select="nfd:packetCounters/nfd:incomingPackets/nfd:nInterests"/></td>
104 <td><xsl:value-of select="nfd:packetCounters/nfd:outgoingPackets/nfd:nInterests"/></td>
105 <td><xsl:value-of select="nfd:packetCounters/nfd:incomingPackets/nfd:nDatas"/></td>
106 <td><xsl:value-of select="nfd:packetCounters/nfd:outgoingPackets/nfd:nDatas"/></td>
107 </tr>
108 </tbody>
Chengyu Fan45d1a762014-07-08 14:21:32 -0600109 </table>
110</xsl:template>
111
112<xsl:template match="nfd:channels">
113 <h2>Channels</h2>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700114 <table class="item-list">
115 <thead>
116 <tr>
117 <th>Channel URI</th>
118 </tr>
119 </thead>
120 <tbody>
121 <xsl:for-each select="nfd:channel">
122 <xsl:variable name="style">
123 <xsl:choose>
124 <xsl:when test="position() mod 2 = 1">
125 <xsl:text>odd</xsl:text>
126 </xsl:when>
127 <xsl:otherwise>even</xsl:otherwise>
128 </xsl:choose>
129 </xsl:variable>
130 <tr class="{$style}">
131 <td><xsl:value-of select="nfd:localUri"/></td>
132 </tr>
133 </xsl:for-each>
134 </tbody>
Chengyu Fan45d1a762014-07-08 14:21:32 -0600135 </table>
136</xsl:template>
137
138<xsl:template match="nfd:faces">
139 <h2>Faces</h2>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700140 <table class="item-list">
141 <thead>
142 <tr>
143 <th>Face ID</th>
144 <th>Remote URI</th>
145 <th>Local URI</th>
146 <th>In Interests</th>
147 <th>In Data</th>
Chengyu Fan3331cfa2014-07-25 17:36:31 -0600148 <th>In Bytes</th>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700149 <th>Out Interests</th>
150 <th>Out Data</th>
Chengyu Fan3331cfa2014-07-25 17:36:31 -0600151 <th>Out Bytes</th>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700152 </tr>
153 </thead>
154 <tbody>
155 <xsl:for-each select="nfd:face">
156 <xsl:variable name="style">
157 <xsl:choose>
158 <xsl:when test="position() mod 2 = 1">
159 <xsl:text>odd</xsl:text>
160 </xsl:when>
161 <xsl:otherwise>even</xsl:otherwise>
162 </xsl:choose>
163 </xsl:variable>
164 <tr class="{$style}">
165 <td><xsl:value-of select="nfd:faceId"/></td>
166 <td><xsl:value-of select="nfd:remoteUri"/></td>
167 <td><xsl:value-of select="nfd:localUri"/></td>
168 <td><xsl:value-of select="nfd:packetCounters/nfd:incomingPackets/nfd:nInterests"/></td>
169 <td><xsl:value-of select="nfd:packetCounters/nfd:incomingPackets/nfd:nDatas"/></td>
Chengyu Fan3331cfa2014-07-25 17:36:31 -0600170 <td><xsl:value-of select="nfd:byteCounters/nfd:incomingBytes"/></td>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700171 <td><xsl:value-of select="nfd:packetCounters/nfd:outgoingPackets/nfd:nInterests"/></td>
172 <td><xsl:value-of select="nfd:packetCounters/nfd:outgoingPackets/nfd:nDatas"/></td>
Chengyu Fan3331cfa2014-07-25 17:36:31 -0600173 <td><xsl:value-of select="nfd:byteCounters/nfd:outgoingBytes"/></td>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700174 </tr>
175 </xsl:for-each>
176 </tbody>
Chengyu Fan45d1a762014-07-08 14:21:32 -0600177 </table>
178</xsl:template>
179
180<xsl:template match="nfd:fib">
181 <h2>FIB</h2>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700182 <table class="item-list">
183 <thead>
184 <tr>
Chengyu Fan30aa2072014-07-20 13:52:32 -0600185 <th width="20%">Prefix</th>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700186 <th>NextHops</th>
187 </tr>
188 </thead>
189 <tbody>
190 <xsl:for-each select="nfd:fibEntry">
191 <xsl:variable name="style">
192 <xsl:choose>
193 <xsl:when test="position() mod 2 = 1">
194 <xsl:text>odd</xsl:text>
195 </xsl:when>
196 <xsl:otherwise>even</xsl:otherwise>
197 </xsl:choose>
198 </xsl:variable>
199 <tr class="{$style}">
200 <td style="text-align:left;vertical-align:top;padding:0"><xsl:value-of select="nfd:prefix"/></td>
201 <td>
Chengyu Fan30aa2072014-07-20 13:52:32 -0600202 <table class="item-sublist">
203 <tr>
204 <th>FaceId</th>
205 <xsl:for-each select="nfd:nextHops/nfd:nextHop">
206 <td><xsl:value-of select="nfd:faceId"/></td>
207 </xsl:for-each>
208 </tr>
209 <tr>
210 <th>Cost</th>
211 <xsl:for-each select="nfd:nextHops/nfd:nextHop">
212 <td><xsl:value-of select="nfd:cost"/></td>
213 </xsl:for-each>
214 </tr>
215 </table>
216 </td>
217 </tr>
218 </xsl:for-each>
219 </tbody>
220 </table>
221</xsl:template>
222
223<xsl:template match="nfd:rib">
224 <h2>RIB</h2>
225 <table class="item-list">
226 <thead>
227 <tr>
228 <th width="20%">Prefix</th>
229 <th>Routes</th>
230 </tr>
231 </thead>
232 <tbody>
233 <xsl:for-each select="nfd:ribEntry">
234 <xsl:variable name="style">
235 <xsl:choose>
236 <xsl:when test="position() mod 2 = 1">
237 <xsl:text>odd</xsl:text>
238 </xsl:when>
239 <xsl:otherwise>even</xsl:otherwise>
240 </xsl:choose>
241 </xsl:variable>
242 <tr class="{$style}">
243 <td style="text-align:left;vertical-align:top;padding:0"><xsl:value-of select="nfd:prefix"/></td>
244 <td>
245 <table class="item-sublist">
246 <tr>
247 <th>FaceId</th>
248 <xsl:for-each select="nfd:routes/nfd:route">
249 <td><xsl:value-of select="nfd:faceId"/></td>
250 </xsl:for-each>
251 </tr>
252 <tr>
253 <th>Origin</th>
254 <xsl:for-each select="nfd:routes/nfd:route">
255 <td><xsl:value-of select="nfd:origin"/></td>
256 </xsl:for-each>
257 </tr>
258 <tr>
259 <th>Cost</th>
260 <xsl:for-each select="nfd:routes/nfd:route">
261 <td><xsl:value-of select="nfd:cost"/></td>
262 </xsl:for-each>
263 </tr>
264 <tr>
265 <th>Flags</th>
266 <xsl:for-each select="nfd:routes/nfd:route">
267 <td><xsl:value-of select="nfd:flags"/></td>
268 </xsl:for-each>
269 </tr>
270 <tr>
271 <th>Expires in</th>
272 <xsl:for-each select="nfd:routes/nfd:route">
273 <td>
274 <xsl:choose>
275 <xsl:when test="nfd:expirationPeriod">
276 <xsl:call-template name="formatDuration"><xsl:with-param name="duration" select="nfd:expirationPeriod" /></xsl:call-template>
277 </xsl:when>
278 <xsl:otherwise>
279 Never
280 </xsl:otherwise>
281 </xsl:choose>
282 </td>
283 </xsl:for-each>
284 </tr>
285 </table>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700286 </td>
287 </tr>
Chengyu Fan45d1a762014-07-08 14:21:32 -0600288 </xsl:for-each>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700289 </tbody>
Chengyu Fan45d1a762014-07-08 14:21:32 -0600290 </table>
291</xsl:template>
292
293<xsl:template match="nfd:strategyChoices">
294 <h2>Strategy Choices</h2>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700295 <table class="item-list">
296 <thead>
297 <tr>
Chengyu Fan30aa2072014-07-20 13:52:32 -0600298 <th width="20%">Namespace</th>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700299 <th>Strategy Name</th>
300 </tr>
301 </thead>
302 <tbody>
303 <xsl:for-each select="nfd:strategyChoice">
304 <tr>
305 <td><xsl:value-of select="nfd:namespace"/></td>
306 <td><xsl:value-of select="nfd:strategy/nfd:name"/></td>
307 </tr>
308 </xsl:for-each>
309 </tbody>
Chengyu Fan45d1a762014-07-08 14:21:32 -0600310 </table>
311</xsl:template>
312
313</xsl:stylesheet>