-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MGS/sp-sim: Introduce location mapping #933
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
really great; very cool
/// List of human-readable location names; the actual strings don't matter, | ||
/// but they're used in log messages and to sync with the refined locations | ||
/// contained in `determination`. For "rack v1" we could use something like | ||
/// "sidecar-a"/"sidecar-b". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's ask @rmustacc what the printing on the rack is going to say and match that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Robert pointed me to RFD 200 § 7.2, which refers to them as SWITCH 0
/SWITCH 1
(if space permits) or SW0
/SW1
(shorthand). I'm slightly inclined to stick with lowercase for log strings/config files, so maybe switch0
/switch1
?
port_config.location.remove(&location).ok_or_else(|| { | ||
StartupError::InvalidConfig { | ||
reason: format!( | ||
"port {} has no entry for determined location {:?}", | ||
port.0, location, | ||
), | ||
} | ||
})?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might we want to see all such errors rather that just the first? Or perhaps log out all mismatches and return an error saying that the config was bad?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I considered doing some kind of full-config-file-validation up front; that seems better than failing here after we've already talked to some SPs. I'll do that and log all errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added config validation in 674ffc2; it's a little long/boilerplatey but I think that's probably fine in exchange for getting a complete list of errors.
0 => determination.sp_port_0, | ||
1 => determination.sp_port_1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do I recall correctly that the KSZ numbers these 1 and 2? If that's the case we might want to stick with that to prevent confusion in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 7782fbc
3aa03c0
to
a089bb4
Compare
This runs the SP socket address and RFD 250 location discovery process.
b098ac2
to
674ffc2
Compare
This PR builds on #932 and is the second of three building toward a preliminary implementation of RFD 250-style SP and location discovery.
There are two relevant changes in this PR (plus some refactoring of error types):
Ping
/Pong
messages are replaced withDiscover
/DiscoverResponse
, the latter of which includes the port on which the SP received theDiscover
.LocationMap
type is added (but not currently used - that will be in the next PR). This includes the tokio task responsible for sendingDiscover
packets on all switch ports, collecting the responses, and using them to derive the current location based on the configuration. The configuration includes a very simple description that lets us implement RFD 250 section 4.4: it lists specific ports we want to ping, and what the responses on those ports mean in terms of which sidecar we're running on.