Merge "Improve help strings for tap services"

This commit is contained in:
Zuul
2025-12-11 15:03:09 +00:00
committed by Gerrit Code Review
3 changed files with 40 additions and 39 deletions

View File

@@ -47,14 +47,14 @@ _formatters = {
def _add_updatable_args(parser):
parser.add_argument('--name', help=_('Name of this Tap service.'))
parser.add_argument('--name', help=_('Name of the tap flow.'))
parser.add_argument(
'--description', help=_('Description for this Tap service.')
'--description', help=_('Description of the tap flow.')
)
class CreateTapFlow(command.ShowOne):
_description = _("Create a tap flow")
_description = _("Create a new tap flow.")
def get_parser(self, prog_name):
parser = super().get_parser(prog_name)
@@ -64,13 +64,15 @@ class CreateTapFlow(command.ShowOne):
'--port',
required=True,
metavar="SOURCE_PORT",
help=_('Source port to which the Tap Flow is connected.'),
help=_('Source port (name or ID) to monitor.'),
)
parser.add_argument(
'--tap-service',
required=True,
metavar="TAP_SERVICE",
help=_('Tap Service to which the Tap Flow belongs.'),
help=_(
'Tap service (name or ID) to associate with this tap flow.'
),
)
parser.add_argument(
'--direction',
@@ -79,15 +81,15 @@ class CreateTapFlow(command.ShowOne):
choices=['IN', 'OUT', 'BOTH'],
type=lambda s: s.upper(),
help=_(
'Direction of the Tap flow. Possible options are: '
'IN, OUT, BOTH'
'Direction of the Tap flow. Valid options are: '
'IN, OUT and BOTH'
),
)
parser.add_argument(
'--vlan-filter',
required=False,
metavar="VLAN_FILTER",
help=_('VLAN Ids to be mirrored in the form of range string.'),
help=_('VLAN IDs to mirror in the form of range string.'),
)
return parser
@@ -125,7 +127,7 @@ class CreateTapFlow(command.ShowOne):
class ListTapFlow(command.Lister):
_description = _("List tap flows that belong to a given tenant")
_description = _("List tap flows.")
def get_parser(self, prog_name):
parser = super().get_parser(prog_name)
@@ -158,14 +160,14 @@ class ListTapFlow(command.Lister):
class ShowTapFlow(command.ShowOne):
_description = _("Show information of a given tap flow")
_description = _("Show tap flow details.")
def get_parser(self, prog_name):
parser = super().get_parser(prog_name)
parser.add_argument(
TAP_FLOW,
metavar=f"<{TAP_FLOW}>",
help=_("ID or name of tap flow to look up."),
help=_("Tap flow to display (name or ID)."),
)
return parser
@@ -181,7 +183,7 @@ class ShowTapFlow(command.ShowOne):
class DeleteTapFlow(command.Command):
_description = _("Delete a tap flow")
_description = _("Delete a tap flow.")
def get_parser(self, prog_name):
parser = super().get_parser(prog_name)
@@ -189,7 +191,7 @@ class DeleteTapFlow(command.Command):
TAP_FLOW,
metavar=f"<{TAP_FLOW}>",
nargs="+",
help=_("ID(s) or name(s) of tap flow to delete."),
help=_("Tap flow to delete (name or ID)."),
)
return parser
@@ -200,7 +202,6 @@ class DeleteTapFlow(command.Command):
try:
id = client.find_tap_flow(id_or_name, ignore_missing=False).id
client.delete_tap_flow(id)
LOG.warning("Tap flow %(id)s deleted", {'id': id})
except Exception as e:
fails += 1
LOG.error(
@@ -224,7 +225,7 @@ class UpdateTapFlow(command.ShowOne):
parser.add_argument(
TAP_FLOW,
metavar=f"<{TAP_FLOW}>",
help=_("ID or name of tap flow to update."),
help=_("Tap flow to modify (name or ID)."),
)
_add_updatable_args(parser)
return parser

View File

@@ -49,7 +49,7 @@ def _get_columns(item):
class CreateTapMirror(command.ShowOne):
_description = _("Create a Tap Mirror")
_description = _("Create a new tap mirror.")
def get_parser(self, prog_name):
parser = super().get_parser(prog_name)
@@ -60,7 +60,7 @@ class CreateTapMirror(command.ShowOne):
dest='port_id',
required=True,
metavar="PORT",
help=_('Port to which the Tap Mirror is connected.'),
help=_('Port (name or ID) to which the Tap Mirror is connected.'),
)
parser.add_argument(
'--directions',
@@ -68,8 +68,8 @@ class CreateTapMirror(command.ShowOne):
action=osc_port.JSONKeyValueAction,
required=True,
help=_(
'A dictionary of direction and tunnel_id. Direction can '
'be IN and OUT.'
'Dictionary of direction and tunnel_id. Valid directions are: '
'IN and OUT.'
),
)
parser.add_argument(
@@ -77,15 +77,15 @@ class CreateTapMirror(command.ShowOne):
dest='remote_ip',
required=True,
help=_(
'The remote IP of the Tap Mirror, this will be the '
'remote end of the GRE or ERSPAN v1 tunnel'
'Remote IP address for the tap mirror (remote end of the '
'GRE or ERSPAN v1 tunnel).'
),
)
parser.add_argument(
'--mirror-type',
dest='mirror_type',
required=True,
help=_('The type of the mirroring, it can be gre or erspanv1'),
help=_('Mirror type. Valid values are: gre and erspanv1.'),
)
return parser
@@ -120,7 +120,7 @@ class CreateTapMirror(command.ShowOne):
class ListTapMirror(command.Lister):
_description = _("List Tap Mirrors that belong to a given tenant")
_description = _("List tap mirrors.")
def get_parser(self, prog_name):
parser = super().get_parser(prog_name)
@@ -148,14 +148,14 @@ class ListTapMirror(command.Lister):
class ShowTapMirror(command.ShowOne):
_description = _("Show information of a given Tap Mirror")
_description = _("Show tap mirror details.")
def get_parser(self, prog_name):
parser = super().get_parser(prog_name)
parser.add_argument(
TAP_MIRROR,
metavar=f"<{TAP_MIRROR}>",
help=_("ID or name of Tap Mirror to look up."),
help=_("Tap mirror to display (name or ID)."),
)
return parser
@@ -171,7 +171,7 @@ class ShowTapMirror(command.ShowOne):
class DeleteTapMirror(command.Command):
_description = _("Delete a Tap Mirror")
_description = _("Delete a tap mirror.")
def get_parser(self, prog_name):
parser = super().get_parser(prog_name)
@@ -179,7 +179,7 @@ class DeleteTapMirror(command.Command):
TAP_MIRROR,
metavar=f"<{TAP_MIRROR}>",
nargs="+",
help=_("ID(s) or name(s) of the Tap Mirror to delete."),
help=_("Tap mirror to delete (name or ID)."),
)
return parser
@@ -210,14 +210,14 @@ class DeleteTapMirror(command.Command):
class UpdateTapMirror(command.ShowOne):
_description = _("Update a Tap Mirror.")
_description = _("Update a tap mirror.")
def get_parser(self, prog_name):
parser = super().get_parser(prog_name)
parser.add_argument(
TAP_MIRROR,
metavar=f"<{TAP_MIRROR}>",
help=_("ID or name of the Tap Mirror to update."),
help=_("Tap mirror to modify (name or ID)."),
)
tap_service._add_updatable_args(parser)
return parser

