-
Notifications
You must be signed in to change notification settings - Fork 515
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Networking V2: add QoS policy Create call
Implement QoS policy Create function. Add tests, docs and acceptance test helper.
- Loading branch information
1 parent
2d58570
commit ac621e5
Showing
7 changed files
with
174 additions
and
1 deletion.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
acceptance/openstack/networking/v2/extensions/qos/policies/policies.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,36 @@ | ||
package policies | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/gophercloud/gophercloud" | ||
"github.com/gophercloud/gophercloud/acceptance/tools" | ||
"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/qos/policies" | ||
th "github.com/gophercloud/gophercloud/testhelper" | ||
) | ||
|
||
// CreateQoSPolicy will create a QoS policy. An error will be returned if the | ||
// QoS policy could not be created. | ||
func CreateQoSPolicy(t *testing.T, client *gophercloud.ServiceClient) (*policies.Policy, error) { | ||
policyName := tools.RandomString("TESTACC-", 8) | ||
policyDescription := tools.RandomString("TESTACC-DESC-", 8) | ||
|
||
createOpts := policies.CreateOpts{ | ||
Name: policyName, | ||
Description: policyDescription, | ||
} | ||
|
||
t.Logf("Attempting to create a QoS policy: %s", policyName) | ||
|
||
policy, err := policies.Create(client, createOpts).Extract() | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
t.Logf("Succesfully created a QoS policy") | ||
|
||
th.AssertEquals(t, policyName, policy.Name) | ||
th.AssertEquals(t, policyDescription, policy.Description) | ||
|
||
return policy, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters