Tags support for lb resources

Add tags support for all lb related resources. It includes:
load balancer, listener, member, pool, L7rule, L7policy
and health-monitor

Change-Id: Ib33a002b3b59820db29897454e9d4303c73310b2
Story: 2003890
Task: 26757
This commit is contained in:
wangxiyuan 2018-09-28 16:50:57 +08:00 committed by Nir Magnezi
parent ac6342ef2a
commit d62189366c
97 changed files with 646 additions and 159 deletions

View File

@ -1082,6 +1082,18 @@ subnet_id-optional:
in: body
required: false
type: uuid
tags:
description: |
A list of simple strings assigned to the resource.
in: body
required: true
type: list
tags-optional:
description: |
A list of simple strings assigned to the resource.
in: body
required: false
type: list
timeout_client_data:
description: |
Frontend client inactivity timeout in milliseconds. Default: 50000.

View File

@ -1 +1 @@
curl -X POST -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"healthmonitor":{"name":"super-pool-health-monitor","admin_state_up":true,"pool_id":"4029d267-3983-4224-a3d0-afb3fe16a2cd","delay":"10","expected_codes":"200","max_retries":"1","http_method":"GET","timeout":"5","url_path":"/","type":"HTTP","max_retries_down":3}}' http://198.51.100.10:9876/v2/lbaas/healthmonitors
curl -X POST -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"healthmonitor":{"name":"super-pool-health-monitor","admin_state_up":true,"pool_id":"4029d267-3983-4224-a3d0-afb3fe16a2cd","delay":"10","expected_codes":"200","max_retries":"1","http_method":"GET","timeout":"5","url_path":"/","type":"HTTP","max_retries_down":3,"tags":["test_tag"]}}' http://198.51.100.10:9876/v2/lbaas/healthmonitors

View File

@ -10,6 +10,7 @@
"timeout": "5",
"url_path": "/",
"type": "HTTP",
"max_retries_down": 3
"max_retries_down": 3,
"tags": ["test_tag"]
}
}

View File

@ -20,6 +20,7 @@
"url_path": "/",
"type": "HTTP",
"id": "8ed3c5ac-6efa-420c-bedb-99ba14e58db5",
"operating_status": "ONLINE"
"operating_status": "ONLINE",
"tags": ["test_tag"]
}
}

View File

@ -20,6 +20,7 @@
"url_path": "/",
"type": "HTTP",
"id": "8ed3c5ac-6efa-420c-bedb-99ba14e58db5",
"operating_status": "ONLINE"
"operating_status": "ONLINE",
"tags": ["test_tag"]
}
}

View File

@ -1 +1 @@
curl -X PUT -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"healthmonitor":{"name":"super-pool-health-monitor-updated","admin_state_up":true,"delay":5,"expected_codes":"200","http_method":"HEAD","timeout":2,"url_path":"/index.html","max_retries":2,"max_retries_down":2}}' http://198.51.100.10:9876/v2/lbaas/healthmonitors/8ed3c5ac-6efa-420c-bedb-99ba14e58db5
curl -X PUT -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"healthmonitor":{"name":"super-pool-health-monitor-updated","admin_state_up":true,"delay":5,"expected_codes":"200","http_method":"HEAD","timeout":2,"url_path":"/index.html","max_retries":2,"max_retries_down":2,"tags":["updated_tag"]}}' http://198.51.100.10:9876/v2/lbaas/healthmonitors/8ed3c5ac-6efa-420c-bedb-99ba14e58db5

View File

@ -8,6 +8,7 @@
"timeout": 2,
"url_path": "/index.html",
"max_retries": 2,
"max_retries_down": 2
"max_retries_down": 2,
"tags": ["updated_tag"]
}
}

View File

@ -20,6 +20,7 @@
"url_path": "/index.html",
"type": "HTTP",
"id": "8ed3c5ac-6efa-420c-bedb-99ba14e58db5",
"operating_status": "ONLINE"
"operating_status": "ONLINE",
"tags": ["updated_tag"]
}
}

View File

@ -21,7 +21,8 @@
"url_path": "/",
"type": "HTTP",
"id": "8ed3c5ac-6efa-420c-bedb-99ba14e58db5",
"operating_status": "ONLINE"
"operating_status": "ONLINE",
"tags": ["test_tag"]
}
]
}

View File

@ -20,7 +20,8 @@
"project_id": "e3cd678b11784734bc366148aa37580e",
"id": "8a1412f0-4c32-4257-8b07-af4770b604fd",
"operating_status": "ONLINE",
"name": "redirect-example.com"
"name": "redirect-example.com",
"tags": ["test_tag"]
}
]
}

View File

@ -1 +1 @@
curl -X POST -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"l7policy":{"description":"Redirect requests to example.com","admin_state_up":true,"listener_id":"023f2e34-7806-443b-bfae-16c324569a3d","redirect_url":"http://www.example.com","name":"redirect-example.com","action":"REDIRECT_TO_URL","position":1}}' http://198.51.100.10:9876/v2/lbaas/l7policies
curl -X POST -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"l7policy":{"description":"Redirect requests to example.com","admin_state_up":true,"listener_id":"023f2e34-7806-443b-bfae-16c324569a3d","redirect_url":"http://www.example.com","name":"redirect-example.com","action":"REDIRECT_TO_URL","position":1,"tags":["test_tag"]}}' http://198.51.100.10:9876/v2/lbaas/l7policies

View File

@ -6,6 +6,7 @@
"redirect_url": "http://www.example.com",
"name": "redirect-example.com",
"action": "REDIRECT_TO_URL",
"position": 1
"position": 1,
"tags": ["test_tag"]
}
}

View File

@ -20,7 +20,8 @@
"project_id": "e3cd678b11784734bc366148aa37580e",
"id": "8a1412f0-4c32-4257-8b07-af4770b604fd",
"operating_status": "OFFLINE",
"name": "redirect-example.com"
"name": "redirect-example.com",
"tags": ["test_tag"]
}
]
}

View File

@ -20,6 +20,7 @@
"project_id": "e3cd678b11784734bc366148aa37580e",
"id": "8a1412f0-4c32-4257-8b07-af4770b604fd",
"operating_status": "ONLINE",
"name": "redirect-example.com"
"name": "redirect-example.com",
"tags": ["test_tag"]
}
}

View File

@ -1 +1 @@
curl -X PUT -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"l7policy":{"description":"Redirect requests to images.example.com","admin_state_up":true,"redirect_url":"http://images.example.com","name":"redirect-images.example.com","action":"REDIRECT_TO_URL","position":1}}' http://198.51.100.10:9876/v2/lbaas/l7policies/8a1412f0-4c32-4257-8b07-af4770b604fd
curl -X PUT -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"l7policy":{"description":"Redirect requests to images.example.com","admin_state_up":true,"redirect_url":"http://images.example.com","name":"redirect-images.example.com","action":"REDIRECT_TO_URL","position":1,"tags":["updated_tag"]}}' http://198.51.100.10:9876/v2/lbaas/l7policies/8a1412f0-4c32-4257-8b07-af4770b604fd

View File

@ -5,6 +5,7 @@
"redirect_url": "http://images.example.com",
"name": "redirect-images.example.com",
"action": "REDIRECT_TO_URL",
"position": 1
"position": 1,
"tags": ["updated_tag"]
}
}

View File

@ -20,6 +20,7 @@
"project_id": "e3cd678b11784734bc366148aa37580e",
"id": "8a1412f0-4c32-4257-8b07-af4770b604fd",
"operating_status": "ONLINE",
"name": "redirect-example.com"
"name": "redirect-example.com",
"tags": ["updated_tag"]
}
}

View File

@ -1 +1 @@
curl -X POST -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"rule":{"compare_type":"REGEX","invert":false,"type":"PATH","value":"/images*","admin_state_up":true}}' http://198.51.100.10:9876/v2/lbaas/l7policies/8a1412f0-4c32-4257-8b07-af4770b604fd/rules
curl -X POST -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"rule":{"compare_type":"REGEX","invert":false,"type":"PATH","value":"/images*","admin_state_up":true,"tags":["test_tag"]}}' http://198.51.100.10:9876/v2/lbaas/l7policies/8a1412f0-4c32-4257-8b07-af4770b604fd/rules

View File

@ -4,6 +4,7 @@
"invert": false,
"type": "PATH",
"value": "/images*",
"admin_state_up": true
"admin_state_up": true,
"tags": ["test_tag"]
}
}

View File

@ -12,6 +12,7 @@
"project_id": "e3cd678b11784734bc366148aa37580e",
"type": "PATH",
"id": "16621dbb-a736-4888-a57a-3ecd53df784c",
"operating_status": "OFFLINE"
"operating_status": "OFFLINE",
"tags": ["test_tag"]
}
}

View File

@ -12,6 +12,7 @@
"project_id": "e3cd678b11784734bc366148aa37580e",
"type": "PATH",
"id": "16621dbb-a736-4888-a57a-3ecd53df784c",
"operating_status": "ONLINE"
"operating_status": "ONLINE",
"tags": ["test_tag"]
}
}

View File

@ -1 +1 @@
curl -X PUT -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"rule":{"compare_type":"REGEX","invert":true,"type":"PATH","value":"/images/special*","admin_state_up":true}}' http://198.51.100.10:9876/v2/lbaas/l7policies/8a1412f0-4c32-4257-8b07-af4770b604fd/rules/16621dbb-a736-4888-a57a-3ecd53df784c
curl -X PUT -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"rule":{"compare_type":"REGEX","invert":true,"type":"PATH","value":"/images/special*","admin_state_up":true,"tags":["updated_tag"]}}' http://198.51.100.10:9876/v2/lbaas/l7policies/8a1412f0-4c32-4257-8b07-af4770b604fd/rules/16621dbb-a736-4888-a57a-3ecd53df784c

View File

@ -4,6 +4,7 @@
"invert": true,
"type": "PATH",
"value": "/images/special*",
"admin_state_up": true
"admin_state_up": true,
"tags": ["updated_tag"]
}
}

View File

@ -12,6 +12,7 @@
"project_id": "e3cd678b11784734bc366148aa37580e",
"type": "PATH",
"id": "16621dbb-a736-4888-a57a-3ecd53df784c",
"operating_status": "ONLINE"
"operating_status": "ONLINE",
"tags": ["updated_tag"]
}
}

View File

@ -12,7 +12,8 @@
"project_id": "e3cd678b11784734bc366148aa37580e",
"type": "PATH",
"id": "16621dbb-a736-4888-a57a-3ecd53df784c",
"operating_status": "ONLINE"
"operating_status": "ONLINE",
"tags": ["test_tag"]
}
]
}

View File

@ -1 +1 @@
curl -X POST -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"listener": {"protocol": "TERMINATED_HTTPS", "description": "A great TLS listener", "admin_state_up": true, "connection_limit": 200, "protocol_port": "443", "loadbalancer_id": "607226db-27ef-4d41-ae89-f2a800e9c2db", "name": "great_tls_listener", "insert_headers": {"X-Forwarded-For": "true", "X-Forwarded-Port": "true"}, "default_tls_container_ref": "http://198.51.100.10:9311/v1/containers/a570068c-d295-4780-91d4-3046a325db51", "sni_container_refs": ["http://198.51.100.10:9311/v1/containers/a570068c-d295-4780-91d4-3046a325db51", "http://198.51.100.10:9311/v1/containers/aaebb31e-7761-4826-8cb4-2b829caca3ee"], "timeout_client_data": 50000, "timeout_member_connect": 5000, "timeout_member_data": 50000, "timeout_tcp_inspect": 0}}' http://198.51.100.10:9876/v2/lbaas/listeners
curl -X POST -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"listener": {"protocol": "TERMINATED_HTTPS", "description": "A great TLS listener", "admin_state_up": true, "connection_limit": 200, "protocol_port": "443", "loadbalancer_id": "607226db-27ef-4d41-ae89-f2a800e9c2db", "name": "great_tls_listener", "insert_headers": {"X-Forwarded-For": "true", "X-Forwarded-Port": "true"}, "default_tls_container_ref": "http://198.51.100.10:9311/v1/containers/a570068c-d295-4780-91d4-3046a325db51", "sni_container_refs": ["http://198.51.100.10:9311/v1/containers/a570068c-d295-4780-91d4-3046a325db51", "http://198.51.100.10:9311/v1/containers/aaebb31e-7761-4826-8cb4-2b829caca3ee"], "timeout_client_data": 50000, "timeout_member_connect": 5000, "timeout_member_data": 50000, "timeout_tcp_inspect": 0, "tags": ["test_tag"]}}' http://198.51.100.10:9876/v2/lbaas/listeners

View File

@ -19,6 +19,7 @@
"timeout_client_data": 50000,
"timeout_member_connect": 5000,
"timeout_member_data": 50000,
"timeout_tcp_inspect": 0
"timeout_tcp_inspect": 0,
"tags": ["test_tag"]
}
}

View File

@ -34,6 +34,7 @@
"timeout_client_data": 50000,
"timeout_member_connect": 5000,
"timeout_member_data": 50000,
"timeout_tcp_inspect": 0
"timeout_tcp_inspect": 0,
"tags": ["test_tag"]
}
}

View File

@ -34,6 +34,7 @@
"timeout_client_data": 50000,
"timeout_member_connect": 5000,
"timeout_member_data": 50000,
"timeout_tcp_inspect": 0
"timeout_tcp_inspect": 0,
"tags": ["test_tag"]
}
}

View File

