Merge "Change signature of `lsp_detach_mirror` method"

This commit is contained in:
Zuul
2026-04-20 09:59:07 +00:00
committed by Gerrit Code Review
4 changed files with 10 additions and 10 deletions
+3 -3
View File
@@ -1600,15 +1600,15 @@ class API(api.API, metaclass=abc.ABCMeta):
"""
@abc.abstractmethod
def lsp_detach_mirror(self, port, mirror, if_exist=False):
def lsp_detach_mirror(self, port, mirror, if_exists=False):
"""Detaches an lsp from the given mirror
:param port: the id of the lsp
:type port: str
:param mirror: the name or ID of the mirror
:type mirror: str
:param if_exist: If True, don't fail if the mirror_rules entry
:param if_exists: If True, don't fail if the mirror_rules entry
doesn't exist.
:type if_exist: Optional[bool]
:type if_exists: Optional[bool]
:returns: :class:`Command` with RowView result
"""
+3 -3
View File
@@ -1293,17 +1293,17 @@ class LspAttachMirror(cmd.BaseCommand):
class LspDetachMirror(cmd.BaseCommand):
def __init__(self, api, port, mirror, if_exist=False):
def __init__(self, api, port, mirror, if_exists=False):
super().__init__(api)
self.port = port
self.mirror = mirror
self.if_exist = if_exist
self.if_exists = if_exists
def run_idl(self, txn):
try:
lsp = self.api.lookup('Logical_Switch_Port', self.port)
mirror = self.api.lookup('Mirror', self.mirror)
if mirror not in lsp.mirror_rules and not self.if_exist:
if mirror not in lsp.mirror_rules and not self.if_exists:
msg = "Mirror Rule %s doesn't exist on LSP %s" % (self.mirror,
self.port)
raise RuntimeError(msg)
+2 -2
View File
@@ -474,5 +474,5 @@ class OvnNbApiIdlImpl(ovs_idl.Backend, api.API):
def lsp_attach_mirror(self, port, mirror, may_exist=False):
return cmd.LspAttachMirror(self, port, mirror, may_exist)
def lsp_detach_mirror(self, port, mirror, if_exist=False):
return cmd.LspDetachMirror(self, port, mirror, if_exist)
def lsp_detach_mirror(self, port, mirror, if_exists=False):
return cmd.LspDetachMirror(self, port, mirror, if_exists)
@@ -3219,9 +3219,9 @@ class TestMirrorOps(OvnNorthboundTest):
check_error=True
)
# detach with if_exist=True, and check the result, to be as previously
# detach with if_exists=True, and check the result, to be as previously
self.api.lsp_detach_mirror(
self.port_uuid, mirror2.uuid,
if_exist=True).execute(check_error=True)
if_exists=True).execute(check_error=True)
self.assertEqual(1, len(port.mirror_rules))
self.assertEqual(mirror1.uuid, port.mirror_rules[0].uuid)