Add query mappings for vpnaas resources

Network VPNaaS resources like VPN service, IPSEC site connections etc
didn't have explicit query mappings.
Adding the query mappings allows to filter for e.g. project_id already
on the server instead of transferring the list of all resources and then
filter at the client side.
Affected resource types:
VpnService, VpnIPSecSiteConnection, VpnIpsecPolicy, VpnIkePolicy,
VpnEndpointGroup, LoadBalancer

Change-Id: I2c708de7dfc9f3be780e721248883e8a165b6294
This commit is contained in:
Bodo Petermann
2022-12-29 13:35:18 +01:00
parent b1d758c266
commit 0ea056f3a3
9 changed files with 62 additions and 0 deletions

View File

@@ -27,6 +27,12 @@ class LoadBalancer(resource.Resource):
allow_delete = True
allow_list = True
_query_mapping = resource.QueryParameters(
'description', 'name', 'project_id', 'provider', 'provisioning_status',
'tenant_id', 'vip_address', 'vip_subnet_id',
is_admin_state_up='admin_state_up'
)
# Properties
#: Description for the load balancer.
description = resource.Body('description')

View File

@@ -27,12 +27,19 @@ class VpnEndpointGroup(resource.Resource):
allow_delete = True
allow_list = True
_query_mapping = resource.QueryParameters(
'description', 'name', 'project_id', 'tenant_id',
type='endpoint_type'
)
# Properties
#: Human-readable description for the resource.
description = resource.Body('description')
#: List of endpoints of the same type, for the endpoint group.
#: The values will depend on type.
endpoints = resource.Body('endpoints', type=list)
#: Human-readable name of the resource. Default is an empty string.
name = resource.Body('name')
project_id = resource.Body('project_id', alias='tenant_id')
#: Tenant_id (deprecated attribute).
tenant_id = resource.Body('tenant_id', deprecated=True)

View File

@@ -26,6 +26,11 @@ class VpnIkePolicy(resource.Resource):
allow_delete = True
allow_list = True
_query_mapping = resource.QueryParameters(
'auth_algorithm', 'description', 'encryption_algorithm', 'ike_version',
'name', 'pfs', 'project_id', 'phase1_negotiation_mode',
)
# Properties
#: The authentication hash algorithm. Valid values are sha1,
# sha256, sha384, sha512. The default is sha1.

View File

@@ -25,6 +25,11 @@ class VpnIpsecPolicy(resource.Resource):
allow_delete = True
allow_list = True
_query_mapping = resource.QueryParameters(
'auth_algorithm', 'description', 'encryption_algorithm', 'name', 'pfs',
'project_id', 'phase1_negotiation_mode',
)
# Properties
#: The authentication hash algorithm. Valid values are sha1,
# sha256, sha384, sha512. The default is sha1.
@@ -40,6 +45,8 @@ class VpnIpsecPolicy(resource.Resource):
# portion of the lifetime. Default unit is seconds and
# default value is 3600.
lifetime = resource.Body('lifetime', type=dict)
#: Human-readable name of the resource. Default is an empty string.
name = resource.Body('name')
#: Perfect forward secrecy (PFS). A valid value is Group2,
# Group5, Group14, and so on. Default is Group5.
pfs = resource.Body('pfs')

View File

@@ -25,6 +25,14 @@ class VpnIPSecSiteConnection(resource.Resource):
allow_delete = True
allow_list = True
_query_mapping = resource.QueryParameters(
'auth_mode', 'description', 'ikepolicy_id', 'ipsecpolicy_id',
'initiator', 'local_ep_group_id', 'peer_address', 'local_id',
'mtu', 'name', 'peer_id', 'project_id', 'psk', 'peer_ep_group_id',
'route_mode', 'vpnservice_id', 'status',
is_admin_state_up='admin_state_up'
)
# Properties
#: The dead peer detection (DPD) action.
# A valid value is clear, hold, restart,
@@ -96,6 +104,8 @@ class VpnIPSecSiteConnection(resource.Resource):
peer_ep_group_id = resource.Body('peer_ep_group_id')
#: The route mode. A valid value is static, which is the default.
route_mode = resource.Body('route_mode')
#: The site connection status
status = resource.Body('status')
#: The dead peer detection (DPD) timeout
# in seconds. A valid value is a
# positive integer that is greater

View File

@@ -27,6 +27,12 @@ class VpnService(resource.Resource):
allow_delete = True
allow_list = True
_query_mapping = resource.QueryParameters(
'description', 'external_v4_ip', 'external_v6_ip', 'name', 'router_id',
'project_id', 'tenant_id', 'subnet_id',
is_admin_state_up='admin_state_up'
)
# Properties
#: Human-readable description for the vpnservice.
description = resource.Body('description')

View File

@@ -55,5 +55,10 @@ class TestVpnEndpointGroup(base.TestCase):
{
"limit": "limit",
"marker": "marker",
'description': 'description',
'name': 'name',
'project_id': 'project_id',
'tenant_id': 'tenant_id',
'type': 'endpoint_type',
},
sot._query_mapping._mapping)

View File

@@ -57,5 +57,12 @@ class TestVpnIpsecPolicy(base.TestCase):
{
"limit": "limit",
"marker": "marker",
'auth_algorithm': 'auth_algorithm',
'description': 'description',
'encryption_algorithm': 'encryption_algorithm',
'name': 'name',
'pfs': 'pfs',
'project_id': 'project_id',
'phase1_negotiation_mode': 'phase1_negotiation_mode',
},
sot._query_mapping._mapping)

View File

@@ -59,5 +59,14 @@ class TestVpnService(base.TestCase):
{
"limit": "limit",
"marker": "marker",
'description': 'description',
'external_v4_ip': 'external_v4_ip',
'external_v6_ip': 'external_v6_ip',
'name': 'name',
'router_id': 'router_id',
'project_id': 'project_id',
'tenant_id': 'tenant_id',
'subnet_id': 'subnet_id',
'is_admin_state_up': 'admin_state_up',
},
sot._query_mapping._mapping)