Merge "Add "-d 1" option to the ncat client."

This commit is contained in:
Zuul 2023-07-05 10:30:20 +00:00 committed by Gerrit Code Review
commit 21874c703f

@ -76,9 +76,11 @@ def get_ncat_server_cmd(port, protocol, msg=None):
def get_ncat_client_cmd(ip_address, port, protocol, ssh_client=None):
cmd = 'echo "knock knock" | nc '
ncat_version = get_ncat_version(ssh_client=ssh_client)
if ncat_version > packaging_version.Version('7.60'):
cmd += '-d 1 '
if protocol.lower() == neutron_lib_constants.PROTO_NAME_UDP:
cmd += '-u '
ncat_version = get_ncat_version(ssh_client=ssh_client)
if ncat_version > packaging_version.Version('7.60'):
cmd += '-z '
cmd += '-w 1 %(host)s %(port)s' % {'host': ip_address, 'port': port}