Correct flavor to flavor_id in LB API

This matches neutron-lbaas. This was never actually used, so changing it
should not be an issue hopefully.

Change-Id: If5dfcb291e7fa5c406ea99905f61673786823c8b
This commit is contained in:
Adam Harwell 2018-04-19 16:15:01 -07:00
parent 97c0eab918
commit 86da7a86a1
11 changed files with 23 additions and 23 deletions

View File

@ -1 +1 @@
curl -X POST -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"loadbalancer": {"description": "My favorite load balancer", "admin_state_up": true, "project_id": "e3cd678b11784734bc366148aa37580e", "flavor": "a7ae5d5a-d855-4f9a-b187-af66b53f4d04", "vip_subnet_id": "d4af86e1-0051-488c-b7a0-527f97490c9a", "vip_address": "203.0.113.50", "provider": "octavia", "name": "best_load_balancer", "vip_qos_policy_id": "ec4f78ca-8da8-4e99-8a1a-e3b94595a7a3"}}' http://198.51.100.10:9876/v2.0/lbaas/loadbalancers curl -X POST -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"loadbalancer": {"description": "My favorite load balancer", "admin_state_up": true, "project_id": "e3cd678b11784734bc366148aa37580e", "flavor_id": "a7ae5d5a-d855-4f9a-b187-af66b53f4d04", "vip_subnet_id": "d4af86e1-0051-488c-b7a0-527f97490c9a", "vip_address": "203.0.113.50", "provider": "octavia", "name": "best_load_balancer", "vip_qos_policy_id": "ec4f78ca-8da8-4e99-8a1a-e3b94595a7a3"}}' http://198.51.100.10:9876/v2.0/lbaas/loadbalancers

View File

@ -4,7 +4,7 @@
"admin_state_up": true, "admin_state_up": true,
"project_id": "e3cd678b11784734bc366148aa37580e", "project_id": "e3cd678b11784734bc366148aa37580e",
"provisioning_status": "PENDING_CREATE", "provisioning_status": "PENDING_CREATE",
"flavor": "", "flavor_id": "",
"vip_subnet_id": "d4af86e1-0051-488c-b7a0-527f97490c9a", "vip_subnet_id": "d4af86e1-0051-488c-b7a0-527f97490c9a",
"vip_address": "203.0.113.50", "vip_address": "203.0.113.50",
"vip_network_id": "d0d217df-3958-4fbf-a3c2-8dad2908c709", "vip_network_id": "d0d217df-3958-4fbf-a3c2-8dad2908c709",

View File

