Skip to content

Commit

Permalink
Merge pull request #1221 from zhaoqin-github/flavor21
Browse files Browse the repository at this point in the history
[OPENSTACK-2915] New implementation of flavor 21
  • Loading branch information
zhaoqin-github authored Nov 18, 2023
2 parents 2597045 + f9b63a4 commit 9304ebc
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions f5lbaasdriver/v2/bigip/plugin_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,21 @@ def get_network_by_id(self, context, id=None):
context, id
)

@log_helpers.log_method_call
def get_network_by_name(self, context, name=None):
"""Delete network."""
networks = []
if name:
filters = {
'name': [name]
}
networks = self.driver.plugin.db._core_plugin.get_networks(
context,
filters=filters
)

return networks

@log_helpers.log_method_call
def delete_network_by_name(self, context, name=None):
"""Delete network."""
Expand Down Expand Up @@ -895,9 +910,17 @@ def get_router_id_by_subnet(self, context, subnet_id=None):
def attach_subnet_to_router(self, context, router_id=None, subnet_id=None):
"""Attach a subnet to a router."""
if router_id and subnet_id:
self.driver.plugin.db._l3_plugin.add_router_interface(
context, router_id, {'subnet_id': subnet_id}
)
try:
self.driver.plugin.db._l3_plugin.add_router_interface(
context, router_id, {'subnet_id': subnet_id}
)
except q_exc.BadRequest as ex:
ignore_msg = "Router already has a port on subnet " + subnet_id
if hasattr(ex, "msg") and ignore_msg in ex.msg:
LOG.debug("Router is already attached to subnet %s",
subnet_id)
else:
raise

@log_helpers.log_method_call
def detach_subnet_from_router(self, context, router_id=None,
Expand Down

0 comments on commit 9304ebc

Please sign in to comment.