Adding Vip port ID for loadbalancer - Issue #9
Vip port ID is actually being returned by the lbaas api although
documentation does not reference it. This PR exposes this important
attribute when creating or listing loadbalancers.
REQ: curl -g -i --cacert "/home/sabhaya/ipc/cacert.cer" -X POST
https://10.243.189.6:9696/v2.0/lbaas/loadbalancers.json -H "User-Agent:
python-neutronclient" -H "Content-Type: application/json" -H "Accept:
application/json" -H "X-Auth-Token:
{SHA1}197d9453ec40aa1453b88ed2fd31dc22ee9bb6d3" -d '{"loadbalancer":
{"vip_subnet_id": "6cfcd316-6060-42e3-95a7-fe5dd7ba6f46", "description":
"vipul-test", "admin_state_up": true}}'
DEBUG: keystoneauth.session RESP: [201] Content-Type: application/json
Content-Length: 430 X-Openstack-Request-Id:
req-c38d6086-77d6-4f91-94d1-b6f233cf90c0 Date: Thu, 07 Jul 2016 00:13:58
GMT Connection: keep-alive
RESP BODY: {"loadbalancer": {"description": "vipul-test",
"admin_state_up": true, "tenant_id": "4c45f9757fce480c875e096fba3e254e",
"provisioning_status": "PENDING_CREATE", "listeners": [], "vip_address":
"10.0.2.31", "vip_port_id": "4e901618-0a8d-4d46-861c-28fad2df7a8c",
"provider": "octavia", "vip_subnet_id":
"6cfcd316-6060-42e3-95a7-fe5dd7ba6f46", "id":
"c28cf436-f201-4c4f-be63-ecbd092aae63", "operating_status": "OFFLINE",
"name": ""}}
Created a new loadbalancer:
+---------------------+--------------------------------------+
| Field | Value |
+---------------------+--------------------------------------+
| admin_state_up | True |
| description | vipul-test |
| id | c28cf436-f201-4c4f-be63-ecbd092aae63 |
| listeners | |
| name | |
| operating_status | OFFLINE |
| provider | octavia |
| provisioning_status | PENDING_CREATE |
| tenant_id | 4c45f9757fce480c875e096fba3e254e |
| vip_address | 10.0.2.31 |
| vip_port_id | 4e901618-0a8d-4d46-861c-28fad2df7a8c |
| vip_subnet_id | 6cfcd316-6060-42e3-95a7-fe5dd7ba6f46 |
+---------------------+———————————————————+"}}'"
diff --git a/openstack/networking/v2/extensions/lbaas_v2/loadbalancers/requests.go b/openstack/networking/v2/extensions/lbaas_v2/loadbalancers/requests.go
index ce493c9..bc4a3c6 100644
--- a/openstack/networking/v2/extensions/lbaas_v2/loadbalancers/requests.go
+++ b/openstack/networking/v2/extensions/lbaas_v2/loadbalancers/requests.go
@@ -22,6 +22,7 @@
TenantID string `q:"tenant_id"`
ProvisioningStatus string `q:"provisioning_status"`
VipAddress string `q:"vip_address"`
+ VipPortID string `q:"vip_port_id"`
VipSubnetID string `q:"vip_subnet_id"`
ID string `q:"id"`
OperatingStatus string `q:"operating_status"`
diff --git a/openstack/networking/v2/extensions/lbaas_v2/loadbalancers/results.go b/openstack/networking/v2/extensions/lbaas_v2/loadbalancers/results.go
index 168e531..4423c24 100644
--- a/openstack/networking/v2/extensions/lbaas_v2/loadbalancers/results.go
+++ b/openstack/networking/v2/extensions/lbaas_v2/loadbalancers/results.go
@@ -20,6 +20,8 @@
ProvisioningStatus string `json:"provisioning_status"`
// The IP address of the Loadbalancer.
VipAddress string `json:"vip_address"`
+ // The UUID of the port associated with the IP address.
+ VipPortID string `json:"vip_port_id"`
// The UUID of the subnet on which to allocate the virtual IP for the Loadbalancer address.
VipSubnetID string `json:"vip_subnet_id"`
// The unique ID for the LoadBalancer.
diff --git a/openstack/networking/v2/extensions/lbaas_v2/loadbalancers/testing/fixtures.go b/openstack/networking/v2/extensions/lbaas_v2/loadbalancers/testing/fixtures.go
index f882949..a452236 100644
--- a/openstack/networking/v2/extensions/lbaas_v2/loadbalancers/testing/fixtures.go
+++ b/openstack/networking/v2/extensions/lbaas_v2/loadbalancers/testing/fixtures.go
@@ -25,6 +25,7 @@
"description": "lb config for the web tier",
"vip_subnet_id": "8a49c438-848f-467b-9655-ea1548708154",
"vip_address": "10.30.176.47",
+ "vip_port_id": "2a22e552-a347-44fd-b530-1f2b1b2a6735",
"flavor": "small",
"provider": "haproxy",
"admin_state_up": true,
@@ -38,6 +39,7 @@
"description": "lb config for the db tier",
"vip_subnet_id": "9cedb85d-0759-4898-8a4b-fa5a5ea10086",
"vip_address": "10.30.176.48",
+ "vip_port_id": "2bf413c8-41a9-4477-b505-333d5cbe8b55",
"flavor": "medium",
"provider": "haproxy",
"admin_state_up": true,
@@ -58,6 +60,7 @@
"description": "lb config for the db tier",
"vip_subnet_id": "9cedb85d-0759-4898-8a4b-fa5a5ea10086",
"vip_address": "10.30.176.48",
+ "vip_port_id": "2bf413c8-41a9-4477-b505-333d5cbe8b55",
"flavor": "medium",
"provider": "haproxy",
"admin_state_up": true,
@@ -77,6 +80,7 @@
"description": "lb config for the db tier",
"vip_subnet_id": "9cedb85d-0759-4898-8a4b-fa5a5ea10086",
"vip_address": "10.30.176.48",
+ "vip_port_id": "2bf413c8-41a9-4477-b505-333d5cbe8b55",
"flavor": "medium",
"provider": "haproxy",
"admin_state_up": true,
@@ -126,6 +130,7 @@
Description: "lb config for the web tier",
VipSubnetID: "8a49c438-848f-467b-9655-ea1548708154",
VipAddress: "10.30.176.47",
+ VipPortID: "2a22e552-a347-44fd-b530-1f2b1b2a6735",
Flavor: "small",
Provider: "haproxy",
AdminStateUp: true,
@@ -139,6 +144,7 @@
Description: "lb config for the db tier",
VipSubnetID: "9cedb85d-0759-4898-8a4b-fa5a5ea10086",
VipAddress: "10.30.176.48",
+ VipPortID: "2bf413c8-41a9-4477-b505-333d5cbe8b55",
Flavor: "medium",
Provider: "haproxy",
AdminStateUp: true,
@@ -152,6 +158,7 @@
Description: "lb config for the db tier",
VipSubnetID: "9cedb85d-0759-4898-8a4b-fa5a5ea10086",
VipAddress: "10.30.176.48",
+ VipPortID: "2bf413c8-41a9-4477-b505-333d5cbe8b55",
Flavor: "medium",
Provider: "haproxy",
AdminStateUp: true,