Add admin state up switch

Add admin state up switches to various steps of load balancer creation.

Change-Id: Ib4008fa1e1d00921040320e2d1b44d35bd38cef9
This commit is contained in:
Tom Weininger 2023-02-16 12:17:56 +01:00
parent a9370ef261
commit f6535f71d8
7 changed files with 60 additions and 7 deletions

View File

@ -0,0 +1,5 @@
---
features:
- |
Added "Admin State Up" switch to load balancer steps base, listener, pool
and health monitor.

View File

@ -82,6 +82,7 @@
"Additional routes announced to the instance, one entry per line(e.g. {ip})": "Additional routes announced to the instance, one entry per line(e.g. {ip})", "Additional routes announced to the instance, one entry per line(e.g. {ip})": "Additional routes announced to the instance, one entry per line(e.g. {ip})",
"Addresses": "Addresses", "Addresses": "Addresses",
"Admin State": "Admin State", "Admin State": "Admin State",
"Admin State Up": "Admin State Up",
"Admin Status": "Admin Status", "Admin Status": "Admin Status",
"Administrator": "Administrator", "Administrator": "Administrator",
"Adopt Complete": "Adopt Complete", "Adopt Complete": "Adopt Complete",
@ -634,6 +635,10 @@
"Default Policy": "Default Policy", "Default Policy": "Default Policy",
"Default is slaac, for details, see https://docs.openstack.org/neutron/latest/admin/config-ipv6.html": "Default is slaac, for details, see https://docs.openstack.org/neutron/latest/admin/config-ipv6.html", "Default is slaac, for details, see https://docs.openstack.org/neutron/latest/admin/config-ipv6.html": "Default is slaac, for details, see https://docs.openstack.org/neutron/latest/admin/config-ipv6.html",
"Defaults": "Defaults", "Defaults": "Defaults",
"Defines the admin state of the health monitor.": "Defines the admin state of the health monitor.",
"Defines the admin state of the listener.": "Defines the admin state of the listener.",
"Defines the admin state of the pool.": "Defines the admin state of the pool.",
"Defines the admin state of the port.": "Defines the admin state of the port.",
"Degraded": "Degraded", "Degraded": "Degraded",
"Delay Interval(s)": "Delay Interval(s)", "Delay Interval(s)": "Delay Interval(s)",
"Delete": "Delete", "Delete": "Delete",

View File

