Improve help strings for tap services

This is a follow up patch to feedback from[1]

[1] https://review.opendev.org/c/openstack/python-openstackclient/+/963445/comment/8f9576d4_938391ea/

Change-Id: I1c1ee68b37ef4c87c13d18e773c19b4ca5814ead
Signed-off-by: Miro Tomaska <mtomaska@redhat.com>
This commit is contained in:
Miro Tomaska 2025-11-26 13:56:05 -05:00
parent 97c2238df1
commit 9e49047ed1
3 changed files with 40 additions and 39 deletions

View file

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

View file

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

View file

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