Use explicit "dict_or_nodata" validation for "external_gateway_info"

That API definition will be used during the policy check to create the
needed rule for each internal GW info element, specifically with the
external network fixed IPs. Only the owner of the external network or
the administrator can create fixed IPs on the external network.

Change-Id: Ia70485ed7713436dd6433ed39ae721500dbed7dd
Closes-Bug: #1940224
This commit is contained in:
Rodolfo Alonso Hernandez
2021-08-17 16:39:38 +00:00
parent 599038af02
commit c6f576e66b

View File

@@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron_lib.api import converters
from neutron_lib.api.definitions import l3
@@ -34,7 +35,18 @@ RESOURCE_ATTRIBUTE_MAP = {
'is_visible': True,
'default': None,
'enforce_policy': True,
'validate': {'type:external_gw_info': None},
'validate': {
'type:dict_or_nodata': {
'network_id': {'type:uuid': None, 'required': True},
'enable_snat': {'type:boolean': None, 'required': False,
'convert_to':
converters.convert_to_boolean},
'external_fixed_ips': {
'type:fixed_ips': None,
'required': False
}
}
}
}
}
}