Chengyu Fan | 45d1a76 | 2014-07-08 14:21:32 -0600 | [diff] [blame] | 1 | <xsl:stylesheet version="1.0" |
Chengyu Fan | 45d1a76 | 2014-07-08 14:21:32 -0600 | [diff] [blame] | 2 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
| 3 | xmlns:nfd="ndn:/localhost/nfd/status/1"> |
Alexander Afanasyev | 8a09376 | 2014-07-16 18:43:09 -0700 | [diff] [blame] | 4 | <xsl:output method="html" encoding="utf-8" indent="yes" /> |
Chengyu Fan | 45d1a76 | 2014-07-08 14:21:32 -0600 | [diff] [blame] | 5 | |
| 6 | <xsl:template match="/"> |
Alexander Afanasyev | 8a09376 | 2014-07-16 18:43:09 -0700 | [diff] [blame] | 7 | <xsl:text disable-output-escaping='yes'><!DOCTYPE html></xsl:text> |
Chengyu Fan | 45d1a76 | 2014-07-08 14:21:32 -0600 | [diff] [blame] | 8 | <html> |
| 9 | <head> |
| 10 | <title>NFD Status</title> |
Alexander Afanasyev | 8a09376 | 2014-07-16 18:43:09 -0700 | [diff] [blame] | 11 | <link rel="stylesheet" type="text/css" href="style.css" /> |
Chengyu Fan | 45d1a76 | 2014-07-08 14:21:32 -0600 | [diff] [blame] | 12 | </head> |
| 13 | <body> |
Alexander Afanasyev | 8a09376 | 2014-07-16 18:43:09 -0700 | [diff] [blame] | 14 | <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 Fan | 45d1a76 | 2014-07-08 14:21:32 -0600 | [diff] [blame] | 28 | </body> |
| 29 | </html> |
| 30 | </xsl:template> |
| 31 | |
Alexander Afanasyev | 8a09376 | 2014-07-16 18:43:09 -0700 | [diff] [blame] | 32 | <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)"/> <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 Fan | a55663d | 2014-08-13 20:31:03 -0600 | [diff] [blame] | 48 | <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 Afanasyev | 8a09376 | 2014-07-16 18:43:09 -0700 | [diff] [blame] | 51 | <xsl:choose> |
Chengyu Fan | a55663d | 2014-08-13 20:31:03 -0600 | [diff] [blame] | 52 | <xsl:when test="$days = 1"> |
| 53 | <xsl:value-of select="$days"/> day |
| 54 | </xsl:when> |
| 55 | <xsl:when test="$days > 1"> |
Alexander Afanasyev | 8a09376 | 2014-07-16 18:43:09 -0700 | [diff] [blame] | 56 | <xsl:value-of select="$days"/> days |
| 57 | </xsl:when> |
Chengyu Fan | a55663d | 2014-08-13 20:31:03 -0600 | [diff] [blame] | 58 | <xsl:when test="$hours = 1"> |
| 59 | <xsl:value-of select="$hours"/> hour |
| 60 | </xsl:when> |
| 61 | <xsl:when test="$hours > 1"> |
Alexander Afanasyev | 8a09376 | 2014-07-16 18:43:09 -0700 | [diff] [blame] | 62 | <xsl:value-of select="$hours"/> hours |
| 63 | </xsl:when> |
Chengyu Fan | a55663d | 2014-08-13 20:31:03 -0600 | [diff] [blame] | 64 | <xsl:when test="$minutes = 1"> |
| 65 | <xsl:value-of select="$minutes"/> minute |
| 66 | </xsl:when> |
| 67 | <xsl:when test="$minutes > 1"> |
Alexander Afanasyev | 8a09376 | 2014-07-16 18:43:09 -0700 | [diff] [blame] | 68 | <xsl:value-of select="$minutes"/> minutes |
| 69 | </xsl:when> |
Chengyu Fan | a55663d | 2014-08-13 20:31:03 -0600 | [diff] [blame] | 70 | <xsl:when test="$seconds = 1"> |
| 71 | <xsl:value-of select="$seconds"/> second |
| 72 | </xsl:when> |
Alexander Afanasyev | 8a09376 | 2014-07-16 18:43:09 -0700 | [diff] [blame] | 73 | <xsl:otherwise> |
| 74 | <xsl:value-of select="$seconds"/> seconds |
| 75 | </xsl:otherwise> |
| 76 | </xsl:choose> |
Alexander Afanasyev | 8a09376 | 2014-07-16 18:43:09 -0700 | [diff] [blame] | 77 | </xsl:template> |
| 78 | |
Chengyu Fan | 45d1a76 | 2014-07-08 14:21:32 -0600 | [diff] [blame] | 79 | <xsl:template match="nfd:generalStatus"> |
| 80 | <h2>General NFD status</h2> |
Alexander Afanasyev | 8a09376 | 2014-07-16 18:43:09 -0700 | [diff] [blame] | 81 | <table class="item-list"> |
| 82 | <thead> |
| 83 | <tr> |
Chengyu Fan | 8a53caf | 2014-08-01 14:08:37 -0600 | [diff] [blame] | 84 | <th>NFD ID</th> |
Alexander Afanasyev | 8a09376 | 2014-07-16 18:43:09 -0700 | [diff] [blame] | 85 | <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 Fan | 8a53caf | 2014-08-01 14:08:37 -0600 | [diff] [blame] | 102 | <td><xsl:apply-templates select="nfd:nfdId"/></td> |
Alexander Afanasyev | 8a09376 | 2014-07-16 18:43:09 -0700 | [diff] [blame] | 103 | <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 Fan | 45d1a76 | 2014-07-08 14:21:32 -0600 | [diff] [blame] | 118 | </table> |
| 119 | </xsl:template> |
| 120 | |
| 121 | <xsl:template match="nfd:channels"> |
| 122 | <h2>Channels</h2> |
Alexander Afanasyev | 8a09376 | 2014-07-16 18:43:09 -0700 | [diff] [blame] | 123 | <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 Fan | 45d1a76 | 2014-07-08 14:21:32 -0600 | [diff] [blame] | 144 | </table> |
| 145 | </xsl:template> |
| 146 | |
| 147 | <xsl:template match="nfd:faces"> |
| 148 | <h2>Faces</h2> |
Alexander Afanasyev | 8a09376 | 2014-07-16 18:43:09 -0700 | [diff] [blame] | 149 | <table class="item-list"> |
| 150 | <thead> |
| 151 | <tr> |
| 152 | <th>Face ID</th> |
| 153 | <th>Remote URI</th> |
| 154 | <th>Local URI</th> |
Chengyu Fan | 27d570a | 2014-10-09 11:52:17 -0600 | [diff] [blame] | 155 | <th>Scope</th> |
| 156 | <th>Persistency</th> |
| 157 | <th>LinkType</th> |
Chengyu Fan | 6717964 | 2014-08-15 16:00:43 -0600 | [diff] [blame] | 158 | <th>Expires in</th> |
Alexander Afanasyev | 8a09376 | 2014-07-16 18:43:09 -0700 | [diff] [blame] | 159 | <th>In Interests</th> |
| 160 | <th>In Data</th> |
Chengyu Fan | 3331cfa | 2014-07-25 17:36:31 -0600 | [diff] [blame] | 161 | <th>In Bytes</th> |
Alexander Afanasyev | 8a09376 | 2014-07-16 18:43:09 -0700 | [diff] [blame] | 162 | <th>Out Interests</th> |
| 163 | <th>Out Data</th> |
Chengyu Fan | 3331cfa | 2014-07-25 17:36:31 -0600 | [diff] [blame] | 164 | <th>Out Bytes</th> |
Alexander Afanasyev | 8a09376 | 2014-07-16 18:43:09 -0700 | [diff] [blame] | 165 | </tr> |
| 166 | </thead> |
| 167 | <tbody> |
| 168 | <xsl:for-each select="nfd:face"> |
| 169 | <xsl:variable name="style"> |
| 170 | <xsl:choose> |
| 171 | <xsl:when test="position() mod 2 = 1"> |
| 172 | <xsl:text>odd</xsl:text> |
| 173 | </xsl:when> |
| 174 | <xsl:otherwise>even</xsl:otherwise> |
| 175 | </xsl:choose> |
| 176 | </xsl:variable> |
| 177 | <tr class="{$style}"> |
| 178 | <td><xsl:value-of select="nfd:faceId"/></td> |
| 179 | <td><xsl:value-of select="nfd:remoteUri"/></td> |
| 180 | <td><xsl:value-of select="nfd:localUri"/></td> |
Chengyu Fan | 27d570a | 2014-10-09 11:52:17 -0600 | [diff] [blame] | 181 | <td><xsl:value-of select="nfd:faceScope"/></td> |
| 182 | <td><xsl:value-of select="nfd:facePersistency"/></td> |
| 183 | <td><xsl:value-of select="nfd:linkType"/></td> |
Chengyu Fan | 6717964 | 2014-08-15 16:00:43 -0600 | [diff] [blame] | 184 | <td> |
| 185 | <xsl:choose> |
| 186 | <xsl:when test="nfd:expirationPeriod"> |
| 187 | <xsl:call-template name="formatDuration"><xsl:with-param name="duration" select="nfd:expirationPeriod" /></xsl:call-template> |
| 188 | </xsl:when> |
| 189 | <xsl:otherwise> |
| 190 | Never |
| 191 | </xsl:otherwise> |
| 192 | </xsl:choose> |
| 193 | </td> |
Alexander Afanasyev | 8a09376 | 2014-07-16 18:43:09 -0700 | [diff] [blame] | 194 | <td><xsl:value-of select="nfd:packetCounters/nfd:incomingPackets/nfd:nInterests"/></td> |
| 195 | <td><xsl:value-of select="nfd:packetCounters/nfd:incomingPackets/nfd:nDatas"/></td> |
Chengyu Fan | 3331cfa | 2014-07-25 17:36:31 -0600 | [diff] [blame] | 196 | <td><xsl:value-of select="nfd:byteCounters/nfd:incomingBytes"/></td> |
Alexander Afanasyev | 8a09376 | 2014-07-16 18:43:09 -0700 | [diff] [blame] | 197 | <td><xsl:value-of select="nfd:packetCounters/nfd:outgoingPackets/nfd:nInterests"/></td> |
| 198 | <td><xsl:value-of select="nfd:packetCounters/nfd:outgoingPackets/nfd:nDatas"/></td> |
Chengyu Fan | 3331cfa | 2014-07-25 17:36:31 -0600 | [diff] [blame] | 199 | <td><xsl:value-of select="nfd:byteCounters/nfd:outgoingBytes"/></td> |
Alexander Afanasyev | 8a09376 | 2014-07-16 18:43:09 -0700 | [diff] [blame] | 200 | </tr> |
| 201 | </xsl:for-each> |
| 202 | </tbody> |
Chengyu Fan | 45d1a76 | 2014-07-08 14:21:32 -0600 | [diff] [blame] | 203 | </table> |
| 204 | </xsl:template> |
| 205 | |
| 206 | <xsl:template match="nfd:fib"> |
| 207 | <h2>FIB</h2> |
Alexander Afanasyev | 8a09376 | 2014-07-16 18:43:09 -0700 | [diff] [blame] | 208 | <table class="item-list"> |
| 209 | <thead> |
| 210 | <tr> |
Chengyu Fan | 30aa207 | 2014-07-20 13:52:32 -0600 | [diff] [blame] | 211 | <th width="20%">Prefix</th> |
Alexander Afanasyev | 8a09376 | 2014-07-16 18:43:09 -0700 | [diff] [blame] | 212 | <th>NextHops</th> |
| 213 | </tr> |
| 214 | </thead> |
| 215 | <tbody> |
| 216 | <xsl:for-each select="nfd:fibEntry"> |
| 217 | <xsl:variable name="style"> |
| 218 | <xsl:choose> |
| 219 | <xsl:when test="position() mod 2 = 1"> |
| 220 | <xsl:text>odd</xsl:text> |
| 221 | </xsl:when> |
| 222 | <xsl:otherwise>even</xsl:otherwise> |
| 223 | </xsl:choose> |
| 224 | </xsl:variable> |
| 225 | <tr class="{$style}"> |
| 226 | <td style="text-align:left;vertical-align:top;padding:0"><xsl:value-of select="nfd:prefix"/></td> |
| 227 | <td> |
Chengyu Fan | 30aa207 | 2014-07-20 13:52:32 -0600 | [diff] [blame] | 228 | <table class="item-sublist"> |
| 229 | <tr> |
| 230 | <th>FaceId</th> |
| 231 | <xsl:for-each select="nfd:nextHops/nfd:nextHop"> |
| 232 | <td><xsl:value-of select="nfd:faceId"/></td> |
| 233 | </xsl:for-each> |
| 234 | </tr> |
| 235 | <tr> |
| 236 | <th>Cost</th> |
| 237 | <xsl:for-each select="nfd:nextHops/nfd:nextHop"> |
| 238 | <td><xsl:value-of select="nfd:cost"/></td> |
| 239 | </xsl:for-each> |
| 240 | </tr> |
| 241 | </table> |
| 242 | </td> |
| 243 | </tr> |
| 244 | </xsl:for-each> |
| 245 | </tbody> |
| 246 | </table> |
| 247 | </xsl:template> |
| 248 | |
| 249 | <xsl:template match="nfd:rib"> |
| 250 | <h2>RIB</h2> |
| 251 | <table class="item-list"> |
| 252 | <thead> |
| 253 | <tr> |
| 254 | <th width="20%">Prefix</th> |
| 255 | <th>Routes</th> |
| 256 | </tr> |
| 257 | </thead> |
| 258 | <tbody> |
| 259 | <xsl:for-each select="nfd:ribEntry"> |
| 260 | <xsl:variable name="style"> |
| 261 | <xsl:choose> |
| 262 | <xsl:when test="position() mod 2 = 1"> |
| 263 | <xsl:text>odd</xsl:text> |
| 264 | </xsl:when> |
| 265 | <xsl:otherwise>even</xsl:otherwise> |
| 266 | </xsl:choose> |
| 267 | </xsl:variable> |
| 268 | <tr class="{$style}"> |
| 269 | <td style="text-align:left;vertical-align:top;padding:0"><xsl:value-of select="nfd:prefix"/></td> |
| 270 | <td> |
| 271 | <table class="item-sublist"> |
| 272 | <tr> |
| 273 | <th>FaceId</th> |
| 274 | <xsl:for-each select="nfd:routes/nfd:route"> |
| 275 | <td><xsl:value-of select="nfd:faceId"/></td> |
| 276 | </xsl:for-each> |
| 277 | </tr> |
| 278 | <tr> |
| 279 | <th>Origin</th> |
| 280 | <xsl:for-each select="nfd:routes/nfd:route"> |
| 281 | <td><xsl:value-of select="nfd:origin"/></td> |
| 282 | </xsl:for-each> |
| 283 | </tr> |
| 284 | <tr> |
| 285 | <th>Cost</th> |
| 286 | <xsl:for-each select="nfd:routes/nfd:route"> |
| 287 | <td><xsl:value-of select="nfd:cost"/></td> |
| 288 | </xsl:for-each> |
| 289 | </tr> |
| 290 | <tr> |
Chengyu Fan | 1c630ba | 2014-08-20 13:27:58 -0500 | [diff] [blame] | 291 | <th>ChildInherit</th> |
Chengyu Fan | 30aa207 | 2014-07-20 13:52:32 -0600 | [diff] [blame] | 292 | <xsl:for-each select="nfd:routes/nfd:route"> |
Chengyu Fan | 1c630ba | 2014-08-20 13:27:58 -0500 | [diff] [blame] | 293 | <td> |
| 294 | <xsl:if test="nfd:flags/nfd:childInherit"> |
| 295 | Y |
| 296 | </xsl:if> |
| 297 | </td> |
| 298 | </xsl:for-each> |
| 299 | </tr> |
| 300 | <tr> |
| 301 | <th>RibCapture</th> |
| 302 | <xsl:for-each select="nfd:routes/nfd:route"> |
| 303 | <td> |
| 304 | <xsl:if test="nfd:flags/nfd:ribCapture"> |
| 305 | Y |
| 306 | </xsl:if> |
| 307 | </td> |
Chengyu Fan | 30aa207 | 2014-07-20 13:52:32 -0600 | [diff] [blame] | 308 | </xsl:for-each> |
| 309 | </tr> |
| 310 | <tr> |
| 311 | <th>Expires in</th> |
| 312 | <xsl:for-each select="nfd:routes/nfd:route"> |
| 313 | <td> |
| 314 | <xsl:choose> |
| 315 | <xsl:when test="nfd:expirationPeriod"> |
| 316 | <xsl:call-template name="formatDuration"><xsl:with-param name="duration" select="nfd:expirationPeriod" /></xsl:call-template> |
| 317 | </xsl:when> |
| 318 | <xsl:otherwise> |
| 319 | Never |
| 320 | </xsl:otherwise> |
| 321 | </xsl:choose> |
| 322 | </td> |
| 323 | </xsl:for-each> |
| 324 | </tr> |
| 325 | </table> |
Alexander Afanasyev | 8a09376 | 2014-07-16 18:43:09 -0700 | [diff] [blame] | 326 | </td> |
| 327 | </tr> |
Chengyu Fan | 45d1a76 | 2014-07-08 14:21:32 -0600 | [diff] [blame] | 328 | </xsl:for-each> |
Alexander Afanasyev | 8a09376 | 2014-07-16 18:43:09 -0700 | [diff] [blame] | 329 | </tbody> |
Chengyu Fan | 45d1a76 | 2014-07-08 14:21:32 -0600 | [diff] [blame] | 330 | </table> |
| 331 | </xsl:template> |
| 332 | |
| 333 | <xsl:template match="nfd:strategyChoices"> |
| 334 | <h2>Strategy Choices</h2> |
Alexander Afanasyev | 8a09376 | 2014-07-16 18:43:09 -0700 | [diff] [blame] | 335 | <table class="item-list"> |
| 336 | <thead> |
| 337 | <tr> |
Chengyu Fan | 30aa207 | 2014-07-20 13:52:32 -0600 | [diff] [blame] | 338 | <th width="20%">Namespace</th> |
Alexander Afanasyev | 8a09376 | 2014-07-16 18:43:09 -0700 | [diff] [blame] | 339 | <th>Strategy Name</th> |
| 340 | </tr> |
| 341 | </thead> |
| 342 | <tbody> |
| 343 | <xsl:for-each select="nfd:strategyChoice"> |
| 344 | <tr> |
| 345 | <td><xsl:value-of select="nfd:namespace"/></td> |
| 346 | <td><xsl:value-of select="nfd:strategy/nfd:name"/></td> |
| 347 | </tr> |
| 348 | </xsl:for-each> |
| 349 | </tbody> |
Chengyu Fan | 45d1a76 | 2014-07-08 14:21:32 -0600 | [diff] [blame] | 350 | </table> |
| 351 | </xsl:template> |
| 352 | |
| 353 | </xsl:stylesheet> |