@ -1 +1 @@
curl -X PUT -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"listener": {"description": "An updated great TLS listener", "admin_state_up": true, "connection_limit": 200, "name": "great_updated_tls_listener", "insert_headers": {"X-Forwarded-For": "false", "X-Forwarded-Port": "true"}, "default_tls_container_ref": "http://198.51.100.10:9311/v1/containers/a570068c-d295-4780-91d4-3046a325db51", "sni_container_refs": ["http://198.51.100.10:9311/v1/containers/a570068c-d295-4780-91d4-3046a325db51", "http://198.51.100.10:9311/v1/containers/aaebb31e-7761-4826-8cb4-2b829caca3ee"], "timeout_client_data": 100000, "timeout_member_connect": 1000, "timeout_member_data": 100000, "timeout_tcp_inspect": 5}}' http://198.51.100.10:9876/v2/lbaas/listeners/023f2e34-7806-443b-bfae-16c324569a3d
curl -X PUT -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"listener": {"description": "An updated great TLS listener", "admin_state_up": true, "connection_limit": 200, "name": "great_updated_tls_listener", "insert_headers": {"X-Forwarded-For": "false", "X-Forwarded-Port": "true"}, "default_tls_container_ref": "http://198.51.100.10:9311/v1/containers/a570068c-d295-4780-91d4-3046a325db51", "sni_container_refs": ["http://198.51.100.10:9311/v1/containers/a570068c-d295-4780-91d4-3046a325db51", "http://198.51.100.10:9311/v1/containers/aaebb31e-7761-4826-8cb4-2b829caca3ee"], "timeout_client_data": 100000, "timeout_member_connect": 1000, "timeout_member_data": 100000, "timeout_tcp_inspect": 5, "tags": ["updated_tag"]}}' http://198.51.100.10:9876/v2/lbaas/listeners/023f2e34-7806-443b-bfae-16c324569a3d

View File

@ -17,6 +17,7 @@
"timeout_client_data": 100000,
"timeout_member_connect": 1000,
"timeout_member_data": 100000,
"timeout_tcp_inspect": 5
"timeout_tcp_inspect": 5,
"tags": ["updated_tag"]
}
}

View File

@ -34,6 +34,7 @@
"timeout_client_data": 100000,
"timeout_member_connect": 1000,
"timeout_member_data": 100000,
"timeout_tcp_inspect": 5
"timeout_tcp_inspect": 5,
"tags": ["updated_tag"]
}
}

View File

@ -36,7 +36,8 @@
"timeout_client_data": 50000,
"timeout_member_connect": 5000,
"timeout_member_data": 50000,
"timeout_tcp_inspect": 0
"timeout_tcp_inspect": 0,
"tags": ["test_tag"]
}
]
}

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_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/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", "tags": ["test_tag"]}}' http://198.51.100.10:9876/v2/lbaas/loadbalancers

View File

@ -7,6 +7,7 @@
"vip_address": "203.0.113.50",
"provider": "octavia",
"name": "best_load_balancer",
"vip_qos_policy_id": "ec4f78ca-8da8-4e99-8a1a-e3b94595a7a3"
"vip_qos_policy_id": "ec4f78ca-8da8-4e99-8a1a-e3b94595a7a3",
"tags": ["test_tag"]
}
}

View File

@ -15,6 +15,7 @@
"id": "607226db-27ef-4d41-ae89-f2a800e9c2db",
"operating_status": "OFFLINE",
"name": "best_load_balancer",
"vip_qos_policy_id": "ec4f78ca-8da8-4e99-8a1a-e3b94595a7a3"
"vip_qos_policy_id": "ec4f78ca-8da8-4e99-8a1a-e3b94595a7a3",
"tags": ["test_tag"]
}
}

View File

@ -40,7 +40,8 @@
"protocol_port": 443,
"default_pool": {
"name": "https_pool"
}
},
"tags": ["test_tag"]
},
{
"name": "redirect_listener",
@ -83,6 +84,7 @@
"vip_address": "203.0.113.50",
"provider": "octavia",
"name": "best_load_balancer",
"vip_qos_policy_id": "ec4f78ca-8da8-4e99-8a1a-e3b94595a7a3"
"vip_qos_policy_id": "ec4f78ca-8da8-4e99-8a1a-e3b94595a7a3",
"tags": ["test_tag"]
}
}

View File

@ -39,7 +39,8 @@
"sni_container_refs": [],
"protocol_port": 443,
"id": "73c6c564-f215-48e9-91d6-f10bb3454954",
"name": "https_listener"
"name": "https_listener",
"tags": ["test_tag"]
},
{
"l7policies": [
@ -173,6 +174,7 @@
"id": "607226db-27ef-4d41-ae89-f2a800e9c2db",
"operating_status": "ONLINE",
"name": "best_load_balancer",
"vip_qos_policy_id": "ec4f78ca-8da8-4e99-8a1a-e3b94595a7a3"
"vip_qos_policy_id": "ec4f78ca-8da8-4e99-8a1a-e3b94595a7a3",
"tags": ["test_tag"]
}
}

View File

@ -15,6 +15,7 @@
"id": "8a562351-f0fb-424c-a0af-513461424ea5",
"operating_status": "ONLINE",
"name": "best_load_balancer",
"vip_qos_policy_id": "ec4f78ca-8da8-4e99-8a1a-e3b94595a7a3"
"vip_qos_policy_id": "ec4f78ca-8da8-4e99-8a1a-e3b94595a7a3",
"tags": []
}
}

View File

@ -1 +1 @@
curl -X PUT -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"loadbalancer": {"description": "Temporarily disabled load balancer", "admin_state_up": false, "name": "disabled_load_balancer", "vip_qos_policy_id": "ec4f78ca-8da8-4e99-8a1a-e3b94595a7a3"}}' http://198.51.100.10:9876/v2/lbaas/loadbalancers/8b6fc468-07d5-4d8b-a0b9-695060e72c31
curl -X PUT -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"loadbalancer": {"description": "Temporarily disabled load balancer", "admin_state_up": false, "name": "disabled_load_balancer", "vip_qos_policy_id": "ec4f78ca-8da8-4e99-8a1a-e3b94595a7a3", "tags": ["updated_tag"]}}' http://198.51.100.10:9876/v2/lbaas/loadbalancers/8b6fc468-07d5-4d8b-a0b9-695060e72c31

View File

@ -3,6 +3,7 @@
"description": "Temporarily disabled load balancer",
"admin_state_up": false,
"name": "disabled_load_balancer",
"vip_qos_policy_id": "ec4f78ca-8da8-4e99-8a1a-e3b94595a7a3"
"vip_qos_policy_id": "ec4f78ca-8da8-4e99-8a1a-e3b94595a7a3",
"tags": ["updated_tag"]
}
}

View File

@ -15,6 +15,7 @@
"id": "8b6fc468-07d5-4d8b-a0b9-695060e72c31",
"operating_status": "ONLINE",
"name": "disabled_load_balancer",
"vip_qos_policy_id": "ec4f78ca-8da8-4e99-8a1a-e3b94595a7a3"
"vip_qos_policy_id": "ec4f78ca-8da8-4e99-8a1a-e3b94595a7a3",
"tags": ["updated_tag"]
}
}

View File

@ -26,7 +26,8 @@
"id": "607226db-27ef-4d41-ae89-f2a800e9c2db",
"operating_status": "ONLINE",
"name": "best_load_balancer",
"vip_qos_policy_id": "ec4f78ca-8da8-4e99-8a1a-e3b94595a7a3"
"vip_qos_policy_id": "ec4f78ca-8da8-4e99-8a1a-e3b94595a7a3",
"tags": []
}
]
}

View File

@ -1 +1 @@
curl -X PUT -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"members":[{"name":"web-server-1","weight":"20","admin_state_up":true,"subnet_id":"bbb35f84-35cc-4b2f-84c2-a6a29bba68aa","address":"192.0.2.16","protocol_port":"80","monitor_port":8080},{"name":"web-server-2","weight":"10","admin_state_up":true,"subnet_id":"bbb35f84-35cc-4b2f-84c2-a6a29bba68aa","address":"192.0.2.17","protocol_port":"80","monitor_port":8080}]}' http://198.51.100.10:9876/v2/lbaas/pools/4029d267-3983-4224-a3d0-afb3fe16a2cd/members
curl -X PUT -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"members":[{"name":"web-server-1","weight":"20","admin_state_up":true,"subnet_id":"bbb35f84-35cc-4b2f-84c2-a6a29bba68aa","address":"192.0.2.16","protocol_port":"80","monitor_port":8080,"tags":["updated_tag"]},{"name":"web-server-2","weight":"10","admin_state_up":true,"subnet_id":"bbb35f84-35cc-4b2f-84c2-a6a29bba68aa","address":"192.0.2.17","protocol_port":"80","monitor_port":8080,"tags":["updated_tag"]}]}' http://198.51.100.10:9876/v2/lbaas/pools/4029d267-3983-4224-a3d0-afb3fe16a2cd/members

View File

@ -7,7 +7,8 @@
"subnet_id": "bbb35f84-35cc-4b2f-84c2-a6a29bba68aa",
"address": "192.0.2.16",
"protocol_port": 80,
"monitor_port": 8080
"monitor_port": 8080,
"tags": ["updated_tag"]
},
{
"name": "web-server-2",
@ -16,7 +17,8 @@
"subnet_id": "bbb35f84-35cc-4b2f-84c2-a6a29bba68aa",
"address": "192.0.2.17",
"protocol_port": 80,
"monitor_port": 8080
"monitor_port": 8080,
"tags": ["updated_tag"]
}
]
}

View File

@ -1 +1 @@
curl -X POST -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"member":{"name":"web-server-1","weight":"20","admin_state_up":true,"subnet_id":"bbb35f84-35cc-4b2f-84c2-a6a29bba68aa","address":"192.0.2.16","protocol_port":"80","monitor_port":8080,"backup":false}}' http://198.51.100.10:9876/v2/lbaas/pools/4029d267-3983-4224-a3d0-afb3fe16a2cd/members
curl -X POST -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"member":{"name":"web-server-1","weight":"20","admin_state_up":true,"subnet_id":"bbb35f84-35cc-4b2f-84c2-a6a29bba68aa","address":"192.0.2.16","protocol_port":"80","monitor_port":8080,"backup":false,"tags":["test_tag"]}}' http://198.51.100.10:9876/v2/lbaas/pools/4029d267-3983-4224-a3d0-afb3fe16a2cd/members

View File

@ -7,6 +7,7 @@
"address": "192.0.2.16",
"protocol_port": "80",
"monitor_port": 8080,
"backup": false
"backup": false,
"tags": ["test_tag"]
}
}

View File

@ -14,6 +14,7 @@
"address": "192.0.2.16",
"protocol_port": 80,
"id": "957a1ace-1bd2-449b-8455-820b6e4b63f3",
"operating_status": "NO_MONITOR"
"operating_status": "NO_MONITOR",
"tags": ["test_tag"]
}
}

View File

@ -14,6 +14,7 @@
"address": "192.0.2.16",
"protocol_port": 80,
"id": "957a1ace-1bd2-449b-8455-820b6e4b63f3",
"operating_status": "NO_MONITOR"
"operating_status": "NO_MONITOR",
"tags": ["test_tag"]
}
}

View File

@ -1 +1 @@
curl -X PUT -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"member":{"name":"web-server-1-2","weight":"0","admin_state_up":"true","monitor_address":"192.0.2.40","monitor_port":8888,"backup":false}}' http://198.51.100.10:9876/v2/lbaas/pools/4029d267-3983-4224-a3d0-afb3fe16a2cd/members/957a1ace-1bd2-449b-8455-820b6e4b63f3
curl -X PUT -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"member":{"name":"web-server-1-2","weight":"0","admin_state_up":"true","monitor_address":"192.0.2.40","monitor_port":8888,"backup":false,"tags":["updated_tag"]}}' http://198.51.100.10:9876/v2/lbaas/pools/4029d267-3983-4224-a3d0-afb3fe16a2cd/members/957a1ace-1bd2-449b-8455-820b6e4b63f3

View File

@ -5,6 +5,7 @@
"admin_state_up": "true",
"monitor_address": "192.0.2.40",
"monitor_port": 8888,
"backup": false
"backup": false,
"tags": ["updated_tag"]
}
}

View File

@ -14,6 +14,7 @@
"address": "192.0.2.16",
"protocol_port": 80,
"id": "957a1ace-1bd2-449b-8455-820b6e4b63f3",
"operating_status": "NO_MONITOR"
"operating_status": "NO_MONITOR",
"tags": ["updated_tag"]
}
}

View File

@ -15,7 +15,8 @@
"address": "192.0.2.16",
"protocol_port": 80,
"id": "957a1ace-1bd2-449b-8455-820b6e4b63f3",
"operating_status": "NO_MONITOR"
"operating_status": "NO_MONITOR",
"tags": ["test_tag"]
}
]
}

View File

@ -1 +1 @@
curl -X POST -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"pool":{"lb_algorithm":"ROUND_ROBIN","protocol":"HTTP","description":"Super Round Robin Pool","admin_state_up":true,"session_persistence":{"cookie_name":"ChocolateChip","type":"APP_COOKIE"},"listener_id":"023f2e34-7806-443b-bfae-16c324569a3d","name":"super-pool"}}' http://198.51.100.10:9876/v2/lbaas/pools
curl -X POST -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"pool":{"lb_algorithm":"ROUND_ROBIN","protocol":"HTTP","description":"Super Round Robin Pool","admin_state_up":true,"session_persistence":{"cookie_name":"ChocolateChip","type":"APP_COOKIE"},"listener_id":"023f2e34-7806-443b-bfae-16c324569a3d","name":"super-pool","tags":["test_tag"]}}' http://198.51.100.10:9876/v2/lbaas/pools

View File

@ -9,6 +9,7 @@
"type": "APP_COOKIE"
},
"listener_id": "023f2e34-7806-443b-bfae-16c324569a3d",
"name": "super-pool"
"name": "super-pool",
"tags": ["test_tag"]
}
}

View File

@ -26,6 +26,7 @@
"project_id": "e3cd678b11784734bc366148aa37580e",
"id": "4029d267-3983-4224-a3d0-afb3fe16a2cd",
"operating_status": "ONLINE",
"name": "super-pool"
"name": "super-pool",
"tags": ["test_tag"]
}
}

View File

@ -26,6 +26,7 @@
"project_id": "e3cd678b11784734bc366148aa37580e",
"id": "4029d267-3983-4224-a3d0-afb3fe16a2cd",
"operating_status": "ONLINE",
"name": "super-pool"
"name": "super-pool",
"tags": ["test_tag"]
}
}

