What the parser accepts is what the engine stores (#1281) #1282
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jaylouisw/packetforge!1282
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/config-text-to-state"
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?
What the parser accepts is now what the engine stores.
Fixes #1281.
Three commands that stored something else
routeTo()readsr.gwas an address andr.ifaceas an egress. A port name ingwtherefore produced aroute that is listed, installed, printed by
show running-config— and then ARPs for an address calledGi0.Measured on a two-router lab with the pc's LAN behind r2:
ip route 192.168.9.0 255.255.255.0 10.0.0.2ip route 192.168.9.0 255.255.255.0 Gi0no ARP reply from 192.168.9.9Fixed
The port-only form is legal and worth keeping — it is how you point at a segment — but it carries a packet only
when the far side proxies ARP for the destination, and nothing said so anywhere. It is now stored in the
egress field, and both surfaces say the rest:
Refusals, each naming the token and the route, none of them storing anything:
ip address <addr>/<len>says what is wrong and both accepted forms, and leaves the previous address alone:Inside a DHCP pool the
/prefixspelling is split into network + mask with the one mask rule, so bothspellings produce identical state and identical printed config;
/33is refused quoting the value andstores no half-network.
The route printer now emits three shapes rather than padding a missing gateway with an empty field, and all
three round-trip byte-identically.
Evidence
test/config-text-to-state.test.js— 34 checks, 23 of which fail withengine/cli.jsreverted:{gw: null, iface: <port>}, warns at the console and is annotated in the table;could not resolve (
no ARP reply from 192.168.9.9) and the table says why before the packet is sent;config.routesempty;ip address …/24: quotes what was typed, shows both accepted forms, previous address untouched;/33refused, nothing half-stored.It drives
CliSessiondirectly rather thanrunCommands:runCommandsinterleavesprompt + commandechoes,and deciding which lines are echoes means guessing at prompt syntax — which broke on a refusal containing
<network> <mask>, where an angle bracket looked like a prompt.Suite: 155 suites, 6,521 assertions, 0 failed.