Skip to content

Commit 934b040

Browse files
committed
make check exhaustive
1 parent d133557 commit 934b040

File tree

4 files changed

+170
-60
lines changed

4 files changed

+170
-60
lines changed

dev-tools/ls-apis/api-manifest.toml

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -607,69 +607,83 @@ sled agent.
607607
[[localhost_only_edges]]
608608
server = "ddmd"
609609
client = "dpd-client"
610-
note = "still to verify: ddmd communicates with dendrite locally within the switch zone"
610+
note = "verified: sled-agent configures ddmd with dpd_host=[::1] (services.rs:3127)"
611611

612612
[[localhost_only_edges]]
613613
server = "dpd"
614614
client = "gateway-client"
615-
note = "still to verify: dendrite communicates with MGS locally"
615+
note = "verified: dpd defaults to [::1]:MGS_PORT (dendrite switch_identifiers.rs:60)"
616616

617617
[[localhost_only_edges]]
618618
server = "lldpd"
619619
client = "dpd-client"
620-
note = "still to verify: lldpd communicates with dendrite locally within the switch zone"
620+
note = "verified: lldpd defaults to localhost for dpd (lldp dendrite.rs:194)"
621621

622622
[[localhost_only_edges]]
623623
server = "mgd"
624624
client = "ddm-admin-client"
625-
note = "still to verify: mgd communicates with ddmd locally within the switch zone"
625+
note = "verified: mg-lower hardcodes localhost:8000 (mg-lower ddm.rs:110)"
626626

627627
[[localhost_only_edges]]
628628
server = "mgd"
629629
client = "dpd-client"
630-
note = "still to verify: mgd communicates with dendrite locally within the switch zone"
630+
note = "verified: mg-lower hardcodes localhost (mg-lower dendrite.rs:491)"
631631

632632
[[localhost_only_edges]]
633633
server = "mgd"
634634
client = "gateway-client"
635-
note = "still to verify: mgd communicates with MGS locally"
635+
note = "verified: mgd defaults to [::1]:12225 (mgd main.rs:93)"
636+
637+
# NOTE: The following sled-agent edges are BUGS - they use underlay IPs, not
638+
# localhost. They are kept here to avoid breaking the build, but need to be
639+
# fixed, either through client-side versioning or by some other means.
636640

637641
[[localhost_only_edges]]
638642
server = "omicron-sled-agent"
639643
client = "gateway-client"
640-
note = "still to verify: sled-agent communicates with MGS locally"
644+
note = "BUG: uses underlay IP, not localhost (early_networking.rs:376)"
641645

642646
[[localhost_only_edges]]
643647
server = "omicron-sled-agent"
644648
client = "ddm-admin-client"
645-
note = "still to verify: sled-agent communicates with ddmd locally"
649+
note = "verified: uses Client::localhost() (ddm_reconciler.rs:56)"
646650

647651
[[localhost_only_edges]]
648652
server = "omicron-sled-agent"
649653
client = "dpd-client"
650-
note = "still to verify: sled-agent communicates with dendrite locally"
654+
note = "BUG: uses underlay IP, not localhost (services.rs:1090)"
651655

652656
[[localhost_only_edges]]
653657
server = "omicron-sled-agent"
654658
client = "mg-admin-client"
655-
note = "still to verify: sled-agent communicates with mgd locally"
659+
note = "BUG: uses underlay IP, not localhost (early_networking.rs:483)"
656660

657661
[[localhost_only_edges]]
658662
server = "omicron-sled-agent"
659663
client = "propolis-client"
660-
note = "still to verify: sled-agent communicates with propolis instances locally"
664+
note = "BUG: uses zone IP, not localhost (instance.rs:2283)"
661665

662666
[[localhost_only_edges]]
663667
server = "tfportd"
664668
client = "dpd-client"
665-
note = "still to verify: tfportd communicates with dendrite locally within the switch zone"
669+
note = "verified: configured with dpd_host=[::1] (services.rs:2852)"
666670

667671
[[localhost_only_edges]]
668672
server = "tfportd"
669673
client = "lldpd-client"
670-
note = "still to verify: tfportd communicates with lldpd locally within the switch zone"
674+
note = "verified: hardcodes localhost (tfportd tfport.rs:88)"
675+
676+
[[localhost_only_edges]]
677+
server = "wicketd"
678+
client = "ddm-admin-client"
679+
note = "verified: uses DdmAdminClient::localhost() (bootstrap_addrs.rs:162)"
671680

