-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathyang-accountability-compare.html
More file actions
384 lines (376 loc) · 17.6 KB
/
Copy pathyang-accountability-compare.html
File metadata and controls
384 lines (376 loc) · 17.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>YANG Module Accountability — Cross-Version Comparison</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
<style>
:root { --bg:#fafafa; --fg:#222; --card:#fff; --border:#e0e0e0; --accent:#1565C0;
--ok:#2e7d32; --warn:#f57c00; --bad:#c62828; --muted:#888; }
body.dark { --bg:#181a1f; --fg:#e8e8e8; --card:#23262d; --border:#3a3d44; --accent:#64b5f6;
--ok:#81c784; --warn:#ffb74d; --bad:#e57373; --muted:#888; }
body { margin:0; font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
background:var(--bg); color:var(--fg); }
header { background:linear-gradient(135deg,#1565C0 0%,#1976D2 100%); color:#fff;
padding:24px 20px; text-align:center; }
header h1 { margin:0 0 6px; font-size:1.6rem; }
header p { margin:0; opacity:.85; font-size:.9rem; }
.nav { padding:10px 20px; background:var(--card); border-bottom:1px solid var(--border);
text-align:center; }
.nav a { color:var(--accent); text-decoration:none; margin:0 10px; font-weight:500; }
main { max-width:1400px; margin:20px auto; padding:0 20px; }
.summary-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
gap:14px; margin-bottom:24px; }
.summary-card { background:var(--card); border:1px solid var(--border); border-radius:8px;
padding:14px; }
.summary-card h3 { margin:0 0 8px; font-size:.95rem; color:var(--accent); }
.summary-card .num { font-size:1.4rem; font-weight:600; }
.summary-card .sub { font-size:.78rem; color:var(--muted); }
.controls { display:flex; gap:10px; flex-wrap:wrap; margin-bottom:14px; align-items:center; }
.controls input, .controls select { padding:6px 10px; border:1px solid var(--border);
border-radius:4px; background:var(--card); color:var(--fg); }
.matrix-wrap { overflow-x:auto; background:var(--card); border:1px solid var(--border);
border-radius:8px; }
table { width:100%; border-collapse:collapse; font-size:.85rem; }
th, td { padding:6px 10px; border-bottom:1px solid var(--border); text-align:left; }
th { position:sticky; top:0; background:var(--card); z-index:2; }
td.module { font-family:"SF Mono",Consolas,monospace; font-size:.8rem; max-width:340px;
overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cell { display:inline-flex; gap:4px; align-items:center; }
.pip { display:inline-block; width:16px; height:16px; border-radius:50%;
font-size:.65rem; line-height:16px; text-align:center; color:#fff; }
.pip.spec { background:var(--ok); }
.pip.tree { background:var(--accent); }
.pip.absent { background:#bbb; }
.deltas { background:var(--card); border:1px solid var(--border); border-radius:8px;
padding:14px; margin-top:24px; }
.delta-row { padding:8px 0; border-bottom:1px solid var(--border); }
.delta-row:last-child { border-bottom:none; }
.added { color:var(--ok); }
.removed { color:var(--bad); }
details summary { cursor:pointer; }
.delta-up { color:var(--ok); font-weight:600; }
.delta-down { color:var(--bad); font-weight:600; }
.delta-flat { color:var(--muted); }
#growthTable { width:100%; border-collapse:collapse; font-size:0.85rem; }
#growthTable th, #growthTable td { padding:6px 10px; border-bottom:1px solid var(--border); text-align:left; }
#growthTable td.num { text-align:right; font-variant-numeric:tabular-nums; }
</style>
<link rel="stylesheet" href="assets/css/site.css">
<script src="assets/js/site-chrome.js" defer></script>
<!-- BEGIN seo-meta (managed by scripts/inject_seo_meta.py) -->
<meta name="description" content="Compare YANG module coverage between Cisco IOS XE releases.">
<meta name="keywords" content="Cisco IOS XE, YANG, OpenAPI, RESTCONF, NETCONF, network automation, model-driven telemetry, programmability, swagger">
<meta name="author" content="Cisco DevNet">
<meta name="theme-color" content="#1565c0" media="(prefers-color-scheme: light)">
<meta name="theme-color" content="#0a0d12" media="(prefers-color-scheme: dark)">
<meta name="format-detection" content="telephone=no">
<link rel="canonical" href="https://ciscodevnet.github.io/cisco-ios-xe-openapi-swagger/yang-accountability-compare.html">
<link rel="icon" type="image/svg+xml" href="assets/icons/favicon.svg">
<link rel="alternate icon" type="image/x-icon" href="assets/icons/favicon.ico">
<link rel="apple-touch-icon" sizes="180x180" href="assets/icons/apple-touch-icon.png">
<meta property="og:type" content="website">
<meta property="og:site_name" content="Cisco IOS XE OpenAPI & YANG Docs">
<meta property="og:title" content="YANG Module Accountability — Cross-Version Comparison">
<meta property="og:description" content="Compare YANG module coverage between Cisco IOS XE releases.">
<meta property="og:url" content="https://ciscodevnet.github.io/cisco-ios-xe-openapi-swagger/yang-accountability-compare.html">
<meta property="og:image" content="https://ciscodevnet.github.io/cisco-ios-xe-openapi-swagger/assets/icons/og-image.png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="YANG Module Accountability — Cross-Version Comparison">
<meta name="twitter:description" content="Compare YANG module coverage between Cisco IOS XE releases.">
<meta name="twitter:image" content="https://ciscodevnet.github.io/cisco-ios-xe-openapi-swagger/assets/icons/og-image.png">
<!-- END seo-meta -->
<!-- BEGIN pwa (managed by scripts/inject_pwa.py) -->
<link rel="manifest" href="site.webmanifest">
<script src="assets/js/analytics-config.js"></script>
<script src="assets/js/sw-register.js" defer></script>
<script src="assets/js/analytics.js" defer></script>
<!-- END pwa -->
</head>
<body>
<header>
<h1>YANG Module Accountability — Cross-Version</h1>
<p>Compare module coverage across all supported IOS XE releases</p>
</header>
<div class="nav">
<a href="index.html">← Hub</a>
<a href="yang-accountability.html">Single-version Report</a>
<a href="tree-compare.html">Tree Compare</a>
<a href="telemetry.html">Telemetry & Notifications</a>
<a href="exports.html">Exports</a>
</div>
<main>
<div id="summary" class="summary-grid"></div>
<!-- API growth across releases -->
<div id="growth" style="background:var(--card); border:1px solid var(--border); border-radius:8px; padding:14px; margin-bottom:20px;">
<h3 style="margin:0 0 10px;">API growth across releases</h3>
<p style="margin:0 0 10px; font-size:0.85rem; color:var(--muted);">
Sourced from <code>version-stats.json</code> (regenerated by
<code>scripts/build_version_stats.py</code>). Δ columns compare each release
to the previous one in chronological order.
</p>
<div style="overflow-x:auto;">
<table id="growthTable">
<thead>
<tr>
<th>Release</th>
<th>Date</th>
<th style="text-align:right;">Specs</th>
<th style="text-align:right;">Δ Specs</th>
<th style="text-align:right;">Paths</th>
<th style="text-align:right;">Δ Paths</th>
<th style="text-align:right;">Operations</th>
<th style="text-align:right;">Δ Ops</th>
<th style="text-align:right;">Modules</th>
<th style="text-align:right;">With specs</th>
<th style="text-align:right;">With trees</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
<div class="controls">
<input id="filter" type="search" placeholder="Filter modules…" aria-label="Filter YANG modules" style="flex:1;min-width:240px;">
<select id="presence">
<option value="all">All modules</option>
<option value="any">Any version present</option>
<option value="all-versions">Present in all versions</option>
<option value="diff">Differing across versions</option>
</select>
<button id="csvBtn" type="button" title="Download visible rows as CSV">Export CSV</button>
<span id="count" style="color:var(--muted);"></span>
</div>
<div class="matrix-wrap">
<table id="matrix">
<thead><tr id="header-row"><th>Module</th></tr></thead>
<tbody></tbody>
</table>
</div>
<div id="deltas" class="deltas"></div>
</main>
<script>
(function () {
var DATA;
fetch('accountability_compare.json', { cache:'no-store' })
.then(function (r) {
if (!r.ok) throw new Error('HTTP ' + r.status);
return r.json();
})
.then(function (data) { DATA = data; render(); })
.catch(function (e) {
document.querySelector('main').innerHTML =
'<p style="color:var(--bad);">Failed to load <code>accountability_compare.json</code>: '
+ (e && e.message) + '. Run <code>python scripts/build_accountability_compare.py</code> first.</p>';
});
// Independently load API growth stats and populate the growth table.
fetch('version-stats.json', { cache:'no-store' })
.then(function (r) { return r.ok ? r.json() : null; })
.catch(function () { return null; })
.then(function (data) { if (data) renderGrowth(data); });
function render() {
var versions = DATA.versions || [];
// Header row
var hr = document.getElementById('header-row');
versions.forEach(function (v) {
var th = document.createElement('th');
th.textContent = v;
hr.appendChild(th);
});
// Summary cards
var sg = document.getElementById('summary');
versions.forEach(function (v) {
var s = (DATA.summary && DATA.summary[v]) || {};
var c = document.createElement('div');
c.className = 'summary-card';
c.innerHTML = '<h3>' + escapeHtml(v) + '</h3>'
+ '<div class="num">' + (s.total_modules || 0) + '</div>'
+ '<div class="sub">specs ' + (s.with_specs || 0)
+ ' / trees ' + (s.with_trees || 0) + '</div>';
sg.appendChild(c);
});
// Deltas
var d = document.getElementById('deltas');
if ((DATA.deltas || []).length) {
d.innerHTML = '<h3 style="margin-top:0;">Version-to-version deltas</h3>';
DATA.deltas.forEach(function (delta) {
var row = document.createElement('div');
row.className = 'delta-row';
row.innerHTML = '<strong>' + escapeHtml(delta.from) + ' → '
+ escapeHtml(delta.to) + '</strong> · '
+ '<span class="added">+' + delta.added_count + ' added</span> · '
+ '<span class="removed">−' + delta.removed_count + ' removed</span>'
+ (delta.added_count + delta.removed_count > 0
? '<details><summary>details</summary>'
+ '<div><span class="added">Added:</span> '
+ escapeHtml((delta.added || []).join(', ') || '—') + '</div>'
+ '<div><span class="removed">Removed:</span> '
+ escapeHtml((delta.removed || []).join(', ') || '—') + '</div>'
+ '</details>'
: '');
d.appendChild(row);
});
} else {
d.style.display = 'none';
}
bindControls();
drawTable();
}
function bindControls() {
document.getElementById('filter').addEventListener('input', drawTable);
document.getElementById('presence').addEventListener('change', drawTable);
var csv = document.getElementById('csvBtn');
if (csv) csv.addEventListener('click', function () { exportCsv(csv); });
}
function _filteredRows() {
var versions = DATA.versions || [];
var matrix = DATA.matrix || [];
var q = document.getElementById('filter').value.trim().toLowerCase();
var presence = document.getElementById('presence').value;
return matrix.filter(function (row) {
if (q && row.module.toLowerCase().indexOf(q) === -1) return false;
var presents = versions.map(function (v) {
return row.by_version[v] && row.by_version[v].present;
});
if (presence === 'any' && !presents.some(Boolean)) return false;
if (presence === 'all-versions' && !presents.every(Boolean)) return false;
if (presence === 'diff') {
var first = JSON.stringify(row.by_version[versions[0]] || {});
var same = versions.every(function (v) {
return JSON.stringify(row.by_version[v] || {}) === first;
});
if (same) return false;
}
return true;
});
}
function _csvCell(value) {
var s = value == null ? '' : String(value);
if (/[",\r\n]/.test(s)) s = '"' + s.replace(/"/g, '""') + '"';
return s;
}
function exportCsv(btn) {
var versions = DATA.versions || [];
var rows = _filteredRows();
if (!rows.length) {
var o = btn.textContent;
btn.textContent = 'No rows';
setTimeout(function () { btn.textContent = o; }, 2000);
return;
}
var headers = ['Module'];
versions.forEach(function (v) {
headers.push(v + ' present');
headers.push(v + ' has_spec');
headers.push(v + ' has_tree');
});
var lines = [headers.map(_csvCell).join(',')];
rows.forEach(function (row) {
var vals = [row.module];
versions.forEach(function (v) {
var c = row.by_version[v] || {};
vals.push(c.present ? 'yes' : 'no');
vals.push(c.has_spec ? 'yes' : 'no');
vals.push(c.has_tree ? 'yes' : 'no');
});
lines.push(vals.map(_csvCell).join(','));
});
var csv = '\uFEFF' + lines.join('\r\n') + '\r\n';
var blob = new Blob([csv], { type: 'text/csv;charset=utf-8' });
var ts = new Date().toISOString().slice(0, 10);
var a = document.createElement('a');
a.href = URL.createObjectURL(blob);
a.download = 'yang-accountability-compare-' + ts + '.csv';
document.body.appendChild(a);
a.click();
setTimeout(function () { URL.revokeObjectURL(a.href); a.remove(); }, 0);
var orig = btn.textContent;
btn.textContent = 'Exported ' + rows.length;
setTimeout(function () { btn.textContent = orig; }, 2500);
}
function drawTable() {
var versions = DATA.versions || [];
var matrix = DATA.matrix || [];
var tbody = document.querySelector('#matrix tbody');
tbody.innerHTML = '';
var rows = _filteredRows();
rows.forEach(function (row) {
var tr = document.createElement('tr');
var td = document.createElement('td');
td.className = 'module';
td.title = row.module;
td.textContent = row.module;
tr.appendChild(td);
versions.forEach(function (v) {
var c = row.by_version[v] || {};
var cell = document.createElement('td');
if (!c.present) {
cell.innerHTML = '<span class="pip absent" title="not in this release">·</span>';
} else {
cell.innerHTML = '<span class="cell">'
+ (c.has_spec ? '<span class="pip spec" title="OpenAPI spec">S</span>' : '')
+ (c.has_tree ? '<span class="pip tree" title="YANG tree">T</span>' : '')
+ (!c.has_spec && !c.has_tree ? '<span class="pip absent">·</span>' : '')
+ '</span>';
}
tr.appendChild(cell);
});
tbody.appendChild(tr);
});
document.getElementById('count').textContent =
rows.length + ' / ' + matrix.length + ' modules shown';
}
function escapeHtml(s) {
return String(s == null ? '' : s).replace(/&/g, '&').replace(/</g, '<')
.replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''');
}
// Populate the API growth table from version-stats.json. Sorts releases by
// publication date so the deltas read in chronological order.
function renderGrowth(data) {
var tbody = document.querySelector('#growthTable tbody');
if (!tbody) return;
var versions = (data.versions || []).slice();
var totals = data.totals || {};
versions.sort(function (a, b) {
var da = (totals[a] && totals[a].date) || '';
var db = (totals[b] && totals[b].date) || '';
return da.localeCompare(db);
});
function fmt(n) { return n == null ? '\u2014' : Number(n).toLocaleString(); }
function delta(cur, prev) {
if (prev == null || cur == null || !prev) return '<span class="delta-flat">\u2014</span>';
var d = cur - prev;
if (d === 0) return '<span class="delta-flat">0</span>';
var pct = (d / prev * 100);
var sign = d > 0 ? '+' : '';
var cls = d > 0 ? 'delta-up' : 'delta-down';
return '<span class="' + cls + '">' + sign + fmt(d)
+ ' (' + sign + pct.toFixed(1) + '%)</span>';
}
var rows = '';
var prev = null;
versions.forEach(function (v) {
var t = totals[v] || {};
rows += '<tr>'
+ '<td><strong>' + escapeHtml(v) + '</strong></td>'
+ '<td>' + escapeHtml(t.date || '\u2014') + '</td>'
+ '<td class="num">' + fmt(t.specs) + '</td>'
+ '<td class="num">' + delta(t.specs, prev && prev.specs) + '</td>'
+ '<td class="num">' + fmt(t.paths) + '</td>'
+ '<td class="num">' + delta(t.paths, prev && prev.paths) + '</td>'
+ '<td class="num">' + fmt(t.operations) + '</td>'
+ '<td class="num">' + delta(t.operations, prev && prev.operations) + '</td>'
+ '<td class="num">' + fmt(t.modules_total) + '</td>'
+ '<td class="num">' + fmt(t.modules_with_specs) + '</td>'
+ '<td class="num">' + fmt(t.modules_with_trees) + '</td>'
+ '</tr>';
prev = t;
});
tbody.innerHTML = rows;
}
})();
</script>
</body>
</html>