View File

@ -1 +1 @@
curl -X PUT -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"pool":{"lb_algorithm":"LEAST_CONNECTIONS","session_persistence":{"type":"SOURCE_IP"},"description":"second description","name":"second_name"}}' http://198.51.100.10:9876/v2/lbaas/pools/4029d267-3983-4224-a3d0-afb3fe16a2cd
curl -X PUT -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d '{"pool":{"lb_algorithm":"LEAST_CONNECTIONS","session_persistence":{"type":"SOURCE_IP"},"description":"second description","name":"second_name","tags":["updated_tag"]}}' http://198.51.100.10:9876/v2/lbaas/pools/4029d267-3983-4224-a3d0-afb3fe16a2cd

View File

@ -5,6 +5,7 @@
"type": "SOURCE_IP"
},
"description": "Super Least Connections Pool",
"name": "super-least-conn-pool"
"name": "super-least-conn-pool",
"tags": ["updated_tag"]
}
}

View File

@ -26,6 +26,7 @@
"project_id": "e3cd678b11784734bc366148aa37580e",
"id": "4029d267-3983-4224-a3d0-afb3fe16a2cd",
"operating_status": "ONLINE",
"name": "super-least-conn-pool"
"name": "super-least-conn-pool",
"tags": ["updated_tag"]
}
}

View File

@ -32,7 +32,8 @@
"project_id": "e3cd678b11784734bc366148aa37580e",
"id": "ddb2b28f-89e9-45d3-a329-a359c3e39e4a",
"operating_status": "ONLINE",
"name": "round_robin_pool"
"name": "round_robin_pool",
"tags": ["test_tag"]
}
]
}

View File

@ -58,6 +58,7 @@ Response Parameters
- pool_id: pool-id
- project_id: project_id
- provisioning_status: provisioning_status
- tags: tags
- timeout: healthmonitor-timeout
- type: healthmonitor-type
- updated_at: updated_at
@ -161,6 +162,7 @@ Request
- max_retries_down: healthmonitor-max-retries-down-optional
- pool_id: pool-id
- project_id: project_id-optional-deprecated
- tags: tags-optional
- timeout: healthmonitor-timeout
- type: healthmonitor-type
- url_path: healthmonitor-url_path-optional
@ -195,6 +197,7 @@ Response Parameters
- pool_id: pool-id
- project_id: project_id
- provisioning_status: provisioning_status
- tags: tags
- timeout: healthmonitor-timeout
- type: healthmonitor-type
- updated_at: updated_at
@ -262,6 +265,7 @@ Response Parameters
- pool_id: pool-id
- project_id: project_id
- provisioning_status: provisioning_status
- tags: tags
- timeout: healthmonitor-timeout
- type: healthmonitor-type
- updated_at: updated_at
@ -314,6 +318,7 @@ Request
- max_retries: healthmonitor-max-retries-optional
- max_retries_down: healthmonitor-max-retries-down-optional
- name: name-optional
- tags: tags-optional
- timeout: healthmonitor-timeout-optional
- url_path: healthmonitor-url_path-optional
@ -347,6 +352,7 @@ Response Parameters
- pool_id: pool-id
- project_id: project_id
- provisioning_status: provisioning_status
- tags: tags
- timeout: healthmonitor-timeout
- type: healthmonitor-type
- updated_at: updated_at

View File

@ -60,6 +60,7 @@ Response Parameters
- redirect_prefix: l7policy-redirect-prefix
- redirect_url: l7policy-redirect-url
- rules: l7policy-rule-ids
- tags: tags
- updated_at: updated_at
Response Example
@ -142,6 +143,7 @@ Request
- redirect_pool_id: l7policy-redirect-pool_id-optional
- redirect_prefix: l7policy-redirect-prefix-optional
- redirect_url: l7policy-redirect-url-optional
- tags: tags-optional
Request Example
----------------
@ -175,6 +177,7 @@ Response Parameters
- redirect_prefix: l7policy-redirect-prefix
- redirect_url: l7policy-redirect-url
- rules: l7policy-rule-ids
- tags: tags
- updated_at: updated_at
Response Example
@ -241,6 +244,7 @@ Response Parameters
- redirect_prefix: l7policy-redirect-prefix
- redirect_url: l7policy-redirect-url
- rules: l7policy-rule-ids
- tags: tags
- updated_at: updated_at
@ -296,6 +300,7 @@ Request
- redirect_pool_id: l7policy-redirect-pool_id-optional
- redirect_prefix: l7policy-redirect-prefix-optional
- redirect_url: l7policy-redirect-url-optional
- tags: tags-optional
Request Example
---------------
@ -329,6 +334,7 @@ Response Parameters
- redirect_prefix: l7policy-redirect-prefix
- redirect_url: l7policy-redirect-url
- rules: l7policy-rule-ids
- tags: tags
- updated_at: updated_at
Response Example

View File

@ -55,6 +55,7 @@ Response Parameters
- operating_status: operating_status
- project_id: project_id
- provisioning_status: provisioning_status
- tags: tags
- type: l7rule-type
- updated_at: updated_at
- value: l7rule-value
@ -124,6 +125,7 @@ Request
- key: l7rule-key-optional
- l7policy_id: path-l7policy-id
- project_id: project_id-optional
- tags: tags-optional
- type: l7rule-type
- value: l7rule-value
@ -153,6 +155,7 @@ Response Parameters
- operating_status: operating_status
- project_id: project_id
- provisioning_status: provisioning_status
- tags: tags
- type: l7rule-type
- updated_at: updated_at
- value: l7rule-value
@ -216,6 +219,7 @@ Response Parameters
- operating_status: operating_status
- project_id: project_id
- provisioning_status: provisioning_status
- tags: tags
- type: l7rule-type
- updated_at: updated_at
- value: l7rule-value
@ -266,6 +270,7 @@ Request
- key: l7rule-key-optional
- l7policy_id: path-l7policy-id
- l7rule_id: path-l7rule-id
- tags: tags-optional
- type: l7rule-type-optional
- value: l7rule-value-optional
@ -295,6 +300,7 @@ Response Parameters
- operating_status: operating_status
- project_id: project_id
- provisioning_status: provisioning_status
- tags: tags
- type: l7rule-type
- updated_at: updated_at
- value: l7rule-value

View File

@ -63,6 +63,7 @@ Response Parameters
- protocol_port: protocol_port
- provisioning_status: provisioning_status
- sni_container_refs: sni_container_refs
- tags: tags
- timeout_client_data: timeout_client_data
- timeout_member_connect: timeout_member_connect
- timeout_member_data: timeout_member_data
@ -149,6 +150,7 @@ Request
- protocol: protocol
- protocol_port: protocol_port
- sni_container_refs: sni_container_refs-optional
- tags: tags-optional
- timeout_client_data: timeout_client_data-optional
- timeout_member_connect: timeout_member_connect-optional
- timeout_member_data: timeout_member_data-optional
@ -219,6 +221,7 @@ Response Parameters
- protocol_port: protocol_port
- provisioning_status: provisioning_status
- sni_container_refs: sni_container_refs
- tags: tags
- timeout_client_data: timeout_client_data
- timeout_member_connect: timeout_member_connect
- timeout_member_data: timeout_member_data
@ -292,6 +295,7 @@ Response Parameters
- protocol_port: protocol_port
- provisioning_status: provisioning_status
- sni_container_refs: sni_container_refs
- tags: tags
- timeout_client_data: timeout_client_data
- timeout_member_connect: timeout_member_connect
- timeout_member_data: timeout_member_data
@ -346,6 +350,7 @@ Request
- listener_id: path-listener-id
- name: name-optional
- sni_container_refs: sni_container_refs-optional
- tags: tags-optional
- timeout_client_data: timeout_client_data-optional
- timeout_member_connect: timeout_member_connect-optional
- timeout_member_data: timeout_member_data-optional
@ -386,6 +391,7 @@ Response Parameters
- protocol_port: protocol_port
- provisioning_status: provisioning_status
- sni_container_refs: sni_container_refs
- tags: tags
- timeout_client_data: timeout_client_data
- timeout_member_connect: timeout_member_connect
- timeout_member_data: timeout_member_data

View File

@ -58,6 +58,7 @@ Response Parameters
- project_id: project_id
- provider: provider
- provisioning_status: provisioning_status
- tags: tags
- updated_at: updated_at
- vip_address: vip_address
- vip_network_id: vip_network_id
@ -168,6 +169,7 @@ Request
- name: name-optional
- project_id: project_id-optional
- provider: provider-optional
- tags: tags-optional
- vip_address: vip_address-optional
- vip_network_id: vip_network_id-optional
- vip_port_id: vip_port_id-optional
@ -204,6 +206,7 @@ Response Parameters
- project_id: project_id
- provider: provider
- provisioning_status: provisioning_status
- tags: tags
- updated_at: updated_at
- vip_address: vip_address
- vip_network_id: vip_network_id
@ -296,6 +299,7 @@ Response Parameters
- project_id: project_id
- provider: provider
- provisioning_status: provisioning_status
- tags: tags
- updated_at: updated_at
- vip_address: vip_address
- vip_network_id: vip_network_id
@ -348,6 +352,7 @@ Request
- loadbalancer: loadbalancer
- loadbalancer_id: path-loadbalancer-id
- name: name-optional
- tags: tags-optional
- vip_qos_policy_id: vip_qos_policy_id-optional
Request Example
@ -380,6 +385,7 @@ Response Parameters
- project_id: project_id
- provider: provider
- provisioning_status: provisioning_status
- tags: tags
- updated_at: updated_at
- vip_address: vip_address
- vip_network_id: vip_network_id

View File

@ -59,6 +59,7 @@ Response Parameters
- protocol_port: protocol_port-member
- provisioning_status: provisioning_status
- subnet_id: subnet_id
- tags: tags
- updated_at: updated_at
- weight: weight
@ -156,6 +157,7 @@ Request
- project_id: project_id-optional-deprecated
- protocol_port: protocol_port
- subnet_id: subnet_id-optional
- tags: tags-optional
- weight: weight-optional
Request Example
@ -188,6 +190,7 @@ Response Parameters
- protocol_port: protocol_port-member
- provisioning_status: provisioning_status
- subnet_id: subnet_id
- tags: tags
- updated_at: updated_at
- weight: weight
@ -254,6 +257,7 @@ Response Parameters
- protocol_port: protocol_port-member
- provisioning_status: provisioning_status
- subnet_id: subnet_id
- tags: tags
- updated_at: updated_at
- weight: weight
@ -307,6 +311,7 @@ Request
- monitor_port: monitor_port-optional
- name: name-optional
- pool_id: path-pool-id
- tags: tags-optional
- weight: weight-optional
Request Example
@ -339,6 +344,7 @@ Response Parameters
- protocol_port: protocol_port-member
- provisioning_status: provisioning_status
- subnet_id: subnet_id
- tags: tags
- updated_at: updated_at
- weight: weight
@ -401,6 +407,7 @@ Request
- project_id: project_id-optional-deprecated
- protocol_port: protocol_port
- subnet_id: subnet_id-optional
- tags: tags-optional
- weight: weight-optional
Request Example

View File

@ -60,6 +60,7 @@ Response Parameters
- protocol: protocol-pools
- provisioning_status: provisioning_status
- session_persistence: session_persistence
- tags: tags
- updated_at: updated_at
Response Example
@ -167,6 +168,7 @@ Request
- project_id: project_id-optional-deprecated
- protocol: protocol-pools
- session_persistence: session_persistence-optional
- tags: tags-optional
.. _session_persistence:
@ -243,6 +245,7 @@ Response Parameters
- protocol: protocol-pools
- provisioning_status: provisioning_status
- session_persistence: session_persistence
- tags: tags
- updated_at: updated_at
Response Example
@ -309,6 +312,7 @@ Response Parameters
- protocol: protocol-pools
- provisioning_status: provisioning_status
- session_persistence: session_persistence
- tags: tags
- updated_at: updated_at
Response Example
@ -356,6 +360,7 @@ Request
- name: name-optional
- pool_id: path-pool-id
- session_persistence: session_persistence-optional
- tags: tags-optional
Request Example
---------------
@ -389,6 +394,7 @@ Response Parameters
- protocol: protocol-pools
- provisioning_status: provisioning_status
- session_persistence: session_persistence
- tags: tags
- updated_at: updated_at
Response Example

View File

@ -86,6 +86,8 @@ def _base_to_provider_dict(current_dict, include_project_id=False):
del new_dict['project_id']
if 'tenant_id' in new_dict:
del new_dict['tenant_id']
if 'tags' in new_dict:
del new_dict['tags']
return new_dict

View File

@ -44,6 +44,7 @@ class HealthMonitorResponse(BaseHealthMonitorType):
operating_status = wtypes.wsattr(wtypes.StringType())
created_at = wtypes.wsattr(wtypes.datetime.datetime)
updated_at = wtypes.wsattr(wtypes.datetime.datetime)
tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType()))
@classmethod
def from_data_model(cls, data_model, children=False):
@ -98,6 +99,7 @@ class HealthMonitorPOST(BaseHealthMonitorType):
# TODO(johnsom) Remove after deprecation (R series)
project_id = wtypes.wsattr(wtypes.StringType(max_length=36))
pool_id = wtypes.wsattr(wtypes.UuidType(), mandatory=True)
tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(max_length=255)))
class HealthMonitorRootPOST(types.BaseType):
@ -121,6 +123,7 @@ class HealthMonitorPUT(BaseHealthMonitorType):
expected_codes = wtypes.wsattr(
wtypes.StringType(pattern=r'^(\d{3}(\s*,\s*\d{3})*)$|^(\d{3}-\d{3})$'))
admin_state_up = wtypes.wsattr(bool)
tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(max_length=255)))
class HealthMonitorRootPUT(types.BaseType):
@ -148,6 +151,7 @@ class HealthMonitorSingleCreate(BaseHealthMonitorType):
expected_codes = wtypes.wsattr(
wtypes.StringType(pattern=r'^(\d{3}(\s*,\s*\d{3})*)$|^(\d{3}-\d{3})$'))
admin_state_up = wtypes.wsattr(bool, default=True)
tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(max_length=255)))
class HealthMonitorStatusResponse(BaseHealthMonitorType):

