Allow filtering BGPVPNs

BGPVPNs can be filtered server-side when being listed. The most
interesting filters here are for routers, networks and ports, as these
allow to filter for a specific association the BGPVPN has, but the other
filter options might come in handy as well.

route|import|export-target support only exact matches in the BGPVPN API,
meaning all entries need to be given in the right order as a comma
separated string. As this is quiet counter-intuitive for a user (that
might expect they could provide only one or unsorted entries) these
attributes have been left out.

Change-Id: I355b6584e115cf70a7fd040a24d30f9686555b85
This commit is contained in:
Sebastian Lohff 2024-04-18 12:27:37 +02:00
parent 8c6a129b8c
commit 761d558e17
3 changed files with 28 additions and 0 deletions

View File

@ -27,6 +27,19 @@ class BgpVpn(resource.Resource):
allow_delete = True
allow_list = True
_query_mapping = resource.QueryParameters(
'name',
'project_id',
'local_pref',
'vni',
'type',
'networks',
'routers',
'ports',
# NOTE(seba): (route|import|export) targets only support exact matches
# and have therefore been left out
)
# Properties
#: The Id of the BGPVPN
id = resource.Body('id')

View File

@ -62,6 +62,14 @@ class TestBgpVpn(base.TestCase):
{
'limit': 'limit',
'marker': 'marker',
'local_pref': 'local_pref',
'name': 'name',
'networks': 'networks',
'routers': 'routers',
'ports': 'ports',
'project_id': 'project_id',
'type': 'type',
'vni': 'vni',
},
sot._query_mapping._mapping,
)

View File

@ -0,0 +1,7 @@
---
features:
- |
``openstack.network.v2.bgpvpn.BgpVpn`` can now be filtered by its
associations to `networks`, `routers` and `ports. Additionally,
filtering for the attributes `name`, `project_id`, `local_pref`, `vni`
and `type` is now done on server-side.