Skip to content

Commit 7d47899

Browse files
committed
[neutron]: introduce Stateful argument for the security groups
1 parent c08ddc8 commit 7d47899

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ func TestSecurityGroupsCreateUpdateDelete(t *testing.T) {
2020
group, err := CreateSecurityGroup(t, client)
2121
th.AssertNoErr(t, err)
2222
defer DeleteSecurityGroup(t, client, group.ID)
23+
th.AssertEquals(t, group.Stateful, true)
2324

2425
rule, err := CreateSecurityGroupRule(t, client, group.ID)
2526
th.AssertNoErr(t, err)
@@ -32,6 +33,7 @@ func TestSecurityGroupsCreateUpdateDelete(t *testing.T) {
3233
updateOpts := groups.UpdateOpts{
3334
Name: name,
3435
Description: &description,
36+
Stateful: new(bool),
3537
}
3638

3739
newGroup, err := groups.Update(client, group.ID, updateOpts).Extract()
@@ -40,6 +42,7 @@ func TestSecurityGroupsCreateUpdateDelete(t *testing.T) {
4042
tools.PrintResource(t, newGroup)
4143
th.AssertEquals(t, newGroup.Name, name)
4244
th.AssertEquals(t, newGroup.Description, description)
45+
th.AssertEquals(t, newGroup.Stateful, false)
4346

4447
listOpts := groups.ListOpts{}
4548
allPages, err := groups.List(client, listOpts).AllPages()

openstack/networking/v2/extensions/security/groups/requests.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ type ListOpts struct {
1414
ID string `q:"id"`
1515
Name string `q:"name"`
1616
Description string `q:"description"`
17+
Stateful *bool `q:"stateful"`
1718
TenantID string `q:"tenant_id"`
1819
ProjectID string `q:"project_id"`
1920
Limit int `q:"limit"`
@@ -61,6 +62,9 @@ type CreateOpts struct {
6162

6263
// Describes the security group.
6364
Description string `json:"description,omitempty"`
65+
66+
// Stateful indicates if the security group is stateful or stateless.
67+
Stateful *bool `json:"stateful,omitempty"`
6468
}
6569

6670
// ToSecGroupCreateMap builds a request body from CreateOpts.
@@ -95,6 +99,9 @@ type UpdateOpts struct {
9599

96100
// Describes the security group.
97101
Description *string `json:"description,omitempty"`
102+
103+
// Stateful indicates if the security group is stateful or stateless.
104+
Stateful *bool `json:"stateful,omitempty"`
98105
}
99106

100107
// ToSecGroupUpdateMap builds a request body from UpdateOpts.

openstack/networking/v2/extensions/security/groups/results.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ type SecGroup struct {
2525
// traffic entering and leaving the group.
2626
Rules []rules.SecGroupRule `json:"security_group_rules"`
2727

28+
// Indicates if the security group is stateful or stateless.
29+
Stateful bool `json:"stateful"`
30+
2831
// TenantID is the project owner of the security group.
2932
TenantID string `json:"tenant_id"`
3033

0 commit comments

Comments
 (0)