View File

@ -43,6 +43,7 @@ class L7PolicyResponse(BaseL7PolicyType):
rules = wtypes.wsattr([types.IdOnlyType])
created_at = wtypes.wsattr(wtypes.datetime.datetime)
updated_at = wtypes.wsattr(wtypes.datetime.datetime)
tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType()))
@classmethod
def from_data_model(cls, data_model, children=False):
@ -94,6 +95,7 @@ class L7PolicyPOST(BaseL7PolicyType):
default=constants.MAX_POLICY_POSITION)
listener_id = wtypes.wsattr(wtypes.UuidType(), mandatory=True)
rules = wtypes.wsattr([l7rule.L7RuleSingleCreate])
tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(max_length=255)))
class L7PolicyRootPOST(types.BaseType):
@ -113,6 +115,7 @@ class L7PolicyPUT(BaseL7PolicyType):
position = wtypes.wsattr(wtypes.IntegerType(
minimum=constants.MIN_POLICY_POSITION,
maximum=constants.MAX_POLICY_POSITION))
tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(max_length=255)))
class L7PolicyRootPUT(types.BaseType):
@ -135,3 +138,4 @@ class L7PolicySingleCreate(BaseL7PolicyType):
maximum=constants.MAX_POLICY_POSITION),
default=constants.MAX_POLICY_POSITION)
rules = wtypes.wsattr([l7rule.L7RuleSingleCreate])
tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(max_length=255)))

View File

@ -37,6 +37,7 @@ class L7RuleResponse(BaseL7Type):
updated_at = wtypes.wsattr(wtypes.datetime.datetime)
project_id = wtypes.wsattr(wtypes.StringType())
admin_state_up = wtypes.wsattr(bool)
tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType()))
@classmethod
def from_data_model(cls, data_model, children=False):
@ -74,6 +75,7 @@ class L7RulePOST(BaseL7Type):
admin_state_up = wtypes.wsattr(bool, default=True)
# TODO(johnsom) Remove after deprecation (R series)
project_id = wtypes.wsattr(wtypes.StringType(max_length=36))
tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(max_length=255)))
class L7RuleRootPOST(types.BaseType):
@ -92,6 +94,7 @@ class L7RulePUT(BaseL7Type):
value = wtypes.wsattr(wtypes.StringType(max_length=255))
invert = wtypes.wsattr(bool)
admin_state_up = wtypes.wsattr(bool)
tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(max_length=255)))
class L7RuleRootPUT(types.BaseType):
@ -110,3 +113,4 @@ class L7RuleSingleCreate(BaseL7Type):
value = wtypes.wsattr(wtypes.StringType(max_length=255), mandatory=True)
invert = wtypes.wsattr(bool, default=False)
admin_state_up = wtypes.wsattr(bool, default=True)
tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(max_length=255)))

View File

@ -54,6 +54,7 @@ class ListenerResponse(BaseListenerType):
timeout_member_connect = wtypes.wsattr(wtypes.IntegerType())
timeout_member_data = wtypes.wsattr(wtypes.IntegerType())
timeout_tcp_inspect = wtypes.wsattr(wtypes.IntegerType())
tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType()))
@classmethod
def from_data_model(cls, data_model, children=False):
@ -133,6 +134,7 @@ class ListenerPOST(BaseListenerType):
wtypes.IntegerType(minimum=constants.MIN_TIMEOUT,
maximum=constants.MAX_TIMEOUT),
default=CONF.haproxy_amphora.timeout_tcp_inspect)
tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(max_length=255)))
class ListenerRootPOST(types.BaseType):
@ -164,6 +166,7 @@ class ListenerPUT(BaseListenerType):
timeout_tcp_inspect = wtypes.wsattr(
wtypes.IntegerType(minimum=constants.MIN_TIMEOUT,
maximum=constants.MAX_TIMEOUT))
tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(max_length=255)))
class ListenerRootPUT(types.BaseType):
@ -206,6 +209,7 @@ class ListenerSingleCreate(BaseListenerType):
wtypes.IntegerType(minimum=constants.MIN_TIMEOUT,
maximum=constants.MAX_TIMEOUT),
default=CONF.haproxy_amphora.timeout_tcp_inspect)
tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(max_length=255)))
class ListenerStatusResponse(BaseListenerType):

View File

@ -55,6 +55,7 @@ class LoadBalancerResponse(BaseLoadBalancerType):
provider = wtypes.wsattr(wtypes.StringType())
flavor_id = wtypes.wsattr(wtypes.StringType())
vip_qos_policy_id = wtypes.wsattr(wtypes.UuidType())
tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType()))
@classmethod
def from_data_model(cls, data_model, children=False):
@ -125,6 +126,7 @@ class LoadBalancerPOST(BaseLoadBalancerType):
# TODO(johnsom) This should be dynamic based on the loaded flavors
# once flavors are implemented.
flavor_id = wtypes.wsattr(wtypes.Enum(str, *constants.SUPPORTED_FLAVORS))
tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(max_length=255)))
class LoadBalancerRootPOST(types.BaseType):
@ -138,6 +140,7 @@ class LoadBalancerPUT(BaseLoadBalancerType):
description = wtypes.wsattr(wtypes.StringType(max_length=255))
vip_qos_policy_id = wtypes.wsattr(wtypes.UuidType())
admin_state_up = wtypes.wsattr(bool)
tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(max_length=255)))
class LoadBalancerRootPUT(types.BaseType):

View File

@ -41,6 +41,7 @@ class MemberResponse(BaseMemberType):
updated_at = wtypes.wsattr(wtypes.datetime.datetime)
monitor_address = wtypes.wsattr(types.IPAddressType())
monitor_port = wtypes.wsattr(wtypes.IntegerType())
tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType()))
@classmethod
def from_data_model(cls, data_model, children=False):
@ -82,6 +83,7 @@ class MemberPOST(BaseMemberType):
minimum=constants.MIN_PORT_NUMBER, maximum=constants.MAX_PORT_NUMBER),
default=None)
monitor_address = wtypes.wsattr(types.IPAddressType(), default=None)
tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(max_length=255)))
class MemberRootPOST(types.BaseType):
@ -98,6 +100,7 @@ class MemberPUT(BaseMemberType):
monitor_port = wtypes.wsattr(wtypes.IntegerType(
minimum=constants.MIN_PORT_NUMBER, maximum=constants.MAX_PORT_NUMBER))
monitor_address = wtypes.wsattr(types.IPAddressType())
tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(max_length=255)))
class MemberRootPUT(types.BaseType):
@ -123,6 +126,7 @@ class MemberSingleCreate(BaseMemberType):
monitor_port = wtypes.wsattr(wtypes.IntegerType(
minimum=constants.MIN_PORT_NUMBER, maximum=constants.MAX_PORT_NUMBER))
monitor_address = wtypes.wsattr(types.IPAddressType())
tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(max_length=255)))
class MemberStatusResponse(BaseMemberType):

View File

@ -75,6 +75,7 @@ class PoolResponse(BasePoolType):
updated_at = wtypes.wsattr(wtypes.datetime.datetime)
healthmonitor_id = wtypes.wsattr(wtypes.UuidType())
members = wtypes.wsattr([types.IdOnlyType])
tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType()))
@classmethod
def from_data_model(cls, data_model, children=False):
@ -145,6 +146,7 @@ class PoolPOST(BasePoolType):
project_id = wtypes.wsattr(wtypes.StringType(max_length=36))
healthmonitor = wtypes.wsattr(health_monitor.HealthMonitorSingleCreate)
members = wtypes.wsattr([member.MemberSingleCreate])
tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(max_length=255)))
class PoolRootPOST(types.BaseType):
@ -159,6 +161,7 @@ class PoolPUT(BasePoolType):
lb_algorithm = wtypes.wsattr(
wtypes.Enum(str, *constants.SUPPORTED_LB_ALGORITHMS))
session_persistence = wtypes.wsattr(SessionPersistencePUT)
tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(max_length=255)))
class PoolRootPut(types.BaseType):
@ -176,6 +179,7 @@ class PoolSingleCreate(BasePoolType):
session_persistence = wtypes.wsattr(SessionPersistencePOST)
healthmonitor = wtypes.wsattr(health_monitor.HealthMonitorSingleCreate)
members = wtypes.wsattr([member.MemberSingleCreate])
tags = wtypes.wsattr(wtypes.ArrayType(wtypes.StringType(max_length=255)))
class PoolStatusResponse(BasePoolType):

View File

