serial: clock rate takes the box's menu, not the port's link ladder #2127

Merged
jaylouisw merged 2 commits from rev/1119-0912 into main 2026-11-19 09:41:40 +00:00
Owner

Question. On a Cisco serial port, is the set of rates clock rate accepts the set of rates the line can run at — so a 1.544 Mbps port refuses clock rate 9600 — or the parser's own menu?

Verdict: the parser's menu. A serial port's clock rate ? prints the standard rates (1200 … 4000000) and, under them, <300-4000000> Choose clockrate from list above; any integer in that range is accepted, and one that is not on the menu is rounded to the nearest rate the hardware supports, with the command reference's line %Clockrate rounded to nearest value that your hardware can support. The rounded rate — not the typed one — is what show running-config then holds.

PacketForge built its acceptable set from the port's link-speed ladder (a 2811 offered six rates) and refused 9600, 19200, 38400, 72000, 125000, 128000, 148000, 250000, 500000, 800000 and 1000000, every one of which the box's own menu prints. test/serial-links.test.js had pinned that defect (/% 9600 bps is not a rate/) — the suite had been written from the same wrong rule.

Changed

  • engine/cli.js: SERIAL_CLOCK_RATES (the vendor's menu, cited at the constant) unioned with the rates the port declares, cut to the port's top rate. On the menu → stored as typed. Inside 300 … top but not on the menu → stored at the nearest menu rate and the console prints the vendor's sentence verbatim. Below 300 or above the top → refused with the range quoted (300-<top> bps).
  • test/serial-clock-menu.test.js (new, 77 checks) and test/serial-links.test.js §5 flipped to the vendor's behaviour.
  • docs/CLI.md, docs/PHYSICAL_LAYER.md §2.1, research/serial-clock-menu.md (sources: IOS Interface & Hardware Component Command Reference clock rate; a 2501 clock rate ? capture; Troubleshooting Serial Lines; the 4-port serial SPA guide; the serial interface card guide and HWIC-2T datasheet).

Still open (recorded, not guessed): the top of the range on a 2811. The model declares its Se ports at 1.544M (a T1 line rate); the WIC-2T card is 2.048 Mbps per port and the HWIC-2T 8 Mbps per port, so a real card's menu would include 2000000/4000000. Which card the model should declare is device data, not a parser rule, so it is untouched.

Tests: node scripts/syntax-check.js OK (447 files); npm test — 368 suites, 12,545 assertions, 0 failed.

**Question.** On a Cisco serial port, is the set of rates `clock rate` accepts the set of rates the *line* can run at — so a 1.544 Mbps port refuses `clock rate 9600` — or the parser's own menu? **Verdict: the parser's menu.** A serial port's `clock rate ?` prints the standard rates (1200 … 4000000) and, under them, `<300-4000000> Choose clockrate from list above`; any integer in that range is accepted, and one that is not on the menu is rounded to the nearest rate the hardware supports, with the command reference's line `%Clockrate rounded to nearest value that your hardware can support.` The rounded rate — not the typed one — is what `show running-config` then holds. PacketForge built its acceptable set from the port's link-speed ladder (a 2811 offered six rates) and refused 9600, 19200, 38400, 72000, 125000, 128000, 148000, 250000, 500000, 800000 and 1000000, every one of which the box's own menu prints. `test/serial-links.test.js` had pinned that defect (`/% 9600 bps is not a rate/`) — the suite had been written from the same wrong rule. **Changed** - `engine/cli.js`: `SERIAL_CLOCK_RATES` (the vendor's menu, cited at the constant) unioned with the rates the port declares, cut to the port's top rate. On the menu → stored as typed. Inside 300 … top but not on the menu → stored at the nearest menu rate and the console prints the vendor's sentence verbatim. Below 300 or above the top → refused with the range quoted (`300-<top> bps`). - `test/serial-clock-menu.test.js` (new, 77 checks) and `test/serial-links.test.js` §5 flipped to the vendor's behaviour. - `docs/CLI.md`, `docs/PHYSICAL_LAYER.md` §2.1, `research/serial-clock-menu.md` (sources: IOS Interface & Hardware Component Command Reference `clock rate`; a 2501 `clock rate ?` capture; *Troubleshooting Serial Lines*; the 4-port serial SPA guide; the serial interface card guide and HWIC-2T datasheet). **Still open** (recorded, not guessed): the top of the range on a 2811. The model declares its Se ports at `1.544M` (a T1 line rate); the WIC-2T card is 2.048 Mbps per port and the HWIC-2T 8 Mbps per port, so a real card's menu would include 2000000/4000000. Which card the model should declare is device data, not a parser rule, so it is untouched. **Tests:** `node scripts/syntax-check.js` OK (447 files); `npm test` — 368 suites, 12,545 assertions, 0 failed.
serial: clock rate takes the box's menu, not the port's link ladder (#2126)
Some checks failed
CI / Classify the change (pull_request) Successful in 11s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 8s
CI / Server smoke test (pull_request) Successful in 8s
CI / Arm auto-merge (pull_request) Has been cancelled
CI / Test (Node 20) (pull_request) Has been cancelled
CI / Test (Node 18) (pull_request) Has been cancelled
CI / Test (Node 22) (pull_request) Has been cancelled
CI / Docker build (pull_request) Has been cancelled
65d917bb6c
A 2811 refused `clock rate 9600` with a list of six rates, and the six were the
port's link-speed ladder. A Cisco serial port's own `clock rate ?` prints the
standard rates 1200-4000000 above `<300-4000000> Choose clockrate from list
above`, and the command reference says any value in that range is accepted and
rounded to the nearest rate the hardware supports, with the console line
`%Clockrate rounded to nearest value that your hardware can support.`

So the menu is now the vendor's list unioned with the rates the port declares,
cut to the port's top rate; a value inside 300-top that is not on the menu is
rounded and reported in the box's words; below 300 or above the top is refused
with the range quoted. 9600, 19200, 38400, 72000, 125000, 128000, 148000,
250000, 500000, 800000 and 1000000 are accepted again.

test/serial-links.test.js had pinned the defect (`/% 9600 bps is not a rate/`);
it now pins the opposite. New test/serial-clock-menu.test.js (77 checks).
Evidence and the open boundary (WIC-2T 2.048 Mbps vs the model's 1.544 Mbps):
research/serial-clock-menu.md.
chore: the change above is PR #2127, not #2126
All checks were successful
CI / Classify the change (pull_request) Successful in 14s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 8s
CI / Server smoke test (pull_request) Successful in 8s
CI / Test (Node 20) (pull_request) Successful in 53s
CI / Test (Node 22) (pull_request) Successful in 52s
CI / Docker build (pull_request) Successful in 18s
CI / Test (Node 18) (pull_request) Successful in 57s
CI / Arm auto-merge (pull_request) Successful in 3s
3919124d16
Its subject was written before the pull request existed, and #2126 is an
unrelated docs PR. The serial clock-rate change is #2127.
forgejo-actions scheduled this pull request to auto merge when all checks succeed 2026-11-19 09:27:55 +00:00
jaylouisw deleted branch rev/1119-0912 2026-11-19 09:41:43 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jaylouisw/packetforge!2127
No description provided.