A copper SFP in an SFP+ cage mates an RJ45 port (#1514) #1602
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!1602
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/1116-0405"
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?
Fixes #1514
connect()refused an SFP+ cage against an RJ45 port outright, even when the spec or the caller said the cage holds1000base-t-sfp- which is what a copper SFP module is. The refusal contradicted the engine's own media table (CAGE_MEDIA['sfp+']lists the module, so the cage may carry it) and then offered no medium at all:The module IS the converter: the cage is a module slot, and the socket on the outside of that module is an ordinary RJ45. A 10G port fed from a 1G copper appliance is a common install, and the only way to draw it was
{ force: true }- a cable the validator says is impossible.What changed
engine/media.js:copperSfpModuleOf()/copperSfpBridge()- a copper module in a cage that can hold it converts that cage to an RJ45 socket for mating. The conditions are facts about the install, not the catalogue: the port must say the module is fitted (specmedia, ormediaIdon the cable), and the cage's repertoire must be able to hold that part.engine/media.js:commonMedia()returns the module for a bridged pair, so a refusal names a medium and the medium is the part on the floor.engine/media.js:portWithModule(), applied in validation formediaId, so a caller naming the module is the same claim a spec makes withmedia.engine/validation.js:completeHardware()keepsmediaDeclaredthrough normalisation.engine/device.js:serialize()writes it (only when set) and load restores it, so a saved lab comes back with the same cage contents.What deliberately does not change: an EMPTY SFP+ cage still refuses an RJ45 socket. The cage repertoire offers the module as one of eleven things it might hold, and "the cage could hold one" is not "one is in there" - otherwise
test/validation.test.js's "rejects an RJ45 port cabled to an SFP cage" and every fibre port in the catalogue would quietly become copper. A coil of fibre-only modules and an SC/APC PON port still refuse copper, and rates still have to agree: a cage pinned to 25G with a 1G module in it refuses a 1G RJ45 port withE_NO_COMMON_SPEED, not a connector verdict.Tests -
test/copper-sfp-bridge.test.js, 29 checks: the rule both ways round, an empty cage and a fibre module still refused, the rate verdict, the CRS305SFP+4<-> RT-AX89Xwaninstall from the issue with and withoutmediaId(the link comes up at 1G, not the cage's 10G), a save/reload round trip, a sweep of every module cage in the CAGES table, and a catalogue-wide sweep asserting a port mates RJ45 iff its spec says the module is fitted. Against the previousmedia.jsthe same file gives 14 failures.Gates:
node scripts/syntax-check.js334 files OK; relevant suites (validation22,fiber-connectors31,sfp28-legacy41,link-roundtrip36,media-cfp230,poe-inference17,skip-audit15) all pass; fullnpm test264 suites / 9577 assertions / 0 failed.connect() refused an SFP+ cage against an RJ45 port outright, even when the spec or the caller said the cage holds 1000base-t-sfp - which is what a copper SFP module is. The refusal contradicted the engine's own media table (CAGE_MEDIA['sfp+'] lists the module, so the cage may carry it) and then offered no medium at all: "possible media: none". The module IS the converter: the cage is a module slot, and the socket on the outside of that module is an ordinary RJ45. A 10G port fed from a 1G copper appliance is a common install, and the only way to draw it was { force: true } - a cable the validator says is impossible. - engine/media.js: copperSfpModuleOf()/copperSfpBridge() - a copper module in a cage that can hold it converts that cage to an RJ45 socket for mating purposes. Conditions are facts about the install, not the catalogue: the port must say the module is fitted (spec `media`, or `mediaId` on the cable) and the cage's repertoire must be able to hold that part. An EMPTY SFP+ cage still refuses an RJ45 socket - "the cage could hold one" is not "one is in there". - engine/media.js: commonMedia() returns the module for a bridged pair, so a refusal names a medium and the medium is the part on the floor. - engine/media.js: portWithModule(), applied in validation for `mediaId`, so the caller naming the module is the same claim a spec makes with `media`. - engine/validation.js: completeHardware()/normalizePort() keep `mediaDeclared`. - engine/device.js: serialize() writes it (only when set) and load restores it, so a saved lab comes back with the same cage contents. - test/copper-sfp-bridge.test.js: 29 checks - the rule both ways round, rates still having to agree (25G-only cage vs 1G RJ45 is E_NO_COMMON_SPEED), the CRS305 SFP+4 <-> RT-AX89X wan install from the issue with and without mediaId, a save/reload round trip, a sweep of every module cage and a catalogue-wide sweep (mating RJ45 iff the spec says the module is fitted). Against the previous media.js the same file gives 14 failures. Co-authored-by: jay <jay@jayw.uk>7479ceb3defd8db2876c