@ -31,6 +31,10 @@ class BaseDataModel(object):
if attr.startswith('_') or not kwargs.get(attr, True):
continue
value = self.__dict__[attr]
if attr == 'tags':
# tags is a list, it doesn't need recurse
ret[attr] = value
continue
if recurse:
if isinstance(getattr(self, attr), list):
@ -225,7 +229,7 @@ class HealthMonitor(BaseDataModel):
rise_threshold=None, http_method=None, url_path=None,
expected_codes=None, enabled=None, pool=None, name=None,
provisioning_status=None, operating_status=None,
created_at=None, updated_at=None):
created_at=None, updated_at=None, tags=None):
self.id = id
self.project_id = project_id
self.pool_id = pool_id
@ -244,6 +248,7 @@ class HealthMonitor(BaseDataModel):
self.name = name
self.created_at = created_at
self.updated_at = updated_at
self.tags = tags
def delete(self):
self.pool.health_monitor = None
@ -255,7 +260,8 @@ class Pool(BaseDataModel):
operating_status=None, members=None, health_monitor=None,
session_persistence=None, load_balancer_id=None,
load_balancer=None, listeners=None, l7policies=None,
created_at=None, updated_at=None, provisioning_status=None):
created_at=None, updated_at=None, provisioning_status=None,
tags=None):
self.id = id
self.project_id = project_id
self.name = name
@ -274,6 +280,7 @@ class Pool(BaseDataModel):
self.created_at = created_at
self.updated_at = updated_at
self.provisioning_status = provisioning_status
self.tags = tags
def update(self, update_dict):
for key, value in update_dict.items():
@ -319,7 +326,8 @@ class Member(BaseDataModel):
protocol_port=None, weight=None, backup=None, enabled=None,
subnet_id=None, operating_status=None, pool=None,
created_at=None, updated_at=None, provisioning_status=None,
name=None, monitor_address=None, monitor_port=None):
name=None, monitor_address=None, monitor_port=None,
tags=None):
self.id = id
self.project_id = project_id
self.pool_id = pool_id
@ -337,6 +345,7 @@ class Member(BaseDataModel):
self.name = name
self.monitor_address = monitor_address
self.monitor_port = monitor_port
self.tags = tags
def delete(self):
for mem in self.pool.members:
@ -356,7 +365,8 @@ class Listener(BaseDataModel):
l7policies=None, pools=None, insert_headers=None,
created_at=None, updated_at=None,
timeout_client_data=None, timeout_member_connect=None,
timeout_member_data=None, timeout_tcp_inspect=None):
timeout_member_data=None, timeout_tcp_inspect=None,
tags=None):
self.id = id
self.project_id = project_id
self.name = name
@ -384,6 +394,7 @@ class Listener(BaseDataModel):
self.timeout_member_connect = timeout_member_connect
self.timeout_member_data = timeout_member_data
self.timeout_tcp_inspect = timeout_tcp_inspect
self.tags = tags
def update(self, update_dict):
for key, value in update_dict.items():
@ -424,7 +435,7 @@ class LoadBalancer(BaseDataModel):
provisioning_status=None, operating_status=None, enabled=None,
topology=None, vip=None, listeners=None, amphorae=None,
pools=None, vrrp_group=None, server_group_id=None,
created_at=None, updated_at=None, provider=None):
created_at=None, updated_at=None, provider=None, tags=None):
self.id = id
self.project_id = project_id
@ -443,6 +454,7 @@ class LoadBalancer(BaseDataModel):
self.created_at = created_at
self.updated_at = updated_at
self.provider = provider
self.tags = tags or []
def update(self, update_dict):
for key, value in update_dict.items():
@ -557,7 +569,7 @@ class L7Rule(BaseDataModel):
def __init__(self, id=None, l7policy_id=None, type=None, enabled=None,
compare_type=None, key=None, value=None, l7policy=None,
invert=False, provisioning_status=None, operating_status=None,
project_id=None, created_at=None, updated_at=None):
project_id=None, created_at=None, updated_at=None, tags=None):
self.id = id
self.l7policy_id = l7policy_id
self.type = type
@ -572,6 +584,7 @@ class L7Rule(BaseDataModel):
self.created_at = created_at
self.updated_at = updated_at
self.enabled = enabled
self.tags = tags
def delete(self):
if len(self.l7policy.l7rules) == 1:
@ -592,7 +605,7 @@ class L7Policy(BaseDataModel):
position=None, listener=None, redirect_pool=None,
enabled=None, l7rules=None, provisioning_status=None,
operating_status=None, project_id=None, created_at=None,
updated_at=None, redirect_prefix=None):
updated_at=None, redirect_prefix=None, tags=None):
self.id = id
self.name = name
self.description = description
@ -611,6 +624,7 @@ class L7Policy(BaseDataModel):
self.created_at = created_at
self.updated_at = updated_at
self.redirect_prefix = redirect_prefix
self.tags = tags
def _conditionally_remove_pool_links(self, pool):
"""Removes links to the given pool from parent objects.

View File

@ -151,4 +151,35 @@ class NameMixin(object):
name = sa.Column(sa.String(255), nullable=True)
class TagMixin(object):
"""Tags mixin to add to classes which need tags.
The class must realize the specified db relationship as well.
"""
@property
def tags(self):
if self._tags:
return [each_tag.tag for each_tag in self._tags]
return []
@tags.setter
def tags(self, values):
new_tags = []
if values:
for tag in values:
tag_ref = Tags()
tag_ref.resource_id = self.id
tag_ref.tag = tag
new_tags.append(tag_ref)
self._tags = new_tags
BASE = declarative.declarative_base(cls=OctaviaBase)
class Tags(BASE):
__tablename__ = "tags"
resource_id = sa.Column(sa.String(36), primary_key=True)
tag = sa.Column(sa.String(255), primary_key=True, index=True)

View File

@ -0,0 +1,37 @@
# Copyright 2018 Huawei
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""tags_support
Revision ID: 80dba23a159f
Revises: 55874a4ceed6
Create Date: 2018-10-15 15:29:27.258640
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '80dba23a159f'
down_revision = '55874a4ceed6'
def upgrade():
op.create_table(
u'tags',
sa.Column(u'resource_id', sa.String(36), primary_key=True,
nullable=False),
sa.Column(u'tag', sa.String(255), primary_key=True, nullable=False,
index=True),
)

View File

@ -169,7 +169,8 @@ class ListenerStatistics(base_models.BASE):
class Member(base_models.BASE, base_models.IdMixin, base_models.ProjectMixin,
models.TimestampMixin, base_models.NameMixin):
models.TimestampMixin, base_models.NameMixin,
base_models.TagMixin):
__data_model__ = data_models.Member
@ -206,10 +207,18 @@ class Member(base_models.BASE, base_models.IdMixin, base_models.ProjectMixin,
enabled = sa.Column(sa.Boolean(), nullable=False)
pool = orm.relationship("Pool", back_populates="members")
_tags = orm.relationship(
'Tags',
single_parent=True,
lazy='subquery',
cascade='all,delete-orphan',
primaryjoin='and_(foreign(Tags.resource_id)==Member.id)'
)
class HealthMonitor(base_models.BASE, base_models.IdMixin,
base_models.ProjectMixin, models.TimestampMixin,
base_models.NameMixin):
base_models.NameMixin, base_models.TagMixin):
__data_model__ = data_models.HealthMonitor
@ -252,10 +261,17 @@ class HealthMonitor(base_models.BASE, base_models.IdMixin,
sa.ForeignKey("operating_status.name",
name="fk_health_monitor_operating_status_name"),
nullable=False)
_tags = orm.relationship(
'Tags',
single_parent=True,
lazy='subquery',
cascade='all,delete-orphan',
primaryjoin='and_(foreign(Tags.resource_id)==HealthMonitor.id)'
)
class Pool(base_models.BASE, base_models.IdMixin, base_models.ProjectMixin,
models.TimestampMixin, base_models.NameMixin):
models.TimestampMixin, base_models.NameMixin, base_models.TagMixin):
__data_model__ = data_models.Pool
@ -300,6 +316,13 @@ class Pool(base_models.BASE, base_models.IdMixin, base_models.ProjectMixin,
back_populates="default_pool")
l7policies = orm.relationship("L7Policy", uselist=True,
back_populates="redirect_pool")
_tags = orm.relationship(
'Tags',
single_parent=True,
lazy='subquery',
cascade='all,delete-orphan',
primaryjoin='and_(foreign(Tags.resource_id)==Pool.id)'
)
# This property should be a unique list of any listeners that reference
# this pool as its default_pool and any listeners referenced by enabled
@ -321,7 +344,7 @@ class Pool(base_models.BASE, base_models.IdMixin, base_models.ProjectMixin,
class LoadBalancer(base_models.BASE, base_models.IdMixin,
base_models.ProjectMixin, models.TimestampMixin,
base_models.NameMixin):
base_models.NameMixin, base_models.TagMixin):
__data_model__ = data_models.LoadBalancer
@ -355,6 +378,13 @@ class LoadBalancer(base_models.BASE, base_models.IdMixin,
back_populates="load_balancer")
listeners = orm.relationship('Listener', cascade='delete', uselist=True,
back_populates='load_balancer')
_tags = orm.relationship(
'Tags',
single_parent=True,
lazy='subquery',
cascade='all,delete-orphan',
primaryjoin='and_(foreign(Tags.resource_id)==LoadBalancer.id)'
)
class VRRPGroup(base_models.BASE):
@ -402,7 +432,7 @@ class Vip(base_models.BASE):
class Listener(base_models.BASE, base_models.IdMixin,
base_models.ProjectMixin, models.TimestampMixin,
base_models.NameMixin):
base_models.NameMixin, base_models.TagMixin):
__data_model__ = data_models.Listener
@ -462,6 +492,14 @@ class Listener(base_models.BASE, base_models.IdMixin,
timeout_member_data = sa.Column(sa.Integer, nullable=True)
timeout_tcp_inspect = sa.Column(sa.Integer, nullable=True)
_tags = orm.relationship(
'Tags',
single_parent=True,
lazy='subquery',
cascade='all,delete-orphan',
primaryjoin='and_(foreign(Tags.resource_id)==Listener.id)'
)
# This property should be a unique list of the default_pool and anything
# referenced by enabled L7Policies with at least one rule that also
# reference this listener. The intent is that listener.pools should be a
@ -552,7 +590,7 @@ class AmphoraHealth(base_models.BASE):
class L7Rule(base_models.BASE, base_models.IdMixin, base_models.ProjectMixin,
models.TimestampMixin):
models.TimestampMixin, base_models.TagMixin):
__data_model__ = data_models.L7Rule
@ -592,10 +630,18 @@ class L7Rule(base_models.BASE, base_models.IdMixin, base_models.ProjectMixin,
sa.ForeignKey("operating_status.name",
name="fk_l7rule_operating_status_name"),
nullable=False)
_tags = orm.relationship(
'Tags',
single_parent=True,
lazy='subquery',
cascade='all,delete-orphan',
primaryjoin='and_(foreign(Tags.resource_id)==L7Rule.id)'
)
class L7Policy(base_models.BASE, base_models.IdMixin, base_models.ProjectMixin,
models.TimestampMixin, base_models.NameMixin):
models.TimestampMixin, base_models.NameMixin,
base_models.TagMixin):
__data_model__ = data_models.L7Policy
@ -642,6 +688,13 @@ class L7Policy(base_models.BASE, base_models.IdMixin, base_models.ProjectMixin,
sa.ForeignKey("operating_status.name",
name="fk_l7policy_operating_status_name"),
nullable=False)
_tags = orm.relationship(
'Tags',
single_parent=True,
lazy='subquery',
cascade='all,delete-orphan',
primaryjoin='and_(foreign(Tags.resource_id)==L7Policy.id)'
)
class Quotas(base_models.BASE):

View File

@ -92,6 +92,10 @@ class BaseRepository(object):
:returns: octavia.common.data_model
"""
with session.begin(subtransactions=True):
tags = model_kwargs.pop('tags', None)
if tags:
resource = session.query(self.model_class).get(id)
resource.tags = tags
session.query(self.model_class).filter_by(
id=id).update(model_kwargs)
@ -697,6 +701,7 @@ class LoadBalancerRepository(BaseRepository):
subqueryload(models.LoadBalancer.amphorae),
subqueryload(models.LoadBalancer.pools),
subqueryload(models.LoadBalancer.listeners),
subqueryload(models.LoadBalancer._tags),
noload('*'))
return super(LoadBalancerRepository, self).get_all(
@ -817,6 +822,7 @@ class HealthMonitorRepository(BaseRepository):
# no-load (blank) the tables we don't need
query_options = (
subqueryload(models.HealthMonitor.pool),
subqueryload(models.HealthMonitor._tags),
noload('*'))
return super(HealthMonitorRepository, self).get_all(
@ -868,6 +874,7 @@ class PoolRepository(BaseRepository):
subqueryload(models.Pool.load_balancer),
subqueryload(models.Pool.members),
subqueryload(models.Pool.session_persistence),
subqueryload(models.Pool._tags),
noload('*'))
return super(PoolRepository, self).get_all(
@ -895,6 +902,7 @@ class MemberRepository(BaseRepository):
# no-load (blank) the tables we don't need
query_options = (
subqueryload(models.Member.pool),
subqueryload(models.Member._tags),
noload('*'))
return super(MemberRepository, self).get_all(
@ -940,6 +948,7 @@ class ListenerRepository(BaseRepository):
subqueryload(models.Listener.l7policies),
subqueryload(models.Listener.load_balancer),
subqueryload(models.Listener.sni_containers),
subqueryload(models.Listener._tags),
noload('*'))
return super(ListenerRepository, self).get_all(
@ -986,6 +995,10 @@ class ListenerRepository(BaseRepository):
def update(self, session, id, **model_kwargs):
with session.begin(subtransactions=True):
tags = model_kwargs.pop('tags', None)
if tags:
resource = session.query(self.model_class).get(id)
resource.tags = tags
listener_db = session.query(self.model_class).filter_by(
id=id).first()
# Verify any newly specified default_pool_id exists
@ -1461,6 +1474,7 @@ class L7RuleRepository(BaseRepository):
# no-load (blank) the tables we don't need
query_options = (
subqueryload(models.L7Rule.l7policy),
subqueryload(models.L7Rule._tags),
noload('*'))
return super(L7RuleRepository, self).get_all(
@ -1556,6 +1570,7 @@ class L7PolicyRepository(BaseRepository):
subqueryload(models.L7Policy.l7rules),
subqueryload(models.L7Policy.listener),
subqueryload(models.L7Policy.redirect_pool),
subqueryload(models.L7Policy._tags),
noload('*'))
if not deleted:

View File

@ -81,7 +81,7 @@ class TestHealthMonitor(base.BaseAPITest):
def test_get(self):
api_hm = self.create_health_monitor(
self.pool_id, constants.HEALTH_MONITOR_HTTP,
1, 1, 1, 1).get(self.root_tag)
1, 1, 1, 1, tags=['test_tag']).get(self.root_tag)
# Set status to ACTIVE/ONLINE because set_lb_status did it in the db
api_hm['provisioning_status'] = constants.ACTIVE
api_hm['operating_status'] = constants.ONLINE
@ -168,12 +168,13 @@ class TestHealthMonitor(base.BaseAPITest):
def test_get_all(self):
api_hm = self.create_health_monitor(
self.pool_id, constants.HEALTH_MONITOR_HTTP,
1, 1, 1, 1).get(self.root_tag)
1, 1, 1, 1, tags=['test_tag']).get(self.root_tag)
self.set_lb_status(self.lb_id)
hms = self.get(self.HMS_PATH).json.get(self.root_tag_list)
self.assertIsInstance(hms, list)
self.assertEqual(1, len(hms))
self.assertEqual(api_hm.get('id'), hms[0].get('id'))
self.assertEqual(api_hm['tags'], hms[0]['tags'])
def test_get_all_not_authorized(self):
self.create_health_monitor(
@ -1112,9 +1113,10 @@ class TestHealthMonitor(base.BaseAPITest):
def test_update(self):
api_hm = self.create_health_monitor(
self.pool_with_listener_id,
constants.HEALTH_MONITOR_HTTP, 1, 1, 1, 1).get(self.root_tag)
constants.HEALTH_MONITOR_HTTP, 1, 1, 1, 1,
tags=['old_tag']).get(self.root_tag)
self.set_lb_status(self.lb_id)
new_hm = {'max_retries': 2}
new_hm = {'max_retries': 2, 'tags': ['new_tag']}
self.put(
self.HM_PATH.format(healthmonitor_id=api_hm.get('id')),
self._build_body(new_hm))
@ -1128,6 +1130,7 @@ class TestHealthMonitor(base.BaseAPITest):
response = self.get(self.HM_PATH.format(
healthmonitor_id=api_hm.get('id'))).json.get(self.root_tag)
self.assertEqual(2, response[constants.MAX_RETRIES])
self.assertEqual(['new_tag'], response['tags'])
def test_update_HTTPS(self):
api_hm = self.create_health_monitor(

View File

@ -51,7 +51,8 @@ class TestL7Policy(base.BaseAPITest):
def test_get(self):
api_l7policy = self.create_l7policy(
self.listener_id,
constants.L7POLICY_ACTION_REJECT).get(self.root_tag)
constants.L7POLICY_ACTION_REJECT,
tags=['test_tag']).get(self.root_tag)
response = self.get(self.L7POLICY_PATH.format(
l7policy_id=api_l7policy.get('id'))).json.get(self.root_tag)
self.assertEqual(api_l7policy, response)
@ -120,12 +121,14 @@ class TestL7Policy(base.BaseAPITest):
def test_get_all(self):
api_l7policy = self.create_l7policy(self.listener_id,
constants.L7POLICY_ACTION_REJECT,
tags=['test_tag']
).get(self.root_tag)
self.set_lb_status(self.lb_id)
policies = self.get(self.L7POLICIES_PATH).json.get(self.root_tag_list)
self.assertIsInstance(policies, list)
self.assertEqual(1, len(policies))
self.assertEqual(api_l7policy.get('id'), policies[0].get('id'))
self.assertEqual(api_l7policy['tags'], policies[0]['tags'])
def test_get_all_admin(self):
project_id = uuidutils.generate_uuid()
@ -669,16 +672,19 @@ class TestL7Policy(base.BaseAPITest):
def test_update(self):
api_l7policy = self.create_l7policy(self.listener_id,
constants.L7POLICY_ACTION_REJECT,
tags=['old_tag']
).get(self.root_tag)
self.set_lb_status(self.lb_id)
new_l7policy = {
'action': constants.L7POLICY_ACTION_REDIRECT_TO_URL,
'redirect_url': 'http://www.example.com'}
'redirect_url': 'http://www.example.com',
'tags': ['new_tag']}
response = self.put(self.L7POLICY_PATH.format(
l7policy_id=api_l7policy.get('id')),
self._build_body(new_l7policy)).json.get(self.root_tag)
self.assertEqual(constants.L7POLICY_ACTION_REDIRECT_TO_URL,
response.get('action'))
self.assertEqual(['new_tag'], response['tags'])
self.assert_correct_status(
lb_id=self.lb_id, listener_id=self.listener_id,
l7policy_id=api_l7policy.get('id'),

View File

@ -51,7 +51,7 @@ class TestL7Rule(base.BaseAPITest):
l7rule = self.create_l7rule(
self.l7policy_id, constants.L7RULE_TYPE_PATH,
constants.L7RULE_COMPARE_TYPE_STARTS_WITH,
'/api').get(self.root_tag)
'/api', tags=['test_tag']).get(self.root_tag)
response = self.get(self.l7rule_path.format(
l7rule_id=l7rule.get('id'))).json.get(self.root_tag)
self.assertEqual(l7rule, response)
@ -128,20 +128,23 @@ class TestL7Rule(base.BaseAPITest):
api_l7r_a = self.create_l7rule(
self.l7policy_id, constants.L7RULE_TYPE_PATH,
constants.L7RULE_COMPARE_TYPE_STARTS_WITH,
'/api').get(self.root_tag)
'/api', tags=['test_tag1']).get(self.root_tag)
self.set_lb_status(self.lb_id)
api_l7r_b = self.create_l7rule(
self.l7policy_id, constants.L7RULE_TYPE_COOKIE,
constants.L7RULE_COMPARE_TYPE_CONTAINS, 'some-value',
key='some-cookie').get(self.root_tag)
key='some-cookie', tags=['test_tag2']).get(self.root_tag)
self.set_lb_status(self.lb_id)
rules = self.get(self.l7rules_path).json.get(self.root_tag_list)
self.assertIsInstance(rules, list)
self.assertEqual(2, len(rules))
rule_id_types = [(r.get('id'), r.get('type')) for r in rules]
self.assertIn((api_l7r_a.get('id'), api_l7r_a.get('type')),
rule_id_types = [(r.get('id'), r.get('type'),
r['tags']) for r in rules]
self.assertIn((api_l7r_a.get('id'), api_l7r_a.get('type'),
api_l7r_a['tags']),
rule_id_types)
self.assertIn((api_l7r_b.get('id'), api_l7r_b.get('type')),
self.assertIn((api_l7r_b.get('id'), api_l7r_b.get('type'),
api_l7r_b['tags']),
rule_id_types)
def test_get_all_authorized(self):
@ -594,13 +597,14 @@ class TestL7Rule(base.BaseAPITest):
api_l7rule = self.create_l7rule(
self.l7policy_id, constants.L7RULE_TYPE_PATH,
constants.L7RULE_COMPARE_TYPE_STARTS_WITH,
'/api').get(self.root_tag)
'/api', tags=['old_tag']).get(self.root_tag)
self.set_lb_status(self.lb_id)
new_l7rule = {'value': '/images'}
new_l7rule = {'value': '/images', 'tags': ['new_tag']}
response = self.put(self.l7rule_path.format(
l7rule_id=api_l7rule.get('id')),
self._build_body(new_l7rule)).json.get(self.root_tag)
self.assertEqual('/images', response.get('value'))
self.assertEqual(['new_tag'], response['tags'])
self.assert_correct_status(
lb_id=self.lb_id, listener_id=self.listener_id,
l7policy_id=self.l7policy_id, l7rule_id=api_l7rule.get('id'),

View File

@ -53,23 +53,30 @@ class TestListener(base.BaseAPITest):
lb1_id = lb1.get('loadbalancer').get('id')
self.set_lb_status(lb1_id)
listener1 = self.create_listener(
constants.PROTOCOL_HTTP, 80, lb1_id).get(self.root_tag)
constants.PROTOCOL_HTTP, 80, lb1_id,
tags=['test_tag1']).get(self.root_tag)
self.set_lb_status(lb1_id)
listener2 = self.create_listener(
constants.PROTOCOL_HTTP, 81, lb1_id).get(self.root_tag)
constants.PROTOCOL_HTTP, 81, lb1_id,
tags=['test_tag2']).get(self.root_tag)
self.set_lb_status(lb1_id)
listener3 = self.create_listener(
constants.PROTOCOL_HTTP, 82, lb1_id).get(self.root_tag)
constants.PROTOCOL_HTTP, 82, lb1_id,
tags=['test_tag3']).get(self.root_tag)
self.set_lb_status(lb1_id)
listeners = self.get(self.LISTENERS_PATH).json.get(self.root_tag_list)
self.assertEqual(3, len(listeners))
listener_id_ports = [(l.get('id'), l.get('protocol_port'))
listener_id_ports = [(l.get('id'), l.get('protocol_port'),
l.get('tags'))
for l in listeners]
self.assertIn((listener1.get('id'), listener1.get('protocol_port')),
self.assertIn((listener1.get('id'), listener1.get('protocol_port'),
listener1.get('tags')),
listener_id_ports)
self.assertIn((listener2.get('id'), listener2.get('protocol_port')),
self.assertIn((listener2.get('id'), listener2.get('protocol_port'),
listener2.get('tags')),
listener_id_ports)
self.assertIn((listener3.get('id'), listener3.get('protocol_port')),
self.assertIn((listener3.get('id'), listener3.get('protocol_port'),
listener3.get('tags')),
listener_id_ports)
def test_get_all_non_admin(self):
@ -385,6 +392,7 @@ class TestListener(base.BaseAPITest):
listener_id=listener['id']))
api_listener = response.json.get(self.root_tag)
self.assertEqual(listener, api_listener)
self.assertEqual([], api_listener['tags'])
def test_get_authorized(self):
listener = self.create_listener(
@ -466,7 +474,8 @@ class TestListener(base.BaseAPITest):
'sni_container_refs': [sni1, sni2],
'insert_headers': {},
'project_id': self.project_id,
'loadbalancer_id': self.lb_id}
'loadbalancer_id': self.lb_id,
'tags': ['test_tag']}
lb_listener.update(optionals)
body = self._build_body(lb_listener)
response = self.post(self.LISTENERS_PATH, body, status=response_status)
@ -488,6 +497,7 @@ class TestListener(base.BaseAPITest):
self.assertIn(sni, sni_ex)
self.assertIsNotNone(listener_api.pop('created_at'))
self.assertIsNone(listener_api.pop('updated_at'))
self.assertEqual(['test_tag'], listener_api['tags'])
self.assertNotEqual(lb_listener, listener_api)
self.assert_correct_lb_status(self.lb_id, constants.ONLINE,
constants.PENDING_UPDATE)
@ -860,14 +870,15 @@ class TestListener(base.BaseAPITest):
name='listener1', description='desc1',
admin_state_up=False, connection_limit=10,
default_tls_container_ref=tls_uuid,
default_pool_id=None).get(self.root_tag)
default_pool_id=None, tags=['old_tag']).get(self.root_tag)
self.set_lb_status(self.lb_id)
new_listener = {'name': 'listener2', 'admin_state_up': True,
'default_pool_id': self.pool_id,
'timeout_client_data': 1,
'timeout_member_connect': 2,
'timeout_member_data': 3,
'timeout_tcp_inspect': 4}
'timeout_tcp_inspect': 4,
'tags': ['new_tag']}
body = self._build_body(new_listener)
listener_path = self.LISTENER_PATH.format(
listener_id=listener['id'])
@ -878,6 +889,7 @@ class TestListener(base.BaseAPITest):
listener.update(update_expect)
self.assertEqual(listener['created_at'], api_listener['created_at'])
self.assertNotEqual(listener['updated_at'], api_listener['updated_at'])
self.assertEqual(['new_tag'], api_listener['tags'])
self.assertNotEqual(listener, api_listener)
self.assert_correct_lb_status(self.lb_id, constants.ONLINE,
constants.PENDING_UPDATE)