@ -3,7 +3,7 @@
"description": "My favorite load balancer", "description": "My favorite load balancer",
"admin_state_up": true, "admin_state_up": true,
"project_id": "e3cd678b11784734bc366148aa37580e", "project_id": "e3cd678b11784734bc366148aa37580e",
"flavor": "", "flavor_id": "",
"listeners": [ "listeners": [
{ {
"name": "http_listener", "name": "http_listener",

View File

@ -4,7 +4,7 @@
"admin_state_up": true, "admin_state_up": true,
"project_id": "e3cd678b11784734bc366148aa37580e", "project_id": "e3cd678b11784734bc366148aa37580e",
"provisioning_status": "ACTIVE", "provisioning_status": "ACTIVE",
"flavor": "", "flavor_id": "",
"vip_subnet_id": "d4af86e1-0051-488c-b7a0-527f97490c9a", "vip_subnet_id": "d4af86e1-0051-488c-b7a0-527f97490c9a",
"listeners": [ "listeners": [
{ {

View File

@ -4,7 +4,7 @@
"admin_state_up": true, "admin_state_up": true,
"project_id": "e3cd678b11784734bc366148aa37580e", "project_id": "e3cd678b11784734bc366148aa37580e",
"provisioning_status": "PENDING_CREATE", "provisioning_status": "PENDING_CREATE",
"flavor": "", "flavor_id": "",
"vip_subnet_id": "d4af86e1-0051-488c-b7a0-527f97490c9a", "vip_subnet_id": "d4af86e1-0051-488c-b7a0-527f97490c9a",
"vip_address": "203.0.113.50", "vip_address": "203.0.113.50",
"vip_network_id": "d0d217df-3958-4fbf-a3c2-8dad2908c709", "vip_network_id": "d0d217df-3958-4fbf-a3c2-8dad2908c709",

View File

@ -4,7 +4,7 @@
"admin_state_up": false, "admin_state_up": false,
"project_id": "e3cd678b11784734bc366148aa37580e", "project_id": "e3cd678b11784734bc366148aa37580e",
"provisioning_status": "PENDING_UPDATE", "provisioning_status": "PENDING_UPDATE",
"flavor": "", "flavor_id": "",
"vip_subnet_id": "d4af86e1-0051-488c-b7a0-527f97490c9a", "vip_subnet_id": "d4af86e1-0051-488c-b7a0-527f97490c9a",
"vip_address": "203.0.113.50", "vip_address": "203.0.113.50",
"vip_network_id": "d0d217df-3958-4fbf-a3c2-8dad2908c709", "vip_network_id": "d0d217df-3958-4fbf-a3c2-8dad2908c709",

View File

@ -5,7 +5,7 @@
"admin_state_up": true, "admin_state_up": true,
"project_id": "e3cd678b11784734bc366148aa37580e", "project_id": "e3cd678b11784734bc366148aa37580e",
"provisioning_status": "ACTIVE", "provisioning_status": "ACTIVE",
"flavor": "a7ae5d5a-d855-4f9a-b187-af66b53f4d04", "flavor_id": "",
"vip_subnet_id": "d4af86e1-0051-488c-b7a0-527f97490c9a", "vip_subnet_id": "d4af86e1-0051-488c-b7a0-527f97490c9a",
"listeners": [ "listeners": [
{ {

View File

@ -48,7 +48,7 @@ Response Parameters
- admin_state_up: admin_state_up - admin_state_up: admin_state_up
- created_at: created_at - created_at: created_at
- description: description - description: description
- flavor: flavor-id - flavor_id: flavor-id
- id: loadbalancer-id - id: loadbalancer-id
- listeners: listeners - listeners: listeners
- loadbalancers: loadbalancers - loadbalancers: loadbalancers
@ -102,7 +102,7 @@ and submit the request again.
Administrative users can specify a project ID that is different than Administrative users can specify a project ID that is different than
their own to create load balancers for other projects. their own to create load balancers for other projects.
An optional ``flavor`` attribute can be used to create the load balancer An optional ``flavor_id`` attribute can be used to create the load balancer
using a pre-configured octavia flavor. Flavors are created by the operator using a pre-configured octavia flavor. Flavors are created by the operator
to allow custom load balancer configurations, such as allocating more to allow custom load balancer configurations, such as allocating more
memory for the load balancer. memory for the load balancer.
@ -115,7 +115,7 @@ You can also specify the ``provider`` attribute when you create a
load balancer. The ``provider`` attribute specifies which backend should load balancer. The ``provider`` attribute specifies which backend should
be used to create the load balancer. This could be the default provider be used to create the load balancer. This could be the default provider
(``octavia``) or a vendor supplied ``provider`` if one has been installed. (``octavia``) or a vendor supplied ``provider`` if one has been installed.
Setting both a flavor and a provider will result in a conflict error. Setting both a flavor_id and a provider will result in a conflict error.
Specifying a Virtual IP (VIP) is mandatory. There are three ways to specify Specifying a Virtual IP (VIP) is mandatory. There are three ways to specify
a VIP network for the load balancer: a VIP network for the load balancer:
@ -162,7 +162,7 @@ Request
- admin_state_up: admin_state_up-default-optional - admin_state_up: admin_state_up-default-optional
- description: description-optional - description: description-optional
- flavor: flavor-id-optional - flavor_id: flavor-id-optional
- listeners: listeners-optional - listeners: listeners-optional
- loadbalancer: loadbalancer - loadbalancer: loadbalancer
- name: name-optional - name: name-optional
@ -194,7 +194,7 @@ Response Parameters
- admin_state_up: admin_state_up - admin_state_up: admin_state_up
- created_at: created_at - created_at: created_at
- description: description - description: description
- flavor: flavor-id - flavor_id: flavor-id
- id: loadbalancer-id - id: loadbalancer-id
- listeners: listeners - listeners: listeners
- loadbalancer: loadbalancer - loadbalancer: loadbalancer
@ -286,7 +286,7 @@ Response Parameters
- admin_state_up: admin_state_up - admin_state_up: admin_state_up
- created_at: created_at - created_at: created_at
- description: description - description: description
- flavor: flavor-id - flavor_id: flavor-id
- id: loadbalancer-id - id: loadbalancer-id
- loadbalancer: loadbalancer - loadbalancer: loadbalancer
- listeners: listeners - listeners: listeners
@ -370,7 +370,7 @@ Response Parameters
- admin_state_up: admin_state_up - admin_state_up: admin_state_up
- created_at: created_at - created_at: created_at
- description: description - description: description
- flavor: flavor-id - flavor_id: flavor-id
- id: loadbalancer-id - id: loadbalancer-id
- listeners: listeners - listeners: listeners
- loadbalancer: loadbalancer - loadbalancer: loadbalancer

View File

@ -274,8 +274,8 @@ class LoadBalancersController(base.BaseController):
# Remove these lines as they are implemented. # Remove these lines as they are implemented.
if 'provider' in lb_dict: if 'provider' in lb_dict:
del lb_dict['provider'] del lb_dict['provider']
if 'flavor' in lb_dict: if 'flavor_id' in lb_dict:
del lb_dict['flavor'] del lb_dict['flavor_id']
db_lb = self.repositories.create_load_balancer_and_vip( db_lb = self.repositories.create_load_balancer_and_vip(
lock_session, lb_dict, vip_dict) lock_session, lb_dict, vip_dict)

View File

@ -52,7 +52,7 @@ class LoadBalancerResponse(BaseLoadBalancerType):
listeners = wtypes.wsattr([types.IdOnlyType]) listeners = wtypes.wsattr([types.IdOnlyType])
pools = wtypes.wsattr([types.IdOnlyType]) pools = wtypes.wsattr([types.IdOnlyType])
provider = wtypes.wsattr(wtypes.StringType()) provider = wtypes.wsattr(wtypes.StringType())
flavor = wtypes.wsattr(wtypes.StringType()) flavor_id = wtypes.wsattr(wtypes.StringType())
vip_qos_policy_id = wtypes.wsattr(wtypes.UuidType()) vip_qos_policy_id = wtypes.wsattr(wtypes.UuidType())
@classmethod @classmethod
@ -76,8 +76,8 @@ class LoadBalancerResponse(BaseLoadBalancerType):
result.pools = [ result.pools = [
pool_model.from_data_model(i) for i in data_model.pools] pool_model.from_data_model(i) for i in data_model.pools]
if not result.flavor: if not result.flavor_id:
result.flavor = "" result.flavor_id = ""
if not result.provider: if not result.provider:
result.provider = "octavia" result.provider = "octavia"
@ -125,7 +125,7 @@ class LoadBalancerPOST(BaseLoadBalancerType):
provider = wtypes.wsattr(wtypes.Enum(str, *constants.SUPPORTED_PROVIDERS)) provider = wtypes.wsattr(wtypes.Enum(str, *constants.SUPPORTED_PROVIDERS))
# TODO(johnsom) This should be dynamic based on the loaded flavors # TODO(johnsom) This should be dynamic based on the loaded flavors
# once flavors are implemented. # once flavors are implemented.
flavor = wtypes.wsattr(wtypes.Enum(str, *constants.SUPPORTED_FLAVORS)) flavor_id = wtypes.wsattr(wtypes.Enum(str, *constants.SUPPORTED_FLAVORS))
class LoadBalancerRootPOST(types.BaseType): class LoadBalancerRootPOST(types.BaseType):

View File

@ -797,12 +797,12 @@ class TestLoadBalancer(base.BaseAPITest):
lb_json = {'name': 'test1', lb_json = {'name': 'test1',
'vip_subnet_id': uuidutils.generate_uuid(), 'vip_subnet_id': uuidutils.generate_uuid(),
'project_id': self.project_id, 'project_id': self.project_id,
'flavor': 'BOGUS' 'flavor_id': 'BOGUS'
} }
lb_json.update(optionals) lb_json.update(optionals)
body = self._build_body(lb_json) body = self._build_body(lb_json)
response = self.post(self.LBS_PATH, body, status=400) response = self.post(self.LBS_PATH, body, status=400)
self.assertIn("Invalid input for field/attribute flavor. Value: " self.assertIn("Invalid input for field/attribute flavor_id. Value: "
"'BOGUS'. Value should be one of:", "'BOGUS'. Value should be one of:",
response.json.get('faultstring')) response.json.get('faultstring'))
@ -1948,7 +1948,7 @@ class TestLoadBalancerGraph(base.BaseAPITest):
# expected that this would be overwritten anyway, so 'ANY' is fine? # expected that this would be overwritten anyway, so 'ANY' is fine?
'vip_network_id': mock.ANY, 'vip_network_id': mock.ANY,
'vip_qos_policy_id': None, 'vip_qos_policy_id': None,
'flavor': '', 'flavor_id': '',
'provider': 'octavia' 'provider': 'octavia'
} }
expected_lb.update(create_lb) expected_lb.update(create_lb)