@@ -343,6 +343,8 @@ mod test {
343
343
use nexus_types:: deployment:: blueprint_zone_type;
344
344
use nexus_types:: external_api:: params;
345
345
use nexus_types:: external_api:: shared;
346
+ use nexus_types:: external_api:: views:: SledPolicy ;
347
+ use nexus_types:: external_api:: views:: SledProvisionPolicy ;
346
348
use nexus_types:: external_api:: views:: SledState ;
347
349
use nexus_types:: identity:: Resource ;
348
350
use nexus_types:: internal_api:: params:: DnsConfigParams ;
@@ -353,6 +355,7 @@ mod test {
353
355
use omicron_common:: address:: IpRange ;
354
356
use omicron_common:: address:: Ipv6Subnet ;
355
357
use omicron_common:: address:: RACK_PREFIX ;
358
+ use omicron_common:: address:: REPO_DEPOT_PORT ;
356
359
use omicron_common:: address:: SLED_PREFIX ;
357
360
use omicron_common:: address:: get_sled_address;
358
361
use omicron_common:: address:: get_switch_zone_address;
@@ -733,7 +736,11 @@ mod test {
733
736
. map ( |( i, ( sled_id, subnet) ) | {
734
737
let sled_info = Sled :: new (
735
738
* sled_id,
739
+ SledPolicy :: InService {
740
+ provision_policy : SledProvisionPolicy :: Provisionable ,
741
+ } ,
736
742
get_sled_address ( Ipv6Subnet :: new ( subnet. network ( ) ) ) ,
743
+ REPO_DEPOT_PORT ,
737
744
// The first two of these (arbitrarily) will be marked
738
745
// Scrimlets.
739
746
if i < 2 { SledRole :: Scrimlet } else { SledRole :: Gimlet } ,
@@ -759,7 +766,8 @@ mod test {
759
766
//
760
767
// 2. Every SRV record that we find should have a "target" that points
761
768
// 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.
763
771
//
764
772
// 3. There is at least one SRV record for each service that we expect
765
773
// to appear in the representative system that we're working with.
@@ -784,7 +792,7 @@ mod test {
784
792
. collect ( ) ;
785
793
println ! ( "omicron zones by IP: {:#?}" , omicron_zones_by_ip) ;
786
794
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.
788
796
assert ! (
789
797
omicron_zones_by_ip. values( ) . all( |id| * id != out_of_service_id)
790
798
) ;
@@ -805,6 +813,17 @@ mod test {
805
813
} )
806
814
. collect ( ) ;
807
815
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
+
808
827
// Prune the special boundary NTP DNS name out, collecting their IP
809
828
// addresses, and build a list of expected SRV targets to ensure these
810
829
// IPs show up both in the special boundary NTP DNS name and as their
@@ -872,9 +891,23 @@ mod test {
872
891
continue ;
873
892
}
874
893
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
+
875
907
println ! (
876
908
"note: found IP ({}) not corresponding to any \
877
- Omicron zone or switch zone (name {:?})",
909
+ Omicron zone, switch zone, or global zone \
910
+ (name {:?})",
878
911
addr, name
879
912
) ;
880
913
}
@@ -924,6 +957,7 @@ mod test {
924
957
ServiceName :: CruciblePantry ,
925
958
ServiceName :: BoundaryNtp ,
926
959
ServiceName :: InternalNtp ,
960
+ ServiceName :: RepoDepot ,
927
961
] ) ;
928
962
929
963
for ( name, records) in & blueprint_dns_zone. records {
0 commit comments