olt: add bulk DHCPv4/DHCPv6 filter edit alongside flood mode
Generalises the OLT bulk tool from flood-mode-only to arbitrary NNI-service
edits. DHCP modes live nested under each NNI entry's Filter object
(Filter.DHCPv4 / Filter.DHCPv6, e.g. "pass" <-> "umt"), confirmed from a
real OLT-CFG paste-back.
- src/mcms-api.js: planFloodChange -> planNniEdit(oltCfg, {tagPattern, flood,
dhcpv4, dhcpv6}); each concern optional. DHCP is value-replacement,
replace-only-when-present (never invents the key; leaves EAPOL/PPPoE/NDP).
Still non-mutating (clones the entry AND the Filter). Returns changes with
per-entry edits[]. summarizeOltNniNetworks surfaces dhcpv4/dhcpv6; new
dhcpModeOfNni helper.
- main.js + web/server.js: executeFloodChange handler passes flood/dhcpv4/
dhcpv6 ops through (channel name kept for wire compat).
- renderer: OLT inspector now has three action dropdowns (Flooding / DHCPv4 /
DHCPv6, defaults flood private->auto + DHCP pass->umt); table shows DHCP
chips + per-service "will change (flood, DHCPv4, …)"; flood-mode filter
defaults to Any so DHCP-on-pass auto-flood OLTs still show; CSV report
lists every per-NNI edit (pon-olt-nni-*.csv).
Verified: node --check; planNniEdit unit-tested against the real fixture +
a pass variant (13/13: no-mutation, EAPOL/PPPoE/NDP preserved,
replace-when-present, flood/DHCP independence); OLT view rendered offscreen
showing correct per-service "will change" markers.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
de037c8795
commit
5e3d9271a8
7 changed files with 232 additions and 118 deletions
17
main.js
17
main.js
|
|
@ -10,7 +10,7 @@ const path = require('path');
|
|||
const fs = require('fs');
|
||||
const {
|
||||
McmsClient, McmsApiError, extractOnuHealth,
|
||||
summarizeOltNniNetworks, planFloodChange,
|
||||
summarizeOltNniNetworks, planNniEdit,
|
||||
} = require('./src/mcms-api');
|
||||
const { summarizeDashboard } = require('./src/dashboard');
|
||||
const { planUpgrade, activeBankPtr, inactiveBank } = require('./src/bank-strategy');
|
||||
|
|
@ -654,9 +654,11 @@ ipcMain.handle('api:listOlts', async (_ev, opts) => {
|
|||
});
|
||||
|
||||
/**
|
||||
* Apply a planned flooding mode change to a list of OLT IDs. For each
|
||||
* OLT we GET the current CFG (to avoid stomping concurrent edits),
|
||||
* run planFloodChange, and PUT the result back. Streams progress.
|
||||
* Apply a set of NNI-service edits (flood mode and/or DHCPv4/DHCPv6 filter)
|
||||
* to a list of OLT IDs. For each OLT we GET the current CFG (to avoid
|
||||
* stomping concurrent edits), run planNniEdit, and PUT the result back.
|
||||
* Streams progress. (Channel name kept as executeFloodChange for wire
|
||||
* compatibility.)
|
||||
*
|
||||
* Concurrency is kept low (default 3) — OLT writes carry a much larger
|
||||
* blast radius than ONU reads, so we deliberately stay below the ONU
|
||||
|
|
@ -666,8 +668,7 @@ ipcMain.handle('api:executeFloodChange', async (event, opts) => {
|
|||
try {
|
||||
const c = requireClient();
|
||||
const {
|
||||
oltIds, tagPattern, fromMode = 'private',
|
||||
targetMode = 'auto', ponFloodIdValue = 0,
|
||||
oltIds, tagPattern, flood = null, dhcpv4 = null, dhcpv6 = null,
|
||||
concurrency = 3,
|
||||
} = opts || {};
|
||||
const queue = [...oltIds];
|
||||
|
|
@ -683,9 +684,7 @@ ipcMain.handle('api:executeFloodChange', async (event, opts) => {
|
|||
try {
|
||||
const cfg = await c.getOltConfig(id);
|
||||
if (!cfg) throw new Error('OLT not found');
|
||||
const plan = planFloodChange(cfg, {
|
||||
tagPattern, fromMode, targetMode, ponFloodIdValue,
|
||||
});
|
||||
const plan = planNniEdit(cfg, { tagPattern, flood, dhcpv4, dhcpv6 });
|
||||
if (plan.changes.length === 0) {
|
||||
entry = { oltId: id, ok: true, noop: true, changes: [], skipped: plan.unchanged };
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue