From f6535f71d8197ba5e6357097ed93840f9d721a8a Mon Sep 17 00:00:00 2001 From: Tom Weininger Date: Thu, 16 Feb 2023 12:17:56 +0100 Subject: [PATCH] Add admin state up switch Add admin state up switches to various steps of load balancer creation. Change-Id: Ib4008fa1e1d00921040320e2d1b44d35bd38cef9 --- ...e-loadbalancer-switches-721264bd7d7bcf75.yaml | 5 +++++ src/locales/en.json | 5 +++++ .../actions/StepCreate/BaseStep/index.jsx | 16 +++++++++++++--- .../actions/StepCreate/index.jsx | 10 ++++++++-- .../HealthMonitorStep/index.jsx | 10 +++++++++- .../StepCreateComponents/ListenerStep/index.jsx | 7 +++++++ .../StepCreateComponents/PoolStep/index.jsx | 14 +++++++++++++- 7 files changed, 60 insertions(+), 7 deletions(-) create mode 100644 releasenotes/notes/add-admin-state-loadbalancer-switches-721264bd7d7bcf75.yaml diff --git a/releasenotes/notes/add-admin-state-loadbalancer-switches-721264bd7d7bcf75.yaml b/releasenotes/notes/add-admin-state-loadbalancer-switches-721264bd7d7bcf75.yaml new file mode 100644 index 00000000..ac78ea4a --- /dev/null +++ b/releasenotes/notes/add-admin-state-loadbalancer-switches-721264bd7d7bcf75.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Added "Admin State Up" switch to load balancer steps base, listener, pool + and health monitor. diff --git a/src/locales/en.json b/src/locales/en.json index 861b5851..143be4ad 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -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})", "Addresses": "Addresses", "Admin State": "Admin State", + "Admin State Up": "Admin State Up", "Admin Status": "Admin Status", "Administrator": "Administrator", "Adopt Complete": "Adopt Complete", @@ -634,6 +635,10 @@ "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", "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", "Delay Interval(s)": "Delay Interval(s)", "Delete": "Delete", diff --git a/src/pages/network/containers/LoadBalancers/LoadBalancerInstance/actions/StepCreate/BaseStep/index.jsx b/src/pages/network/containers/LoadBalancers/LoadBalancerInstance/actions/StepCreate/BaseStep/index.jsx index f248e378..7e977f4b 100644 --- a/src/pages/network/containers/LoadBalancers/LoadBalancerInstance/actions/StepCreate/BaseStep/index.jsx +++ b/src/pages/network/containers/LoadBalancers/LoadBalancerInstance/actions/StepCreate/BaseStep/index.jsx @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { inject, observer } from 'mobx-react'; import Base from 'components/Form'; -import { LbaasStore } from 'stores/octavia/loadbalancer'; +import { inject, observer } from 'mobx-react'; import { NetworkStore } from 'stores/neutron/network'; import { SubnetStore } from 'stores/neutron/subnet'; +import { LbaasStore } from 'stores/octavia/loadbalancer'; export class BaseStep extends Base { init() { @@ -40,6 +40,7 @@ export class BaseStep extends Base { get defaultValue() { return { project_id: this.props.rootStore.user.project.id, + admin_state_enabled: true, }; } @@ -79,7 +80,10 @@ export class BaseStep extends Base { }; get formItems() { - const { network_id, subnetDetails = [] } = this.state; + const { + network_id, + subnetDetails = [], + } = this.state; return [ { name: 'name', @@ -110,6 +114,12 @@ export class BaseStep extends Base { hidden: !network_id, required: true, }, + { + name: 'admin_state_enabled', + label: t('Admin State Up'), + type: 'switch', + tip: t('Defines the admin state of the port.'), + }, ]; } } diff --git a/src/pages/network/containers/LoadBalancers/LoadBalancerInstance/actions/StepCreate/index.jsx b/src/pages/network/containers/LoadBalancers/LoadBalancerInstance/actions/StepCreate/index.jsx index d15d7fcd..697dd143 100644 --- a/src/pages/network/containers/LoadBalancers/LoadBalancerInstance/actions/StepCreate/index.jsx +++ b/src/pages/network/containers/LoadBalancers/LoadBalancerInstance/actions/StepCreate/index.jsx @@ -82,6 +82,7 @@ export class StepCreate extends StepAction { description, vip_address, vip_network_id, + admin_state_enabled, enableHealthMonitor, listener_protocol, listener_ssl_parsing_method, @@ -89,6 +90,9 @@ export class StepCreate extends StepAction { listener_default_tls_container_ref, listener_client_ca_tls_container_ref, listener_sni_container_refs, + listener_admin_state_up, + pool_admin_state_up, + monitor_admin_state_up, ...rest } = values; const data = { @@ -101,8 +105,10 @@ export class StepCreate extends StepAction { if (ip_address && ip_address.ip) { data.vip_address = ip_address.ip; } + data.admin_state_up = admin_state_enabled; const listenerData = { + admin_state_up: listener_admin_state_up, protocol: listener_protocol, }; @@ -127,8 +133,8 @@ export class StepCreate extends StepAction { } } - const poolData = {}; - const healthMonitorData = {}; + const poolData = { admin_state_up: pool_admin_state_up }; + const healthMonitorData = { admin_state_up: monitor_admin_state_up }; Object.keys(rest).forEach((i) => { if (i.indexOf('listener') === 0) { listenerData[i.replace('listener_', '')] = values[i]; diff --git a/src/pages/network/containers/LoadBalancers/StepCreateComponents/HealthMonitorStep/index.jsx b/src/pages/network/containers/LoadBalancers/StepCreateComponents/HealthMonitorStep/index.jsx index b36975fe..db0c3a69 100644 --- a/src/pages/network/containers/LoadBalancers/StepCreateComponents/HealthMonitorStep/index.jsx +++ b/src/pages/network/containers/LoadBalancers/StepCreateComponents/HealthMonitorStep/index.jsx @@ -41,13 +41,15 @@ export class HealthMonitorStep extends Base { health_timeout: 3, health_max_retries: 3, health_type: '', + monitor_admin_state_up: true, }; } allowed = () => Promise.resolve(); get formItems() { - const { health_delay, enableHealthMonitor } = this.state; + const {health_delay, enableHealthMonitor} = + this.state; return [ { name: 'enableHealthMonitor', @@ -116,6 +118,12 @@ export class HealthMonitorStep extends Base { required: true, hidden: !enableHealthMonitor, }, + { + name: 'monitor_admin_state_up', + label: t('Admin State Up'), + type: 'switch', + tip: t('Defines the admin state of the health monitor.'), + }, ]; } } diff --git a/src/pages/network/containers/LoadBalancers/StepCreateComponents/ListenerStep/index.jsx b/src/pages/network/containers/LoadBalancers/StepCreateComponents/ListenerStep/index.jsx index 39cc14a0..7bc83bb4 100644 --- a/src/pages/network/containers/LoadBalancers/StepCreateComponents/ListenerStep/index.jsx +++ b/src/pages/network/containers/LoadBalancers/StepCreateComponents/ListenerStep/index.jsx @@ -67,6 +67,7 @@ export class ListenerStep extends Base { listener_ssl_parsing_method: 'one-way', listener_sni_enabled: false, 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'), required: true, }, + { + name: 'listener_admin_state_up', + label: t('Admin State Up'), + type: 'switch', + tip: t('Defines the admin state of the listener.'), + }, ]; } } diff --git a/src/pages/network/containers/LoadBalancers/StepCreateComponents/PoolStep/index.jsx b/src/pages/network/containers/LoadBalancers/StepCreateComponents/PoolStep/index.jsx index ead2f212..893d06b2 100644 --- a/src/pages/network/containers/LoadBalancers/StepCreateComponents/PoolStep/index.jsx +++ b/src/pages/network/containers/LoadBalancers/StepCreateComponents/PoolStep/index.jsx @@ -49,8 +49,14 @@ export class PoolStep extends Base { }); }; + get defaultValue() { + return { + pool_admin_state_up: true, + }; + } + get formItems() { - const { pool_lb_algorithm } = this.state; + const {pool_lb_algorithm} = this.state; return [ { name: 'pool_name', @@ -84,6 +90,12 @@ export class PoolStep extends Base { }, required: true, }, + { + name: 'pool_admin_state_up', + label: t('Admin State Up'), + type: 'switch', + tip: t('Defines the admin state of the pool.'), + }, ]; } }