View File

@ -65,7 +65,8 @@ class TestLoadBalancer(base.BaseAPITest):
def test_create(self, **optionals):
lb_json = {'name': 'test1',
'vip_subnet_id': uuidutils.generate_uuid(),
'project_id': self.project_id
'project_id': self.project_id,
'tags': ['test_tag1', 'test_tag2']
}
lb_json.update(optionals)
body = self._build_body(lb_json)
@ -849,21 +850,29 @@ class TestLoadBalancer(base.BaseAPITest):
def test_get_all_admin(self):
project_id = uuidutils.generate_uuid()
lb1 = self.create_load_balancer(uuidutils.generate_uuid(),
name='lb1', project_id=self.project_id)
name='lb1', project_id=self.project_id,
tags=['test_tag1'])
lb2 = self.create_load_balancer(uuidutils.generate_uuid(),
name='lb2', project_id=project_id)
name='lb2', project_id=project_id,
tags=['test_tag2'])
lb3 = self.create_load_balancer(uuidutils.generate_uuid(),
name='lb3', project_id=project_id)
name='lb3', project_id=project_id,
tags=['test_tag3'])
response = self.get(self.LBS_PATH)
lbs = response.json.get(self.root_tag_list)
self.assertEqual(3, len(lbs))
lb_id_names = [(lb.get('id'), lb.get('name')) for lb in lbs]
lb_id_names = [(lb.get('id'),
lb.get('name'),
lb.get('tags')) for lb in lbs]
lb1 = lb1.get(self.root_tag)
lb2 = lb2.get(self.root_tag)
lb3 = lb3.get(self.root_tag)
self.assertIn((lb1.get('id'), lb1.get('name')), lb_id_names)
self.assertIn((lb2.get('id'), lb2.get('name')), lb_id_names)
self.assertIn((lb3.get('id'), lb3.get('name')), lb_id_names)
self.assertIn((lb1.get('id'), lb1.get('name'), lb1.get('tags')),
lb_id_names)
self.assertIn((lb2.get('id'), lb2.get('name'), lb2.get('tags')),
lb_id_names)
self.assertIn((lb3.get('id'), lb3.get('name'), lb3.get('tags')),
lb_id_names)
def test_get_all_non_admin(self):
project_id = uuidutils.generate_uuid()
@ -1160,7 +1169,8 @@ class TestLoadBalancer(base.BaseAPITest):
name='lb1',
project_id=project_id,
description='desc1',
admin_state_up=False)
admin_state_up=False,
tags=['test_tag'])
lb_dict = lb.get(self.root_tag)
response = self.get(
self.LB_PATH.format(
@ -1173,6 +1183,7 @@ class TestLoadBalancer(base.BaseAPITest):
self.assertEqual(subnet.id, response.get('vip_subnet_id'))
self.assertEqual(network.id, response.get('vip_network_id'))
self.assertEqual(port.id, response.get('vip_port_id'))
self.assertEqual(['test_tag'], response.get('tags'))
def test_get_deleted_gives_404(self):
api_lb = self.create_load_balancer(
@ -1293,15 +1304,17 @@ class TestLoadBalancer(base.BaseAPITest):
name='lb1',
project_id=project_id,
description='desc1',
admin_state_up=False)
admin_state_up=False,
tags=['test_tag1'])
lb_dict = lb.get(self.root_tag)
lb_json = self._build_body({'name': 'lb2'})
lb_json = self._build_body({'name': 'lb2', 'tags': ['test_tag2']})
lb = self.set_lb_status(lb_dict.get('id'))
response = self.put(self.LB_PATH.format(lb_id=lb_dict.get('id')),
lb_json)
api_lb = response.json.get(self.root_tag)
self.assertIsNotNone(api_lb.get('vip_subnet_id'))
self.assertEqual('lb2', api_lb.get('name'))
self.assertEqual(['test_tag2'], api_lb.get('tags'))
self.assertEqual(project_id, api_lb.get('project_id'))
self.assertEqual('desc1', api_lb.get('description'))
self.assertFalse(api_lb.get('admin_state_up'))
@ -2100,7 +2113,8 @@ class TestLoadBalancerGraph(base.BaseAPITest):
'vip_network_id': mock.ANY,
'vip_qos_policy_id': None,
'flavor_id': '',
'provider': 'noop_driver'
'provider': 'noop_driver',
'tags': []
}
expected_lb.update(create_lb)
expected_lb['listeners'] = expected_listeners
@ -2133,6 +2147,7 @@ class TestLoadBalancerGraph(base.BaseAPITest):
'timeout_member_connect': constants.DEFAULT_TIMEOUT_MEMBER_CONNECT,
'timeout_member_data': constants.DEFAULT_TIMEOUT_MEMBER_DATA,
'timeout_tcp_inspect': constants.DEFAULT_TIMEOUT_TCP_INSPECT,
'tags': []
}
if create_sni_containers:
create_listener['sni_container_refs'] = create_sni_containers
@ -2180,7 +2195,8 @@ class TestLoadBalancerGraph(base.BaseAPITest):
'enabled': True,
'provisioning_status': constants.PENDING_CREATE,
'operating_status': constants.OFFLINE,
'project_id': self._project_id
'project_id': self._project_id,
'tags': []
}
expected_pool.update(create_pool)
if expected_members:
@ -2199,7 +2215,8 @@ class TestLoadBalancerGraph(base.BaseAPITest):
'enabled': True,
'subnet_id': None,
'operating_status': constants.OFFLINE,
'project_id': self._project_id
'project_id': self._project_id,
'tags': []
}
expected_member.update(create_member)
return create_member, expected_member
@ -2219,7 +2236,8 @@ class TestLoadBalancerGraph(base.BaseAPITest):
'admin_state_up': True,
'project_id': self._project_id,
'provisioning_status': constants.PENDING_CREATE,
'operating_status': constants.OFFLINE
'operating_status': constants.OFFLINE,
'tags': []
}
expected_hm.update(create_hm)
return create_hm, expected_hm
@ -2260,7 +2278,8 @@ class TestLoadBalancerGraph(base.BaseAPITest):
'rules': [],
'project_id': self._project_id,
'provisioning_status': constants.PENDING_CREATE,
'operating_status': constants.OFFLINE
'operating_status': constants.OFFLINE,
'tags': []
}
expected_l7policy.update(create_l7policy)
expected_l7policy.pop('redirect_pool', None)
@ -2286,7 +2305,8 @@ class TestLoadBalancerGraph(base.BaseAPITest):
'key': None,
'project_id': self._project_id,
'provisioning_status': constants.PENDING_CREATE,
'operating_status': constants.OFFLINE
'operating_status': constants.OFFLINE,
'tags': []
}]
expected_l7rules[0].update(create_l7rules[0])
return create_l7rules, expected_l7rules

View File

