Being able to edit default pool of listener
Change-Id: I4607d41156994b865a28f7eb63b2f7877105b93b Story: 1713859 Task: 5450
This commit is contained in:
parent
9711760b33
commit
e9b3988a9d
@ -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'):
|
||||
|
@ -24,3 +24,9 @@
|
||||
Default value is -1 which represents infinite connections.
|
||||
</translate>
|
||||
</p>
|
||||
<p>
|
||||
<strong translate>Default Pool ID:</strong>
|
||||
<translate>
|
||||
The ID of the pool used by the listener if no L7 policies match.
|
||||
</translate>
|
||||
</p>
|
||||
|
@ -79,6 +79,21 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-sm-8 col-md-6" ng-if="model.context.id">
|
||||
<div class="form-group required">
|
||||
<label class="control-label required">
|
||||
<translate>Default Pool ID</translate>
|
||||
<span class="hz-icon-required fa fa-asterisk"></span>
|
||||
</label>
|
||||
<select class="form-control" name="default_pool_id" id="default_pool_id"
|
||||
ng-model="model.spec.listener.default_pool_id" ng-required="true">
|
||||
<option ng-repeat="pool_id in model.spec.availablePools" value="{$ pool_id $}">
|
||||
{$ pool_id $}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
@ -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) {
|
||||
|
@ -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([]);
|
||||
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
You can now change the default pool on listeners.
|
Loading…
Reference in New Issue
Block a user