@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { inject, observer } from 'mobx-react';
import Base from 'components/Form'; import Base from 'components/Form';
import { LbaasStore } from 'stores/octavia/loadbalancer'; import { inject, observer } from 'mobx-react';
import { NetworkStore } from 'stores/neutron/network'; import { NetworkStore } from 'stores/neutron/network';
import { SubnetStore } from 'stores/neutron/subnet'; import { SubnetStore } from 'stores/neutron/subnet';
import { LbaasStore } from 'stores/octavia/loadbalancer';
export class BaseStep extends Base { export class BaseStep extends Base {
init() { init() {
@ -40,6 +40,7 @@ export class BaseStep extends Base {
get defaultValue() { get defaultValue() {
return { return {
project_id: this.props.rootStore.user.project.id, project_id: this.props.rootStore.user.project.id,
admin_state_enabled: true,
}; };
} }
@ -79,7 +80,10 @@ export class BaseStep extends Base {
}; };
get formItems() { get formItems() {
const { network_id, subnetDetails = [] } = this.state; const {
network_id,
subnetDetails = [],
} = this.state;
return [ return [
{ {
name: 'name', name: 'name',
@ -110,6 +114,12 @@ export class BaseStep extends Base {
hidden: !network_id, hidden: !network_id,
required: true, required: true,
}, },
{
name: 'admin_state_enabled',
label: t('Admin State Up'),
type: 'switch',
tip: t('Defines the admin state of the port.'),
},
]; ];
} }
} }

View File

@ -82,6 +82,7 @@ export class StepCreate extends StepAction {
description, description,
vip_address, vip_address,
vip_network_id, vip_network_id,
admin_state_enabled,
enableHealthMonitor, enableHealthMonitor,
listener_protocol, listener_protocol,
listener_ssl_parsing_method, listener_ssl_parsing_method,
@ -89,6 +90,9 @@ export class StepCreate extends StepAction {
listener_default_tls_container_ref, listener_default_tls_container_ref,
listener_client_ca_tls_container_ref, listener_client_ca_tls_container_ref,
listener_sni_container_refs, listener_sni_container_refs,
listener_admin_state_up,
pool_admin_state_up,
monitor_admin_state_up,
...rest ...rest
} = values; } = values;
const data = { const data = {
@ -101,8 +105,10 @@ export class StepCreate extends StepAction {
if (ip_address && ip_address.ip) { if (ip_address && ip_address.ip) {
data.vip_address = ip_address.ip; data.vip_address = ip_address.ip;
} }
data.admin_state_up = admin_state_enabled;
const listenerData = { const listenerData = {
admin_state_up: listener_admin_state_up,
protocol: listener_protocol, protocol: listener_protocol,
}; };
@ -127,8 +133,8 @@ export class StepCreate extends StepAction {
} }
} }
const poolData = {}; const poolData = { admin_state_up: pool_admin_state_up };
const healthMonitorData = {}; const healthMonitorData = { admin_state_up: monitor_admin_state_up };
Object.keys(rest).forEach((i) => { Object.keys(rest).forEach((i) => {
if (i.indexOf('listener') === 0) { if (i.indexOf('listener') === 0) {
listenerData[i.replace('listener_', '')] = values[i]; listenerData[i.replace('listener_', '')] = values[i];

View File

@ -41,13 +41,15 @@ export class HealthMonitorStep extends Base {
health_timeout: 3, health_timeout: 3,
health_max_retries: 3, health_max_retries: 3,
health_type: '', health_type: '',
monitor_admin_state_up: true,
}; };
} }
allowed = () => Promise.resolve(); allowed = () => Promise.resolve();
get formItems() { get formItems() {
const { health_delay, enableHealthMonitor } = this.state; const {health_delay, enableHealthMonitor} =
this.state;
return [ return [
{ {
name: 'enableHealthMonitor', name: 'enableHealthMonitor',
@ -116,6 +118,12 @@ export class HealthMonitorStep extends Base {
required: true, required: true,
hidden: !enableHealthMonitor, hidden: !enableHealthMonitor,
}, },
{
name: 'monitor_admin_state_up',
label: t('Admin State Up'),
type: 'switch',
tip: t('Defines the admin state of the health monitor.'),
},
]; ];
} }
} }

View File

@ -67,6 +67,7 @@ export class ListenerStep extends Base {
listener_ssl_parsing_method: 'one-way', listener_ssl_parsing_method: 'one-way',
listener_sni_enabled: false, listener_sni_enabled: false,
listener_connection_limit: -1, listener_connection_limit: -1,
listener_admin_state_up: true,
}; };
} }
@ -195,6 +196,12 @@ export class ListenerStep extends Base {
extra: t('-1 means no connection limit'), extra: t('-1 means no connection limit'),
required: true, required: true,
}, },
{
name: 'listener_admin_state_up',
label: t('Admin State Up'),
type: 'switch',
tip: t('Defines the admin state of the listener.'),
},
]; ];
} }
} }

View File

@ -49,8 +49,14 @@ export class PoolStep extends Base {
}); });
}; };
get defaultValue() {
return {
pool_admin_state_up: true,
};
}
get formItems() { get formItems() {
const { pool_lb_algorithm } = this.state; const {pool_lb_algorithm} = this.state;
return [ return [
{ {
name: 'pool_name', name: 'pool_name',
@ -84,6 +90,12 @@ export class PoolStep extends Base {
}, },
required: true, required: true,
}, },
{
name: 'pool_admin_state_up',
label: t('Admin State Up'),
type: 'switch',
tip: t('Defines the admin state of the pool.'),
},
]; ];
} }
} }