@ -69,6 +69,7 @@ class TestMember(base.BaseAPITest):
member_id=api_member.get('id'))).json.get(self.root_tag)
self.assertEqual(api_member, response)
self.assertEqual(api_member.get('name'), '')
self.assertEqual([], api_member['tags'])
def test_get_authorized(self):
api_member = self.create_member(
@ -128,10 +129,12 @@ class TestMember(base.BaseAPITest):
def test_get_all(self):
api_m_1 = self.create_member(
self.pool_id, '192.0.2.1', 80).get(self.root_tag)
self.pool_id, '192.0.2.1', 80,
tags=['test_tag1']).get(self.root_tag)
self.set_lb_status(self.lb_id)
api_m_2 = self.create_member(
self.pool_id, '192.0.2.2', 80).get(self.root_tag)
self.pool_id, '192.0.2.2', 80,
tags=['test_tag2']).get(self.root_tag)
self.set_lb_status(self.lb_id)
# Original objects didn't have the updated operating/provisioning
# status that exists in the DB.
@ -393,11 +396,13 @@ class TestMember(base.BaseAPITest):
return_value=override_credentials):
api_member = self.create_member(
self.pool_id, '192.0.2.1', 80).get(self.root_tag)
self.pool_id, '192.0.2.1', 80,
tags=['test_tag']).get(self.root_tag)
self.conf.config(group='api_settings', auth_strategy=auth_strategy)
self.assertEqual('192.0.2.1', api_member['address'])
self.assertEqual(80, api_member['protocol_port'])
self.assertEqual(['test_tag'], api_member['tags'])
self.assertIsNotNone(api_member['created_at'])
self.assertIsNone(api_member['updated_at'])
self.assert_correct_status(
@ -528,8 +533,10 @@ class TestMember(base.BaseAPITest):
mock_driver.name = 'noop_driver'
mock_get_driver.return_value = mock_driver
member5 = {'address': '192.0.2.5', 'protocol_port': 80}
member6 = {'address': '192.0.2.6', 'protocol_port': 80}
member5 = {'address': '192.0.2.5', 'protocol_port': 80,
'tags': ['test_tag1']}
member6 = {'address': '192.0.2.6', 'protocol_port': 80,
'tags': ['test_tag2']}
req_dict = [member5, member6]
body = {self.root_tag_list: req_dict}
@ -540,8 +547,8 @@ class TestMember(base.BaseAPITest):
).json.get(self.root_tag_list)
expected_members = [
('192.0.2.5', 80, 'PENDING_CREATE'),
('192.0.2.6', 80, 'PENDING_CREATE'),
('192.0.2.5', 80, 'PENDING_CREATE', ['test_tag1']),
('192.0.2.6', 80, 'PENDING_CREATE', ['test_tag2']),
]
member_ids = {}
@ -550,7 +557,8 @@ class TestMember(base.BaseAPITest):
self.assertIn(
(rm['address'],
rm['protocol_port'],
rm['provisioning_status']), expected_members)
rm['provisioning_status'],
rm['tags']), expected_members)
member_ids[(rm['address'], rm['protocol_port'])] = rm['id']
provider_dict = driver_utils.member_dict_to_provider_dict(rm)
@ -825,9 +833,9 @@ class TestMember(base.BaseAPITest):
new_name = "name2"
api_member = self.create_member(
self.pool_with_listener_id, '192.0.2.1', 80,
name=old_name).get(self.root_tag)
name=old_name, tags=['old_tag']).get(self.root_tag)
self.set_lb_status(self.lb_id)
new_member = {'name': new_name}
new_member = {'name': new_name, 'tags': ['new_tag']}
self.conf = self.useFixture(oslo_fixture.Config(cfg.CONF))
auth_strategy = self.conf.conf.api_settings.get('auth_strategy')
self.conf.config(group='api_settings', auth_strategy=constants.TESTING)
@ -866,6 +874,7 @@ class TestMember(base.BaseAPITest):
member_prov_status=constants.PENDING_UPDATE)
self.set_lb_status(self.lb_id)
self.assertEqual(new_name, response.get('name'))
self.assertEqual(['new_tag'], response['tags'])
self.assertEqual(api_member.get('created_at'),
response.get('created_at'))
self.assert_correct_status(

View File

@ -66,7 +66,7 @@ class TestPool(base.BaseAPITest):
self.lb_id,
constants.PROTOCOL_HTTP,
constants.LB_ALGORITHM_ROUND_ROBIN,
listener_id=self.listener_id).get(self.root_tag)
listener_id=self.listener_id, tags=['test_tag']).get(self.root_tag)
# Set status to ACTIVE/ONLINE because set_lb_status did it in the db
api_pool['provisioning_status'] = constants.ACTIVE
api_pool['operating_status'] = constants.ONLINE
@ -158,12 +158,13 @@ class TestPool(base.BaseAPITest):
self.lb_id,
constants.PROTOCOL_HTTP,
constants.LB_ALGORITHM_ROUND_ROBIN,
listener_id=self.listener_id).get(self.root_tag)
listener_id=self.listener_id, tags=['test_tag']).get(self.root_tag)
self.set_lb_status(lb_id=self.lb_id)
pools = self.get(self.POOLS_PATH).json.get(self.root_tag_list)
self.assertIsInstance(pools, list)
self.assertEqual(1, len(pools))
self.assertEqual(api_pool.get('id'), pools[0].get('id'))
self.assertEqual(['test_tag'], pools[0]['tags'])
def test_get_all_hides_deleted(self):
api_pool = self.create_pool(
@ -556,7 +557,8 @@ class TestPool(base.BaseAPITest):
self.lb_id,
constants.PROTOCOL_HTTP,
constants.LB_ALGORITHM_ROUND_ROBIN,
listener_id=self.listener_id).get(self.root_tag)
listener_id=self.listener_id,
tags=['test_tag']).get(self.root_tag)
self.assert_correct_status(
lb_id=self.lb_id, listener_id=self.listener_id,
pool_id=api_pool.get('id'),
@ -568,6 +570,7 @@ class TestPool(base.BaseAPITest):
self.assertEqual(constants.PROTOCOL_HTTP, api_pool.get('protocol'))
self.assertEqual(constants.LB_ALGORITHM_ROUND_ROBIN,
api_pool.get('lb_algorithm'))
self.assertEqual(['test_tag'], api_pool['tags'])
self.assertIsNotNone(api_pool.get('created_at'))
self.assertIsNone(api_pool.get('updated_at'))
self.assert_correct_status(
@ -900,9 +903,9 @@ class TestPool(base.BaseAPITest):
self.lb_id,
constants.PROTOCOL_HTTP,
constants.LB_ALGORITHM_ROUND_ROBIN,
listener_id=self.listener_id).get(self.root_tag)
listener_id=self.listener_id, tags=['old_tag']).get(self.root_tag)
self.set_lb_status(lb_id=self.lb_id)
new_pool = {'name': 'new_name'}
new_pool = {'name': 'new_name', 'tags': ['new_tag']}
self.put(self.POOL_PATH.format(pool_id=api_pool.get('id')),
self._build_body(new_pool))
self.assert_correct_status(
@ -915,6 +918,7 @@ class TestPool(base.BaseAPITest):
response = self.get(self.POOL_PATH.format(
pool_id=api_pool.get('id'))).json.get(self.root_tag)
self.assertEqual('new_name', response.get('name'))
self.assertEqual(['new_tag'], response['tags'])
self.assertIsNotNone(response.get('created_at'))
self.assertIsNotNone(response.get('updated_at'))
self.assert_correct_status(

View File

@ -133,7 +133,8 @@ class AllRepositoriesTest(base.OctaviaDBTestBase):
'provider': 'amphora',
'server_group_id': uuidutils.generate_uuid(),
'project_id': uuidutils.generate_uuid(),
'id': uuidutils.generate_uuid()}
'id': uuidutils.generate_uuid(),
'tags': ['test_tag']}
vip = {'ip_address': '192.0.2.1',
'port_id': uuidutils.generate_uuid(),
'subnet_id': uuidutils.generate_uuid(),
@ -160,7 +161,8 @@ class AllRepositoriesTest(base.OctaviaDBTestBase):
'enabled': True, 'operating_status': constants.ONLINE,
'project_id': uuidutils.generate_uuid(),
'id': uuidutils.generate_uuid(),
'provisioning_status': constants.ACTIVE}
'provisioning_status': constants.ACTIVE,
'tags': ['test_tag']}
pool_dm = self.repos.create_pool_on_load_balancer(
self.session, pool, listener_id=self.listener.id)
pool_dm_dict = pool_dm.to_dict()
@ -185,7 +187,8 @@ class AllRepositoriesTest(base.OctaviaDBTestBase):
'enabled': True, 'operating_status': constants.ONLINE,
'project_id': uuidutils.generate_uuid(),
'id': uuidutils.generate_uuid(),
'provisioning_status': constants.ACTIVE}
'provisioning_status': constants.ACTIVE,
'tags': ['test_tag']}
sp = {'type': constants.SESSION_PERSISTENCE_HTTP_COOKIE,
'cookie_name': 'cookie_monster',
'pool_id': pool['id'],
@ -223,7 +226,8 @@ class AllRepositoriesTest(base.OctaviaDBTestBase):
'enabled': True, 'operating_status': constants.ONLINE,
'project_id': uuidutils.generate_uuid(),
'id': uuidutils.generate_uuid(),
'provisioning_status': constants.ACTIVE}
'provisioning_status': constants.ACTIVE,
'tags': ['test_tag']}
pool_dm = self.repos.create_pool_on_load_balancer(
self.session, pool, listener_id=self.listener.id)
update_pool = {'protocol': constants.PROTOCOL_TCP, 'name': 'up_pool'}
@ -250,7 +254,8 @@ class AllRepositoriesTest(base.OctaviaDBTestBase):
'enabled': True, 'operating_status': constants.ONLINE,
'project_id': uuidutils.generate_uuid(),
'id': uuidutils.generate_uuid(),
'provisioning_status': constants.ACTIVE}
'provisioning_status': constants.ACTIVE,
'tags': ['test_tag']}
sp = {'type': constants.SESSION_PERSISTENCE_HTTP_COOKIE,
'cookie_name': 'cookie_monster',
'pool_id': pool['id'],
@ -1841,7 +1846,7 @@ class PoolRepositoryTest(BaseRepositoryTest):
description="pool_description", protocol=constants.PROTOCOL_HTTP,
lb_algorithm=constants.LB_ALGORITHM_ROUND_ROBIN,
provisioning_status=constants.ACTIVE,
operating_status=constants.ONLINE, enabled=True)
operating_status=constants.ONLINE, enabled=True, tags=['test_tag'])
return pool
def test_get(self):
@ -1982,7 +1987,7 @@ class MemberRepositoryTest(BaseRepositoryTest):
protocol=constants.PROTOCOL_HTTP,
lb_algorithm=constants.LB_ALGORITHM_ROUND_ROBIN,
provisioning_status=constants.ACTIVE,
operating_status=constants.ONLINE, enabled=True)
operating_status=constants.ONLINE, enabled=True, tags=['test_tag'])
def create_member(self, member_id, project_id, pool_id, ip_address):
member = self.member_repo.create(self.session, id=member_id,
@ -2129,7 +2134,8 @@ class TestListenerRepositoryTest(BaseRepositoryTest):
protocol=constants.PROTOCOL_HTTP, protocol_port=port,
connection_limit=1, load_balancer_id=self.load_balancer.id,
default_pool_id=default_pool_id, operating_status=constants.ONLINE,
provisioning_status=constants.ACTIVE, enabled=True, peer_port=1025)
provisioning_status=constants.ACTIVE, enabled=True, peer_port=1025,
tags=['test_tag'])
return listener
def create_amphora(self, amphora_id, loadbalancer_id):
@ -2506,7 +2512,7 @@ class HealthMonitorRepositoryTest(BaseRepositoryTest):
url_path="http://localhost:80/index.php",
provisioning_status=constants.ACTIVE,
operating_status=constants.ONLINE,
expected_codes="200", enabled=True)
expected_codes="200", enabled=True, tags=['test_tag'])
self.assertEqual(hm_id, health_monitor.id)
return health_monitor
@ -2555,7 +2561,7 @@ class LoadBalancerRepositoryTest(BaseRepositoryTest):
description="lb_description",
provisioning_status=constants.ACTIVE,
operating_status=constants.ONLINE,
enabled=True)
enabled=True, tags=['test_tag'])
return lb
def test_get(self):
@ -3364,7 +3370,7 @@ class L7PolicyRepositoryTest(BaseRepositoryTest):
protocol=constants.PROTOCOL_HTTP,
lb_algorithm=constants.LB_ALGORITHM_ROUND_ROBIN,
provisioning_status=constants.ACTIVE,
operating_status=constants.ONLINE, enabled=True)
operating_status=constants.ONLINE, enabled=True, tags=['test_tag'])
return pool
def create_l7policy(self, l7policy_id, listener_id, position,
@ -3767,7 +3773,8 @@ class L7RuleRepositoryTest(BaseRepositoryTest):
self.session, id=l7rule_id, l7policy_id=l7policy_id,
type=type, compare_type=compare_type, key=key, value=value,
invert=invert, provisioning_status=constants.ACTIVE,
operating_status=constants.ONLINE, enabled=enabled)
operating_status=constants.ONLINE, enabled=enabled,
tags=['test_tag'])
return l7rule
def test_get(self):

View File

