diff --git a/octavia_dashboard/api/rest/lbaasv2.py b/octavia_dashboard/api/rest/lbaasv2.py index 223cebec..c5ca48e5 100644 --- a/octavia_dashboard/api/rest/lbaasv2.py +++ b/octavia_dashboard/api/rest/lbaasv2.py @@ -358,7 +358,8 @@ def update_listener(request, **kwargs): name=data['listener'].get('name'), description=data['listener'].get('description'), connection_limit=data['listener'].get('connection_limit'), - admin_state_up=data['listener'].get('admin_state_up') + admin_state_up=data['listener'].get('admin_state_up'), + default_pool_id=data['listener'].get('default_pool_id'), ) if data.get('pool'): diff --git a/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/listener/listener.help.html b/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/listener/listener.help.html index bae971e3..d8ae8d79 100644 --- a/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/listener/listener.help.html +++ b/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/listener/listener.help.html @@ -24,3 +24,9 @@ Default value is -1 which represents infinite connections.

+

+ Default Pool ID: + + The ID of the pool used by the listener if no L7 policies match. + +

diff --git a/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/listener/listener.html b/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/listener/listener.html index 9d784a0e..a251d8b2 100644 --- a/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/listener/listener.html +++ b/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/listener/listener.html @@ -79,6 +79,21 @@ +
+
+ + +
+
+
diff --git a/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/model.service.js b/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/model.service.js index eff26953..a329604b 100644 --- a/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/model.service.js +++ b/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/model.service.js @@ -150,7 +150,8 @@ protocol: null, port: null, connection_limit: -1, - admin_state_up: true + admin_state_up: true, + default_pool_id: null }, pool: { id: null, @@ -175,7 +176,8 @@ admin_state_up: true }, members: [], - certificates: [] + certificates: [], + availablePools: [] }; if (!model.initializing) { @@ -286,7 +288,8 @@ function initEditListener() { model.context.submit = editListener; return $q.all([ - neutronAPI.getSubnets().then(onGetSubnets).then(getListener).then(onGetListener), + neutronAPI.getSubnets().then(onGetSubnets).then(getListener) + .then(onGetListener).then(getPools).then(onGetPools), neutronAPI.getPorts().then(onGetPorts), novaAPI.getServers().then(onGetServers) ]).then(initMemberAddresses); @@ -501,6 +504,20 @@ model.spec.listener.name = name; } + function onGetPools(response) { + angular.forEach(response.data.items, function addPool(pool) { + if (pool.listeners.length > 0 && pool.listeners[0].id !== model.spec.listener.id) { + return; + } + if (pool.protocol === model.spec.listener.protocol) { + model.spec.availablePools.push(pool.id); + } else if (pool.protocol === 'HTTP' && + model.spec.listener.protocol === 'TERMINATED_HTTPS') { + model.spec.availablePools.push(pool.id); + } + }); + } + function onGetSubnets(response) { model.subnets.length = 0; push.apply(model.subnets, response.data.items); @@ -563,6 +580,10 @@ return lbaasv2API.getPool(model.context.id, true); } + function getPools() { + return lbaasv2API.getPools(model.spec.loadbalancer_id); + } + function getMembers() { return lbaasv2API.getMembers(model.spec.parentResourceId); } @@ -650,6 +671,7 @@ spec.port = listener.protocol_port; spec.connection_limit = listener.connection_limit; spec.admin_state_up = listener.admin_state_up; + spec.default_pool_id = listener.default_pool_id; } function setPoolSpec(pool) { diff --git a/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/model.service.spec.js b/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/model.service.spec.js index b01ae577..731679c4 100644 --- a/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/model.service.spec.js +++ b/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/model.service.spec.js @@ -122,6 +122,18 @@ return deferred.promise; }, + getPools: function() { + var pools = [ + { id: '1234', name: 'Pool 1', listeners: [ '1234' ], protocol: 'HTTP' }, + { id: '5678', name: 'Pool 2', listeners: [], protocol: 'HTTP' }, + { id: '9012', name: 'Pool 3', listeners: [], protocol: 'HTTPS' } + ]; + + var deferred = $q.defer(); + deferred.resolve({ data: { items: pools } }); + + return deferred.promise; + }, getListener: function() { var deferred = $q.defer(); var listenerData; @@ -993,9 +1005,9 @@ // This is here to ensure that as people add/change spec properties, they don't forget // to implement tests for them. it('has the right number of properties', function() { - expect(Object.keys(model.spec).length).toBe(8); + expect(Object.keys(model.spec).length).toBe(9); expect(Object.keys(model.spec.loadbalancer).length).toBe(5); - expect(Object.keys(model.spec.listener).length).toBe(7); + expect(Object.keys(model.spec.listener).length).toBe(8); expect(Object.keys(model.spec.pool).length).toBe(8); expect(Object.keys(model.spec.monitor).length).toBe(10); expect(model.spec.members).toEqual([]); diff --git a/releasenotes/notes/edit-default-pool-on-listener-206d8dfeea135360.yaml b/releasenotes/notes/edit-default-pool-on-listener-206d8dfeea135360.yaml new file mode 100644 index 00000000..1e4aafef --- /dev/null +++ b/releasenotes/notes/edit-default-pool-on-listener-206d8dfeea135360.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + You can now change the default pool on listeners.