diff --git a/doc/source/user/proxies/network.rst b/doc/source/user/proxies/network.rst index 748d78d98..4ce20b92b 100644 --- a/doc/source/user/proxies/network.rst +++ b/doc/source/user/proxies/network.rst @@ -314,3 +314,18 @@ Tap As A Service Operations :members: create_tap_flow, delete_tap_flow, find_tap_flow, get_tap_flow, update_tap_flow, tap_flows, create_tap_service, delete_tap_service, find_tap_service, update_tap_service, tap_services + +BGPVPN operations +^^^^^^^^^^^^^^^^^ + +.. autoclass:: openstack.network.v2._proxy.Proxy + :noindex: + :members: create_bgpvpn, delete_bgpvpn, find_bgpvpn, get_bgpvpn, + update_bgpvpn, bgpvpns, create_bgpvpn_network_association, + delete_bgpvpn_network_association, get_bgpvpn_network_association, + bgpvpn_network_associations, create_bgpvpn_port_association, + delete_bgpvpn_port_association, find_bgpvpn_port_association, + get_bgpvpn_port_association, update_bgpvpn_port_association, + bgpvpn_port_associations, create_bgpvpn_router_association, + delete_bgpvpn_router_association, get_bgpvpn_router_association, + update_bgpvpn_router_association, bgpvpn_router_associations diff --git a/doc/source/user/resources/network/index.rst b/doc/source/user/resources/network/index.rst index aa13d628a..167c47746 100644 --- a/doc/source/user/resources/network/index.rst +++ b/doc/source/user/resources/network/index.rst @@ -11,6 +11,10 @@ Network Resources v2/availability_zone v2/bgp_peer v2/bgp_speaker + v2/bgpvpn + v2/bgpvpn_network_association + v2/bgpvpn_port_association + v2/bgpvpn_router_association v2/extension v2/flavor v2/floating_ip diff --git a/doc/source/user/resources/network/v2/bgpvpn.rst b/doc/source/user/resources/network/v2/bgpvpn.rst new file mode 100644 index 000000000..4c5d8af03 --- /dev/null +++ b/doc/source/user/resources/network/v2/bgpvpn.rst @@ -0,0 +1,12 @@ +openstack.network.v2.bgpvpn +============================= + +.. automodule:: openstack.network.v2.bgpvpn + +The BgpVpn Class +----------------- + +The ``BgpVpn`` class inherits from :class:`~openstack.resource.Resource`. + +.. autoclass:: openstack.network.v2.bgpvpn.BgpVpn + :members: diff --git a/doc/source/user/resources/network/v2/bgpvpn_network_association.rst b/doc/source/user/resources/network/v2/bgpvpn_network_association.rst new file mode 100644 index 000000000..9d78df436 --- /dev/null +++ b/doc/source/user/resources/network/v2/bgpvpn_network_association.rst @@ -0,0 +1,13 @@ +openstack.network.v2.bgpvpn_network_association +=============================================== + +.. automodule:: openstack.network.v2.bgpvpn_network_association + +The BgpVpnNetworkAssociation Class +---------------------------------- + +The ``BgpVpnNetworkAssociation`` class inherits from +:class:`~openstack.resource.Resource`. + +.. autoclass:: openstack.network.v2.bgpvpn_network_association.BgpVpnNetworkAssociation + :members: diff --git a/doc/source/user/resources/network/v2/bgpvpn_port_association.rst b/doc/source/user/resources/network/v2/bgpvpn_port_association.rst new file mode 100644 index 000000000..07584c1aa --- /dev/null +++ b/doc/source/user/resources/network/v2/bgpvpn_port_association.rst @@ -0,0 +1,13 @@ +openstack.network.v2.bgpvpn_port_association +============================================ + +.. automodule:: openstack.network.v2.bgpvpn_port_association + +The BgpVpnPortAssociation Class +------------------------------- + +The ``BgpVpnPortAssociation`` class inherits from +:class:`~openstack.resource.Resource`. + +.. autoclass:: openstack.network.v2.bgpvpn_port_association.BgpVpnPortAssociation + :members: diff --git a/doc/source/user/resources/network/v2/bgpvpn_router_association.rst b/doc/source/user/resources/network/v2/bgpvpn_router_association.rst new file mode 100644 index 000000000..4f046da7e --- /dev/null +++ b/doc/source/user/resources/network/v2/bgpvpn_router_association.rst @@ -0,0 +1,13 @@ +openstack.network.v2.bgpvpn_router_association +============================================== + +.. automodule:: openstack.network.v2.bgpvpn_router_association + +The BgpVpnRouterAssociation Class +--------------------------------- + +The ``BgpVpnRouterAssociation`` class inherits from +:class:`~openstack.resource.Resource`. + +.. autoclass:: openstack.network.v2.bgpvpn_router_association.BgpVpnRouterAssociation + :members: diff --git a/openstack/network/v2/_proxy.py b/openstack/network/v2/_proxy.py index 51272e72c..dd7140abc 100644 --- a/openstack/network/v2/_proxy.py +++ b/openstack/network/v2/_proxy.py @@ -23,6 +23,13 @@ from openstack.network.v2 import auto_allocated_topology as \ from openstack.network.v2 import availability_zone from openstack.network.v2 import bgp_peer as _bgp_peer from openstack.network.v2 import bgp_speaker as _bgp_speaker +from openstack.network.v2 import bgpvpn as _bgpvpn +from openstack.network.v2 import bgpvpn_network_association as \ + _bgpvpn_network_association +from openstack.network.v2 import bgpvpn_port_association as \ + _bgpvpn_port_association +from openstack.network.v2 import bgpvpn_router_association as \ + _bgpvpn_router_association from openstack.network.v2 import extension from openstack.network.v2 import firewall_group as _firewall_group from openstack.network.v2 import firewall_policy as _firewall_policy @@ -90,6 +97,13 @@ class Proxy(proxy.Proxy, Generic[T]): "availability_zone": availability_zone.AvailabilityZone, "bgp_peer": _bgp_peer.BgpPeer, "bgp_speaker": _bgp_speaker.BgpSpeaker, + "bgpvpn": _bgpvpn.BgpVpn, + "bgpvpn_network_association": + _bgpvpn_network_association.BgpVpnNetworkAssociation, + "bgpvpn_port_association": + _bgpvpn_port_association.BgpVpnPortAssociation, + "bgpvpn_router_association": + _bgpvpn_router_association.BgpVpnRouterAssociation, "extension": extension.Extension, "firewall_group": _firewall_group.FirewallGroup, "firewall_policy": _firewall_policy.FirewallPolicy, @@ -646,6 +660,385 @@ class Proxy(proxy.Proxy, Generic[T]): speaker = self._get_resource(_bgp_speaker.BgpSpeaker, bgp_speaker_id) speaker.remove_bgp_speaker_from_dragent(self, bgp_agent) + def create_bgpvpn(self, **attrs): + """Create a new BGPVPN + + :param attrs: Keyword arguments which will be used to create a + :class:`~openstack.network.v2.bgpvpn.BgpVpn`, comprised of the + properties on the BGPVPN class, for details see the Neutron + api-ref. + + :returns: The result of BGPVPN creation + :rtype: :class:`~openstack.network.v2.bgpvpn.BgpVpn` + """ + return self._create(_bgpvpn.BgpVpn, **attrs) + + def delete_bgpvpn(self, bgpvpn, ignore_missing=True): + """Delete a BGPVPN + + :param bgpvpn: The value can be either the ID of a bgpvpn or + a :class:`~openstack.network.v2.bgpvpn.BgpVpn` instance. + :param bool ignore_missing: When set to ``False`` + :class:`~openstack.exceptions.ResourceNotFound` will be + raised when the BGPVPN does not exist. + When set to ``True``, no exception will be set when + attempting to delete a nonexistent BGPVPN. + + :returns: ``None`` + """ + self._delete(_bgpvpn.BgpVpn, bgpvpn, ignore_missing=ignore_missing) + + def find_bgpvpn(self, name_or_id, ignore_missing=True, **query): + """"Find a single BGPVPN + + :param name_or_id: The name or ID of a BGPVPN. + :param bool ignore_missing: When set to ``False`` + :class:`~openstack.exceptions.ResourceNotFound` will be + raised when the resource does not exist. + When set to ``True``, None will be returned when + attempting to find a nonexistent resource. + :param dict query: Any additional parameters to be passed into + underlying methods. such as query filters. + :returns: One :class:`~openstack.network.v2.bgpvpn.BGPVPN` + or None + """ + return self._find(_bgpvpn.BgpVpn, name_or_id, + ignore_missing=ignore_missing, **query) + + def get_bgpvpn(self, bgpvpn): + """Get a signle BGPVPN + + :param bgpvpn: The value can be the ID of a BGPVPN or a + :class:`~openstack.network.v2.bgpvpn.BgpVpn` instance. + + :returns: One :class:`~openstack.network.v2.bgpvpn.BgpVpn` + :raises: :class:`~openstack.exceptions.ResourceNotFound` + when no resource can be found. + """ + return self._get(_bgpvpn.BgpVpn, bgpvpn) + + def update_bgpvpn(self, bgppvpn, **attrs): + """Update a BGPVPN + + :param bgpvpn: Either the ID of a BGPVPN or a + :class:`~openstack.network.v2.bgpvpn.BgpVpn` instance. + :param attrs: The attributes to update on the BGPVPN represented + by ``value``. + + :returns: The updated BGPVPN + :rtype: :class:`~openstack.network.v2.bgpvpn.BgpVpn` + """ + return self._update(_bgpvpn.BgpVpn, bgppvpn, **attrs) + + def bgpvpns(self, **query): + """Return a generator of BGP VPNs + + :param dict query: Optional query parameters to be sent to limit + the resources being returned. + + :returns: A generator of BgpVPN objects + :rtype: :class:`~openstack.network.v2.bgpvpn.BgpVpn` + """ + return self._list(_bgpvpn.BgpVpn, **query) + + def create_bgpvpn_network_association(self, bgpvpn, **attrs): + """Create a new BGPVPN Network Association + + :param bgpvpn: The value can be either the ID of a bgpvpn or + a :class:`~openstack.network.v2.bgpvpn.BgpVpn` instance. + :param attrs: Keyword arguments which will be used to create + a :class:`~openstack.network.v2.bgpvpn_network_association. + BgpVpnNetworkAssociation`, + comprised of the properties on the BgpVpnNetworkAssociation class. + + :returns: The results of BgpVpnNetworkAssociation creation + :rtype: :class:`~openstack.network.v2.bgpvpn_network_association. + BgpVpnNetworkAssociation` + """ + bgpvpn_res = self._get_resource(_bgpvpn.BgpVpn, bgpvpn) + return self._create( + _bgpvpn_network_association.BgpVpnNetworkAssociation, + bgpvpn_id=bgpvpn_res.id, **attrs) + + def delete_bgpvpn_network_association(self, bgpvpn, net_association, + ignore_missing=True): + """Delete a BGPVPN Network Association + + :param bgpvpn: The value can be either the ID of a bgpvpn or + a :class:`~openstack.network.v2.bgpvpn.BgpVpn` instance. + :param net_association: The value can be either the ID of a + bgpvpn_network_association or + a :class:`~openstack.network.v2.bgpvpn_network_association. + BgpVpnNetworkAssociation` instance. + :param bool ignore_missing: When set to ``False`` + :class:`~openstack.exceptions.ResourceNotFound` will be + raised when the BgpVpnNetworkAssociation does not exist. + When set to ``True``, no exception will be set when + attempting to delete a nonexistent BgpVpnNetworkAssociation. + + :returns: ``None`` + """ + bgpvpn_res = self._get_resource(_bgpvpn.BgpVpn, bgpvpn) + self._delete( + _bgpvpn_network_association.BgpVpnNetworkAssociation, + net_association, ignore_missing=ignore_missing, + bgpvpn_id=bgpvpn_res.id) + + def get_bgpvpn_network_association(self, bgpvpn, net_association): + """Get a signle BGPVPN Network Association + + :param bgpvpn: The value can be the ID of a BGPVPN or a + :class:`~openstack.network.v2.bgpvpn.BgpVpn` instance. + :param net_association: The value can be the ID of a + BgpVpnNetworkAssociation or a + :class:`~openstack.network.v2.bgpvpn_network_association. + BgpVpnNetworkAssociation` instance. + + :returns: One :class:`~openstack.network.v2. + bgpvpn_network_associaition.BgpVpnNetworkAssociation` + :raises: :class:`~openstack.exceptions.ResourceNotFound` + when no resource can be found. + """ + bgpvpn_res = self._get_resource(_bgpvpn.BgpVpn, bgpvpn) + return self._get( + _bgpvpn_network_association.BgpVpnNetworkAssociation, + net_association, bgpvpn_id=bgpvpn_res.id) + + def bgpvpn_network_associations(self, bgpvpn, **query): + """Return a generator of BGP VPN Network Associations + + :param: bgpvpn: The value can be the ID of a BGPVPN or a + :class:`~openstack.network.v2.bgpvpn.BgpVpn` instance. + :param dict query: Optional query parameters to be sent to limit + the resources being returned. + + :returns: A generator of BgpVpnNetworkAssociation objects + :rtype: :class:`~openstack.network.v2.bgpvpn_network_association. + BgpVpnNetworkAssociation` + """ + bgpvpn_res = self._get_resource(_bgpvpn.BgpVpn, bgpvpn) + return self._list( + _bgpvpn_network_association.BgpVpnNetworkAssociation, + bgpvpn_id=bgpvpn_res.id, **query) + + def create_bgpvpn_port_association(self, bgpvpn, **attrs): + """Create a new BGPVPN Port Association + + :param bgpvpn: The value can be either the ID of a bgpvpn or + a :class:`~openstack.network.v2.bgpvpn.BgpVpn` instance. + :param attrs: Keyword arguments which will be used to create + a :class:`~openstack.network.v2.bgpvpn_port_association. + BgpVpnPortAssociation`, + comprised of the properties on the BgpVpnPortAssociation class. + + :returns: The results of BgpVpnPortAssociation creation + :rtype: :class:`~openstack.network.v2.bgpvpn_port_association. + BgpVpnPortAssociation` + """ + bgpvpn_res = self._get_resource(_bgpvpn.BgpVpn, bgpvpn) + return self._create( + _bgpvpn_port_association.BgpVpnPortAssociation, + bgpvpn_id=bgpvpn_res.id, **attrs) + + def delete_bgpvpn_port_association(self, bgpvpn, port_association, + ignore_missing=True): + """Delete a BGPVPN Port Association + + :param bgpvpn: The value can be either the ID of a bgpvpn or + a :class:`~openstack.network.v2.bgpvpn.BgpVpn` instance. + :param port_association: The value can be either the ID of a + bgpvpn_port_association or + a :class:`~openstack.network.v2.bgpvpn_port_association. + BgpVpnPortAssociation` instance. + :param bool ignore_missing: When set to ``False`` + :class:`~openstack.exceptions.ResourceNotFound` will be + raised when the BgpVpnPortAssociation does not exist. + When set to ``True``, no exception will be set when + attempting to delete a nonexistent BgpVpnPortAssociation. + + :returns: ``None`` + """ + bgpvpn_res = self._get_resource(_bgpvpn.BgpVpn, bgpvpn) + self._delete( + _bgpvpn_port_association.BgpVpnPortAssociation, + port_association, ignore_missing=ignore_missing, + bgpvpn_id=bgpvpn_res.id) + + def find_bgpvpn_port_association(self, name_or_id, bgpvpn_id, + ignore_missing=True, **query): + """"Find a single BGPVPN Port Association + + :param name_or_id: The name or ID of a BgpVpnNetworkAssociation. + :param bgpvpn_id: The value can be the ID of a BGPVPN. + :param bool ignore_missing: When set to ``False`` + :class:`~openstack.exceptions.ResourceNotFound` will be + raised when the resource does not exist. + When set to ``True``, None will be returned when + attempting to find a nonexistent resource. + :param dict query: Any additional parameters to be passed into + underlying methods. such as query filters. + :returns: One :class:`~openstack.network.v2.bgpvpn.BGPVPN` + or None + """ + return self._find( + _bgpvpn_port_association.BgpVpnPortAssociation, + name_or_id, + ignore_missing=ignore_missing, bgpvpn_id=bgpvpn_id, **query) + + def get_bgpvpn_port_association(self, bgpvpn, port_association): + """Get a signle BGPVPN Port Association + + :param bgpvpn: The value can be the ID of a BGPVPN or a + :class:`~openstack.network.v2.bgpvpn.BgpVpn` instance. + :param port_association: The value can be the ID of a + BgpVpnPortAssociation or a + :class:`~openstack.network.v2.bgpvpn_port_association. + BgpVpnPortAssociation` instance. + + :returns: One :class:`~openstack.network.v2. + bgpvpn_port_associaition.BgpVpnPortAssociation` + :raises: :class:`~openstack.exceptions.ResourceNotFound` + when no resource can be found. + """ + bgpvpn_res = self._get_resource(_bgpvpn.BgpVpn, bgpvpn) + return self._get( + _bgpvpn_port_association.BgpVpnPortAssociation, + port_association, bgpvpn_id=bgpvpn_res.id) + + def update_bgpvpn_port_association(self, bgpvpn, port_association, + **attrs): + """Update a BPGPN Port Association + + :param bgpvpn: Either the ID of a BGPVPN or a + :class:`~openstack.network.v2.bgpvpn.BgpVpn` instance. + :param port_association: The value can be the ID of a + BgpVpnPortAssociation or a + :class:`~openstack.network.v2.bgpvpn_port_association. + BgpVpnPortAssociation` instance. + :param attrs: The attributes to update on the BGPVPN represented + by ``value``. + + :returns: The updated BgpVpnPortAssociation. + :rtype: :class:`~openstack.network.v2.bgpvpn.BgpVpn` + """ + bgpvpn_res = self._get_resource(_bgpvpn.BgpVpn, bgpvpn) + return self._update( + _bgpvpn_port_association.BgpVpnPortAssociation, + port_association, bgpvpn_id=bgpvpn_res.id, **attrs) + + def bgpvpn_port_associations(self, bgpvpn, **query): + """Return a generator of BGP VPN Port Associations + + :param: bgpvpn: The value can be the ID of a BGPVPN or a + :class:`~openstack.network.v2.bgpvpn.BgpVpn` instance. + :param dict query: Optional query parameters to be sent to limit + the resources being returned. + + :returns: A generator of BgpVpnNetworkAssociation objects + :rtype: :class:`~openstack.network.v2.bgpvpn_network_association. + BgpVpnNetworkAssociation` + """ + bgpvpn_res = self._get_resource(_bgpvpn.BgpVpn, bgpvpn) + return self._list( + _bgpvpn_port_association.BgpVpnPortAssociation, + bgpvpn_id=bgpvpn_res.id, **query) + + def create_bgpvpn_router_association(self, bgpvpn, **attrs): + """Create a new BGPVPN Router Association + + :param bgpvpn: The value can be either the ID of a bgpvpn or + a :class:`~openstack.network.v2.bgpvpn.BgpVpn` instance. + :param attrs: Keyword arguments which will be used to create + a :class:`~openstack.network.v2.bgpvpn_router_association. + BgpVpnRouterAssociation`, + comprised of the properties on the BgpVpnRouterAssociation class. + + :returns: The results of BgpVpnRouterAssociation creation + :rtype: :class:`~openstack.network.v2.bgpvpn_router_association. + BgpVpnRouterAssociation` + """ + bgpvpn_res = self._get_resource(_bgpvpn.BgpVpn, bgpvpn) + return self._create( + _bgpvpn_router_association.BgpVpnRouterAssociation, + bgpvpn_id=bgpvpn_res.id, **attrs) + + def delete_bgpvpn_router_association(self, bgpvpn, router_association, + ignore_missing=True): + """Delete a BGPVPN Router Association + + :param bgpvpn: The value can be either the ID of a bgpvpn or + a :class:`~openstack.network.v2.bgpvpn.BgpVpn` instance. + :param port_association: The value can be either the ID of a + bgpvpn_router_association or + a :class:`~openstack.network.v2.bgpvpn_router_association. + BgpVpnRouterAssociation` instance. + :param bool ignore_missing: When set to ``False`` + :class:`~openstack.exceptions.ResourceNotFound` will be + raised when the BgpVpnRouterAssociation does not exist. + When set to ``True``, no exception will be set when + attempting to delete a nonexistent BgpVpnRouterAsociation. + + :returns: ``None`` + """ + bgpvpn_res = self._get_resource(_bgpvpn.BgpVpn, bgpvpn) + self._delete( + _bgpvpn_router_association.BgpVpnRouterAssociation, + router_association, ignore_missing=ignore_missing, + bgpvpn_id=bgpvpn_res.id) + + def get_bgpvpn_router_association(self, bgpvpn, router_association): + """Get a signle BGPVPN Router Association + + :param bgpvpn: The value can be the ID of a BGPVPN or a + :class:`~openstack.network.v2.bgpvpn.BgpVpn` instance. + :param router_association: The value can be the ID of a + BgpVpnRouterAssociation or a + :class:`~openstack.network.v2.bgpvpn_router_association. + BgpVpnRouterAssociation` instance. + + :returns: One :class:`~openstack.network.v2. + bgpvpn_router_associaition.BgpVpnRouterAssociation` + :raises: :class:`~openstack.exceptions.ResourceNotFound` + when no resource can be found. + """ + bgpvpn_res = self._get_resource(_bgpvpn.BgpVpn, bgpvpn) + return self._get( + _bgpvpn_router_association.BgpVpnRouterAssociation, + router_association, bgpvpn_id=bgpvpn_res.id) + + def update_bgpvpn_router_association(self, bgpvpn, + router_association, **attrs): + """Update a BPGPN Router Association + + :param dict query: Optional query parameters to be sent to limit + the resources being returned. + + :returns: A generator of BgpVpnNetworkAssociation objects + :rtype: :class:`~openstack.network.v2.bgpvpn_network_association. + BgpVpnNetworkAssociation` + """ + bgpvpn_res = self._get_resource(_bgpvpn.BgpVpn, bgpvpn) + return self._update( + _bgpvpn_router_association.BgpVpnRouterAssociation, + router_association, bgpvpn_id=bgpvpn_res.id, **attrs) + + def bgpvpn_router_associations(self, bgpvpn, **query): + """Return a generator of BGP VPN router Associations + + :param: bgpvpn: The value can be the ID of a BGPVPN or a + :class:`~openstack.network.v2.bgpvpn.BgpVpn` instance. + :param dict query: Optional query parameters to be sent to limit + the resources being returned. + + :returns: A generator of BgpVpnRouterAssociation objects + :rtype: :class:`~openstack.network.v2.bgpvpn_router_association. + BgpVpnRouterAssociation` + """ + bgpvpn_res = self._get_resource(_bgpvpn.BgpVpn, bgpvpn) + return self._list( + _bgpvpn_router_association.BgpVpnRouterAssociation, + bgpvpn_id=bgpvpn_res.id, **query) + def find_extension(self, name_or_id, ignore_missing=True, **query): """Find a single extension diff --git a/openstack/network/v2/bgpvpn.py b/openstack/network/v2/bgpvpn.py new file mode 100644 index 000000000..98de33208 --- /dev/null +++ b/openstack/network/v2/bgpvpn.py @@ -0,0 +1,54 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from openstack import resource + + +class BgpVpn(resource.Resource): + resource_key = 'bgpvpn' + resources_key = 'bgpvpns' + base_path = '/bgpvpn/bgpvpns' + + _allow_unknown_attrs_in_body = True + + # capabilities + allow_create = True + allow_fetch = True + allow_commit = True + allow_delete = True + allow_list = True + + # Properties + #: The Id of the BGPVPN + id = resource.Body('id') + #: The BGPVPN's name. + name = resource.Body('name') + #: The ID of the project that owns the BGPVPN + project_id = resource.Body('project_id', alias='tenant_id') + #: Tenant_id (deprecated attribute). + tenant_id = resource.Body('tenant_id', deprecated=True) + #: List of route distinguisher strings. + route_distinguishers = resource.Body('route_distinguishers') + #: Route Targets that will be both imported and used for export. + route_targets = resource.Body('route_targets') + #: Additional Route Targets that will be imported. + import_targets = resource.Body('import_targets') + #: Additional Route Targets that will be used for export. + export_targets = resource.Body('export_targets') + #: The default BGP LOCAL_PREF of routes that will be advertised to + #: the BGPVPN. + local_pref = resource.Body('local_pref') + #: The globally-assigned VXLAN vni for the BGP VPN. + vni = resource.Body('vni') + #: Selection of the type of VPN and the technology behind it. + #: Allowed values are l2 or l3. + type = resource.Body('type') diff --git a/openstack/network/v2/bgpvpn_network_association.py b/openstack/network/v2/bgpvpn_network_association.py new file mode 100644 index 000000000..2a041f578 --- /dev/null +++ b/openstack/network/v2/bgpvpn_network_association.py @@ -0,0 +1,40 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from openstack import resource + + +class BgpVpnNetworkAssociation(resource.Resource): + resource_key = 'network_association' + resources_key = 'network_associations' + base_path = '/bgpvpn/bgpvpns/%(bgpvpn_id)s/network_associations' + + _allow_unknown_attrs_in_body = True + + # capabilities + allow_create = True + allow_fetch = True + allow_commit = False + allow_delete = True + allow_list = True + + # Properties + #: The Id of the BGPVPN + id = resource.Body('id') + #: The ID of the BGPVPN who owns Network Association. + bgpvpn_id = resource.URI('bgpvpn_id') + #: The ID of the project that owns the BGPVPN + project_id = resource.Body('project_id', alias='tenant_id') + #: Tenant_id (deprecated attribute). + tenant_id = resource.Body('tenant_id', deprecated=True) + #: The ID of a Neutron network with which to associate the BGP VPN. + network_id = resource.Body('network_id') diff --git a/openstack/network/v2/bgpvpn_port_association.py b/openstack/network/v2/bgpvpn_port_association.py new file mode 100644 index 000000000..9b37b3e5c --- /dev/null +++ b/openstack/network/v2/bgpvpn_port_association.py @@ -0,0 +1,49 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from openstack import resource + + +class BgpVpnPortAssociation(resource.Resource): + resource_key = 'port_association' + resources_key = 'port_associations' + base_path = '/bgpvpn/bgpvpns/%(bgpvpn_id)s/port_associations' + _allow_unknown_attrs_in_body = True + + # capabilities + allow_create = True + allow_fetch = True + allow_commit = True + allow_delete = True + allow_list = True + + # Properties + #: The Id of the BGPVPN + id = resource.Body('id') + #: The ID of the BGPVPN who owns Network Association. + bgpvpn_id = resource.URI('bgpvpn_id') + #: The ID of the project that owns the BGPVPN + project_id = resource.Body('project_id', alias='tenant_id') + #: Tenant_id (deprecated attribute). + tenant_id = resource.Body('tenant_id', deprecated=True) + #: The ID of a Neutron Port with which to associate the BGP VPN. + port_id = resource.Body('port_id') + #: Boolean flag controlling whether or not the fixed IPs of a port will be + #: advertised to the BGPVPN (default: true). + advertise_fixed_ips = resource.Body('advertise_fixed_ips') + #: List of routes, each route being a dict with at least a type key, + #: which can be prefix or bgpvpn. + #: For the prefix type, the IP prefix (v4 or v6) to advertise is specified + #: in the prefix key. + #: For the bgpvpn type, the bgpvpn_id key specifies the BGPVPN from which + #: routes will be readvertised + routes = resource.Body('routes') diff --git a/openstack/network/v2/bgpvpn_router_association.py b/openstack/network/v2/bgpvpn_router_association.py new file mode 100644 index 000000000..bbc11a7c7 --- /dev/null +++ b/openstack/network/v2/bgpvpn_router_association.py @@ -0,0 +1,44 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from openstack import resource + + +class BgpVpnRouterAssociation(resource.Resource): + resource_key = 'router_association' + resources_key = 'router_associations' + base_path = '/bgpvpn/bgpvpns/%(bgpvpn_id)s/router_associations' + + _allow_unknown_attrs_in_body = True + + # capabilities + allow_create = True + allow_fetch = True + allow_commit = True + allow_delete = True + allow_list = True + + # Properties + #: The Id of the BGPVPN + id = resource.Body('id') + #: The ID of the BGPVPN who owns Network Association. + bgpvpn_id = resource.URI('bgpvpn_id') + #: The ID of the project that owns the BGPVPN + project_id = resource.Body('project_id', alias='tenant_id') + #: Tenant_id (deprecated attribute). + tenant_id = resource.Body('tenant_id', deprecated=True) + #: The ID of a Neutron router with which to associate the BGP VPN. + router_id = resource.Body('router_id') + #: Boolean flag controlling whether or not the routes specified in the + #: routes attribute of the router will be advertised to the BGPVPN + #: (default: true). + advertise_extra_routes = resource.Body('advertise_extra_routes') diff --git a/openstack/tests/functional/network/v2/test_bgpvpn.py b/openstack/tests/functional/network/v2/test_bgpvpn.py new file mode 100644 index 000000000..f706b4a29 --- /dev/null +++ b/openstack/tests/functional/network/v2/test_bgpvpn.py @@ -0,0 +1,181 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from openstack.network.v2 import bgpvpn as _bgpvpn +from openstack.network.v2 import bgpvpn_network_association as \ + _bgpvpn_net_assoc +from openstack.network.v2 import bgpvpn_port_association as _bgpvpn_port_assoc +from openstack.network.v2 import bgpvpn_router_association as \ + _bgpvpn_router_assoc +from openstack.network.v2 import network as _network +from openstack.network.v2 import port as _port +from openstack.network.v2 import router as _router +from openstack.network.v2 import subnet as _subnet +from openstack.tests.functional import base + + +class TestBGPVPN(base.BaseFunctionalTest): + + def setUp(self): + super().setUp() + + self.BGPVPN_NAME = 'my_bgpvpn' + self.getUniqueString() + self.NET_NAME = 'my_net' + self.getUniqueString() + self.SUBNET_NAME = 'my_subnet' + self.getUniqueString() + self.PORT_NAME = 'my_port' + self.getUniqueString() + self.ROUTER_NAME = 'my_router' + self.getUniqueString() + self.CIDR = "10.101.0.0/24" + self.ROUTE_DISTINGUISHERS = ['64512:1777', '64512:1888', '64512:1999'] + self.VNI = 1000 + self.ROUTE_TARGETS = '64512:1444', + self.IMPORT_TARGETS = '64512:1555', + self.EXPORT_TARGETS = '64512:1666' + self.TYPE = 'l3' + + if not self.user_cloud.network.find_extension("bgpvpn"): + self.skipTest("Neutron BGPVPN Extension disabled") + bgpvpn = self.operator_cloud.network.create_bgpvpn( + name=self.BGPVPN_NAME, + route_distinguishers=self.ROUTE_DISTINGUISHERS, + route_targets=self.ROUTE_TARGETS, + import_targets=self.IMPORT_TARGETS, + export_targets=self.EXPORT_TARGETS, + ) + assert isinstance(bgpvpn, _bgpvpn.BgpVpn) + self.BGPVPN = bgpvpn + + net = self.operator_cloud.network.create_network(name=self.NET_NAME) + assert isinstance(net, _network.Network) + self.NETWORK = net + subnet = self.operator_cloud.network.create_subnet( + name=self.SUBNET_NAME, + ip_version=4, + network_id=self.NETWORK.id, + cidr=self.CIDR, + ) + assert isinstance(subnet, _subnet.Subnet) + self.SUBNET = subnet + + port = self.operator_cloud.network.create_port( + name=self.PORT_NAME, network_id=self.NETWORK.id) + assert isinstance(port, _port.Port) + self.PORT = port + + router = self.operator_cloud.network.create_router( + name=self.ROUTER_NAME) + assert isinstance(router, _router.Router) + self.ROUTER = router + + net_assoc = ( + self.operator_cloud.network.create_bgpvpn_network_association( + self.BGPVPN, network_id=self.NETWORK.id)) + assert isinstance(net_assoc, + _bgpvpn_net_assoc.BgpVpnNetworkAssociation) + self.NET_ASSOC = net_assoc + + port_assoc = ( + self.operator_cloud.network.create_bgpvpn_port_association( + self.BGPVPN, port_id=self.PORT.id)) + assert isinstance(port_assoc, + _bgpvpn_port_assoc.BgpVpnPortAssociation) + self.PORT_ASSOC = port_assoc + + router_assoc = ( + self.operator_cloud.network.create_bgpvpn_router_association( + self.BGPVPN, router_id=self.ROUTER.id)) + assert isinstance(router_assoc, + _bgpvpn_router_assoc.BgpVpnRouterAssociation) + self.ROUTER_ASSOC = router_assoc + + def tearDown(self): + sot = self.operator_cloud.network.delete_bgpvpn(self.BGPVPN.id) + self.assertIsNone(sot) + sot = self.operator_cloud.network.delete_bgpvpn_network_association( + self.BGPVPN.id, self.NET_ASSOC.id) + self.assertIsNone(sot) + + sot = self.operator_cloud.network.delete_bgpvpn_port_association( + self.BGPVPN.id, self.PORT_ASSOC.id) + self.assertIsNone(sot) + sot = self.operator_cloud.network.delete_bgpvpn_router_association( + self.BGPVPN.id, self.ROUTER_ASSOC.id) + self.assertIsNone(sot) + + sot = self.operator_cloud.network.delete_router(self.ROUTER) + self.assertIsNone(sot) + sot = self.operator_cloud.network.delete_port(self.PORT) + self.assertIsNone(sot) + sot = self.operator_cloud.network.delete_subnet(self.SUBNET) + self.assertIsNone(sot) + sot = self.operator_cloud.network.delete_network(self.NETWORK) + self.assertIsNone(sot) + + super().tearDown() + + def test_find_bgpvpn(self): + sot = self.operator_cloud.network.find_bgpvpn(self.BGPVPN.name) + self.assertEqual(list(self.ROUTE_TARGETS), sot.route_targets) + self.assertEqual(list(self.IMPORT_TARGETS), sot.import_targets) + # Check defaults + self.assertEqual(self.TYPE, sot.type) + + def test_get_bgpvpn(self): + sot = self.operator_cloud.network.get_bgpvpn(self.BGPVPN.id) + self.assertEqual(list(self.ROUTE_TARGETS), sot.route_targets) + self.assertEqual([self.EXPORT_TARGETS], sot.export_targets) + self.assertEqual(list(self.IMPORT_TARGETS), sot.import_targets) + + def test_list_bgpvpns(self): + bgpvpn_ids = [bgpvpn.id for bgpvpn in + self.operator_cloud.network.bgpvpns()] + self.assertIn(self.BGPVPN.id, bgpvpn_ids) + + def test_update_bgpvpn(self): + sot = self.operator_cloud.network.update_bgpvpn( + self.BGPVPN.id, import_targets='64512:1333') + self.assertEqual(['64512:1333'], sot.import_targets) + + def test_get_bgpvpnnetwork_association(self): + sot = self.operator_cloud.network.get_bgpvpn_network_association( + self.BGPVPN.id, self.NET_ASSOC.id) + self.assertEqual(self.NETWORK.id, sot.network_id) + + def test_list_bgpvpn_network_associations(self): + net_assoc_ids = [ + net_assoc.id for net_assoc in + self.operator_cloud.network.bgpvpn_network_associations( + self.BGPVPN.id)] + self.assertIn(self.NET_ASSOC.id, net_assoc_ids) + + def test_get_bgpvpn_port_association(self): + sot = self.operator_cloud.network.get_bgpvpn_port_association( + self.BGPVPN.id, self.PORT_ASSOC.id) + self.assertEqual(self.PORT.id, sot.port_id) + + def test_list_bgpvpn_port_associations(self): + port_assoc_ids = [ + port_assoc.id for port_assoc in + self.operator_cloud.network.bgpvpn_port_associations( + self.BGPVPN.id)] + self.assertIn(self.PORT_ASSOC.id, port_assoc_ids) + + def test_get_bgpvpn_router_association(self): + sot = self.operator_cloud.network.get_bgpvpn_router_association( + self.BGPVPN.id, self.ROUTER_ASSOC.id) + self.assertEqual(self.ROUTER.id, sot.router_id) + + def test_list_bgpvpn_router_associations(self): + router_assoc_ids = [ + router_assoc.id for router_assoc in + self.operator_cloud.network.bgpvpn_router_associations( + self.BGPVPN.id)] + self.assertIn(self.ROUTER_ASSOC.id, router_assoc_ids) diff --git a/openstack/tests/unit/network/v2/test_bgpvpn.py b/openstack/tests/unit/network/v2/test_bgpvpn.py new file mode 100644 index 000000000..af2a661be --- /dev/null +++ b/openstack/tests/unit/network/v2/test_bgpvpn.py @@ -0,0 +1,99 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from openstack.network.v2 import bgpvpn +from openstack.network.v2 import bgpvpn_network_association +from openstack.network.v2 import bgpvpn_port_association +from openstack.network.v2 import bgpvpn_router_association +from openstack.network.v2 import network +from openstack.network.v2 import port +from openstack.network.v2 import router +from openstack.tests.unit import base + +IDENTIFIER = 'IDENTIFIER' +NET_ID = 'NET_ID' +PORT_ID = 'PORT_ID' +ROUTER_ID = 'ROUTER_ID' +EXAMPLE = { + 'id': IDENTIFIER, + 'name': 'bgpvpn', + 'project_id': '42', + 'route_distinguishers': ['64512:1777', '64512:1888', '64512:1999'], + 'route_targets': '64512:1444', + 'import_targets': '64512:1555', + 'export_targets': '64512:1666', +} + + +class TestBgpVpn(base.TestCase): + + def test_basic(self): + sot = bgpvpn.BgpVpn() + self.assertEqual('bgpvpn', sot.resource_key) + self.assertEqual('bgpvpns', sot.resources_key) + self.assertEqual('/bgpvpn/bgpvpns', sot.base_path) + self.assertTrue(sot.allow_create) + self.assertTrue(sot.allow_fetch) + self.assertTrue(sot.allow_commit) + self.assertTrue(sot.allow_delete) + self.assertTrue(sot.allow_list) + + def test_make_it(self): + sot = bgpvpn.BgpVpn(**EXAMPLE) + self.assertEqual(EXAMPLE['id'], sot.id) + self.assertEqual(EXAMPLE['name'], sot.name) + self.assertEqual(EXAMPLE['project_id'], sot.project_id) + self.assertEqual(EXAMPLE['route_distinguishers'], + sot.route_distinguishers) + self.assertEqual(EXAMPLE['route_targets'], sot.route_targets) + self.assertEqual(EXAMPLE['import_targets'], sot.import_targets) + self.assertEqual(EXAMPLE['export_targets'], sot.export_targets) + + self.assertDictEqual( + {'limit': 'limit', + 'marker': 'marker', + }, + sot._query_mapping._mapping) + + def test_create_bgpvpn_network_association(self): + test_bpgvpn = bgpvpn.BgpVpn(**EXAMPLE) + test_net = network.Network(**{'name': 'foo_net', 'id': NET_ID}) + sot = bgpvpn_network_association.BgpVpnNetworkAssociation( + bgpvn_id=test_bpgvpn.id, + network_id=test_net.id + ) + self.assertEqual(test_net.id, sot.network_id) + self.assertEqual(test_bpgvpn.id, sot.bgpvn_id) + + def test_create_bgpvpn_port_association(self): + test_bpgvpn = bgpvpn.BgpVpn(**EXAMPLE) + test_port = port.Port(**{ + 'name': 'foo_port', + 'id': PORT_ID, + 'network_id': NET_ID + }) + sot = bgpvpn_port_association.BgpVpnPortAssociation( + bgpvn_id=test_bpgvpn.id, + port_id=test_port.id + ) + self.assertEqual(test_port.id, sot.port_id) + self.assertEqual(test_bpgvpn.id, sot.bgpvn_id) + + def test_create_bgpvpn_router_association(self): + test_bpgvpn = bgpvpn.BgpVpn(**EXAMPLE) + test_router = router.Router(**{'name': 'foo_port'}) + sot = bgpvpn_router_association.BgpVpnRouterAssociation( + bgpvn_id=test_bpgvpn.id, + router_id=test_router.id + ) + self.assertEqual(test_router.id, sot.router_id) + self.assertEqual(test_bpgvpn.id, sot.bgpvn_id) diff --git a/openstack/tests/unit/network/v2/test_proxy.py b/openstack/tests/unit/network/v2/test_proxy.py index 66a0fd14f..57403f83f 100644 --- a/openstack/tests/unit/network/v2/test_proxy.py +++ b/openstack/tests/unit/network/v2/test_proxy.py @@ -22,6 +22,10 @@ from openstack.network.v2 import auto_allocated_topology from openstack.network.v2 import availability_zone from openstack.network.v2 import bgp_peer from openstack.network.v2 import bgp_speaker +from openstack.network.v2 import bgpvpn +from openstack.network.v2 import bgpvpn_network_association +from openstack.network.v2 import bgpvpn_port_association +from openstack.network.v2 import bgpvpn_router_association from openstack.network.v2 import extension from openstack.network.v2 import firewall_group from openstack.network.v2 import firewall_policy @@ -77,6 +81,7 @@ ROUTER_ID = 'router-id-' + uuid.uuid4().hex FIP_ID = 'fip-id-' + uuid.uuid4().hex CT_HELPER_ID = 'ct-helper-id-' + uuid.uuid4().hex LOCAL_IP_ID = 'lip-id-' + uuid.uuid4().hex +BGPVPN_ID = 'bgpvpn-id-' + uuid.uuid4().hex class TestNetworkProxy(test_proxy_base.TestProxyBase): @@ -1997,3 +2002,207 @@ class TestNetworkBGP(TestNetworkProxy): def test_bgp_peer_update(self): self.verify_update(self.proxy.update_bgp_peer, bgp_peer.BgpPeer) + + +class TestNetworkBGPVPN(TestNetworkProxy): + NETWORK_ASSOCIATION = 'net-assoc-id' + uuid.uuid4().hex + PORT_ASSOCIATION = 'port-assoc-id' + uuid.uuid4().hex + ROUTER_ASSOCIATION = 'router-assoc-id' + uuid.uuid4().hex + + def test_bgpvpn_create(self): + self.verify_create(self.proxy.create_bgpvpn, bgpvpn.BgpVpn) + + def test_bgpvpn_delete(self): + self.verify_delete(self.proxy.delete_bgpvpn, + bgpvpn.BgpVpn, False) + + def test_bgpvpn_delete_ignore(self): + self.verify_delete(self.proxy.delete_bgpvpn, + bgpvpn.BgpVpn, True) + + def test_bgpvpn_find(self): + self.verify_find(self.proxy.find_bgpvpn, bgpvpn.BgpVpn) + + def test_bgpvpn_get(self): + self.verify_get(self.proxy.get_bgpvpn, bgpvpn.BgpVpn) + + def test_bgpvpns(self): + self.verify_list(self.proxy.bgpvpns, bgpvpn.BgpVpn) + + def test_bgpvpn_update(self): + self.verify_update(self.proxy.update_bgpvpn, bgpvpn.BgpVpn) + + def test_bgpvpn_network_association_create(self): + self.verify_create( + self.proxy.create_bgpvpn_network_association, + bgpvpn_network_association.BgpVpnNetworkAssociation, + method_kwargs={'bgpvpn': BGPVPN_ID}, + expected_kwargs={'bgpvpn_id': BGPVPN_ID} + ) + + def test_bgpvpn_network_association_delete(self): + self.verify_delete( + self.proxy.delete_bgpvpn_network_association, + bgpvpn_network_association.BgpVpnNetworkAssociation, + False, + method_args=[BGPVPN_ID, self.NETWORK_ASSOCIATION], + expected_args=[self.NETWORK_ASSOCIATION], + expected_kwargs={'ignore_missing': False, + 'bgpvpn_id': BGPVPN_ID} + ) + + def test_bgpvpn_network_association_delete_ignore(self): + self.verify_delete( + self.proxy.delete_bgpvpn_network_association, + bgpvpn_network_association.BgpVpnNetworkAssociation, + True, + method_args=[BGPVPN_ID, self.NETWORK_ASSOCIATION], + expected_args=[self.NETWORK_ASSOCIATION], + expected_kwargs={'ignore_missing': True, + 'bgpvpn_id': BGPVPN_ID} + ) + + def test_bgpvpn_network_association_get(self): + self.verify_get( + self.proxy.get_bgpvpn_network_association, + bgpvpn_network_association.BgpVpnNetworkAssociation, + method_args=[BGPVPN_ID, self.NETWORK_ASSOCIATION], + expected_args=[self.NETWORK_ASSOCIATION], + expected_kwargs={'bgpvpn_id': BGPVPN_ID} + ) + + def test_bgpvpn_network_associations(self): + self.verify_list( + self.proxy.bgpvpn_network_associations, + bgpvpn_network_association.BgpVpnNetworkAssociation, + method_args=[BGPVPN_ID, ], + expected_args=[], + expected_kwargs={'bgpvpn_id': BGPVPN_ID} + ) + + def test_bgpvpn_port_association_create(self): + self.verify_create( + self.proxy.create_bgpvpn_port_association, + bgpvpn_port_association.BgpVpnPortAssociation, + method_kwargs={'bgpvpn': BGPVPN_ID}, + expected_kwargs={'bgpvpn_id': BGPVPN_ID} + ) + + def test_bgpvpn_port_association_delete(self): + self.verify_delete( + self.proxy.delete_bgpvpn_port_association, + bgpvpn_port_association.BgpVpnPortAssociation, + False, + method_args=[BGPVPN_ID, self.PORT_ASSOCIATION], + expected_args=[self.PORT_ASSOCIATION], + expected_kwargs={'ignore_missing': False, + 'bgpvpn_id': BGPVPN_ID} + ) + + def test_bgpvpn_port_association_delete_ignore(self): + self.verify_delete( + self.proxy.delete_bgpvpn_port_association, + bgpvpn_port_association.BgpVpnPortAssociation, + True, + method_args=[BGPVPN_ID, self.PORT_ASSOCIATION], + expected_args=[self.PORT_ASSOCIATION], + expected_kwargs={'ignore_missing': True, + 'bgpvpn_id': BGPVPN_ID} + ) + + def test_bgpvpn_port_association_find(self): + self.verify_find( + self.proxy.find_bgpvpn_port_association, + bgpvpn_port_association.BgpVpnPortAssociation, + method_args=[BGPVPN_ID], + expected_args=['resource_name'], + method_kwargs={'ignore_missing': True}, + expected_kwargs={'ignore_missing': True, + 'bgpvpn_id': BGPVPN_ID}, + ) + + def test_bgpvpn_port_association_get(self): + self.verify_get( + self.proxy.get_bgpvpn_port_association, + bgpvpn_port_association.BgpVpnPortAssociation, + method_args=[BGPVPN_ID, self.PORT_ASSOCIATION], + expected_args=[self.PORT_ASSOCIATION], + expected_kwargs={'bgpvpn_id': BGPVPN_ID} + ) + + def test_bgpvpn_port_associations(self): + self.verify_list( + self.proxy.bgpvpn_port_associations, + bgpvpn_port_association.BgpVpnPortAssociation, + method_args=[BGPVPN_ID, ], + expected_args=[], + expected_kwargs={'bgpvpn_id': BGPVPN_ID} + ) + + def test_bgpvpn_port_association_update(self): + self.verify_update( + self.proxy.update_bgpvpn_port_association, + bgpvpn_port_association.BgpVpnPortAssociation, + method_args=[BGPVPN_ID, self.PORT_ASSOCIATION], + method_kwargs={}, + expected_args=[self.PORT_ASSOCIATION], + expected_kwargs={'bgpvpn_id': BGPVPN_ID} + ) + + def test_bgpvpn_router_association_create(self): + self.verify_create( + self.proxy.create_bgpvpn_router_association, + bgpvpn_router_association.BgpVpnRouterAssociation, + method_kwargs={'bgpvpn': BGPVPN_ID}, + expected_kwargs={'bgpvpn_id': BGPVPN_ID} + ) + + def test_bgpvpn_router_association_delete(self): + self.verify_delete( + self.proxy.delete_bgpvpn_router_association, + bgpvpn_router_association.BgpVpnRouterAssociation, + False, + method_args=[BGPVPN_ID, self.ROUTER_ASSOCIATION], + expected_args=[self.ROUTER_ASSOCIATION], + expected_kwargs={'ignore_missing': False, + 'bgpvpn_id': BGPVPN_ID} + ) + + def test_bgpvpn_router_association_delete_ignore(self): + self.verify_delete( + self.proxy.delete_bgpvpn_router_association, + bgpvpn_router_association.BgpVpnRouterAssociation, + True, + method_args=[BGPVPN_ID, self.ROUTER_ASSOCIATION], + expected_args=[self.ROUTER_ASSOCIATION], + expected_kwargs={'ignore_missing': True, + 'bgpvpn_id': BGPVPN_ID} + ) + + def test_bgpvpn_router_association_get(self): + self.verify_get( + self.proxy.get_bgpvpn_router_association, + bgpvpn_router_association.BgpVpnRouterAssociation, + method_args=[BGPVPN_ID, self.ROUTER_ASSOCIATION], + expected_args=[self.ROUTER_ASSOCIATION], + expected_kwargs={'bgpvpn_id': BGPVPN_ID} + ) + + def test_bgpvpn_router_associations(self): + self.verify_list( + self.proxy.bgpvpn_router_associations, + bgpvpn_router_association.BgpVpnRouterAssociation, + method_args=[BGPVPN_ID, ], + expected_args=[], + expected_kwargs={'bgpvpn_id': BGPVPN_ID} + ) + + def test_bgpvpn_router_association_update(self): + self.verify_update( + self.proxy.update_bgpvpn_router_association, + bgpvpn_router_association.BgpVpnRouterAssociation, + method_args=[BGPVPN_ID, self.ROUTER_ASSOCIATION], + method_kwargs={}, + expected_args=[self.ROUTER_ASSOCIATION], + expected_kwargs={'bgpvpn_id': BGPVPN_ID} + ) diff --git a/releasenotes/notes/network_add_bgpvpn_resources-b3bd0b568c3c99db.yaml b/releasenotes/notes/network_add_bgpvpn_resources-b3bd0b568c3c99db.yaml new file mode 100644 index 000000000..daa777f32 --- /dev/null +++ b/releasenotes/notes/network_add_bgpvpn_resources-b3bd0b568c3c99db.yaml @@ -0,0 +1,7 @@ +--- +features: + - | + Add BGPVPN, BGPVPN Network Association, BGPVPN Port Association, + and BGPVPN Router Association resources and introduce support + for CRUD operations for these. +