@@ -3842,52 +3842,46 @@ async fn test_multicast_reset_all_tables() -> TestResult {
3842
3842
async fn test_multicast_group_id_recycling ( ) -> TestResult {
3843
3843
let switch = & * get_switch ( ) . await ;
3844
3844
3845
- let egress = PhysPort ( 28 ) ;
3846
- let internal_multicast_ip = IpAddr :: V6 ( MULTICAST_NAT_IP ) ;
3847
- let underlay_group = create_test_multicast_group (
3848
- switch,
3849
- internal_multicast_ip,
3850
- Some ( "recycling_test_underlay" ) ,
3851
- & [ ( egress, types:: Direction :: Underlay ) ] ,
3852
- None ,
3853
- false ,
3854
- None ,
3855
- )
3856
- . await ;
3845
+ let ( port_id, link_id) = switch. link_id ( PhysPort ( 28 ) ) . unwrap ( ) ;
3857
3846
3858
- let group_ip1 = IpAddr :: V4 ( MULTICAST_TEST_IPV4 ) ;
3859
- let nat_target = create_nat_target_ipv4 ( ) ;
3860
- let external_create1 = types:: MulticastGroupCreateExternalEntry {
3847
+ let group_ip1: Ipv6Addr = "ff04::100" . parse ( ) . unwrap ( ) ;
3848
+ let internal_create1 = types:: MulticastGroupCreateEntry {
3861
3849
group_ip : group_ip1,
3862
3850
tag : Some ( "recycling_test_1" . to_string ( ) ) ,
3863
- nat_target : nat_target. clone ( ) ,
3864
- vlan_id : Some ( 10 ) ,
3865
3851
sources : None ,
3852
+ members : vec ! [ types:: MulticastGroupMember {
3853
+ port_id,
3854
+ link_id,
3855
+ direction: types:: Direction :: External ,
3856
+ } ] ,
3866
3857
} ;
3867
3858
3868
3859
let created_group1 = switch
3869
3860
. client
3870
- . multicast_group_create_external ( & external_create1 )
3861
+ . multicast_group_create ( & internal_create1 )
3871
3862
. await ?
3872
3863
. into_inner ( ) ;
3873
3864
3874
3865
let first_external_id = created_group1. external_group_id ;
3875
3866
let first_underlay_id = created_group1. underlay_group_id ;
3876
3867
3877
- switch. client . multicast_group_delete ( & group_ip1) . await ?;
3868
+ switch. client . multicast_group_delete ( & group_ip1. into ( ) ) . await ?;
3878
3869
3879
- let group_ip2 = IpAddr :: V4 ( Ipv4Addr :: new ( 224 , 0 , 1 , 100 ) ) ;
3880
- let external_create2 = types:: MulticastGroupCreateExternalEntry {
3870
+ let group_ip2: Ipv6Addr = "ff04::101" . parse ( ) . unwrap ( ) ;
3871
+ let internal_create2 = types:: MulticastGroupCreateEntry {
3881
3872
group_ip : group_ip2,
3882
3873
tag : Some ( "recycling_test_2" . to_string ( ) ) ,
3883
- nat_target : nat_target. clone ( ) ,
3884
- vlan_id : Some ( 10 ) ,
3885
3874
sources : None ,
3875
+ members : vec ! [ types:: MulticastGroupMember {
3876
+ port_id,
3877
+ link_id,
3878
+ direction: types:: Direction :: External ,
3879
+ } ] ,
3886
3880
} ;
3887
3881
3888
3882
let created_group2 = switch
3889
3883
. client
3890
- . multicast_group_create_external ( & external_create2 )
3884
+ . multicast_group_create ( & internal_create2 )
3891
3885
. await ?
3892
3886
. into_inner ( ) ;
3893
3887
@@ -3896,22 +3890,25 @@ async fn test_multicast_group_id_recycling() -> TestResult {
3896
3890
"Second group should have external group ID"
3897
3891
) ;
3898
3892
assert ! (
3899
- created_group2. underlay_group_id. is_some ( ) ,
3900
- "Second group should have underlay group ID"
3893
+ created_group2. underlay_group_id. is_none ( ) ,
3894
+ "Second group should not have underlay group ID"
3901
3895
) ;
3902
3896
3903
- let group_ip3 = IpAddr :: V4 ( Ipv4Addr :: new ( 224 , 0 , 1 , 101 ) ) ;
3904
- let external_create3 = types:: MulticastGroupCreateExternalEntry {
3897
+ let group_ip3: Ipv6Addr = "ff04::102" . parse ( ) . unwrap ( ) ;
3898
+ let internal_create3 = types:: MulticastGroupCreateEntry {
3905
3899
group_ip : group_ip3,
3906
3900
tag : Some ( "recycling_test_3" . to_string ( ) ) ,
3907
- nat_target : nat_target. clone ( ) ,
3908
- vlan_id : Some ( 10 ) ,
3909
3901
sources : None ,
3902
+ members : vec ! [ types:: MulticastGroupMember {
3903
+ port_id,
3904
+ link_id,
3905
+ direction: types:: Direction :: External ,
3906
+ } ] ,
3910
3907
} ;
3911
3908
3912
3909
let created_group3 = switch
3913
3910
. client
3914
- . multicast_group_create_external ( & external_create3 )
3911
+ . multicast_group_create ( & internal_create3 )
3915
3912
. await ?
3916
3913
. into_inner ( ) ;
3917
3914
@@ -3920,13 +3917,12 @@ async fn test_multicast_group_id_recycling() -> TestResult {
3920
3917
"Third group should have external group ID"
3921
3918
) ;
3922
3919
assert ! (
3923
- created_group3. underlay_group_id. is_some ( ) ,
3924
- "Third group should have underlay group ID"
3920
+ created_group3. underlay_group_id. is_none ( ) ,
3921
+ "Third group should not have underlay group ID"
3925
3922
) ;
3926
3923
3927
- cleanup_test_group ( switch, group_ip2) . await ;
3928
- cleanup_test_group ( switch, group_ip3) . await ;
3929
- cleanup_test_group ( switch, internal_multicast_ip) . await ;
3924
+ cleanup_test_group ( switch, group_ip2. into ( ) ) . await ;
3925
+ cleanup_test_group ( switch, group_ip3. into ( ) ) . await ;
3930
3926
3931
3927
Ok ( ( ) )
3932
3928
}
@@ -3936,62 +3932,51 @@ async fn test_multicast_group_id_recycling() -> TestResult {
3936
3932
async fn test_multicast_group_id_reuse ( ) -> TestResult {
3937
3933
let switch = & * get_switch ( ) . await ;
3938
3934
3939
- let egress = PhysPort ( 29 ) ;
3940
- let internal_multicast_ip = IpAddr :: V6 ( MULTICAST_NAT_IP ) ;
3941
- let underlay_group = create_test_multicast_group (
3942
- switch,
3943
- internal_multicast_ip,
3944
- Some ( "id_reuse_test_underlay" ) ,
3945
- & [ ( egress, types:: Direction :: Underlay ) ] ,
3946
- None ,
3947
- false ,
3948
- None ,
3949
- )
3950
- . await ;
3935
+ let ( port_id, link_id) = switch. link_id ( PhysPort ( 29 ) ) . unwrap ( ) ;
3951
3936
3952
3937
let mut deleted_external_ids = Vec :: new ( ) ;
3953
- let mut deleted_underlay_ids = Vec :: new ( ) ;
3954
3938
3955
3939
for i in 0 ..5 {
3956
- let group_ip = IpAddr :: V4 ( Ipv4Addr :: new ( 224 , 0 , 1 , 50 + i) ) ;
3957
- let nat_target = create_nat_target_ipv4 ( ) ;
3958
- let external_create = types:: MulticastGroupCreateExternalEntry {
3940
+ let group_ip: Ipv6Addr = format ! ( "ff04::{}" , 200 + i) . parse ( ) . unwrap ( ) ;
3941
+ let internal_create = types:: MulticastGroupCreateEntry {
3959
3942
group_ip,
3960
3943
tag : Some ( format ! ( "id_reuse_test_{}" , i) ) ,
3961
- nat_target,
3962
- vlan_id : Some ( 10 ) ,
3963
3944
sources : None ,
3945
+ members : vec ! [ types:: MulticastGroupMember {
3946
+ port_id,
3947
+ link_id,
3948
+ direction: types:: Direction :: External ,
3949
+ } ] ,
3964
3950
} ;
3965
3951
3966
3952
let created_group = switch
3967
3953
. client
3968
- . multicast_group_create_external ( & external_create )
3954
+ . multicast_group_create ( & internal_create )
3969
3955
. await ?
3970
3956
. into_inner ( ) ;
3971
3957
3972
3958
if let Some ( external_id) = created_group. external_group_id {
3973
3959
deleted_external_ids. push ( external_id) ;
3974
3960
}
3975
- if let Some ( underlay_id) = created_group. underlay_group_id {
3976
- deleted_underlay_ids. push ( underlay_id) ;
3977
- }
3978
3961
3979
- switch. client . multicast_group_delete ( & group_ip) . await ?;
3962
+ switch. client . multicast_group_delete ( & group_ip. into ( ) ) . await ?;
3980
3963
}
3981
3964
3982
- let new_group_ip = IpAddr :: V4 ( Ipv4Addr :: new ( 224 , 0 , 1 , 200 ) ) ;
3983
- let nat_target = create_nat_target_ipv4 ( ) ;
3984
- let new_external_create = types:: MulticastGroupCreateExternalEntry {
3965
+ let new_group_ip: Ipv6Addr = "ff04::300" . parse ( ) . unwrap ( ) ;
3966
+ let new_internal_create = types:: MulticastGroupCreateEntry {
3985
3967
group_ip : new_group_ip,
3986
3968
tag : Some ( "id_reuse_verification" . to_string ( ) ) ,
3987
- nat_target,
3988
- vlan_id : Some ( 10 ) ,
3989
3969
sources : None ,
3970
+ members : vec ! [ types:: MulticastGroupMember {
3971
+ port_id,
3972
+ link_id,
3973
+ direction: types:: Direction :: External ,
3974
+ } ] ,
3990
3975
} ;
3991
3976
3992
3977
let new_created_group = switch
3993
3978
. client
3994
- . multicast_group_create_external ( & new_external_create )
3979
+ . multicast_group_create ( & new_internal_create )
3995
3980
. await ?
3996
3981
. into_inner ( ) ;
3997
3982
@@ -4006,19 +3991,7 @@ async fn test_multicast_group_id_reuse() -> TestResult {
4006
3991
panic ! ( "New group should have an external group ID" ) ;
4007
3992
}
4008
3993
4009
- if let Some ( new_underlay_id) = new_created_group. underlay_group_id {
4010
- assert ! (
4011
- deleted_underlay_ids. contains( & new_underlay_id) ,
4012
- "New group should reuse a deleted underlay group ID, got {}, expected one of {:?}" ,
4013
- new_underlay_id,
4014
- deleted_underlay_ids
4015
- ) ;
4016
- } else {
4017
- panic ! ( "New group should have an underlay group ID" ) ;
4018
- }
4019
-
4020
- cleanup_test_group ( switch, new_group_ip) . await ;
4021
- cleanup_test_group ( switch, internal_multicast_ip) . await ;
3994
+ cleanup_test_group ( switch, new_group_ip. into ( ) ) . await ;
4022
3995
4023
3996
Ok ( ( ) )
4024
3997
}
@@ -4028,36 +4001,27 @@ async fn test_multicast_group_id_reuse() -> TestResult {
4028
4001
async fn test_multicast_group_id_pool_exhaustion_recovery ( ) -> TestResult {
4029
4002
let switch = & * get_switch ( ) . await ;
4030
4003
4031
- let egress = PhysPort ( 30 ) ;
4032
- let internal_multicast_ip = IpAddr :: V6 ( MULTICAST_NAT_IP ) ;
4033
- let underlay_group = create_test_multicast_group (
4034
- switch,
4035
- internal_multicast_ip,
4036
- Some ( "pool_exhaustion_test_underlay" ) ,
4037
- & [ ( egress, types:: Direction :: Underlay ) ] ,
4038
- None ,
4039
- false ,
4040
- None ,
4041
- )
4042
- . await ;
4004
+ let ( port_id, link_id) = switch. link_id ( PhysPort ( 30 ) ) . unwrap ( ) ;
4043
4005
4044
4006
let mut created_groups = Vec :: new ( ) ;
4045
4007
let num_groups = 10 ;
4046
4008
4047
4009
for i in 0 ..num_groups {
4048
- let group_ip = IpAddr :: V4 ( Ipv4Addr :: new ( 224 , 0 , 2 , 10 + i as u8 ) ) ;
4049
- let nat_target = create_nat_target_ipv4 ( ) ;
4050
- let external_create = types:: MulticastGroupCreateExternalEntry {
4010
+ let group_ip: Ipv6Addr = format ! ( "ff04::{}" , 400 + i) . parse ( ) . unwrap ( ) ;
4011
+ let internal_create = types:: MulticastGroupCreateEntry {
4051
4012
group_ip,
4052
4013
tag : Some ( format ! ( "pool_test_{}" , i) ) ,
4053
- nat_target,
4054
- vlan_id : Some ( 10 ) ,
4055
4014
sources : None ,
4015
+ members : vec ! [ types:: MulticastGroupMember {
4016
+ port_id,
4017
+ link_id,
4018
+ direction: types:: Direction :: External ,
4019
+ } ] ,
4056
4020
} ;
4057
4021
4058
4022
let created_group = switch
4059
4023
. client
4060
- . multicast_group_create_external ( & external_create )
4024
+ . multicast_group_create ( & internal_create )
4061
4025
. await ?
4062
4026
. into_inner ( ) ;
4063
4027
@@ -4073,24 +4037,26 @@ async fn test_multicast_group_id_pool_exhaustion_recovery() -> TestResult {
4073
4037
4074
4038
let groups_to_delete = & created_groups[ 0 ..num_groups / 2 ] ;
4075
4039
for ( group_ip, _) in groups_to_delete {
4076
- switch. client . multicast_group_delete ( group_ip) . await ?;
4040
+ switch. client . multicast_group_delete ( & ( * group_ip) . into ( ) ) . await ?;
4077
4041
}
4078
4042
4079
4043
let mut new_groups = Vec :: new ( ) ;
4080
4044
for i in 0 ..num_groups / 2 {
4081
- let group_ip = IpAddr :: V4 ( Ipv4Addr :: new ( 224 , 0 , 3 , 10 + i as u8 ) ) ;
4082
- let nat_target = create_nat_target_ipv4 ( ) ;
4083
- let external_create = types:: MulticastGroupCreateExternalEntry {
4045
+ let group_ip: Ipv6Addr = format ! ( "ff04::{}" , 500 + i) . parse ( ) . unwrap ( ) ;
4046
+ let internal_create = types:: MulticastGroupCreateEntry {
4084
4047
group_ip,
4085
4048
tag : Some ( format ! ( "pool_recovery_test_{}" , i) ) ,
4086
- nat_target,
4087
- vlan_id : Some ( 10 ) ,
4088
4049
sources : None ,
4050
+ members : vec ! [ types:: MulticastGroupMember {
4051
+ port_id,
4052
+ link_id,
4053
+ direction: types:: Direction :: External ,
4054
+ } ] ,
4089
4055
} ;
4090
4056
4091
4057
let created_group = switch
4092
4058
. client
4093
- . multicast_group_create_external ( & external_create )
4059
+ . multicast_group_create ( & internal_create )
4094
4060
. await ?
4095
4061
. into_inner ( ) ;
4096
4062
@@ -4110,18 +4076,17 @@ async fn test_multicast_group_id_pool_exhaustion_recovery() -> TestResult {
4110
4076
"New group should have external group ID"
4111
4077
) ;
4112
4078
assert ! (
4113
- group. underlay_group_id. is_some ( ) ,
4114
- "New group should have underlay group ID"
4079
+ group. underlay_group_id. is_none ( ) ,
4080
+ "New group should not have underlay group ID"
4115
4081
) ;
4116
4082
}
4117
4083
4118
4084
for ( group_ip, _) in & created_groups[ num_groups / 2 ..] {
4119
- cleanup_test_group ( switch, * group_ip) . await ;
4085
+ cleanup_test_group ( switch, ( * group_ip) . into ( ) ) . await ;
4120
4086
}
4121
4087
for ( group_ip, _) in & new_groups {
4122
- cleanup_test_group ( switch, * group_ip) . await ;
4088
+ cleanup_test_group ( switch, ( * group_ip) . into ( ) ) . await ;
4123
4089
}
4124
- cleanup_test_group ( switch, internal_multicast_ip) . await ;
4125
4090
4126
4091
Ok ( ( ) )
4127
4092
}
0 commit comments