fix: Fix create ipv6 subnet with ipv6_address_mode
fix create ipv6 subnet with ipv6_address_mode Change-Id: I9edfea47a00d00087e5b941ce50727e751906418
This commit is contained in:
parent
5c3c89c78a
commit
6eddd6e927
@ -156,6 +156,7 @@ export default class FormItem extends React.Component {
|
|||||||
optionFilterProp = 'label',
|
optionFilterProp = 'label',
|
||||||
checkOptions,
|
checkOptions,
|
||||||
checkBoxInfo,
|
checkBoxInfo,
|
||||||
|
allowClear,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
return {
|
return {
|
||||||
options,
|
options,
|
||||||
@ -169,6 +170,7 @@ export default class FormItem extends React.Component {
|
|||||||
optionFilterProp,
|
optionFilterProp,
|
||||||
checkOptions,
|
checkOptions,
|
||||||
checkBoxInfo,
|
checkBoxInfo,
|
||||||
|
allowClear,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
|
@ -400,6 +400,42 @@ export class CreateNetwork extends ModalAction {
|
|||||||
required: true,
|
required: true,
|
||||||
hidden: !create_subnet,
|
hidden: !create_subnet,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'ipv6_ra_mode',
|
||||||
|
label: t('Router Advertisements Mode'),
|
||||||
|
type: 'select',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: 'dhcpv6-stateful',
|
||||||
|
value: 'dhcpv6-stateful',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'dhcpv6-stateless',
|
||||||
|
value: 'dhcpv6-stateless',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'slaac',
|
||||||
|
value: 'slaac',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
hidden: ip_version !== 'ipv6',
|
||||||
|
dependencies: ['ipv6_address_mode'],
|
||||||
|
allowClear: true,
|
||||||
|
validator: (rule, value) => {
|
||||||
|
const ipv6_address_mode =
|
||||||
|
(this.formRef.current &&
|
||||||
|
this.formRef.current.getFieldValue('ipv6_address_mode')) ||
|
||||||
|
undefined;
|
||||||
|
// https://docs.openstack.org/neutron/xena/admin/config-ipv6.html
|
||||||
|
if (!value && ipv6_address_mode) {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
if (ipv6_address_mode && ipv6_address_mode !== value) {
|
||||||
|
return Promise.reject(new Error(t('Invalid combination')));
|
||||||
|
}
|
||||||
|
return Promise.resolve();
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'ipv6_address_mode',
|
name: 'ipv6_address_mode',
|
||||||
label: t('IP Distribution Mode'),
|
label: t('IP Distribution Mode'),
|
||||||
@ -419,6 +455,8 @@ export class CreateNetwork extends ModalAction {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
hidden: ip_version !== 'ipv6',
|
hidden: ip_version !== 'ipv6',
|
||||||
|
dependencies: ['ipv6_ra_mode'],
|
||||||
|
allowClear: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'cidr',
|
name: 'cidr',
|
||||||
|
@ -177,6 +177,42 @@ export default class CreateSubnet extends ModalAction {
|
|||||||
},
|
},
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'ipv6_ra_mode',
|
||||||
|
label: t('Router Advertisements Mode'),
|
||||||
|
type: 'select',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: 'dhcpv6-stateful',
|
||||||
|
value: 'dhcpv6-stateful',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'dhcpv6-stateless',
|
||||||
|
value: 'dhcpv6-stateless',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'slaac',
|
||||||
|
value: 'slaac',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
hidden: ip_version !== 'ipv6',
|
||||||
|
dependencies: ['ipv6_address_mode'],
|
||||||
|
allowClear: true,
|
||||||
|
validator: (rule, value) => {
|
||||||
|
const ipv6_address_mode =
|
||||||
|
(this.formRef.current &&
|
||||||
|
this.formRef.current.getFieldValue('ipv6_address_mode')) ||
|
||||||
|
undefined;
|
||||||
|
// https://docs.openstack.org/neutron/xena/admin/config-ipv6.html
|
||||||
|
if (!value && ipv6_address_mode) {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
if (ipv6_address_mode && ipv6_address_mode !== value) {
|
||||||
|
return Promise.reject(new Error(t('Invalid combination')));
|
||||||
|
}
|
||||||
|
return Promise.resolve();
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'ipv6_address_mode',
|
name: 'ipv6_address_mode',
|
||||||
label: t('IP Distribution Mode'),
|
label: t('IP Distribution Mode'),
|
||||||
@ -196,6 +232,7 @@ export default class CreateSubnet extends ModalAction {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
hidden: ip_version !== 'ipv6',
|
hidden: ip_version !== 'ipv6',
|
||||||
|
allowClear: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'cidr',
|
name: 'cidr',
|
||||||
|
@ -306,6 +306,8 @@ export class NetworkStore extends Base {
|
|||||||
subnet_name,
|
subnet_name,
|
||||||
enable_dhcp,
|
enable_dhcp,
|
||||||
ip_version,
|
ip_version,
|
||||||
|
ipv6_address_mode,
|
||||||
|
ipv6_ra_mode,
|
||||||
gateway_ip,
|
gateway_ip,
|
||||||
cidr,
|
cidr,
|
||||||
disable_gateway,
|
disable_gateway,
|
||||||
@ -323,6 +325,10 @@ export class NetworkStore extends Base {
|
|||||||
gateway_ip: disable_gateway ? null : gateway_ip,
|
gateway_ip: disable_gateway ? null : gateway_ip,
|
||||||
cidr,
|
cidr,
|
||||||
};
|
};
|
||||||
|
if (data.ip_version === 6) {
|
||||||
|
data.ipv6_address_mode = ipv6_address_mode;
|
||||||
|
data.ipv6_ra_mode = ipv6_ra_mode;
|
||||||
|
}
|
||||||
return this.subnetClient.create({ subnet: data });
|
return this.subnetClient.create({ subnet: data });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user