@ -105,6 +105,22 @@ class TestHealthMonitor(object):
self.assertRaises(exc.InvalidInput, wsme_json.fromjson, self._type,
body)
def test_invalid_tags(self):
body = {"tags": "invalid_tag"}
if self._type is hm_type.HealthMonitorPOST:
body.update({"type": constants.PROTOCOL_HTTP,
"pool_id": uuidutils.generate_uuid(),
"delay": 1, "timeout": 1, "max_retries": 1})
self.assertRaises(ValueError, wsme_json.fromjson, self._type,
body)
body = {"tags": [1, 2]}
if self._type is hm_type.HealthMonitorPOST:
body.update({"type": constants.PROTOCOL_HTTP,
"pool_id": uuidutils.generate_uuid(),
"delay": 1, "timeout": 1, "max_retries": 1})
self.assertRaises(exc.InvalidInput, wsme_json.fromjson, self._type,
body)
class TestHealthMonitorPOST(base.BaseTypesTest, TestHealthMonitor):
@ -113,7 +129,8 @@ class TestHealthMonitorPOST(base.BaseTypesTest, TestHealthMonitor):
def test_health_monitor(self):
body = {"type": constants.HEALTH_MONITOR_HTTP, "delay": 1,
"timeout": 1, "max_retries_down": 1, "max_retries": 1,
"pool_id": uuidutils.generate_uuid()}
"pool_id": uuidutils.generate_uuid(),
"tags": ['test_tag']}
hm = wsme_json.fromjson(self._type, body)
self.assertTrue(hm.admin_state_up)
@ -185,6 +202,7 @@ class TestHealthMonitorPUT(base.BaseTypesTest, TestHealthMonitor):
_type = hm_type.HealthMonitorPUT
def test_health_monitor(self):
body = {"http_method": constants.HEALTH_MONITOR_HTTP_METHOD_HEAD}
body = {"http_method": constants.HEALTH_MONITOR_HTTP_METHOD_HEAD,
"tags": ['test_tag']}
hm = wsme_json.fromjson(self._type, body)
self.assertEqual(wsme_types.Unset, hm.admin_state_up)

View File

@ -32,7 +32,8 @@ class TestL7PolicyPOST(base.BaseTypesTest):
def test_l7policy(self):
body = {"listener_id": self.listener_id,
"action": constants.L7POLICY_ACTION_REJECT}
"action": constants.L7POLICY_ACTION_REJECT,
"tags": ['test_tag']}
l7policy = wsme_json.fromjson(self._type, body)
self.assertEqual(self.listener_id, l7policy.listener_id)
self.assertEqual(constants.MAX_POLICY_POSITION, l7policy.position)
@ -73,6 +74,18 @@ class TestL7PolicyPOST(base.BaseTypesTest):
self.assertRaises(ValueError, wsme_json.fromjson, self._type,
body)
def test_invalid_tags(self):
body = {"listener_id": self.listener_id,
"action": constants.L7POLICY_ACTION_REJECT,
"tags": "invalid_tag"}
self.assertRaises(ValueError, wsme_json.fromjson, self._type,
body)
body = {"listener_id": self.listener_id,
"action": constants.L7POLICY_ACTION_REJECT,
"tags": [1, 2]}
self.assertRaises(exc.InvalidInput, wsme_json.fromjson, self._type,
body)
def test_l7policy_min_position(self):
body = {"listener_id": self.listener_id,
"action": constants.L7POLICY_ACTION_REJECT,
@ -118,7 +131,8 @@ class TestL7PolicyPUT(base.BaseTypesTest):
def test_l7policy(self):
body = {"action": constants.L7POLICY_ACTION_REJECT,
"position": constants.MIN_POLICY_POSITION}
"position": constants.MIN_POLICY_POSITION,
"tags": ['test_tag']}
l7policy = wsme_json.fromjson(self._type, body)
self.assertEqual(constants.MIN_POLICY_POSITION, l7policy.position)
self.assertEqual(wsme_types.Unset, l7policy.redirect_url)
@ -148,3 +162,11 @@ class TestL7PolicyPUT(base.BaseTypesTest):
body = {"action": "test"}
self.assertRaises(exc.InvalidInput, wsme_json.fromjson, self._type,
body)
def test_invalid_tags(self):
body = {"tags": "invalid_tag"}
self.assertRaises(ValueError, wsme_json.fromjson, self._type,
body)
body = {"tags": [1, 2]}
self.assertRaises(exc.InvalidInput, wsme_json.fromjson, self._type,
body)

View File

@ -28,7 +28,7 @@ class TestL7RulePOST(base.BaseTypesTest):
def test_l7rule(self):
body = {"type": constants.L7RULE_TYPE_PATH,
"compare_type": constants.L7RULE_COMPARE_TYPE_STARTS_WITH,
"value": "/api"}
"value": "/api", "tags": ['test_tag']}
l7rule = wsme_json.fromjson(self._type, body)
self.assertEqual(wsme_types.Unset, l7rule.key)
self.assertFalse(l7rule.invert)
@ -97,6 +97,20 @@ class TestL7RulePOST(base.BaseTypesTest):
self.assertRaises(exc.InvalidInput, wsme_json.fromjson, self._type,
body)
def test_invalid_tags(self):
body = {"type": constants.L7RULE_TYPE_PATH,
"compare_type": constants.L7RULE_COMPARE_TYPE_STARTS_WITH,
"value": "/api",
"tags": "invalid_tag"}
self.assertRaises(ValueError, wsme_json.fromjson, self._type,
body)
body = {"type": constants.L7RULE_TYPE_PATH,
"compare_type": constants.L7RULE_COMPARE_TYPE_STARTS_WITH,
"value": "/api",
"tags": [1, 2]}
self.assertRaises(exc.InvalidInput, wsme_json.fromjson, self._type,
body)
class TestL7RulePUT(base.BaseTypesTest):
@ -105,7 +119,7 @@ class TestL7RulePUT(base.BaseTypesTest):
def test_l7rule(self):
body = {"type": constants.L7RULE_TYPE_PATH,
"compare_type": constants.L7RULE_COMPARE_TYPE_STARTS_WITH,
"value": "/api"}
"value": "/api", "tags": ['test_tag']}
l7rule = wsme_json.fromjson(self._type, body)
self.assertEqual(wsme_types.Unset, l7rule.key)
self.assertFalse(l7rule.invert)
@ -139,3 +153,11 @@ class TestL7RulePUT(base.BaseTypesTest):
body = {"key": 123}
self.assertRaises(exc.InvalidInput, wsme_json.fromjson, self._type,
body)
def test_invalid_tags(self):
body = {"tags": "invalid_tag"}
self.assertRaises(ValueError, wsme_json.fromjson, self._type,
body)
body = {"tags": [1, 2]}
self.assertRaises(exc.InvalidInput, wsme_json.fromjson, self._type,
body)

View File

@ -61,6 +61,22 @@ class TestListener(object):
"loadbalancer_id": uuidutils.generate_uuid()})
self.assertRaises(ValueError, wsme_json.fromjson, self._type, body)
def test_invalid_tags(self):
body = {"tags": "invalid_tag"}
if self._type is lis_type.ListenerPOST:
body.update({"protocol": constants.PROTOCOL_HTTP,
"protocol_port": 80,
"loadbalancer_id": uuidutils.generate_uuid()})
self.assertRaises(ValueError, wsme_json.fromjson, self._type,
body)
body = {"tags": [1, 2]}
if self._type is lis_type.ListenerPOST:
body.update({"protocol": constants.PROTOCOL_HTTP,
"protocol_port": 80,
"loadbalancer_id": uuidutils.generate_uuid()})
self.assertRaises(exc.InvalidInput, wsme_json.fromjson, self._type,
body)
class TestListenerPOST(base.BaseTypesTest, TestListener):
@ -70,7 +86,8 @@ class TestListenerPOST(base.BaseTypesTest, TestListener):
body = {"name": "test", "description": "test", "connection_limit": 10,
"protocol": constants.PROTOCOL_HTTP, "protocol_port": 80,
"default_pool_id": uuidutils.generate_uuid(),
"loadbalancer_id": uuidutils.generate_uuid()}
"loadbalancer_id": uuidutils.generate_uuid(),
"tags": ['test_tag']}
listener = wsme_json.fromjson(self._type, body)
self.assertTrue(listener.admin_state_up)
@ -132,6 +149,7 @@ class TestListenerPUT(base.BaseTypesTest, TestListener):
"sni_container_refs": [uuidutils.generate_uuid(),
uuidutils.generate_uuid()],
"default_pool_id": uuidutils.generate_uuid(),
"insert_headers": {"a": "1", "b": "2"}}
"insert_headers": {"a": "1", "b": "2"},
"tags": ['test_tag']}
listener = wsme_json.fromjson(self._type, body)
self.assertEqual(wsme_types.Unset, listener.admin_state_up)

View File

@ -27,7 +27,8 @@ class TestLoadBalancer(object):
def test_load_balancer(self):
body = {"name": "test_name", "description": "test_description",
"vip_subnet_id": uuidutils.generate_uuid()}
"vip_subnet_id": uuidutils.generate_uuid(),
"tags": ['test']}
lb = wsme_json.fromjson(self._type, body)
self.assertTrue(lb.admin_state_up)
@ -61,6 +62,14 @@ class TestLoadBalancer(object):
self.assertRaises(exc.InvalidInput, wsme_json.fromjson, self._type,
body)
def test_invalid_tags(self):
body = {"tags": "invalid_tag"}
self.assertRaises(ValueError, wsme_json.fromjson, self._type,
body)
body = {"tags": [1, 2]}
self.assertRaises(exc.InvalidInput, wsme_json.fromjson, self._type,
body)
class TestLoadBalancerPOST(base.BaseTypesTest, TestLoadBalancer):
@ -100,6 +109,7 @@ class TestLoadBalancerPUT(base.BaseTypesTest, TestLoadBalancer):
_type = lb_type.LoadBalancerPUT
def test_load_balancer(self):
body = {"name": "test_name", "description": "test_description"}
body = {"name": "test_name", "description": "test_description",
"tags": ['test_tag']}
lb = wsme_json.fromjson(self._type, body)
self.assertEqual(wsme_types.Unset, lb.admin_state_up)

View File

@ -27,7 +27,7 @@ class TestMemberPOST(base.BaseTypesTest):
def test_member(self):
body = {"name": "member1", "address": "10.0.0.1",
"protocol_port": 80}
"protocol_port": 80, "tags": ['test_tag']}
member = wsme_json.fromjson(self._type, body)
self.assertTrue(member.admin_state_up)
self.assertEqual(1, member.weight)
@ -69,6 +69,15 @@ class TestMemberPOST(base.BaseTypesTest):
"weight": "test"}
self.assertRaises(ValueError, wsme_json.fromjson, self._type, body)
def test_invalid_tags(self):
body = {"address": "10.0.0.1", "protocol_port": 443,
"tags": "invalid_tag"}
self.assertRaises(ValueError, wsme_json.fromjson, self._type,
body)
body = {"address": "10.0.0.1", "protocol_port": 443, "tags": [1, 2]}
self.assertRaises(exc.InvalidInput, wsme_json.fromjson, self._type,
body)
def test_min_weight(self):
body = {"address": "10.0.0.1", "protocol_port": 443,
"weight": constants.MIN_WEIGHT - 1}
@ -101,7 +110,7 @@ class TestMemberPUT(base.BaseTypesTest):
_type = member_type.MemberPUT
def test_member(self):
body = {"name": "new_name"}
body = {"name": "new_name", "tags": ['new_tag']}
member = wsme_json.fromjson(self._type, body)
self.assertEqual(wsme_types.Unset, member.weight)
self.assertEqual(wsme_types.Unset, member.admin_state_up)
@ -124,6 +133,14 @@ class TestMemberPUT(base.BaseTypesTest):
body = {"weight": "test"}
self.assertRaises(ValueError, wsme_json.fromjson, self._type, body)
def test_invalid_tags(self):
body = {"tags": "invalid_tag"}
self.assertRaises(ValueError, wsme_json.fromjson, self._type,
body)
body = {"tags": [1, 2]}
self.assertRaises(exc.InvalidInput, wsme_json.fromjson, self._type,
body)
def test_min_weight(self):
body = {"weight": constants.MIN_WEIGHT - 1}
self.assertRaises(

View File

@ -52,7 +52,8 @@ class TestPoolPOST(base.BaseTypesTest):
"loadbalancer_id": uuidutils.generate_uuid(),
"listener_id": uuidutils.generate_uuid(),
"protocol": constants.PROTOCOL_HTTP,
"lb_algorithm": constants.LB_ALGORITHM_ROUND_ROBIN}
"lb_algorithm": constants.LB_ALGORITHM_ROUND_ROBIN,
"tags": ['test_tag']}
pool = wsme_json.fromjson(self._type, body)
self.assertTrue(pool.admin_state_up)
@ -132,13 +133,25 @@ class TestPoolPOST(base.BaseTypesTest):
pool = wsme_json.fromjson(self._type, body)
self.assertEqual(pool.project_id, body['project_id'])
def test_invalid_tags(self):
body = {"protocol": constants.PROTOCOL_HTTP,
"lb_algorithm": constants.LB_ALGORITHM_ROUND_ROBIN,
"tags": "invalid_tag"}
self.assertRaises(ValueError, wsme_json.fromjson, self._type,
body)
body = {"protocol": constants.PROTOCOL_HTTP,
"lb_algorithm": constants.LB_ALGORITHM_ROUND_ROBIN,
"tags": [1, 2]}
self.assertRaises(exc.InvalidInput, wsme_json.fromjson, self._type,
body)
class TestPoolPUT(base.BaseTypesTest):
_type = pool_type.PoolPUT
def test_pool(self):
body = {"name": "test_name"}
body = {"name": "test_name", "tags": ['new_tag']}
pool = wsme_json.fromjson(self._type, body)
self.assertEqual(wsme_types.Unset, pool.admin_state_up)
@ -167,6 +180,14 @@ class TestPoolPUT(base.BaseTypesTest):
self.assertRaises(exc.InvalidInput, wsme_json.fromjson, self._type,
body)
def test_invalid_tags(self):
body = {"tags": "invalid_tag"}
self.assertRaises(ValueError, wsme_json.fromjson, self._type,
body)
body = {"tags": [1, 2]}
self.assertRaises(exc.InvalidInput, wsme_json.fromjson, self._type,
body)
class TestSessionPersistencePOST(base.BaseTypesTest, TestSessionPersistence):

View File

@ -0,0 +1,12 @@
---
features:
- |
Added tags property for Octavia resources. It includes:
* Load balancer
* Listener
* Member
* Pool
* L7rule
* L7policy
* Health Monitor