IOS XR cli tests move to network_cli (#34007)
* Update task definitions for network_cli * Add connection to debug messages * Specify connection for prepare task * pc won't be around for connection=network_cli * Assorted Python 3 fixes * Give default port if ansible_ssh_port missing * delegate -> connection * Extend error regex
This commit is contained in:
parent
5db9ac23ee
commit
2e76c89910
48 changed files with 154 additions and 107 deletions
|
@ -374,7 +374,7 @@ def get_config(module, config_filter=None, source='running'):
|
|||
if is_netconf(module):
|
||||
out = to_xml(conn.get_config(source=source, filter=config_filter))
|
||||
|
||||
cfg = to_bytes(out, errors='surrogate_then_replace').strip()
|
||||
cfg = out.strip()
|
||||
_DEVICE_CONFIGS.update({key: cfg})
|
||||
return cfg
|
||||
|
||||
|
|
|
@ -328,7 +328,7 @@ def convert_key_to_base64(module):
|
|||
splitfile = key.split()[1]
|
||||
|
||||
base64key = b64decode(splitfile)
|
||||
base64file = open('/tmp/publickey_%s.b64' % (name), 'w')
|
||||
base64file = open('/tmp/publickey_%s.b64' % (name), 'bw')
|
||||
base64file.write(base64key)
|
||||
base64file.close()
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ class ActionModule(_ActionModule):
|
|||
|
||||
# make sure we are in the right cli context which should be
|
||||
# enable mode and not config module
|
||||
if pc.connection == 'network_cli':
|
||||
if (self._play_context.connection == 'local' and pc.connection == 'network_cli') or self._play_context.connection == 'network_cli':
|
||||
if socket_path is None:
|
||||
socket_path = self._connection.socket_path
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ class ActionModule(_ActionModule):
|
|||
try:
|
||||
self._handle_template()
|
||||
except ValueError as exc:
|
||||
return dict(failed=True, msg=exc.message)
|
||||
return dict(failed=True, msg=to_text(exc))
|
||||
|
||||
result = super(ActionModule, self).run(tmp, task_vars)
|
||||
|
||||
|
@ -54,7 +54,7 @@ class ActionModule(_ActionModule):
|
|||
|
||||
# strip out any keys that have two leading and two trailing
|
||||
# underscore characters
|
||||
for key in result.keys():
|
||||
for key in list(result.keys()):
|
||||
if PRIVATE_KEYS_RE.match(key):
|
||||
del result[key]
|
||||
|
||||
|
@ -74,7 +74,7 @@ class ActionModule(_ActionModule):
|
|||
os.remove(fn)
|
||||
tstamp = time.strftime("%Y-%m-%d@%H:%M:%S", time.localtime(time.time()))
|
||||
filename = '%s/%s_config.%s' % (backup_path, host, tstamp)
|
||||
open(filename, 'w').write(to_bytes(contents))
|
||||
open(filename, 'w').write(contents)
|
||||
return filename
|
||||
|
||||
def _handle_template(self):
|
||||
|
|
|
@ -61,9 +61,9 @@ class Cliconf(CliconfBase):
|
|||
if source not in lookup:
|
||||
return self.invalid_params("fetching configuration from %s is not supported" % source)
|
||||
if filter:
|
||||
cmd = to_bytes(b'show {0} {1}'.format(lookup[source], filter), errors='surrogate_or_strict')
|
||||
cmd = to_bytes('show {0} {1}'.format(lookup[source], filter), errors='surrogate_or_strict')
|
||||
else:
|
||||
cmd = to_bytes(b'show {0}'.format(lookup[source]), errors='surrogate_or_strict')
|
||||
cmd = to_bytes('show {0}'.format(lookup[source]), errors='surrogate_or_strict')
|
||||
|
||||
return self.send_command(cmd)
|
||||
|
||||
|
@ -76,10 +76,10 @@ class Cliconf(CliconfBase):
|
|||
|
||||
def commit(self, comment=None):
|
||||
if comment:
|
||||
command = b'commit comment {0}'.format(comment)
|
||||
command = 'commit comment {0}'.format(comment)
|
||||
else:
|
||||
command = b'commit'
|
||||
self.send_command(command)
|
||||
command = 'commit'
|
||||
self.send_command(to_bytes(command))
|
||||
|
||||
def discard_changes(self):
|
||||
self.send_command(b'abort')
|
||||
|
|
|
@ -37,6 +37,7 @@ class TerminalModule(TerminalBase):
|
|||
terminal_stderr_re = [
|
||||
re.compile(br"% ?Error"),
|
||||
re.compile(br"% ?Bad secret"),
|
||||
re.compile(br"% ?This command is not authorized"),
|
||||
re.compile(br"invalid input", re.I),
|
||||
re.compile(br"(?:incomplete|ambiguous) command", re.I),
|
||||
re.compile(br"connection timed out", re.I),
|
||||
|
|
|
@ -9,8 +9,14 @@
|
|||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
- name: run test case (connection=network_cli)
|
||||
include: "{{ test_case_to_run }} ansible_connection=network_cli"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
||||
- name: run test case (connection=local)
|
||||
include: "{{ test_case_to_run }} ansible_connection=local"
|
||||
with_first_found: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
|
|
@ -9,8 +9,14 @@
|
|||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
- name: run test case (connection=network_cli)
|
||||
include: "{{ test_case_to_run }} ansible_connection=network_cli"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
||||
- name: run test case (connection=local)
|
||||
include: "{{ test_case_to_run }} ansible_connection=local"
|
||||
with_first_found: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START cli/bad_operator.yaml"
|
||||
- debug: msg="START cli/bad_operator.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: test bad operator
|
||||
iosxr_command:
|
||||
|
@ -16,4 +16,4 @@
|
|||
- "result.failed == true"
|
||||
- "result.msg is defined"
|
||||
|
||||
- debug: msg="END cli/bad_operator.yaml"
|
||||
- debug: msg="END cli/bad_operator.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START cli/contains.yaml"
|
||||
- debug: msg="START cli/contains.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: test contains operator
|
||||
iosxr_command:
|
||||
|
@ -16,4 +16,4 @@
|
|||
- "result.changed == false"
|
||||
- "result.stdout is defined"
|
||||
|
||||
- debug: msg="END cli/contains.yaml"
|
||||
- debug: msg="END cli/contains.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START cli/invalid.yaml"
|
||||
- debug: msg="START cli/invalid.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: run invalid command
|
||||
iosxr_command:
|
||||
|
@ -23,4 +23,4 @@
|
|||
that:
|
||||
- "result.failed"
|
||||
|
||||
- debug: msg="END cli/invalid.yaml"
|
||||
- debug: msg="END cli/invalid.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START cli/output.yaml"
|
||||
- debug: msg="START cli/output.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: get output for single command
|
||||
iosxr_command:
|
||||
|
@ -24,4 +24,4 @@
|
|||
- "result.stdout is defined"
|
||||
- "result.stdout | length == 2"
|
||||
|
||||
- debug: msg="END cli/output.yaml"
|
||||
- debug: msg="END cli/output.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START cli/timeout.yaml"
|
||||
- debug: msg="START cli/timeout.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: test bad condition
|
||||
iosxr_command:
|
||||
|
@ -15,4 +15,4 @@
|
|||
- "result.failed == true"
|
||||
- "result.msg is defined"
|
||||
|
||||
- debug: msg="END cli/timeout.yaml"
|
||||
- debug: msg="END cli/timeout.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -9,8 +9,14 @@
|
|||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
- name: run test case (connection=network_cli)
|
||||
include: "{{ test_case_to_run }} ansible_connection=network_cli"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
||||
- name: run test case (connection=local)
|
||||
include: "{{ test_case_to_run }} ansible_connection=local"
|
||||
with_first_found: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START cli/backup.yaml"
|
||||
- debug: msg="START cli/backup.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: setup
|
||||
iosxr_config:
|
||||
|
@ -14,8 +14,8 @@
|
|||
find:
|
||||
paths: "{{ role_path }}/backup"
|
||||
pattern: "{{ inventory_hostname_short }}_config*"
|
||||
connection: local
|
||||
register: backup_files
|
||||
delegate_to: localhost
|
||||
|
||||
- name: delete backup files
|
||||
file:
|
||||
|
@ -38,11 +38,11 @@
|
|||
find:
|
||||
paths: "{{ role_path }}/backup"
|
||||
pattern: "{{ inventory_hostname_short }}_config*"
|
||||
connection: local
|
||||
register: backup_files
|
||||
delegate_to: localhost
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "backup_files.files is defined"
|
||||
|
||||
- debug: msg="END cli/backup.yaml"
|
||||
- debug: msg="END cli/backup.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START cli/comment-too-long.yaml"
|
||||
- debug: msg="START cli/comment-too-long.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: setup
|
||||
iosxr_config:
|
||||
|
@ -27,4 +27,4 @@
|
|||
# Check for the correct error message (and not a generic "Invalid input detected") once fixed
|
||||
|
||||
|
||||
- debug: msg="END cli/comment-too-long.yaml"
|
||||
- debug: msg="END cli/comment-too-long.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START cli/comment.yaml"
|
||||
- debug: msg="START cli/comment.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: setup
|
||||
iosxr_config:
|
||||
|
@ -31,4 +31,4 @@
|
|||
- "result.changed == false"
|
||||
- "result.updates is not defined"
|
||||
|
||||
- debug: msg="END cli/comment.yaml"
|
||||
- debug: msg="END cli/comment.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START cli/src_basic.yaml"
|
||||
- debug: msg="START cli/src_basic.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: setup
|
||||
iosxr_config:
|
||||
|
@ -32,4 +32,4 @@
|
|||
# https://github.com/ansible/ansible-modules-core/issues/4807
|
||||
- "result.updates is not defined"
|
||||
|
||||
- debug: msg="END cli/src_basic.yaml"
|
||||
- debug: msg="END cli/src_basic.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START cli/src_invalid.yaml"
|
||||
- debug: msg="START cli/src_invalid.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
|
||||
# Defend https://github.com/ansible/ansible-modules-core/issues/4797
|
||||
|
@ -15,4 +15,4 @@
|
|||
- "result.failed == true"
|
||||
- "result.msg == 'path specified in src not found'"
|
||||
|
||||
- debug: msg="END cli/src_invalid.yaml"
|
||||
- debug: msg="END cli/src_invalid.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START cli/src_match_none.yaml"
|
||||
- debug: msg="START cli/src_match_none.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: setup
|
||||
iosxr_config:
|
||||
|
@ -34,4 +34,4 @@
|
|||
- "result.changed == false"
|
||||
- "result.updates is not defined"
|
||||
|
||||
- debug: msg="END cli/src_match_none.yaml"
|
||||
- debug: msg="END cli/src_match_none.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START cli/sublevel.yaml"
|
||||
- debug: msg="START cli/sublevel.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: setup
|
||||
iosxr_config:
|
||||
|
@ -34,4 +34,4 @@
|
|||
commands: ['no ipv4 access-list test']
|
||||
match: none
|
||||
|
||||
- debug: msg="END cli/sublevel.yaml"
|
||||
- debug: msg="END cli/sublevel.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START cli/sublevel_block.yaml"
|
||||
- debug: msg="START cli/sublevel_block.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: setup
|
||||
iosxr_config:
|
||||
|
@ -9,7 +9,6 @@
|
|||
- 30 permit ipv4 host 3.3.3.3 any log
|
||||
parents: ['ipv4 access-list test']
|
||||
before: ['no ipv4 access-list test']
|
||||
after: ['exit']
|
||||
match: none
|
||||
|
||||
- name: configure sub level command using block resplace
|
||||
|
@ -21,7 +20,6 @@
|
|||
- 40 permit ipv4 host 4.4.4.4 any log
|
||||
parents: ['ipv4 access-list test']
|
||||
replace: block
|
||||
after: ['exit']
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
|
@ -42,7 +40,6 @@
|
|||
- 40 permit ipv4 host 4.4.4.4 any log
|
||||
parents: ['ipv4 access-list test']
|
||||
replace: block
|
||||
after: ['exit']
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
|
@ -54,4 +51,4 @@
|
|||
commands: ['no ipv4 access-list test']
|
||||
match: none
|
||||
|
||||
- debug: msg="END cli/sublevel_block.yaml"
|
||||
- debug: msg="END cli/sublevel_block.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START cli/sublevel_exact.yaml"
|
||||
- debug: msg="START cli/sublevel_exact.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: setup
|
||||
iosxr_config:
|
||||
|
@ -11,7 +11,6 @@
|
|||
- 50 permit ipv4 host 5.5.5.5 any log
|
||||
parents: ['ipv4 access-list test']
|
||||
before: ['no ipv4 access-list test']
|
||||
after: ['exit']
|
||||
match: none
|
||||
|
||||
- name: configure sub level command using exact match
|
||||
|
@ -22,7 +21,6 @@
|
|||
- 30 permit ipv4 host 3.3.3.3 any log
|
||||
- 40 permit ipv4 host 4.4.4.4 any log
|
||||
parents: ['ipv4 access-list test']
|
||||
after: ['exit']
|
||||
match: exact
|
||||
register: result
|
||||
|
||||
|
@ -45,7 +43,6 @@
|
|||
- 40 permit ipv4 host 4.4.4.4 any log
|
||||
- 50 permit ipv4 host 5.5.5.5 any log
|
||||
parents: ['ipv4 access-list test']
|
||||
after: ['exit']
|
||||
match: exact
|
||||
register: result
|
||||
|
||||
|
@ -58,4 +55,4 @@
|
|||
commands: ['no ipv4 access-list test']
|
||||
match: none
|
||||
|
||||
- debug: msg="END cli/sublevel_exact.yaml"
|
||||
- debug: msg="END cli/sublevel_exact.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START cli/sublevel_strict.yaml"
|
||||
- debug: msg="START cli/sublevel_strict.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: setup
|
||||
iosxr_config:
|
||||
|
@ -11,7 +11,6 @@
|
|||
- 50 permit ipv4 host 5.5.5.5 any log
|
||||
parents: ['ipv4 access-list test']
|
||||
before: ['no ipv4 access-list test']
|
||||
after: ['exit']
|
||||
match: none
|
||||
|
||||
- name: configure sub level command using strict match
|
||||
|
@ -23,7 +22,6 @@
|
|||
- 40 permit ipv4 host 4.4.4.4 any log
|
||||
parents: ['ipv4 access-list test']
|
||||
before: ['no ipv4 access-list test']
|
||||
after: ['exit']
|
||||
match: strict
|
||||
replace: block
|
||||
register: result
|
||||
|
@ -46,7 +44,6 @@
|
|||
- 30 permit ipv4 host 3.3.3.3 any log
|
||||
- 40 permit ipv4 host 4.4.4.4 any log
|
||||
parents: ['ipv4 access-list test']
|
||||
after: ['exit']
|
||||
match: strict
|
||||
register: result
|
||||
|
||||
|
@ -59,4 +56,4 @@
|
|||
commands: ['no ipv4 access-list test']
|
||||
match: none
|
||||
|
||||
- debug: msg="END cli/sublevel_strict.yaml"
|
||||
- debug: msg="END cli/sublevel_strict.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START cli/toplevel.yaml"
|
||||
- debug: msg="START cli/toplevel.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: setup
|
||||
iosxr_config:
|
||||
|
@ -30,4 +30,4 @@
|
|||
commands: ['hostname {{ inventory_hostname_short }}']
|
||||
match: none
|
||||
|
||||
- debug: msg="END cli/toplevel.yaml"
|
||||
- debug: msg="END cli/toplevel.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START cli/toplevel_after.yaml"
|
||||
- debug: msg="START cli/toplevel_after.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: setup
|
||||
iosxr_config:
|
||||
|
@ -37,4 +37,4 @@
|
|||
- "hostname {{ inventory_hostname_short }}"
|
||||
match: none
|
||||
|
||||
- debug: msg="END cli/toplevel_after.yaml"
|
||||
- debug: msg="END cli/toplevel_after.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START cli/toplevel_before.yaml"
|
||||
- debug: msg="START cli/toplevel_before.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: setup
|
||||
iosxr_config:
|
||||
|
@ -37,4 +37,4 @@
|
|||
- "hostname {{ inventory_hostname_short }}"
|
||||
match: none
|
||||
|
||||
- debug: msg="END cli/toplevel_before.yaml"
|
||||
- debug: msg="END cli/toplevel_before.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START cli/toplevel_nonidempotent.yaml"
|
||||
- debug: msg="START cli/toplevel_nonidempotent.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: setup
|
||||
iosxr_config:
|
||||
|
@ -33,4 +33,4 @@
|
|||
commands: ['hostname {{ inventory_hostname_short }}']
|
||||
match: none
|
||||
|
||||
- debug: msg="END cli/toplevel_nonidempotent.yaml"
|
||||
- debug: msg="END cli/toplevel_nonidempotent.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -9,8 +9,14 @@
|
|||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
- name: run test case (connection=network_cli)
|
||||
include: "{{ test_case_to_run }} ansible_connection=network_cli"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
||||
- name: run test case (connection=local)
|
||||
include: "{{ test_case_to_run }} ansible_connection=local"
|
||||
with_first_found: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START cli/all_facts.yaml"
|
||||
- debug: msg="START cli/all_facts.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
|
||||
- name: test getting all facts
|
||||
|
@ -25,4 +25,4 @@
|
|||
# Items from those subsets are present
|
||||
- "result.ansible_facts.ansible_net_filesystems is defined"
|
||||
|
||||
- debug: msg="END cli/all_facts.yaml"
|
||||
- debug: msg="END cli/all_facts.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START cli/default_facts.yaml"
|
||||
- debug: msg="START cli/default_facts.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
|
||||
- name: test getting default facts
|
||||
|
@ -27,4 +27,4 @@
|
|||
# ... and not present
|
||||
- "result.ansible_facts.ansible_net_config is not defined" # config
|
||||
|
||||
- debug: msg="END cli/default.yaml"
|
||||
- debug: msg="END cli/default.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START cli/invalid_subset.yaml"
|
||||
- debug: msg="START cli/invalid_subset.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
|
||||
- name: test invalid subset (foobar)
|
||||
|
@ -45,4 +45,4 @@
|
|||
|
||||
|
||||
|
||||
- debug: msg="END cli/invalid_subset.yaml"
|
||||
- debug: msg="END cli/invalid_subset.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START cli/not_hardware_facts.yaml"
|
||||
- debug: msg="START cli/not_hardware_facts.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
|
||||
- name: test not hardware
|
||||
|
@ -27,4 +27,4 @@
|
|||
# ... and not present
|
||||
- "result.ansible_facts.ansible_net_filesystems is not defined"
|
||||
|
||||
- debug: msg="END cli/not_hardware_facts.yaml"
|
||||
- debug: msg="END cli/not_hardware_facts.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -9,8 +9,14 @@
|
|||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
- name: run test case (connection=network_cli)
|
||||
include: "{{ test_case_to_run }} ansible_connection=network_cli"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
||||
- name: run test case (connection=local)
|
||||
include: "{{ test_case_to_run }} ansible_connection=local"
|
||||
with_first_found: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START iosxr_interface cli/basic.yaml"
|
||||
- debug: msg="START iosxr_interface cli/basic.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: Setup interface
|
||||
iosxr_interface:
|
||||
|
@ -256,4 +256,4 @@
|
|||
that:
|
||||
- 'result.changed == false'
|
||||
|
||||
- debug: msg="END iosxr_interface cli/basic.yaml"
|
||||
- debug: msg="END iosxr_interface cli/basic.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START iosxr_interface cli/intent.yaml"
|
||||
- debug: msg="START iosxr_interface cli/intent.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: Setup (interface is up)
|
||||
iosxr_interface:
|
||||
|
|
|
@ -9,8 +9,14 @@
|
|||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
- name: run test case (connection=network_cli)
|
||||
include: "{{ test_case_to_run }} ansible_connection=network_cli"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
||||
- name: run test case (connection=local)
|
||||
include: "{{ test_case_to_run }} ansible_connection=local"
|
||||
with_first_found: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
|
|
@ -9,8 +9,14 @@
|
|||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
- name: run test case (connection=network_cli)
|
||||
include: "{{ test_case_to_run }} ansible_connection=network_cli"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
||||
- name: run test case (connection=local)
|
||||
include: "{{ test_case_to_run }} ansible_connection=local"
|
||||
with_first_found: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START iosxr_netconf cli/basic.yaml"
|
||||
- debug: msg="START iosxr_netconf cli/basic.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: Disable NetConf service
|
||||
iosxr_netconf: &disable_netconf
|
||||
|
@ -66,4 +66,4 @@
|
|||
- name: Disable Netconf service
|
||||
iosxr_netconf: *disable_netconf
|
||||
|
||||
- debug: msg="END iosxr_netconf cli/basic.yaml"
|
||||
- debug: msg="END iosxr_netconf cli/basic.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -9,8 +9,14 @@
|
|||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
- name: run test case (connection=network_cli)
|
||||
include: "{{ test_case_to_run }} ansible_connection=network_cli"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
||||
- name: run test case (connection=local)
|
||||
include: "{{ test_case_to_run }} ansible_connection=local"
|
||||
with_first_found: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START cli/set_domain_search.yaml"
|
||||
- debug: msg="START cli/set_domain_search.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: setup
|
||||
iosxr_config:
|
||||
|
@ -119,4 +119,4 @@
|
|||
match: none
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- debug: msg="END cli/set_domain_search.yaml"
|
||||
- debug: msg="END cli/set_domain_search.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START cli/set_domain_name.yaml"
|
||||
- debug: msg="START cli/set_domain_name.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: setup
|
||||
iosxr_config:
|
||||
|
@ -33,4 +33,4 @@
|
|||
match: none
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- debug: msg="END cli/set_domain_name.yaml"
|
||||
- debug: msg="END cli/set_domain_name.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START cli/set_hostname.yaml"
|
||||
- debug: msg="START cli/set_hostname.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: setup
|
||||
iosxr_config:
|
||||
|
@ -33,4 +33,4 @@
|
|||
match: none
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- debug: msg="END cli/set_hostname.yaml"
|
||||
- debug: msg="END cli/set_hostname.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START cli/set_lookup_source.yaml"
|
||||
- debug: msg="START cli/set_lookup_source.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: setup
|
||||
iosxr_config:
|
||||
|
@ -63,4 +63,4 @@
|
|||
match: none
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- debug: msg="END cli/set_lookup_source.yaml"
|
||||
- debug: msg="END cli/set_lookup_source.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- debug: msg="START cli/set_name_servers.yaml"
|
||||
- debug: msg="START cli/set_name_servers.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: setup
|
||||
iosxr_config:
|
||||
|
@ -83,4 +83,4 @@
|
|||
|
||||
# FIXME: No teardown
|
||||
#
|
||||
- debug: msg="END cli/set_name_servers.yaml"
|
||||
- debug: msg="END cli/set_name_servers.yaml on connection={{ ansible_connection }}"
|
||||
|
|
|
@ -9,8 +9,14 @@
|
|||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
- name: run test case (connection=network_cli)
|
||||
include: "{{ test_case_to_run }} ansible_connection=network_cli"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
||||
- name: run test case (connection=local)
|
||||
include: "{{ test_case_to_run }} ansible_connection=local"
|
||||
with_first_found: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
|
|
@ -9,13 +9,13 @@
|
|||
|
||||
- name: test login
|
||||
expect:
|
||||
command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no show version"
|
||||
command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port|default(22) }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no show version"
|
||||
responses:
|
||||
(?i)password: "pass123"
|
||||
|
||||
- name: test login with invalid password (should fail)
|
||||
expect:
|
||||
command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no show version"
|
||||
command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port|default(22) }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no show version"
|
||||
responses:
|
||||
(?i)password: "badpass"
|
||||
ignore_errors: yes
|
||||
|
@ -35,7 +35,7 @@
|
|||
|
||||
- name: test login with private key
|
||||
expect:
|
||||
command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{ role_path }}/files/private show version"
|
||||
command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port|default(22) }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{ role_path }}/files/private show version"
|
||||
responses:
|
||||
(?i)password: 'pass123'
|
||||
|
||||
|
@ -47,7 +47,7 @@
|
|||
|
||||
- name: test login with private key (should fail, no user)
|
||||
expect:
|
||||
command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{ role_path }}/files/private show version"
|
||||
command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port|default(22) }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{ role_path }}/files/private show version"
|
||||
responses:
|
||||
(?i)password: 'pass123'
|
||||
ignore_errors: yes
|
||||
|
@ -62,7 +62,7 @@
|
|||
|
||||
- name: test login with private key
|
||||
expect:
|
||||
command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{ role_path }}/files/private show version"
|
||||
command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port|default(22) }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{ role_path }}/files/private show version"
|
||||
responses:
|
||||
(?i)password: 'pass123'
|
||||
ignore_errors: yes
|
||||
|
@ -77,7 +77,7 @@
|
|||
# FIXME: pexpect fails with OSError: [Errno 5] Input/output error
|
||||
- name: test login with invalid private key (should fail)
|
||||
expect:
|
||||
command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{ role_path }}/files/private show version"
|
||||
command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port|default(22) }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{ role_path }}/files/private show version"
|
||||
responses:
|
||||
(?i)password: "pass123"
|
||||
ignore_errors: yes
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
- name: Ensure we have loopback 888 for testing
|
||||
iosxr_config:
|
||||
src: config.j2
|
||||
connection: network_cli
|
||||
|
||||
# Some AWS hostnames can be longer than those allowed by the system we are testing
|
||||
# Truncate the hostname
|
||||
|
|
Loading…
Reference in a new issue