OSPF can be read back from the console (#1371) #1372
No reviewers
Labels
No labels
blocked-on-build
bug
device
device-request
enhancement
from-github
needs-datasheet
needs-info
needs-triage
ready-for-agent
ready-for-human
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jaylouisw/packetforge!1372
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/show-ospf"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
OSPF can now be read back from the console. Fixes #1371.
OSPF has been configurable since it was modelled —
ospf router-id,ospf area, and per interfaceip ospf cost | area | passive— andcomputeOspf()turns those numbers into adjacencies, an SPF tree andinstalled routes. None of it could be read: the only place OSPF appeared was an
Oinshow ip route. Youcould set a cost and had no way to find out whether the engine used it, which port an adjacency formed on, or who
the neighbour was. Same shape as
show power inline(#1295) and the STP election (#1365).Three reports
Cost fromis the column that answers the question the number alone cannot: 25 because someone typedip ospf cost 25, or 10 because the wire is 100 Mbps and nobody typmed anything (100 Mbps referencebandwidth: 100 Mbps → 100, 1 Gbps → 10, 2.5 Gbps → 4, 5 Gbps → 2, 10 Gbps+ → 1). A derived cost moves when the
link renegotiates; a configured one does not.
Every row comes from what
computeOspf()recorded —dev.ospfInterfaces,dev.ospfNeighbors,dev.ospfConverged— so the console andshow ip routecannot describe the same topology differently. Thatincludes the wait: on a lab that has not settled the summary prints
(withheld: still converging)beside the routecount, because that is what the engine did.
A port you name that is not contributing gets the reason, not an empty table:
One defect found while writing it
With a single OSPF router in the lab,
computeOspf()returned early (routers.length < 2) before publishinganything, so a box with two OSPF ports reported that nothing had been evaluated. The interface view is now
published where it is computed, in the first pass; the adjacency pass fills in neighbours and flips the
adjacentflag afterwards.
Evidence
test/show-ospf.test.js— 36 checks: the summary counts exactly what the engine computed; the neighbour tablelists the peer by its own router id and every engine neighbour appears with nothing extra; a configured cost
reads
configuredat 25 while an unset port readslink rateat 10; moving the costs moves the chosen path andthe report shows both numbers; a passive port is named and explained; a lone router still reports its ports; the
withheldsentence appears exactly whendev.ospfConvergedis false.engine/cli.js→ 27 of 36 failengine/simulator.js→ 6 of 36 failhelpgains the command;docs/CLI.mdgains "Reading OSPF" with the three reports, the derived-cost table and theexplanations.
Suite: 189 suites, 7,301 assertions, 0 failed. Syntax: 257 files, OK.
OSPF has been configurable since it was modelled - 'ospf router-id', 'ospf area', and per interface 'ip ospf cost | area | passive' - and computeOspf() turns those into adjacencies, an SPF tree and installed routes. None of it could be read: the only place OSPF appeared was an 'O' in show ip route. An operator could set a cost and had no way to find out whether the engine used it, which port an adjacency formed on, or who the neighbour was. Same shape as show power inline and the STP election. Three commands, every row taken from what computeOspf() recorded (dev.ospfInterfaces, dev.ospfNeighbors, dev.ospfConverged), so the console and the route table cannot describe the same topology differently: show ip ospf process summary: router-id, areas, interfaces (passive count), neighbours, routes installed - and '(withheld: still converging)' when the engine has not settled show ip ospf neighbour [p] Neighbor ID (the PEER's router id), address, interface, state show ip ospf interface [p] area, cost, ADJACENT, PASSIVE, and a 'Cost from' column saying whether that number was configured or derived from the link rate A named port that is not contributing is named with the reason - passive (advertises its prefix, forms no adjacency), no address, administratively down, not in OSPF, or does not exist - rather than an empty table. Without a simulation the answer is 'no OSPF state has been evaluated yet', and a box with no OSPF at all says so and names the command that would enable it. One defect found while writing it: with a single OSPF router in the lab, computeOspf() returned before publishing anything, so a box with two OSPF ports reported that nothing had been evaluated. The interface view is now published where it is computed; the adjacency pass fills in neighbours and flips the flag afterwards. Evidence: test/show-ospf.test.js, 36 checks - the summary counts what the engine computed, the neighbour table lists the peer by its own router id and every engine neighbour appears with nothing extra, a configured cost reads 'configured' at 25 while an unset port reads 'link rate' at 10, moving the costs moves the chosen path and the report shows both numbers, a passive port is named and explained, a lone router still reports its ports, and the 'withheld' sentence appears exactly when dev.ospfConverged is false. Reverting engine/cli.js fails 27 of 36; reverting engine/simulator.js fails 6. help gains the command; docs/CLI.md gains 'Reading OSPF' with the three reports and the derived-cost table (100 Mbps -> 100, 1 Gbps -> 10, 2.5 Gbps -> 4, 5 Gbps -> 2, 10 Gbps and above -> 1). Suite: 189 suites, 7,301 assertions, 0 failed. Syntax: 257 files, OK.