View File

@@ -39,9 +39,9 @@ _attr_map = (
def _add_updatable_args(parser):
parser.add_argument('--name', help=_('Name of this Tap service.'))
parser.add_argument('--name', help=_('Name of the tap service.'))
parser.add_argument(
'--description', help=_('Description for this Tap service.')
'--description', help=_('Description of the tap service.')
)
@@ -54,7 +54,7 @@ def _get_columns(item):
class CreateTapService(command.ShowOne):
_description = _("Create a tap service")
_description = _("Create a new tap service.")
def get_parser(self, prog_name):
parser = super().get_parser(prog_name)
@@ -65,7 +65,7 @@ class CreateTapService(command.ShowOne):
dest='port_id',
required=True,
metavar="PORT",
help=_('Port to which the Tap service is connected.'),
help=_('Port (name or ID) to connect to the tap service.'),
)
return parser
@@ -94,7 +94,7 @@ class CreateTapService(command.ShowOne):
class ListTapService(command.Lister):
_description = _("List tap services that belong to a given project")
_description = _("List tap services.")
def get_parser(self, prog_name):
parser = super().get_parser(prog_name)
@@ -122,14 +122,14 @@ class ListTapService(command.Lister):
class ShowTapService(command.ShowOne):
_description = _("Show information of a given tap service")
_description = _("Show tap service details.")
def get_parser(self, prog_name):
parser = super().get_parser(prog_name)
parser.add_argument(
TAP_SERVICE,
metavar=f"<{TAP_SERVICE}>",
help=_("ID or name of tap service to look up."),
help=_("Tap service to display (name or ID)."),
)
return parser
@@ -145,7 +145,7 @@ class ShowTapService(command.ShowOne):
class DeleteTapService(command.Command):
_description = _("Delete a tap service")
_description = _("Delete a tap service.")
def get_parser(self, prog_name):
parser = super().get_parser(prog_name)
@@ -153,7 +153,7 @@ class DeleteTapService(command.Command):
TAP_SERVICE,
metavar=f"<{TAP_SERVICE}>",
nargs="+",
help=_("ID(s) or name(s) of tap service to delete."),
help=_("Tap service to delete (name or ID)."),
)
return parser
@@ -191,7 +191,7 @@ class UpdateTapService(command.ShowOne):
parser.add_argument(
TAP_SERVICE,
metavar=f"<{TAP_SERVICE}>",
help=_("ID or name of tap service to update."),
help=_("Tap service to modify (name or ID)."),
)
_add_updatable_args(parser)
return parser