Skip to content

Commit 2c6c60b

Browse files
committed
Change Direction value type to int
1 parent bc9ccfa commit 2c6c60b

4 files changed

Lines changed: 23 additions & 23 deletions

File tree

internal/acceptance/openstack/networking/v2/extensions/taas/taas.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package taas
22

33
import (
44
"context"
5-
"strconv"
65
"testing"
76

87
"github.com/gophercloud/gophercloud/v2"
@@ -26,8 +25,8 @@ func CreateTapMirror(t *testing.T, client *gophercloud.ServiceClient, portID str
2625
MirrorType: tapmirrors.MirrorTypeErspanv1,
2726
RemoteIP: remoteIP,
2827
Directions: tapmirrors.Directions{
29-
In: strconv.Itoa(mirrorDirectionIN),
30-
Out: strconv.Itoa(mirrorDirectionIN + 1),
28+
In: mirrorDirectionIN,
29+
Out: mirrorDirectionIN + 1,
3130
},
3231
}
3332

openstack/networking/v2/extensions/taas/tapmirrors/requests.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ type CreateOpts struct {
4444
// The remote IP of the Tap Mirror, this will be the remote end of the GRE or ERSPAN v1 tunnel.
4545
RemoteIP string `json:"remote_ip"`
4646

47-
// A dictionary of direction and tunnel_id. Directions are IN and OUT.
48-
// The values of the directions must be unique within the project and
49-
// must be convertible to int.
47+
// A dictionary of direction and tunnel_id. Directions are In and Out. In specifies
48+
// ingress traffic to the port will be mirrored, Out specifies egress traffic will be mirrored.
49+
// The values of the directions are the identifiers of the ERSPAN or GRE session between
50+
// the source and destination, these must be unique within the project.
5051
Directions Directions `json:"directions"`
5152
}
5253

openstack/networking/v2/extensions/taas/tapmirrors/results.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,18 @@ type TapMirror struct {
3636
// A dictionary of direction and tunnel_id. Directions are In and Out. In specifies
3737
// ingress traffic to the port will be mirrored, Out specifies egress traffic will be mirrored.
3838
// The values of the directions are the identifiers of the ERSPAN or GRE session between
39-
// the source and destination, these must be unique within the project and must be convertible to int.
39+
// the source and destination, these must be unique within the project.
4040
Directions Directions `json:"directions"`
4141
}
4242

4343
type Directions struct {
44-
// Unique identifier of the tunnel with ingress traffic. Must be convertible to int.
45-
// Omit to not capture ingress traffic.
46-
In string `json:"IN,omitempty"`
44+
// Unique identifier of the tunnel with ingress traffic. Omit to not capture ingress traffic.
45+
// Encoded as JSON string to be compatible with python tap-as-a-service client.
46+
In int `json:"IN,omitempty,string"`
4747

48-
// Unique identifier of the tunnel with egress traffic. Must be convertible to int.
49-
// Omit to not capture egress traffic.
50-
Out string `json:"OUT,omitempty"`
48+
// Unique identifier of the tunnel with egress traffic. Omit to not capture egress traffic.
49+
// Encoded as JSON string to be compatible with python tap-as-a-service client.
50+
Out int `json:"OUT,omitempty,string"`
5151
}
5252

5353
type commonResult struct {

openstack/networking/v2/extensions/taas/tapmirrors/testing/requests_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ func TestCreate(t *testing.T) {
6868
MirrorType: tapmirrors.MirrorTypeErspanv1,
6969
RemoteIP: "192.168.54.217",
7070
Directions: tapmirrors.Directions{
71-
In: "1",
72-
Out: "2",
71+
In: 1,
72+
Out: 2,
7373
},
7474
}
7575
actual, err := tapmirrors.Create(context.TODO(), fake.ServiceClient(fakeServer), options).Extract()
@@ -84,8 +84,8 @@ func TestCreate(t *testing.T) {
8484
MirrorType: "erspanv1",
8585
RemoteIP: "192.168.54.217",
8686
Directions: tapmirrors.Directions{
87-
In: "1",
88-
Out: "2",
87+
In: 1,
88+
Out: 2,
8989
},
9090
}
9191
th.AssertDeepEquals(t, expected, *actual)
@@ -134,8 +134,8 @@ func TestGet(t *testing.T) {
134134
MirrorType: "erspanv1",
135135
RemoteIP: "192.168.54.217",
136136
Directions: tapmirrors.Directions{
137-
In: "1",
138-
Out: "2",
137+
In: 1,
138+
Out: 2,
139139
},
140140
}
141141
th.AssertDeepEquals(t, expected, *actual)
@@ -207,8 +207,8 @@ func TestList(t *testing.T) {
207207
MirrorType: "erspanv1",
208208
RemoteIP: "192.168.54.217",
209209
Directions: tapmirrors.Directions{
210-
In: "1",
211-
Out: "2",
210+
In: 1,
211+
Out: 2,
212212
},
213213
},
214214
}
@@ -283,8 +283,8 @@ func TestUpdate(t *testing.T) {
283283
MirrorType: "erspanv1",
284284
RemoteIP: "192.168.54.217",
285285
Directions: tapmirrors.Directions{
286-
In: "1",
287-
Out: "2",
286+
In: 1,
287+
Out: 2,
288288
},
289289
}
290290
th.AssertDeepEquals(t, expected, *actual)

0 commit comments

Comments
 (0)