@@ -371,6 +371,63 @@ fn display_zone_init_errors(errors: &[(String, Box<Error>)]) -> String {
371
371
output
372
372
}
373
373
374
+ /// Helper function to add properties to a PropertyGroupBuilder for a sled
375
+ /// agent centered around rack and sled identifiers.
376
+ fn add_sled_ident_properties (
377
+ config : PropertyGroupBuilder ,
378
+ info : & SledAgentInfo ,
379
+ ) -> PropertyGroupBuilder {
380
+ config
381
+ . add_property ( "rack_id" , "astring" , & info. rack_id . to_string ( ) )
382
+ . add_property (
383
+ "sled_id" ,
384
+ "astring" ,
385
+ & info. config . sled_identifiers . sled_id . to_string ( ) ,
386
+ )
387
+ . add_property (
388
+ "sled_model" ,
389
+ "astring" ,
390
+ & info. config . sled_identifiers . model . to_string ( ) ,
391
+ )
392
+ . add_property (
393
+ "sled_serial" ,
394
+ "astring" ,
395
+ & info. config . sled_identifiers . serial . to_string ( ) ,
396
+ )
397
+ . add_property (
398
+ "sled_revision" ,
399
+ "astring" ,
400
+ & info. config . sled_identifiers . revision . to_string ( ) ,
401
+ )
402
+ }
403
+
404
+ /// Helper function to set properties on a SmfHelper for a sled agent centered
405
+ /// around rack and sled identifiers.
406
+ fn setprop_sled_ident_properties (
407
+ smfh : & SmfHelper ,
408
+ info : & SledAgentInfo ,
409
+ ) -> Result < ( ) , Error > {
410
+ smfh. setprop_default_instance ( "config/rack_id" , info. rack_id ) ?;
411
+ smfh. setprop_default_instance (
412
+ "config/sled_id" ,
413
+ info. config . sled_identifiers . sled_id ,
414
+ ) ?;
415
+ smfh. setprop_default_instance (
416
+ "config/sled_model" ,
417
+ info. config . sled_identifiers . model . to_string ( ) ,
418
+ ) ?;
419
+ smfh. setprop_default_instance (
420
+ "config/sled_revision" ,
421
+ info. config . sled_identifiers . revision ,
422
+ ) ?;
423
+ smfh. setprop_default_instance (
424
+ "config/sled_serial" ,
425
+ info. config . sled_identifiers . serial . to_string ( ) ,
426
+ ) ?;
427
+
428
+ Ok ( ( ) )
429
+ }
430
+
374
431
/// Configuration parameters which modify the [`ServiceManager`]'s behavior.
375
432
pub struct Config {
376
433
/// Identifies the sled being configured
@@ -2674,45 +2731,11 @@ impl ServiceManager {
2674
2731
PropertyGroupBuilder :: new ( "config" ) ;
2675
2732
2676
2733
if let Some ( i) = info {
2677
- dendrite_config = dendrite_config
2678
- . add_property (
2679
- "rack_id" ,
2680
- "astring" ,
2681
- & i. rack_id . to_string ( ) ,
2682
- )
2683
- . add_property (
2684
- "sled_id" ,
2685
- "astring" ,
2686
- & i. config
2687
- . sled_identifiers
2688
- . sled_id
2689
- . to_string ( ) ,
2690
- )
2691
- . add_property (
2692
- "sled_model" ,
2693
- "astring" ,
2694
- & i. config
2695
- . sled_identifiers
2696
- . model
2697
- . to_string ( ) ,
2698
- )
2699
- . add_property (
2700
- "sled_serial" ,
2701
- "astring" ,
2702
- & i. config
2703
- . sled_identifiers
2704
- . serial
2705
- . to_string ( ) ,
2706
- )
2707
- . add_property (
2708
- "sled_revision" ,
2709
- "astring" ,
2710
- & i. config
2711
- . sled_identifiers
2712
- . revision
2713
- . to_string ( ) ,
2714
- ) ;
2715
- }
2734
+ dendrite_config = add_sled_ident_properties (
2735
+ dendrite_config,
2736
+ i,
2737
+ )
2738
+ } ;
2716
2739
2717
2740
for address in addresses {
2718
2741
dendrite_config = dendrite_config. add_property (
@@ -2837,64 +2860,30 @@ impl ServiceManager {
2837
2860
}
2838
2861
SwitchService :: Tfport { pkt_source, asic } => {
2839
2862
info ! ( self . inner. log, "Setting up tfport service" ) ;
2863
+
2840
2864
let mut tfport_config =
2841
2865
PropertyGroupBuilder :: new ( "config" ) ;
2842
2866
2843
2867
tfport_config = tfport_config
2844
2868
. add_property (
2845
- "host " ,
2869
+ "dpd_host " ,
2846
2870
"astring" ,
2847
2871
& format ! ( "[{}]" , Ipv6Addr :: LOCALHOST ) ,
2848
2872
)
2849
2873
. add_property (
2850
- "port " ,
2874
+ "dpd_port " ,
2851
2875
"astring" ,
2852
2876
& format ! ( "{}" , DENDRITE_PORT ) ,
2853
2877
) ;
2878
+
2854
2879
if let Some ( i) = info {
2855
- tfport_config = tfport_config
2856
- . add_property (
2857
- "rack_id" ,
2858
- "astring" ,
2859
- & i. rack_id . to_string ( ) ,
2860
- )
2861
- . add_property (
2862
- "sled_id" ,
2863
- "astring" ,
2864
- & i. config
2865
- . sled_identifiers
2866
- . sled_id
2867
- . to_string ( ) ,
2868
- )
2869
- . add_property (
2870
- "sled_model" ,
2871
- "astring" ,
2872
- & i. config
2873
- . sled_identifiers
2874
- . model
2875
- . to_string ( ) ,
2876
- )
2877
- . add_property (
2878
- "sled_revision" ,
2879
- "astring" ,
2880
- & i. config
2881
- . sled_identifiers
2882
- . revision
2883
- . to_string ( ) ,
2884
- )
2885
- . add_property (
2886
- "sled_serial" ,
2887
- "astring" ,
2888
- & i. config
2889
- . sled_identifiers
2890
- . serial
2891
- . to_string ( ) ,
2892
- ) ;
2880
+ tfport_config =
2881
+ add_sled_ident_properties ( tfport_config, i) ;
2893
2882
}
2894
2883
2895
2884
for address in addresses {
2896
2885
tfport_config = tfport_config. add_property (
2897
- "address " ,
2886
+ "listen_address " ,
2898
2887
"astring" ,
2899
2888
& format ! ( "[{}]:{}" , address, TFPORTD_PORT ) ,
2900
2889
) ;
@@ -4435,32 +4424,7 @@ impl ServiceManager {
4435
4424
"configuring dendrite service"
4436
4425
) ;
4437
4426
if let Some ( info) = self . inner . sled_info . get ( ) {
4438
- smfh. setprop_default_instance (
4439
- "config/rack_id" ,
4440
- info. rack_id ,
4441
- ) ?;
4442
- smfh. setprop_default_instance (
4443
- "config/sled_id" ,
4444
- info. config . sled_identifiers . sled_id ,
4445
- ) ?;
4446
- smfh. setprop_default_instance (
4447
- "config/sled_model" ,
4448
- info. config
4449
- . sled_identifiers
4450
- . model
4451
- . to_string ( ) ,
4452
- ) ?;
4453
- smfh. setprop_default_instance (
4454
- "config/sled_revision" ,
4455
- info. config . sled_identifiers . revision ,
4456
- ) ?;
4457
- smfh. setprop_default_instance (
4458
- "config/sled_serial" ,
4459
- info. config
4460
- . sled_identifiers
4461
- . serial
4462
- . to_string ( ) ,
4463
- ) ?;
4427
+ setprop_sled_ident_properties ( & smfh, info) ?;
4464
4428
} else {
4465
4429
info ! (
4466
4430
self . inner. log,
@@ -4541,45 +4505,20 @@ impl ServiceManager {
4541
4505
SwitchService :: Tfport { pkt_source, asic } => {
4542
4506
info ! ( self . inner. log, "configuring tfport service" ) ;
4543
4507
if let Some ( info) = self . inner . sled_info . get ( ) {
4544
- smfh. setprop_default_instance (
4545
- "config/rack_id" ,
4546
- info. rack_id ,
4547
- ) ?;
4548
- smfh. setprop_default_instance (
4549
- "config/sled_id" ,
4550
- info. config . sled_identifiers . sled_id ,
4551
- ) ?;
4552
- smfh. setprop_default_instance (
4553
- "config/sled_model" ,
4554
- info. config
4555
- . sled_identifiers
4556
- . model
4557
- . to_string ( ) ,
4558
- ) ?;
4559
- smfh. setprop_default_instance (
4560
- "config/sled_revision" ,
4561
- info. config . sled_identifiers . revision ,
4562
- ) ?;
4563
- smfh. setprop_default_instance (
4564
- "config/sled_serial" ,
4565
- info. config
4566
- . sled_identifiers
4567
- . serial
4568
- . to_string ( ) ,
4569
- ) ?;
4508
+ setprop_sled_ident_properties ( & smfh, info) ?;
4570
4509
} else {
4571
4510
info ! (
4572
4511
self . inner. log,
4573
4512
"no sled info available yet"
4574
4513
) ;
4575
4514
}
4576
4515
smfh. delpropvalue_default_instance (
4577
- "config/address " ,
4516
+ "config/listen_address " ,
4578
4517
"*" ,
4579
4518
) ?;
4580
4519
for address in & request. addresses {
4581
4520
smfh. addpropvalue_type_default_instance (
4582
- "config/address " ,
4521
+ "config/listen_address " ,
4583
4522
& format ! ( "[{}]:{}" , address, TFPORTD_PORT ) ,
4584
4523
"astring" ,
4585
4524
) ?;
0 commit comments