672681
[[localhost_only_edges]]
673682
server = "wicketd"
674-
client = "*"
675-
note = "still to verify: wicketd communicates with local services; enumerate specific clients later"
683+
client = "dpd-client"
684+
note = "verified: hardcodes [::1]:DENDRITE_PORT (preflight_check/uplink.rs:83)"
685+
686+
[[localhost_only_edges]]
687+
server = "wicketd"
688+
client = "gateway-client"
689+
note = "verified: --mgs-address CLI expects localhost (bin/wicketd.rs:35)"

dev-tools/ls-apis/src/api_metadata.rs

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -203,25 +203,21 @@ impl TryFrom<RawApiMetadata> for AllApiMetadata {
203203

204204
// Validate localhost_only_edges reference known server components and
205205
// APIs.
206-
let known_components: BTreeSet<_> = deployment_units
207-
.values()
208-
.flat_map(|u| u.packages.iter())
209-
.collect();
206+
let known_components: BTreeSet<_> =
207+
deployment_units.values().flat_map(|u| u.packages.iter()).collect();
210208
for edge in &raw.localhost_only_edges {
211209
if !known_components.contains(&edge.server) {
212210
bail!(
213211
"localhost_only_edges: unknown server component {:?}",
214212
edge.server
215213
);
216214
}
217-
// Validate non-wildcard clients reference known APIs.
218-
if let Some(client_name) = edge.client.as_specific() {
219-
if !apis.contains_key(client_name) {
220-
bail!(
221-
"localhost_only_edges: unknown client {:?}",
222-
client_name
223-
);
224-
}
215+
let client_name = edge.client.as_specific();
216+
if !apis.contains_key(client_name) {
217+
bail!(
218+
"localhost_only_edges: unknown client {:?}",
219+
client_name
220+
);
225221
}
226222
}
227223

@@ -449,11 +445,9 @@ pub enum Evaluation {
449445
Dag,
450446
}
451447

452-
/// Specifies which client(s) to match in a localhost-only edge rule.
448+
/// Specifies which client to match in a localhost-only edge rule.
453449
#[derive(Clone, Debug, Eq, PartialEq)]
454450
pub enum ClientMatcher {
455-
/// Match all clients (represented as "*" in TOML).
456-
Wildcard,
457451
/// Match a specific client package.
458452
Specific(ClientPackageName),
459453
}
@@ -464,28 +458,22 @@ impl<'de> Deserialize<'de> for ClientMatcher {
464458
D: serde::Deserializer<'de>,
465459
{
466460
let s = String::deserialize(deserializer)?;
467-
if s == "*" {
468-
Ok(ClientMatcher::Wildcard)
469-
} else {
470-
Ok(ClientMatcher::Specific(ClientPackageName::from(s)))
471-
}
461+
Ok(ClientMatcher::Specific(ClientPackageName::from(s)))
472462
}
473463
}
474464

475465
impl ClientMatcher {
476466
/// Returns true if this matcher matches the given client package.
477467
pub fn matches(&self, client: &ClientPackageName) -> bool {
478468
match self {
479-
ClientMatcher::Wildcard => true,
480469
ClientMatcher::Specific(name) => name == client,
481470
}
482471
}
483472

484-
/// Returns the specific client name, if not a wildcard.
485-
pub fn as_specific(&self) -> Option<&ClientPackageName> {
473+
/// Returns the specific client name.
474+
pub fn as_specific(&self) -> &ClientPackageName {
486475
match self {
487-
ClientMatcher::Wildcard => None,
488-
ClientMatcher::Specific(name) => Some(name),
476+
ClientMatcher::Specific(name) => name,
489477
}
490478
}
491479
}
@@ -498,7 +486,7 @@ impl ClientMatcher {
498486
pub struct LocalhostOnlyEdge {
499487
/// The server component that consumes the API.
500488
pub server: ServerComponentName,
501-
/// The client package consumed, or "*" to match all clients.
489+
/// The client package consumed.
502490
pub client: ClientMatcher,
503491
/// Explanation of why this edge is localhost-only.
504492
pub note: String,

dev-tools/ls-apis/src/bin/ls-apis.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,10 @@ fn print_server_components<'a>(
253253
}
254254
for (c, path) in apis.component_apis_consumed(s, filter)? {
255255
if let Some(note) = apis.localhost_only_edge_note(s, c) {
256-
println!("{} consumes: {} (localhost-only: {})", prefix, c, note);
256+
println!(
257+
"{} consumes: {} (localhost-only: {})",
258+
prefix, c, note
259+
);
257260
} else {
258261
println!("{} consumes: {}", prefix, c);
259262
}

0 commit comments

Comments
 (0)