@@ -84,8 +84,8 @@ func Test_validateSgRule(t *testing.T) {
8484 return & kubeovnv1.SecurityGroup {
8585 ObjectMeta : metav1.ObjectMeta {Name : "test-sg" },
8686 Spec : kubeovnv1.SecurityGroupSpec {
87- SecurityGroupTier : util .SecurityGroupTierMinimum ,
88- IngressRules : rules ,
87+ Tier : util .SecurityGroupAPITierMinimum ,
88+ IngressRules : rules ,
8989 },
9090 }
9191 }
@@ -158,17 +158,17 @@ func Test_validateSgRule(t *testing.T) {
158158 t .Parallel ()
159159
160160 sg := baseSG (kubeovnv1.SecurityGroupRule {
161- IPVersion : "ipv4" ,
162- Priority : 1 ,
163- RemoteType : kubeovnv1 .SgRemoteTypeAddress ,
164- RemoteAddress : "10.0.0.1" ,
165- LocalAddress : "192.168.1.100" ,
166- Protocol : "tcp" ,
167- Policy : kubeovnv1 .SgPolicy (ovnnb .ACLActionAllow ),
168- PortRangeMin : 80 ,
169- PortRangeMax : 443 ,
170- LocalPortRangeMin : 1024 ,
171- LocalPortRangeMax : 65535 ,
161+ IPVersion : "ipv4" ,
162+ Priority : 1 ,
163+ RemoteType : kubeovnv1 .SgRemoteTypeAddress ,
164+ RemoteAddress : "10.0.0.1" ,
165+ LocalAddress : "192.168.1.100" ,
166+ Protocol : "tcp" ,
167+ Policy : kubeovnv1 .SgPolicy (ovnnb .ACLActionAllow ),
168+ PortRangeMin : 80 ,
169+ PortRangeMax : 443 ,
170+ SourcePortRangeMin : 1024 ,
171+ SourcePortRangeMax : 65535 ,
172172 })
173173 err := ctrl .validateSgRule (sg )
174174 require .NoError (t , err )
@@ -178,37 +178,37 @@ func Test_validateSgRule(t *testing.T) {
178178 t .Parallel ()
179179
180180 sg := baseSG (kubeovnv1.SecurityGroupRule {
181- IPVersion : "ipv4" ,
182- Priority : 1 ,
183- RemoteType : kubeovnv1 .SgRemoteTypeAddress ,
184- RemoteAddress : "10.0.0.1" ,
185- LocalAddress : "192.168.1.100" ,
186- Protocol : "tcp" ,
187- Policy : kubeovnv1 .SgPolicy (ovnnb .ACLActionAllow ),
188- PortRangeMin : 80 ,
189- PortRangeMax : 443 ,
190- LocalPortRangeMin : 0 ,
191- LocalPortRangeMax : 65535 ,
181+ IPVersion : "ipv4" ,
182+ Priority : 1 ,
183+ RemoteType : kubeovnv1 .SgRemoteTypeAddress ,
184+ RemoteAddress : "10.0.0.1" ,
185+ LocalAddress : "192.168.1.100" ,
186+ Protocol : "tcp" ,
187+ Policy : kubeovnv1 .SgPolicy (ovnnb .ACLActionAllow ),
188+ PortRangeMin : 80 ,
189+ PortRangeMax : 443 ,
190+ SourcePortRangeMin : 0 ,
191+ SourcePortRangeMax : 65535 ,
192192 })
193193 err := ctrl .validateSgRule (sg )
194- require .ErrorContains (t , err , "portRange is out of range" )
194+ require .ErrorContains (t , err , "sourcePortRange is out of range" )
195195 })
196196
197197 t .Run ("invalid local port range min greater than max" , func (t * testing.T ) {
198198 t .Parallel ()
199199
200200 sg := baseSG (kubeovnv1.SecurityGroupRule {
201- IPVersion : "ipv4" ,
202- Priority : 1 ,
203- RemoteType : kubeovnv1 .SgRemoteTypeAddress ,
204- RemoteAddress : "10.0.0.1" ,
205- LocalAddress : "192.168.1.100" ,
206- Protocol : "udp" ,
207- Policy : kubeovnv1 .SgPolicy (ovnnb .ACLActionAllow ),
208- PortRangeMin : 80 ,
209- PortRangeMax : 443 ,
210- LocalPortRangeMin : 9000 ,
211- LocalPortRangeMax : 8000 ,
201+ IPVersion : "ipv4" ,
202+ Priority : 1 ,
203+ RemoteType : kubeovnv1 .SgRemoteTypeAddress ,
204+ RemoteAddress : "10.0.0.1" ,
205+ LocalAddress : "192.168.1.100" ,
206+ Protocol : "udp" ,
207+ Policy : kubeovnv1 .SgPolicy (ovnnb .ACLActionAllow ),
208+ PortRangeMin : 80 ,
209+ PortRangeMax : 443 ,
210+ SourcePortRangeMin : 9000 ,
211+ SourcePortRangeMax : 8000 ,
212212 })
213213 err := ctrl .validateSgRule (sg )
214214 require .ErrorContains (t , err , "range Minimum value greater than maximum value" )
0 commit comments