blob: 37038c54cd26bbd462f4609abf15b8b062581f98 [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>
Chengyu Fan30aa2072014-07-20 13:52:32 -0600179 <th width="20%">Prefix</th>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700180 <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>
Chengyu Fan30aa2072014-07-20 13:52:32 -0600196 <table class="item-sublist">
197 <tr>
198 <th>FaceId</th>
199 <xsl:for-each select="nfd:nextHops/nfd:nextHop">
200 <td><xsl:value-of select="nfd:faceId"/></td>
201 </xsl:for-each>
202 </tr>
203 <tr>
204 <th>Cost</th>
205 <xsl:for-each select="nfd:nextHops/nfd:nextHop">
206 <td><xsl:value-of select="nfd:cost"/></td>
207 </xsl:for-each>
208 </tr>
209 </table>
210 </td>
211 </tr>
212 </xsl:for-each>
213 </tbody>
214 </table>
215</xsl:template>
216
217<xsl:template match="nfd:rib">
218 <h2>RIB</h2>
219 <table class="item-list">
220 <thead>
221 <tr>
222 <th width="20%">Prefix</th>
223 <th>Routes</th>
224 </tr>
225 </thead>
226 <tbody>
227 <xsl:for-each select="nfd:ribEntry">
228 <xsl:variable name="style">
229 <xsl:choose>
230 <xsl:when test="position() mod 2 = 1">
231 <xsl:text>odd</xsl:text>
232 </xsl:when>
233 <xsl:otherwise>even</xsl:otherwise>
234 </xsl:choose>
235 </xsl:variable>
236 <tr class="{$style}">
237 <td style="text-align:left;vertical-align:top;padding:0"><xsl:value-of select="nfd:prefix"/></td>
238 <td>
239 <table class="item-sublist">
240 <tr>
241 <th>FaceId</th>
242 <xsl:for-each select="nfd:routes/nfd:route">
243 <td><xsl:value-of select="nfd:faceId"/></td>
244 </xsl:for-each>
245 </tr>
246 <tr>
247 <th>Origin</th>
248 <xsl:for-each select="nfd:routes/nfd:route">
249 <td><xsl:value-of select="nfd:origin"/></td>
250 </xsl:for-each>
251 </tr>
252 <tr>
253 <th>Cost</th>
254 <xsl:for-each select="nfd:routes/nfd:route">
255 <td><xsl:value-of select="nfd:cost"/></td>
256 </xsl:for-each>
257 </tr>
258 <tr>
259 <th>Flags</th>
260 <xsl:for-each select="nfd:routes/nfd:route">
261 <td><xsl:value-of select="nfd:flags"/></td>
262 </xsl:for-each>
263 </tr>
264 <tr>
265 <th>Expires in</th>
266 <xsl:for-each select="nfd:routes/nfd:route">
267 <td>
268 <xsl:choose>
269 <xsl:when test="nfd:expirationPeriod">
270 <xsl:call-template name="formatDuration"><xsl:with-param name="duration" select="nfd:expirationPeriod" /></xsl:call-template>
271 </xsl:when>
272 <xsl:otherwise>
273 Never
274 </xsl:otherwise>
275 </xsl:choose>
276 </td>
277 </xsl:for-each>
278 </tr>
279 </table>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700280 </td>
281 </tr>
Chengyu Fan45d1a762014-07-08 14:21:32 -0600282 </xsl:for-each>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700283 </tbody>
Chengyu Fan45d1a762014-07-08 14:21:32 -0600284 </table>
285</xsl:template>
286
287<xsl:template match="nfd:strategyChoices">
288 <h2>Strategy Choices</h2>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700289 <table class="item-list">
290 <thead>
291 <tr>
Chengyu Fan30aa2072014-07-20 13:52:32 -0600292 <th width="20%">Namespace</th>
Alexander Afanasyev8a093762014-07-16 18:43:09 -0700293 <th>Strategy Name</th>
294 </tr>
295 </thead>
296 <tbody>
297 <xsl:for-each select="nfd:strategyChoice">
298 <tr>
299 <td><xsl:value-of select="nfd:namespace"/></td>
300 <td><xsl:value-of select="nfd:strategy/nfd:name"/></td>
301 </tr>
302 </xsl:for-each>
303 </tbody>
Chengyu Fan45d1a762014-07-08 14:21:32 -0600304 </table>
305</xsl:template>
306
307</xsl:stylesheet>