From e332797e4222012212ffd880a9ea5b94fa3e3446 Mon Sep 17 00:00:00 2001 From: ghanshyam Date: Fri, 30 Jun 2017 12:31:29 +0300 Subject: [PATCH] Add 'networks' quota in quota sample files 'networks' quota can be available based on config value. api-ref should show that for quota-set APIs and also sample files so that it can be tested somewhere. Also adding it to quota class APIs sample files also. Closes-Bug: #1702201 Change-Id: I84d562a8ca10826dea4675d74669b5de64ff0ed0 --- api-ref/source/os-quota-sets.inc | 5 +++++ api-ref/source/parameters.yaml | 5 ++++- .../os-quota-class-sets/quota-classes-show-get-resp.json | 3 ++- .../os-quota-class-sets/quota-classes-update-post-req.json | 3 ++- .../quota-classes-update-post-resp.json | 3 ++- .../os-quota-sets/quotas-show-defaults-get-resp.json | 3 ++- .../os-quota-sets/quotas-show-detail-get-resp.json | 7 ++++++- doc/api_samples/os-quota-sets/quotas-show-get-resp.json | 3 ++- .../os-quota-sets/quotas-update-force-post-resp.json | 3 ++- doc/api_samples/os-quota-sets/quotas-update-post-resp.json | 3 ++- .../os-quota-sets/user-quotas-show-get-resp.json | 3 ++- .../os-quota-sets/user-quotas-update-post-resp.json | 3 ++- nova/tests/functional/api_sample_tests/api_sample_base.py | 5 +++++ .../quota-classes-show-get-resp.json.tpl | 3 ++- .../quota-classes-update-post-req.json.tpl | 3 ++- .../quota-classes-update-post-resp.json.tpl | 3 ++- .../os-quota-sets/quotas-show-defaults-get-resp.json.tpl | 3 ++- .../os-quota-sets/quotas-show-detail-get-resp.json.tpl | 7 ++++++- .../os-quota-sets/quotas-show-get-resp.json.tpl | 3 ++- .../os-quota-sets/quotas-update-force-post-resp.json.tpl | 3 ++- .../os-quota-sets/quotas-update-force-resp.json.tpl | 3 ++- .../os-quota-sets/quotas-update-post-resp.json.tpl | 3 ++- .../os-quota-sets/user-quotas-show-get-resp.json.tpl | 3 ++- .../os-quota-sets/user-quotas-update-post-resp.json.tpl | 3 ++- 24 files changed, 64 insertions(+), 22 deletions(-) diff --git a/api-ref/source/os-quota-sets.inc b/api-ref/source/os-quota-sets.inc index 8a650c317103..b47f1437481a 100644 --- a/api-ref/source/os-quota-sets.inc +++ b/api-ref/source/os-quota-sets.inc @@ -51,6 +51,7 @@ Response - security_groups: security_groups_quota - server_groups: server_groups - server_group_members: server_group_members + - networks: networks_quota_set_optional **Example Show A Quota: JSON response** @@ -99,6 +100,7 @@ Request - security_groups: security_groups_quota_optional - server_groups: server_groups_quota_optional - server_group_members: server_group_members_quota_optional + - networks: networks_quota_set_optional **Example Update Quotas: JSON request** @@ -130,6 +132,7 @@ Response - security_groups: security_groups_quota - server_groups: server_groups - server_group_members: server_group_members + - networks: networks_quota_set_optional **Example Update Quotas: JSON response** @@ -203,6 +206,7 @@ Response - security_groups: security_groups_quota - server_groups: server_groups - server_group_members: server_group_members + - networks: networks_quota_set_optional **Example List Default Quotas For Tenant: JSON response** @@ -254,6 +258,7 @@ Response - security_groups: security_groups_quota_details - server_groups: server_groups_quota_details - server_group_members: server_group_members_quota_details + - networks: networks_quota_set_optional **Example Show A Quota: JSON response** diff --git a/api-ref/source/parameters.yaml b/api-ref/source/parameters.yaml index 6353753dcb0f..b24d49f466bd 100644 --- a/api-ref/source/parameters.yaml +++ b/api-ref/source/parameters.yaml @@ -3807,12 +3807,15 @@ networks: in: body required: true type: object -networks_quota_optional: +networks_quota_optional: &networks_quota_optional description: | The number of private networks that can be created per project. in: body required: false type: integer +networks_quota_set_optional: + <<: *networks_quota_optional + max_version: 2.35 new_file: description: | The name of the qcow2 file that Block Storage creates, which becomes the active diff --git a/doc/api_samples/os-quota-class-sets/quota-classes-show-get-resp.json b/doc/api_samples/os-quota-class-sets/quota-classes-show-get-resp.json index 6e477722dda8..2fcfa2b9dd6d 100644 --- a/doc/api_samples/os-quota-class-sets/quota-classes-show-get-resp.json +++ b/doc/api_samples/os-quota-class-sets/quota-classes-show-get-resp.json @@ -12,6 +12,7 @@ "metadata_items": 128, "ram": 51200, "security_group_rules": 20, - "security_groups": 10 + "security_groups": 10, + "networks": 3 } } diff --git a/doc/api_samples/os-quota-class-sets/quota-classes-update-post-req.json b/doc/api_samples/os-quota-class-sets/quota-classes-update-post-req.json index 483fda8c53e7..4e3af3fa86b6 100644 --- a/doc/api_samples/os-quota-class-sets/quota-classes-update-post-req.json +++ b/doc/api_samples/os-quota-class-sets/quota-classes-update-post-req.json @@ -11,6 +11,7 @@ "injected_file_path_bytes": 255, "security_groups": 10, "security_group_rules": 20, - "key_pairs": 100 + "key_pairs": 100, + "networks": 3 } } diff --git a/doc/api_samples/os-quota-class-sets/quota-classes-update-post-resp.json b/doc/api_samples/os-quota-class-sets/quota-classes-update-post-resp.json index c86f86063b88..c58474b539bf 100644 --- a/doc/api_samples/os-quota-class-sets/quota-classes-update-post-resp.json +++ b/doc/api_samples/os-quota-class-sets/quota-classes-update-post-resp.json @@ -11,6 +11,7 @@ "metadata_items": 128, "ram": 51200, "security_group_rules": 20, - "security_groups": 10 + "security_groups": 10, + "networks": 3 } } diff --git a/doc/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json b/doc/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json index c93f809d598c..e03bc651eba0 100644 --- a/doc/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json +++ b/doc/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json @@ -14,6 +14,7 @@ "security_group_rules": 20, "security_groups": 10, "server_groups": 10, - "server_group_members": 10 + "server_group_members": 10, + "networks": 3 } } diff --git a/doc/api_samples/os-quota-sets/quotas-show-detail-get-resp.json b/doc/api_samples/os-quota-sets/quotas-show-detail-get-resp.json index 06ca0f1fba0d..bca3a1e82a00 100644 --- a/doc/api_samples/os-quota-sets/quotas-show-detail-get-resp.json +++ b/doc/api_samples/os-quota-sets/quotas-show-detail-get-resp.json @@ -70,6 +70,11 @@ "in_use": 0, "limit": 10, "reserved": 0 + }, + "networks": { + "in_use": 2, + "limit": 3, + "reserved": 0 } } -} \ No newline at end of file +} diff --git a/doc/api_samples/os-quota-sets/quotas-show-get-resp.json b/doc/api_samples/os-quota-sets/quotas-show-get-resp.json index c93f809d598c..e03bc651eba0 100644 --- a/doc/api_samples/os-quota-sets/quotas-show-get-resp.json +++ b/doc/api_samples/os-quota-sets/quotas-show-get-resp.json @@ -14,6 +14,7 @@ "security_group_rules": 20, "security_groups": 10, "server_groups": 10, - "server_group_members": 10 + "server_group_members": 10, + "networks": 3 } } diff --git a/doc/api_samples/os-quota-sets/quotas-update-force-post-resp.json b/doc/api_samples/os-quota-sets/quotas-update-force-post-resp.json index 66bbd00f44e5..ab901db2c923 100644 --- a/doc/api_samples/os-quota-sets/quotas-update-force-post-resp.json +++ b/doc/api_samples/os-quota-sets/quotas-update-force-post-resp.json @@ -13,6 +13,7 @@ "security_group_rules": 20, "security_groups": 10, "server_groups": 10, - "server_group_members": 10 + "server_group_members": 10, + "networks": 3 } } diff --git a/doc/api_samples/os-quota-sets/quotas-update-post-resp.json b/doc/api_samples/os-quota-sets/quotas-update-post-resp.json index a0f3b1a77d2f..f17ad087f175 100644 --- a/doc/api_samples/os-quota-sets/quotas-update-post-resp.json +++ b/doc/api_samples/os-quota-sets/quotas-update-post-resp.json @@ -13,6 +13,7 @@ "security_group_rules": 20, "security_groups": 45, "server_groups": 10, - "server_group_members": 10 + "server_group_members": 10, + "networks": 3 } } diff --git a/doc/api_samples/os-quota-sets/user-quotas-show-get-resp.json b/doc/api_samples/os-quota-sets/user-quotas-show-get-resp.json index c93f809d598c..e03bc651eba0 100644 --- a/doc/api_samples/os-quota-sets/user-quotas-show-get-resp.json +++ b/doc/api_samples/os-quota-sets/user-quotas-show-get-resp.json @@ -14,6 +14,7 @@ "security_group_rules": 20, "security_groups": 10, "server_groups": 10, - "server_group_members": 10 + "server_group_members": 10, + "networks": 3 } } diff --git a/doc/api_samples/os-quota-sets/user-quotas-update-post-resp.json b/doc/api_samples/os-quota-sets/user-quotas-update-post-resp.json index cf4e8c3d6657..4ac251c08689 100644 --- a/doc/api_samples/os-quota-sets/user-quotas-update-post-resp.json +++ b/doc/api_samples/os-quota-sets/user-quotas-update-post-resp.json @@ -13,6 +13,7 @@ "security_group_rules": 20, "security_groups": 10, "server_groups": 10, - "server_group_members": 10 + "server_group_members": 10, + "networks": 3 } } diff --git a/nova/tests/functional/api_sample_tests/api_sample_base.py b/nova/tests/functional/api_sample_tests/api_sample_base.py index aab616f76d45..41a244ed6a95 100644 --- a/nova/tests/functional/api_sample_tests/api_sample_base.py +++ b/nova/tests/functional/api_sample_tests/api_sample_base.py @@ -93,6 +93,11 @@ class ApiSampleTestBaseV21(testscenarios.WithScenarios, # NOTE(danms): Disable base automatic DB (and cells) config self.USES_DB = False self.USES_DB_SELF = True + # This is to enable the network quota which is being registered + # based on CONF.enable_network_quota. Need this to test the + # network quota in quota sample tests. + self.flags(enable_network_quota=True) + self.useFixture(fixtures.RegisterNetworkQuota()) # super class call is delayed here so that we have the right # paste and conf before loading all the services, as we can't diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-quota-class-sets/quota-classes-show-get-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-quota-class-sets/quota-classes-show-get-resp.json.tpl index f9a94e760af7..da6d69d66fbe 100644 --- a/nova/tests/functional/api_sample_tests/api_samples/os-quota-class-sets/quota-classes-show-get-resp.json.tpl +++ b/nova/tests/functional/api_sample_tests/api_samples/os-quota-class-sets/quota-classes-show-get-resp.json.tpl @@ -12,6 +12,7 @@ "metadata_items": 128, "ram": 51200, "security_group_rules": 20, - "security_groups": 10 + "security_groups": 10, + "networks": 3 } } diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-quota-class-sets/quota-classes-update-post-req.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-quota-class-sets/quota-classes-update-post-req.json.tpl index 483fda8c53e7..4e3af3fa86b6 100644 --- a/nova/tests/functional/api_sample_tests/api_samples/os-quota-class-sets/quota-classes-update-post-req.json.tpl +++ b/nova/tests/functional/api_sample_tests/api_samples/os-quota-class-sets/quota-classes-update-post-req.json.tpl @@ -11,6 +11,7 @@ "injected_file_path_bytes": 255, "security_groups": 10, "security_group_rules": 20, - "key_pairs": 100 + "key_pairs": 100, + "networks": 3 } } diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-quota-class-sets/quota-classes-update-post-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-quota-class-sets/quota-classes-update-post-resp.json.tpl index c36783f2f0e6..059acfde05e1 100644 --- a/nova/tests/functional/api_sample_tests/api_samples/os-quota-class-sets/quota-classes-update-post-resp.json.tpl +++ b/nova/tests/functional/api_sample_tests/api_samples/os-quota-class-sets/quota-classes-update-post-resp.json.tpl @@ -11,6 +11,7 @@ "metadata_items": 128, "ram": 51200, "security_group_rules": 20, - "security_groups": 10 + "security_groups": 10, + "networks": 3 } } diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json.tpl index f66f22cd2dfa..6a79f10758a3 100644 --- a/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json.tpl +++ b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json.tpl @@ -14,6 +14,7 @@ "security_group_rules": 20, "security_groups": 10, "server_groups": 10, - "server_group_members": 10 + "server_group_members": 10, + "networks": 3 } } diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/quotas-show-detail-get-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/quotas-show-detail-get-resp.json.tpl index 06ca0f1fba0d..bca3a1e82a00 100644 --- a/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/quotas-show-detail-get-resp.json.tpl +++ b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/quotas-show-detail-get-resp.json.tpl @@ -70,6 +70,11 @@ "in_use": 0, "limit": 10, "reserved": 0 + }, + "networks": { + "in_use": 2, + "limit": 3, + "reserved": 0 } } -} \ No newline at end of file +} diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/quotas-show-get-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/quotas-show-get-resp.json.tpl index f66f22cd2dfa..6a79f10758a3 100644 --- a/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/quotas-show-get-resp.json.tpl +++ b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/quotas-show-get-resp.json.tpl @@ -14,6 +14,7 @@ "security_group_rules": 20, "security_groups": 10, "server_groups": 10, - "server_group_members": 10 + "server_group_members": 10, + "networks": 3 } } diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/quotas-update-force-post-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/quotas-update-force-post-resp.json.tpl index 66bbd00f44e5..ab901db2c923 100644 --- a/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/quotas-update-force-post-resp.json.tpl +++ b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/quotas-update-force-post-resp.json.tpl @@ -13,6 +13,7 @@ "security_group_rules": 20, "security_groups": 10, "server_groups": 10, - "server_group_members": 10 + "server_group_members": 10, + "networks": 3 } } diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/quotas-update-force-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/quotas-update-force-resp.json.tpl index ff23ff6ae470..bf567a8046c1 100644 --- a/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/quotas-update-force-resp.json.tpl +++ b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/quotas-update-force-resp.json.tpl @@ -14,6 +14,7 @@ "security_groups": 10, "server_groups": 10, "server_group_members": 10, - "id": "fake_tenant" + "id": "fake_tenant", + "networks": 3 } } diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/quotas-update-post-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/quotas-update-post-resp.json.tpl index 605857f39ee6..47e09bf5c0f4 100644 --- a/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/quotas-update-post-resp.json.tpl +++ b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/quotas-update-post-resp.json.tpl @@ -13,6 +13,7 @@ "security_group_rules": 20, "security_groups": 45, "server_groups": 10, - "server_group_members": 10 + "server_group_members": 10, + "networks": 3 } } diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/user-quotas-show-get-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/user-quotas-show-get-resp.json.tpl index f66f22cd2dfa..6a79f10758a3 100644 --- a/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/user-quotas-show-get-resp.json.tpl +++ b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/user-quotas-show-get-resp.json.tpl @@ -14,6 +14,7 @@ "security_group_rules": 20, "security_groups": 10, "server_groups": 10, - "server_group_members": 10 + "server_group_members": 10, + "networks": 3 } } diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/user-quotas-update-post-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/user-quotas-update-post-resp.json.tpl index 34f9df9d705b..ae309dfc97d7 100644 --- a/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/user-quotas-update-post-resp.json.tpl +++ b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/user-quotas-update-post-resp.json.tpl @@ -13,6 +13,7 @@ "security_group_rules": 20, "security_groups": 10, "server_groups": 10, - "server_group_members": 10 + "server_group_members": 10, + "networks": 3 } }