@@ -343,6 +343,8 @@ mod test {
343343 use nexus_types:: deployment:: blueprint_zone_type;
344344 use nexus_types:: external_api:: params;
345345 use nexus_types:: external_api:: shared;
346+ use nexus_types:: external_api:: views:: SledPolicy ;
347+ use nexus_types:: external_api:: views:: SledProvisionPolicy ;
346348 use nexus_types:: external_api:: views:: SledState ;
347349 use nexus_types:: identity:: Resource ;
348350 use nexus_types:: internal_api:: params:: DnsConfigParams ;
@@ -353,6 +355,7 @@ mod test {
353355 use omicron_common:: address:: IpRange ;
354356 use omicron_common:: address:: Ipv6Subnet ;
355357 use omicron_common:: address:: RACK_PREFIX ;
358+ use omicron_common:: address:: REPO_DEPOT_PORT ;
356359 use omicron_common:: address:: SLED_PREFIX ;
357360 use omicron_common:: address:: get_sled_address;
358361 use omicron_common:: address:: get_switch_zone_address;
@@ -733,7 +736,11 @@ mod test {
733736 . map ( |( i, ( sled_id, subnet) ) | {
734737 let sled_info = Sled :: new (
735738 * sled_id,
739+ SledPolicy :: InService {
740+ provision_policy : SledProvisionPolicy :: Provisionable ,
741+ } ,
736742 get_sled_address ( Ipv6Subnet :: new ( subnet. network ( ) ) ) ,
743+ REPO_DEPOT_PORT ,
737744 // The first two of these (arbitrarily) will be marked
738745 // Scrimlets.
739746 if i < 2 { SledRole :: Scrimlet } else { SledRole :: Gimlet } ,
@@ -759,7 +766,8 @@ mod test {
759766 //
760767 // 2. Every SRV record that we find should have a "target" that points
761768 // to another name within the DNS configuration, and that name should
762- // be one of the ones with a AAAA record pointing to an Omicron zone.
769+ // be one of the ones with a AAAA record pointing to either an
770+ // Omicron zone or a global zone.
763771 //
764772 // 3. There is at least one SRV record for each service that we expect
765773 // to appear in the representative system that we're working with.
@@ -784,7 +792,7 @@ mod test {
784792 . collect ( ) ;
785793 println ! ( "omicron zones by IP: {:#?}" , omicron_zones_by_ip) ;
786794
787- // Check to see that the out-of-service zone was actually excluded
795+ // Check to see that the out-of-service zone was actually excluded.
788796 assert ! (
789797 omicron_zones_by_ip. values( ) . all( |id| * id != out_of_service_id)
790798 ) ;
@@ -805,6 +813,17 @@ mod test {
805813 } )
806814 . collect ( ) ;
807815
816+ // We also want a mapping from underlay IP to each sled global zone.
817+ // In this case, the value is the sled id.
818+ let mut all_sleds_by_ip: BTreeMap < _ , _ > = sleds_by_id
819+ . keys ( )
820+ . map ( |sled_id| {
821+ let sled_subnet = sleds_by_id. get ( sled_id) . unwrap ( ) . subnet ( ) ;
822+ let global_zone_ip = * get_sled_address ( sled_subnet) . ip ( ) ;
823+ ( global_zone_ip, * sled_id)
824+ } )
825+ . collect ( ) ;
826+
808827 // Prune the special boundary NTP DNS name out, collecting their IP
809828 // addresses, and build a list of expected SRV targets to ensure these
810829 // IPs show up both in the special boundary NTP DNS name and as their
@@ -872,9 +891,23 @@ mod test {
872891 continue ;
873892 }
874893
894+ if let Some ( sled_id) = all_sleds_by_ip. remove ( addr) {
895+ println ! (
896+ "IP {} found in DNS corresponds with global zone \
897+ for sled {}",
898+ addr, sled_id
899+ ) ;
900+ expected_srv_targets. insert ( format ! (
901+ "{}.{}" ,
902+ name, blueprint_dns_zone. zone_name
903+ ) ) ;
904+ continue ;
905+ }
906+
875907 println ! (
876908 "note: found IP ({}) not corresponding to any \
877- Omicron zone or switch zone (name {:?})",
909+ Omicron zone, switch zone, or global zone \
910+ (name {:?})",
878911 addr, name
879912 ) ;
880913 }
@@ -924,6 +957,7 @@ mod test {
924957 ServiceName :: CruciblePantry ,
925958 ServiceName :: BoundaryNtp ,
926959 ServiceName :: InternalNtp ,
960+ ServiceName :: RepoDepot ,
927961 ] ) ;
928962
929963 for ( name, records) in & blueprint_dns_zone. records {
0 commit comments