Fixing issues with httpapi (#40388)

* I seem to have forgotten the back half of tests

* Set http timeout from persistent_command_timeout

* Tweak URL generation and provide URL on error

* Push var_options to connection process

* Don't wait forever if coming from persistent

* Don't send the entire contents of variables to ansible-connection
pull/40347/head
Nathaniel Case 7 years ago committed by John R Barker
parent 231c3586bd
commit 483df13626

@ -69,7 +69,7 @@ class ConnectionProcess(object):
self.connection = None self.connection = None
self._ansible_playbook_pid = ansible_playbook_pid self._ansible_playbook_pid = ansible_playbook_pid
def start(self): def start(self, variables):
try: try:
messages = list() messages = list()
result = {} result = {}
@ -83,7 +83,7 @@ class ConnectionProcess(object):
self.play_context.private_key_file = os.path.join(self.original_path, self.play_context.private_key_file) self.play_context.private_key_file = os.path.join(self.original_path, self.play_context.private_key_file)
self.connection = connection_loader.get(self.play_context.connection, self.play_context, '/dev/null', self.connection = connection_loader.get(self.play_context.connection, self.play_context, '/dev/null',
ansible_playbook_pid=self._ansible_playbook_pid) ansible_playbook_pid=self._ansible_playbook_pid)
self.connection.set_options() self.connection.set_options(var_options=variables)
self.connection._connect() self.connection._connect()
self.connection._socket_path = self.socket_path self.connection._socket_path = self.socket_path
self.srv.register(self.connection) self.srv.register(self.connection)
@ -201,10 +201,21 @@ def main():
init_data += cur_line init_data += cur_line
cur_line = stdin.readline() cur_line = stdin.readline()
cur_line = stdin.readline()
vars_data = b''
while cur_line.strip() != b'#END_VARS#':
if cur_line == b'':
raise Exception("EOF found before vars data was complete")
vars_data += cur_line
cur_line = stdin.readline()
if PY3: if PY3:
pc_data = cPickle.loads(init_data, encoding='bytes') pc_data = cPickle.loads(init_data, encoding='bytes')
variables = cPickle.loads(vars_data, encoding='bytes')
else: else:
pc_data = cPickle.loads(init_data) pc_data = cPickle.loads(init_data)
variables = cPickle.loads(vars_data)
play_context = PlayContext() play_context = PlayContext()
play_context.deserialize(pc_data) play_context.deserialize(pc_data)
@ -242,7 +253,7 @@ def main():
os.close(r) os.close(r)
wfd = os.fdopen(w, 'w') wfd = os.fdopen(w, 'w')
process = ConnectionProcess(wfd, play_context, socket_path, original_path, ansible_playbook_pid) process = ConnectionProcess(wfd, play_context, socket_path, original_path, ansible_playbook_pid)
process.start() process.start(variables)
except Exception: except Exception:
messages.append(traceback.format_exc()) messages.append(traceback.format_exc())
rc = 1 rc = 1

@ -813,7 +813,9 @@ class TaskExecutor:
self._play_context.timeout = connection.get_option('persistent_command_timeout') self._play_context.timeout = connection.get_option('persistent_command_timeout')
display.vvvv('attempting to start connection', host=self._play_context.remote_addr) display.vvvv('attempting to start connection', host=self._play_context.remote_addr)
display.vvvv('using connection plugin %s' % connection.transport, host=self._play_context.remote_addr) display.vvvv('using connection plugin %s' % connection.transport, host=self._play_context.remote_addr)
socket_path = self._start_connection() # We don't need to send the entire contents of variables to ansible-connection
filtered_vars = dict((key, value) for key, value in variables.items() if key.startswith('ansible'))
socket_path = self._start_connection(filtered_vars)
display.vvvv('local domain socket path is %s' % socket_path, host=self._play_context.remote_addr) display.vvvv('local domain socket path is %s' % socket_path, host=self._play_context.remote_addr)
setattr(connection, '_socket_path', socket_path) setattr(connection, '_socket_path', socket_path)
@ -886,7 +888,7 @@ class TaskExecutor:
return handler return handler
def _start_connection(self): def _start_connection(self, variables):
''' '''
Starts the persistent connection Starts the persistent connection
''' '''
@ -918,8 +920,12 @@ class TaskExecutor:
# that means only protocol=0 will work. # that means only protocol=0 will work.
src = cPickle.dumps(self._play_context.serialize(), protocol=0) src = cPickle.dumps(self._play_context.serialize(), protocol=0)
stdin.write(src) stdin.write(src)
stdin.write(b'\n#END_INIT#\n') stdin.write(b'\n#END_INIT#\n')
src = cPickle.dumps(variables, protocol=0)
stdin.write(src)
stdin.write(b'\n#END_VARS#\n')
stdin.flush() stdin.flush()
(stdout, stderr) = p.communicate() (stdout, stderr) = p.communicate()

@ -16,7 +16,7 @@ version_added: "2.6"
options: options:
host: host:
description: description:
- Specifies the remote device FQDN or IP address to establish the SSH - Specifies the remote device FQDN or IP address to establish the HTTP(S)
connection to. connection to.
default: inventory_hostname default: inventory_hostname
vars: vars:
@ -25,7 +25,8 @@ options:
type: int type: int
description: description:
- Specifies the port on the remote device to listening for connections - Specifies the port on the remote device to listening for connections
when establishing the SSH connection. when establishing the HTTP(S) connection.
When unspecified, will pick 80 or 443 based on the value of use_ssl
ini: ini:
- section: defaults - section: defaults
key: remote_port key: remote_port
@ -33,6 +34,7 @@ options:
- name: ANSIBLE_REMOTE_PORT - name: ANSIBLE_REMOTE_PORT
vars: vars:
- name: ansible_port - name: ansible_port
- name: ansible_httpapi_port
network_os: network_os:
description: description:
- Configures the device platform network operating system. This value is - Configures the device platform network operating system. This value is
@ -139,6 +141,7 @@ from ansible.errors import AnsibleConnectionFailure
from ansible.module_utils._text import to_bytes from ansible.module_utils._text import to_bytes
from ansible.module_utils.six import PY3 from ansible.module_utils.six import PY3
from ansible.module_utils.six.moves import cPickle from ansible.module_utils.six.moves import cPickle
from ansible.module_utils.six.moves.urllib.error import URLError
from ansible.module_utils.urls import open_url from ansible.module_utils.urls import open_url
from ansible.playbook.play_context import PlayContext from ansible.playbook.play_context import PlayContext
from ansible.plugins.loader import cliconf_loader, connection_loader, httpapi_loader from ansible.plugins.loader import cliconf_loader, connection_loader, httpapi_loader
@ -243,13 +246,13 @@ class Connection(ConnectionBase):
network_os = self._play_context.network_os network_os = self._play_context.network_os
protocol = 'https' if self.get_option('use_ssl') else 'http' protocol = 'https' if self.get_option('use_ssl') else 'http'
host = self._play_context.remote_addr host = self.get_option('host')
port = self._play_context.port or 443 if protocol == 'https' else 80 port = self.get_option('port') or (443 if protocol == 'https' else 80)
self._url = '%s://%s:%s' % (protocol, host, port) self._url = '%s://%s:%s' % (protocol, host, port)
self._cliconf = cliconf_loader.get(network_os, self) self._cliconf = cliconf_loader.get(network_os, self)
if self._cliconf: if self._cliconf:
display.vvvv('loaded cliconf plugin for network_os %s' % network_os, host=self._play_context.remote_addr) display.vvvv('loaded cliconf plugin for network_os %s' % network_os, host=host)
else: else:
display.vvvv('unable to load cliconf for network_os %s' % network_os) display.vvvv('unable to load cliconf for network_os %s' % network_os)
@ -295,9 +298,17 @@ class Connection(ConnectionBase):
''' '''
Sends the command to the device over api Sends the command to the device over api
''' '''
url_kwargs = dict(url_username=self._play_context.remote_user, url_password=self._play_context.password) url_kwargs = dict(
url_username=self.get_option('remote_user'), url_password=self.get_option('password'),
timeout=self.get_option('timeout'),
)
url_kwargs.update(kwargs) url_kwargs.update(kwargs)
try:
response = open_url(self._url + path, data=data, **url_kwargs) response = open_url(self._url + path, data=data, **url_kwargs)
except URLError as exc:
raise AnsibleConnectionFailure('Could not connect to {0}: {1}'.format(self._url, exc.reason))
self._auth = response.info().get('Set-Cookie') self._auth = response.info().get('Set-Cookie')
return response return response

@ -117,8 +117,12 @@ class Connection(ConnectionBase):
# that means only protocol=0 will work. # that means only protocol=0 will work.
src = cPickle.dumps(self._play_context.serialize(), protocol=0) src = cPickle.dumps(self._play_context.serialize(), protocol=0)
stdin.write(src) stdin.write(src)
stdin.write(b'\n#END_INIT#\n') stdin.write(b'\n#END_INIT#\n')
src = cPickle.dumps({}, protocol=0)
stdin.write(src)
stdin.write(b'\n#END_VARS#\n')
stdin.flush() stdin.flush()
(stdout, stderr) = p.communicate() (stdout, stderr) = p.communicate()

@ -11,7 +11,6 @@
vrf_name: management vrf_name: management
source_addr: 5.5.5.5 source_addr: 5.5.5.5
state: absent state: absent
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- block: - block:
@ -24,7 +23,6 @@
vrf_name: management vrf_name: management
source_addr: 5.5.5.5 source_addr: 5.5.5.5
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -47,7 +45,6 @@
vrf_name: default vrf_name: default
source_addr: default source_addr: default
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -76,7 +73,6 @@
peer: 1.2.3.4 peer: 1.2.3.4
prefer: enabled prefer: enabled
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -91,7 +87,6 @@
nxos_ntp: &config3 nxos_ntp: &config3
source_int: default source_int: default
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true

@ -8,7 +8,6 @@
key_id: 32 key_id: 32
md5string: hello md5string: hello
state: absent state: absent
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- block: - block:
@ -19,7 +18,6 @@
md5string: hello md5string: hello
authentication: off authentication: off
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -32,7 +30,6 @@
md5string: hello md5string: hello
authentication: off authentication: off
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -43,7 +40,6 @@
md5string: hello md5string: hello
auth_type: encrypt auth_type: encrypt
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -60,7 +56,6 @@
nxos_ntp_auth: &authon nxos_ntp_auth: &authon
authentication: on authentication: on
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -75,7 +70,6 @@
nxos_ntp_auth: &authoff nxos_ntp_auth: &authoff
authentication: off authentication: off
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -91,7 +85,6 @@
key_id: 32 key_id: 32
trusted_key: true trusted_key: true
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -107,7 +100,6 @@
key_id: 32 key_id: 32
trusted_key: false trusted_key: false
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -125,7 +117,6 @@
auth_type: encrypt auth_type: encrypt
authentication: on authentication: on
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true

@ -6,7 +6,6 @@
- name: "Apply default ntp config" - name: "Apply default ntp config"
nxos_ntp_options: &default nxos_ntp_options: &default
state: absent state: absent
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- block: - block:
@ -16,7 +15,6 @@
master: true master: true
logging: true logging: true
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -36,7 +34,6 @@
master: true master: true
stratum: 10 stratum: 10
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -53,7 +50,6 @@
stratum: 10 stratum: 10
logging: false logging: false
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -69,7 +65,6 @@
master: false master: false
logging: true logging: true
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true

@ -7,7 +7,6 @@
- name: Setup - put NXAPI in stopped state - name: Setup - put NXAPI in stopped state
nxos_nxapi: nxos_nxapi:
state: absent state: absent
provider: "{{ cli }}"
- name: Configure NXAPI - name: Configure NXAPI
nxos_nxapi: nxos_nxapi:
@ -15,13 +14,11 @@
enable_sandbox: "{{nxapi_sandbox_option|default(omit)}}" enable_sandbox: "{{nxapi_sandbox_option|default(omit)}}"
enable_https: yes enable_https: yes
https_port: 9443 https_port: 9443
provider: "{{ cli }}"
register: result register: result
- nxos_command: - nxos_command:
commands: commands:
- show nxapi | json - show nxapi | json
provider: "{{ cli }}"
register: result register: result
- include: targets/nxos_nxapi/tasks/platform/n7k/assert_changes.yaml - include: targets/nxos_nxapi/tasks/platform/n7k/assert_changes.yaml
@ -39,7 +36,6 @@
enable_sandbox: "{{nxapi_sandbox_option|default(omit)}}" enable_sandbox: "{{nxapi_sandbox_option|default(omit)}}"
enable_https: yes enable_https: yes
https_port: 9443 https_port: 9443
provider: "{{ cli }}"
register: result register: result
- name: Assert configuration is idempotent - name: Assert configuration is idempotent

@ -4,14 +4,12 @@
- name: Disable NXAPI - name: Disable NXAPI
nxos_nxapi: nxos_nxapi:
state: absent state: absent
provider: "{{ cli }}"
register: result register: result
- name: Check NXAPI state - name: Check NXAPI state
nxos_command: nxos_command:
commands: commands:
- show feature | grep nxapi - show feature | grep nxapi
provider: "{{ cli }}"
register: result register: result
- name: Assert NXAPI is disabled - name: Assert NXAPI is disabled
@ -23,7 +21,6 @@
nxos_nxapi: nxos_nxapi:
state: state:
absent absent
provider: "{{ cli }}"
register: result register: result
- name: Assert idempotence - name: Assert idempotence

@ -4,20 +4,17 @@
- name: Setup - put NXAPI in stopped state - name: Setup - put NXAPI in stopped state
nxos_nxapi: nxos_nxapi:
state: absent state: absent
provider: "{{ cli }}"
register: result register: result
- name: Enable NXAPI - name: Enable NXAPI
nxos_nxapi: nxos_nxapi:
state: present state: present
provider: "{{ cli }}"
register: result register: result
- name: Check NXAPI state - name: Check NXAPI state
nxos_command: nxos_command:
commands: commands:
- show feature | grep nxapi - show feature | grep nxapi
provider: "{{ cli }}"
register: result register: result
- name: Assert NXAPI is enabled - name: Assert NXAPI is enabled
@ -26,7 +23,6 @@
- name: Enable NXAPI again - name: Enable NXAPI again
nxos_nxapi: nxos_nxapi:
provider: "{{ cli }}"
register: result register: result
- name: Assert idempotence - name: Assert idempotence

@ -7,7 +7,6 @@
nxos_feature: nxos_feature:
feature: ospf feature: ospf
state: enabled state: enabled
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- block: - block:
@ -15,7 +14,6 @@
nxos_ospf: &config nxos_ospf: &config
ospf: 1 ospf: 1
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -35,7 +33,6 @@
nxos_feature: nxos_feature:
feature: ospf feature: ospf
state: disabled state: disabled
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
always: always:
@ -43,7 +40,6 @@
nxos_ospf: &unconfig nxos_ospf: &unconfig
ospf: 1 ospf: 1
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true

@ -7,7 +7,6 @@
nxos_feature: nxos_feature:
feature: ospf feature: ospf
state: enabled state: enabled
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- block: - block:
@ -24,7 +23,6 @@
vrf: test vrf: test
passive_interface: true passive_interface: true
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -50,7 +48,6 @@
vrf: default vrf: default
passive_interface: true passive_interface: true
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -71,7 +68,6 @@
passive_interface: false passive_interface: false
vrf: default vrf: default
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -87,7 +83,6 @@
ospf: 2 ospf: 2
vrf: default vrf: default
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -103,7 +98,6 @@
ospf: 1 ospf: 1
vrf: test vrf: test
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -119,7 +113,6 @@
nxos_feature: nxos_feature:
feature: ospf feature: ospf
state: disabled state: disabled
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- debug: msg="END connection={{ ansible_connection }} nxos_ospf_vrf sanity test" - debug: msg="END connection={{ ansible_connection }} nxos_ospf_vrf sanity test"

@ -16,7 +16,6 @@
- name: "Enable nv overlay evpn" - name: "Enable nv overlay evpn"
nxos_evpn_global: &enable_evpn nxos_evpn_global: &enable_evpn
nv_overlay_evpn: true nv_overlay_evpn: true
provider: "{{ connection }}"
- name: "Apply N7K specific setup config" - name: "Apply N7K specific setup config"
include: targets/nxos_overlay_global/tasks/platform/n7k/setup.yaml include: targets/nxos_overlay_global/tasks/platform/n7k/setup.yaml
@ -28,13 +27,11 @@
- feature-set fabric - feature-set fabric
- feature fabric forwarding - feature fabric forwarding
match: none match: none
provider: "{{ connection }}"
when: platform is match('N7K') when: platform is match('N7K')
- name: "Remove possibly existing mac" - name: "Remove possibly existing mac"
nxos_overlay_global: nxos_overlay_global:
anycast_gateway_mac: "default" anycast_gateway_mac: "default"
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
when: overlay_global_supported when: overlay_global_supported
@ -45,7 +42,6 @@
- name: Configure overlay global - name: Configure overlay global
nxos_overlay_global: &configure nxos_overlay_global: &configure
anycast_gateway_mac: "b.b.b" anycast_gateway_mac: "b.b.b"
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -63,7 +59,6 @@
- name: Update anycast gateway mac - name: Update anycast gateway mac
nxos_overlay_global: &update nxos_overlay_global: &update
anycast_gateway_mac: "a.a.a" anycast_gateway_mac: "a.a.a"
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -78,7 +73,6 @@
- name: Remove anycast gateway mac - name: Remove anycast gateway mac
nxos_overlay_global: &remove nxos_overlay_global: &remove
anycast_gateway_mac: "default" anycast_gateway_mac: "default"
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -99,7 +93,6 @@
- name: "Disable nv overlay evpn" - name: "Disable nv overlay evpn"
nxos_evpn_global: &disable_evpn nxos_evpn_global: &disable_evpn
nv_overlay_evpn: false nv_overlay_evpn: false
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
when: overlay_global_supported when: overlay_global_supported

@ -7,18 +7,15 @@
nxos_feature: &disable_feature nxos_feature: &disable_feature
feature: pim feature: pim
state: disabled state: disabled
provider: "{{ connection }}"
- name: "Setup: Enable feature PIM" - name: "Setup: Enable feature PIM"
nxos_feature: nxos_feature:
feature: pim feature: pim
state: enabled state: enabled
provider: "{{ connection }}"
- name: "Setup: Configure ssm_range none" - name: "Setup: Configure ssm_range none"
nxos_pim: &none nxos_pim: &none
ssm_range: "none" ssm_range: "none"
provider: "{{ connection }}"
- block: - block:
- name: Configure ssm_range - name: Configure ssm_range
@ -26,7 +23,6 @@
ssm_range: ssm_range:
- "239.128.1.0/24" - "239.128.1.0/24"
- "224.0.0.0/8" - "224.0.0.0/8"
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -44,7 +40,6 @@
- name: Configure ssm_range default - name: Configure ssm_range default
nxos_pim: &conf_default nxos_pim: &conf_default
ssm_range: "default" ssm_range: "default"
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true

@ -7,13 +7,11 @@
nxos_feature: &disable_feature nxos_feature: &disable_feature
feature: pim feature: pim
state: disabled state: disabled
provider: "{{ connection }}"
- name: "Enable feature PIM" - name: "Enable feature PIM"
nxos_feature: nxos_feature:
feature: pim feature: pim
state: enabled state: enabled
provider: "{{ connection }}"
- set_fact: testint="{{ nxos_int1 }}" - set_fact: testint="{{ nxos_int1 }}"
@ -21,7 +19,6 @@
nxos_config: nxos_config:
lines: lines:
- "default interface {{ testint }}" - "default interface {{ testint }}"
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- name: "Ensure {{testint}} is layer3" - name: "Ensure {{testint}} is layer3"
@ -31,14 +28,12 @@
description: 'Configured by Ansible - Layer3' description: 'Configured by Ansible - Layer3'
admin_state: 'up' admin_state: 'up'
state: present state: present
provider: "{{ connection }}"
- block: - block:
- name: Configure nxos_pim_interface state absent - name: Configure nxos_pim_interface state absent
nxos_pim_interface: &pimabsent nxos_pim_interface: &pimabsent
interface: "{{ testint }}" interface: "{{ testint }}"
state: absent state: absent
provider: "{{ connection }}"
- name: configure jp policy and type - name: configure jp policy and type
nxos_pim_interface: &configjp nxos_pim_interface: &configjp
@ -49,7 +44,6 @@
jp_type_out: routemap jp_type_out: routemap
sparse: True sparse: True
border: True border: True
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -69,7 +63,6 @@
interface: "{{ testint }}" interface: "{{ testint }}"
neighbor_policy: NPR neighbor_policy: NPR
neighbor_type: routemap neighbor_type: routemap
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -88,7 +81,6 @@
interface: "{{ testint }}" interface: "{{ testint }}"
neighbor_policy: NPPF neighbor_policy: NPPF
neighbor_type: prefix neighbor_type: prefix
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -103,7 +95,6 @@
nxos_pim_interface: &confighak1 nxos_pim_interface: &confighak1
interface: "{{ testint }}" interface: "{{ testint }}"
hello_auth_key: password1 hello_auth_key: password1
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -116,7 +107,6 @@
sparse: True sparse: True
border: True border: True
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -133,7 +123,6 @@
sparse: False sparse: False
border: False border: False
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -151,7 +140,6 @@
nxos_pim_interface: &configdefault nxos_pim_interface: &configdefault
interface: "{{ testint }}" interface: "{{ testint }}"
state: default state: default
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -167,7 +155,6 @@
interface: "{{ testint }}" interface: "{{ testint }}"
border: True border: True
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true

@ -12,13 +12,11 @@
nxos_feature: &disable_feature nxos_feature: &disable_feature
feature: pim feature: pim
state: disabled state: disabled
provider: "{{ connection }}"
- name: "Enable feature PIM" - name: "Enable feature PIM"
nxos_feature: &enable_feature nxos_feature: &enable_feature
feature: pim feature: pim
state: enabled state: enabled
provider: "{{ connection }}"
- name: Configure rp_address + group_list - name: Configure rp_address + group_list
nxos_pim_rp_address: &configgl nxos_pim_rp_address: &configgl
@ -26,7 +24,6 @@
group_list: "224.0.0.0/8" group_list: "224.0.0.0/8"
bidir: "{{ bidir }}" bidir: "{{ bidir }}"
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -47,7 +44,6 @@
group_list: "224.0.0.0/8" group_list: "224.0.0.0/8"
bidir: False bidir: False
state: present state: present
provider: "{{ connection }}"
register: result register: result
when: platform is not match("N3L") when: platform is not match("N3L")
@ -67,7 +63,6 @@
rp_address: "10.1.1.20" rp_address: "10.1.1.20"
bidir: "{{ bidir }}" bidir: "{{ bidir }}"
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -83,7 +78,6 @@
rp_address: "10.1.1.20" rp_address: "10.1.1.20"
bidir: False bidir: False
state: present state: present
provider: "{{ connection }}"
register: result register: result
when: platform is not match("N3L") when: platform is not match("N3L")
@ -103,7 +97,6 @@
rp_address: "10.1.1.20" rp_address: "10.1.1.20"
group_list: "224.0.0.0/8" group_list: "224.0.0.0/8"
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -118,7 +111,6 @@
nxos_pim_rp_address: &configbir nxos_pim_rp_address: &configbir
rp_address: "10.1.1.20" rp_address: "10.1.1.20"
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -135,7 +127,6 @@
prefix_list: "pim_prefix_list" prefix_list: "pim_prefix_list"
bidir: "{{ bidir }}" bidir: "{{ bidir }}"
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -152,7 +143,6 @@
prefix_list: "pim_prefix_list" prefix_list: "pim_prefix_list"
bidir: False bidir: False
state: present state: present
provider: "{{ connection }}"
register: result register: result
when: platform is not match("N3L") when: platform is not match("N3L")
@ -173,7 +163,6 @@
prefix_list: "pim_prefix_list" prefix_list: "pim_prefix_list"
bidir: False bidir: False
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -190,7 +179,6 @@
route_map: "pim_routemap" route_map: "pim_routemap"
bidir: "{{ bidir }}" bidir: "{{ bidir }}"
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -207,7 +195,6 @@
route_map: "pim_routemap" route_map: "pim_routemap"
bidir: False bidir: False
state: present state: present
provider: "{{ connection }}"
register: result register: result
when: platform is not match("N3L") when: platform is not match("N3L")
@ -228,7 +215,6 @@
route_map: "pim_routemap" route_map: "pim_routemap"
bidir: False bidir: False
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true

@ -10,21 +10,18 @@
nxos_feature: nxos_feature:
feature: lacp feature: lacp
state: enabled state: enabled
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- name: "Put interface {{testint1}} into default state" - name: "Put interface {{testint1}} into default state"
nxos_config: &intdefault1 nxos_config: &intdefault1
lines: lines:
- "default interface {{ testint1 }}" - "default interface {{ testint1 }}"
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- name: "Put interface {{testint2}} into default state" - name: "Put interface {{testint2}} into default state"
nxos_config: &intdefault2 nxos_config: &intdefault2
lines: lines:
- "default interface {{ testint2 }}" - "default interface {{ testint2 }}"
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- name: Remove possibly configured port-channel 99 - name: Remove possibly configured port-channel 99
@ -34,7 +31,6 @@
force: 'true' force: 'true'
state: absent state: absent
timeout: 60 timeout: 60
provider: "{{ connection }}"
- block: - block:
- name: Configure port-channel mode active - name: Configure port-channel mode active
@ -45,7 +41,6 @@
force: 'true' force: 'true'
state: present state: present
timeout: 60 timeout: 60
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -68,7 +63,6 @@
force: 'true' force: 'true'
state: present state: present
timeout: 60 timeout: 60
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -91,7 +85,6 @@
feature: lacp feature: lacp
state: disabled state: disabled
timeout: 60 timeout: 60
provider: "{{ connection }}"
always: always:
- name: Delete port-channel - name: Delete port-channel

@ -9,20 +9,17 @@
- terminal dont-ask - terminal dont-ask
- delete backup.cfg - delete backup.cfg
match: none match: none
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- name: Create checkpoint file - name: Create checkpoint file
nxos_rollback: nxos_rollback:
checkpoint_file: backup.cfg checkpoint_file: backup.cfg
timeout: 300 timeout: 300
provider: "{{ connection }}"
- name: rollback to the previously created checkpoint file - name: rollback to the previously created checkpoint file
nxos_rollback: nxos_rollback:
rollback_to: backup.cfg rollback_to: backup.cfg
timeout: 300 timeout: 300
provider: "{{ connection }}"
- name: cleanup checkpoint file - name: cleanup checkpoint file
nxos_config: *delete nxos_config: *delete

@ -14,7 +14,6 @@
snapshot_name: test_snapshot1 snapshot_name: test_snapshot1
description: Ansible description: Ansible
save_snapshot_locally: true save_snapshot_locally: true
provider: "{{ connection }}"
- name: create another snapshot - name: create another snapshot
nxos_snapshot: nxos_snapshot:
@ -26,7 +25,6 @@
row_id: ROW_intf row_id: ROW_intf
element_key1: intf-name element_key1: intf-name
save_snapshot_locally: true save_snapshot_locally: true
provider: "{{ connection }}"
- name: compare snapshots - name: compare snapshots
nxos_snapshot: nxos_snapshot:
@ -36,7 +34,6 @@
comparison_results_file: compare_snapshots.txt comparison_results_file: compare_snapshots.txt
compare_option: summary compare_option: summary
path: '.' path: '.'
provider: "{{ connection }}"
- name: FAIL compare snapshots - name: FAIL compare snapshots
nxos_snapshot: nxos_snapshot:
@ -45,7 +42,6 @@
snapshot2: test_snapshot2 snapshot2: test_snapshot2
compare_option: summary compare_option: summary
path: '.' path: '.'
provider: "{{ connection }}"
register: result register: result
ignore_errors: yes ignore_errors: yes
@ -60,7 +56,6 @@
- name: delete snapshot - name: delete snapshot
nxos_snapshot: nxos_snapshot:
action: delete_all action: delete_all
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- debug: msg="END connection={{ ansible_connection }} nxos_snapshot sanity test" - debug: msg="END connection={{ ansible_connection }} nxos_snapshot sanity test"

@ -8,7 +8,6 @@
community: TESTING7 community: TESTING7
group: network-operator group: network-operator
state: absent state: absent
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- block: - block:
@ -18,7 +17,6 @@
community: TESTING7 community: TESTING7
group: network-operator group: network-operator
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -38,7 +36,6 @@
community: TESTING7 community: TESTING7
group: network-admin group: network-admin
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -66,7 +63,6 @@
community: TESTING7 community: TESTING7
access: ro access: ro
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -95,7 +91,6 @@
access: rw access: rw
acl: ansible_acl acl: ansible_acl
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -112,7 +107,6 @@
access: rw access: rw
acl: new_acl acl: new_acl
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -129,7 +123,6 @@
access: rw access: rw
acl: default acl: default
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true

@ -7,7 +7,6 @@
nxos_snmp_contact: &remove nxos_snmp_contact: &remove
contact: Test contact: Test
state: absent state: absent
provider: "{{ connection }}"
- block: - block:
@ -15,7 +14,6 @@
nxos_snmp_contact: &config nxos_snmp_contact: &config
contact: Testing contact: Testing
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -34,7 +32,6 @@
nxos_snmp_contact: &config1 nxos_snmp_contact: &config1
contact: Test contact: Test
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true

@ -21,7 +21,6 @@
src_intf: "{{ intname|default(omit) }}" src_intf: "{{ intname|default(omit) }}"
udp: 222 udp: 222
state: absent state: absent
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- block: - block:
@ -37,7 +36,6 @@
src_intf: "{{ intname|default(omit) }}" src_intf: "{{ intname|default(omit) }}"
udp: 222 udp: 222
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -59,7 +57,6 @@
vrf_filter: default vrf_filter: default
udp: 222 udp: 222
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -79,7 +76,6 @@
vrf: management vrf: management
vrf_filter: management vrf_filter: management
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -97,7 +93,6 @@
udp: 222 udp: 222
vrf_filter: default vrf_filter: default
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true

@ -21,7 +21,6 @@
src_intf: "{{ intname|default(omit) }}" src_intf: "{{ intname|default(omit) }}"
udp: 222 udp: 222
state: absent state: absent
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- block: - block:
@ -37,7 +36,6 @@
src_intf: "{{ intname|default(omit) }}" src_intf: "{{ intname|default(omit) }}"
udp: 222 udp: 222
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -59,7 +57,6 @@
vrf_filter: default vrf_filter: default
udp: 222 udp: 222
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -79,7 +76,6 @@
vrf: management vrf: management
vrf_filter: management vrf_filter: management
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -97,7 +93,6 @@
udp: 222 udp: 222
vrf_filter: default vrf_filter: default
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true

@ -26,7 +26,6 @@
vrf_filter: management vrf_filter: management
src_intf: "{{ intname|default(omit) }}" src_intf: "{{ intname|default(omit) }}"
state: absent state: absent
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- block: - block:
@ -42,7 +41,6 @@
vrf_filter: management vrf_filter: management
src_intf: "{{ intname|default(omit) }}" src_intf: "{{ intname|default(omit) }}"
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -63,7 +61,6 @@
snmp_host: 3.3.3.3 snmp_host: 3.3.3.3
vrf_filter: default vrf_filter: default
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -82,7 +79,6 @@
vrf: management vrf: management
vrf_filter: management vrf_filter: management
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -99,7 +95,6 @@
snmp_host: 3.3.3.3 snmp_host: 3.3.3.3
vrf_filter: default vrf_filter: default
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true

@ -23,7 +23,6 @@
vrf_filter: management vrf_filter: management
src_intf: "{{ intname|default(omit) }}" src_intf: "{{ intname|default(omit) }}"
state: absent state: absent
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- block: - block:
@ -40,7 +39,6 @@
vrf_filter: management vrf_filter: management
src_intf: "{{ intname|default(omit) }}" src_intf: "{{ intname|default(omit) }}"
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -62,7 +60,6 @@
udp: 222 udp: 222
vrf_filter: default vrf_filter: default
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -82,7 +79,6 @@
vrf: management vrf: management
vrf_filter: management vrf_filter: management
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -100,7 +96,6 @@
udp: 222 udp: 222
vrf_filter: default vrf_filter: default
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true

@ -7,14 +7,12 @@
nxos_snmp_location: &remove nxos_snmp_location: &remove
location: Test location: Test
state: absent state: absent
provider: "{{ connection }}"
- block: - block:
- name: Configure snmp location - name: Configure snmp location
nxos_snmp_location: &config nxos_snmp_location: &config
location: Testing location: Testing
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -33,7 +31,6 @@
nxos_snmp_location: &config1 nxos_snmp_location: &config1
location: Test location: Test
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true

@ -7,14 +7,12 @@
nxos_snmp_traps: &remove nxos_snmp_traps: &remove
group: all group: all
state: disabled state: disabled
provider: "{{ connection }}"
- block: - block:
- name: Configure one snmp trap group - name: Configure one snmp trap group
nxos_snmp_traps: &config nxos_snmp_traps: &config
group: bridge group: bridge
state: enabled state: enabled
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -33,7 +31,6 @@
nxos_snmp_traps: &rem1 nxos_snmp_traps: &rem1
group: bridge group: bridge
state: disabled state: disabled
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -48,7 +45,6 @@
nxos_snmp_traps: &config1 nxos_snmp_traps: &config1
group: all group: all
state: enabled state: enabled
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true

@ -7,7 +7,6 @@
nxos_snmp_user: &remove nxos_snmp_user: &remove
user: ntc user: ntc
state: absent state: absent
provider: "{{ connection }}"
- pause: - pause:
seconds: 5 seconds: 5
@ -21,7 +20,6 @@
pwd: N$tOpe%1 pwd: N$tOpe%1
privacy: HelloU$er1 privacy: HelloU$er1
encrypt: true encrypt: true
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -32,7 +30,6 @@
nxos_snmp_user: &chg nxos_snmp_user: &chg
user: ntc user: ntc
group: network-admin group: network-admin
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -50,7 +47,6 @@
user: ntc user: ntc
group: network-admin group: network-admin
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -69,7 +65,6 @@
user: ntc user: ntc
group: network-operator group: network-operator
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true

@ -12,7 +12,6 @@
pref: 100 pref: 100
tag: 5500 tag: 5500
vrf: "{{ item }}" vrf: "{{ item }}"
provider: "{{ connection }}"
with_items: "{{ vrfs }}" with_items: "{{ vrfs }}"
register: result register: result
@ -37,7 +36,6 @@
pref: 10 pref: 10
tag: default tag: default
vrf: "{{ item }}" vrf: "{{ item }}"
provider: "{{ connection }}"
with_items: "{{ vrfs }}" with_items: "{{ vrfs }}"
register: result register: result
@ -58,7 +56,6 @@
pref: 100 pref: 100
vrf: "{{ item }}" vrf: "{{ item }}"
state: absent state: absent
provider: "{{ connection }}"
with_items: "{{ vrfs }}" with_items: "{{ vrfs }}"
register: result register: result
@ -76,7 +73,6 @@
aggregate: aggregate:
- { prefix: "192.168.22.64/24", next_hop: "3.3.3.3" } - { prefix: "192.168.22.64/24", next_hop: "3.3.3.3" }
- { prefix: "192.168.24.64/24", next_hop: "3.3.3.3" } - { prefix: "192.168.24.64/24", next_hop: "3.3.3.3" }
provider: "{{ connection }}"
register: result register: result
- assert: - assert:
@ -97,7 +93,6 @@
- { prefix: "192.168.22.64/24", next_hop: "3.3.3.3" } - { prefix: "192.168.22.64/24", next_hop: "3.3.3.3" }
- { prefix: "192.168.24.64/24", next_hop: "3.3.3.3" } - { prefix: "192.168.24.64/24", next_hop: "3.3.3.3" }
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: - assert:
@ -122,7 +117,6 @@
tag: 5500 tag: 5500
vrf: "{{ item }}" vrf: "{{ item }}"
state: absent state: absent
provider: "{{ connection }}"
with_items: "{{ vrfs }}" with_items: "{{ vrfs }}"
ignore_errors: yes ignore_errors: yes
@ -132,7 +126,6 @@
- { prefix: "192.168.22.64/24", next_hop: "3.3.3.3" } - { prefix: "192.168.22.64/24", next_hop: "3.3.3.3" }
- { prefix: "192.168.24.64/24", next_hop: "3.3.3.3" } - { prefix: "192.168.24.64/24", next_hop: "3.3.3.3" }
state: absent state: absent
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- debug: msg="END connection={{ ansible_connection }} nxos_static_route sanity test" - debug: msg="END connection={{ ansible_connection }} nxos_static_route sanity test"

@ -13,33 +13,28 @@
nxos_config: &default nxos_config: &default
lines: lines:
- "default interface {{ intname }}" - "default interface {{ intname }}"
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- name: "Setup vlans" - name: "Setup vlans"
nxos_vlan: nxos_vlan:
vlan_range: "5-10,20" vlan_range: "5-10,20"
provider: "{{ connection }}"
- block: - block:
- name: Ensure interface is in L2 state - name: Ensure interface is in L2 state
nxos_interface: nxos_interface:
interface: "{{ intname }}" interface: "{{ intname }}"
mode: 'layer2' mode: 'layer2'
provider: "{{ connection }}"
- name: Ensure interface is in its default switchport state - name: Ensure interface is in its default switchport state
nxos_switchport: &def_swi nxos_switchport: &def_swi
interface: "{{ intname }}" interface: "{{ intname }}"
state: unconfigured state: unconfigured
provider: "{{ connection }}"
- name: Ensure interface is configured for access vlan 20 - name: Ensure interface is configured for access vlan 20
nxos_switchport: &acc_vl nxos_switchport: &acc_vl
interface: "{{ intname }}" interface: "{{ intname }}"
mode: access mode: access
access_vlan: 20 access_vlan: 20
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -60,7 +55,6 @@
mode: trunk mode: trunk
native_vlan: 10 native_vlan: 10
trunk_allowed_vlans: 5-10 trunk_allowed_vlans: 5-10
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -77,7 +71,6 @@
mode: trunk mode: trunk
native_vlan: 10 native_vlan: 10
trunk_vlans: 2-50 trunk_vlans: 2-50
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -94,7 +87,6 @@
mode: trunk mode: trunk
trunk_vlans: 2-50 trunk_vlans: 2-50
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -123,7 +115,6 @@
mode: trunk mode: trunk
trunk_vlans: 30-4094 trunk_vlans: 30-4094
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -151,7 +142,6 @@
nxos_vlan: nxos_vlan:
vlan_range: "5-10,20" vlan_range: "5-10,20"
state: absent state: absent
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- name: "default interface" - name: "default interface"

@ -10,14 +10,12 @@
- no ip domain-list ansible.com - no ip domain-list ansible.com
- no ip domain-list redhat.com - no ip domain-list redhat.com
match: none match: none
provider: "{{ cli }}"
- name: configure domain_list using platform agnostic module - name: configure domain_list using platform agnostic module
net_system: net_system:
domain_search: domain_search:
- ansible.com - ansible.com
- redhat.com - redhat.com
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -32,6 +30,5 @@
- no ip domain-list ansible.com - no ip domain-list ansible.com
- no ip domain-list redhat.com - no ip domain-list redhat.com
match: none match: none
provider: "{{ cli }}"
- debug: msg="END nxos cli/net_system.yaml on connection={{ ansible_connection }}" - debug: msg="END nxos cli/net_system.yaml on connection={{ ansible_connection }}"

@ -7,14 +7,12 @@
- no ip domain-list ansible.com - no ip domain-list ansible.com
- no ip domain-list redhat.com - no ip domain-list redhat.com
match: none match: none
provider: "{{ cli }}"
- name: configure domain_list - name: configure domain_list
nxos_system: nxos_system:
domain_search: domain_search:
- ansible.com - ansible.com
- redhat.com - redhat.com
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -28,7 +26,6 @@
domain_search: domain_search:
- ansible.com - ansible.com
- redhat.com - redhat.com
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -39,7 +36,6 @@
nxos_system: nxos_system:
domain_search: domain_search:
- ansible.com - ansible.com
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -51,7 +47,6 @@
nxos_system: nxos_system:
domain_search: domain_search:
- ansible.com - ansible.com
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -63,7 +58,6 @@
domain_search: domain_search:
- ansible.com - ansible.com
- redhat.com - redhat.com
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -76,7 +70,6 @@
domain_search: domain_search:
- ansible.com - ansible.com
- redhat.com - redhat.com
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -88,7 +81,6 @@
domain_search: domain_search:
- ansible.com - ansible.com
- eng.ansible.com - eng.ansible.com
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -103,7 +95,6 @@
domain_search: domain_search:
- ansible.com - ansible.com
- eng.ansible.com - eng.ansible.com
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -117,6 +108,5 @@
- no ip domain-list redhat.com - no ip domain-list redhat.com
- no ip domain-list eng.ansible.com - no ip domain-list eng.ansible.com
match: none match: none
provider: "{{ cli }}"
- debug: msg="END cli/set_domain_search.yaml" - debug: msg="END cli/set_domain_search.yaml"

@ -5,12 +5,10 @@
nxos_config: nxos_config:
lines: no ip domain-name eng.ansible.com lines: no ip domain-name eng.ansible.com
match: none match: none
provider: "{{ cli }}"
- name: configure domain_name - name: configure domain_name
nxos_system: nxos_system:
domain_name: eng.ansible.com domain_name: eng.ansible.com
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -20,7 +18,6 @@
- name: verify domain_name - name: verify domain_name
nxos_system: nxos_system:
domain_name: eng.ansible.com domain_name: eng.ansible.com
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -31,6 +28,5 @@
nxos_config: nxos_config:
lines: no ip domain-name eng.ansible.com lines: no ip domain-name eng.ansible.com
match: none match: none
provider: "{{ cli }}"
- debug: msg="END cli/set_domain_name.yaml" - debug: msg="END cli/set_domain_name.yaml"

@ -8,7 +8,6 @@
- no ip name-server 2.2.2.2 - no ip name-server 2.2.2.2
- no ip name-server 3.3.3.3 - no ip name-server 3.3.3.3
match: none match: none
provider: "{{ cli }}"
- name: configure name_servers - name: configure name_servers
nxos_system: nxos_system:
@ -16,7 +15,6 @@
- 1.1.1.1 - 1.1.1.1
- 2.2.2.2 - 2.2.2.2
- 3.3.3.3 - 3.3.3.3
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -32,7 +30,6 @@
- 1.1.1.1 - 1.1.1.1
- 2.2.2.2 - 2.2.2.2
- 3.3.3.3 - 3.3.3.3
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -45,7 +42,6 @@
# - 1.1.1.1 # - 1.1.1.1
# - { server: 2.2.2.2, vrf: ansible } # - { server: 2.2.2.2, vrf: ansible }
# - 3.3.3.3 # - 3.3.3.3
# provider: "{{ cli }}"
# register: result # register: result
#- assert: #- assert:
@ -61,7 +57,6 @@
# - 1.1.1.1 # - 1.1.1.1
# - { server: 2.2.2.2, vrf: ansible } # - { server: 2.2.2.2, vrf: ansible }
# - 3.3.3.3 # - 3.3.3.3
# provider: "{{ cli }}"
# register: result # register: result
# #
#- assert: #- assert:
@ -73,7 +68,6 @@
name_servers: name_servers:
- 1.1.1.1 - 1.1.1.1
- 2.2.2.2 - 2.2.2.2
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -87,7 +81,6 @@
lines: lines:
- no ip lookup source-interface - no ip lookup source-interface
match: none match: none
provider: "{{ cli }}"
ignore_errors: yes ignore_errors: yes
# FIXME Copied from iosxr, not sure what we need here # FIXME Copied from iosxr, not sure what we need here

@ -8,26 +8,22 @@
nxos_system: &hostname nxos_system: &hostname
hostname: switch hostname: switch
domain_name: test.example.com domain_name: test.example.com
provider: "{{ connection }}"
- name: remove configuration - name: remove configuration
nxos_system: nxos_system:
state: absent state: absent
provider: "{{ connection }}"
- name: configure name servers - name: configure name servers
nxos_system: nxos_system:
name_servers: name_servers:
- 8.8.8.8 - 8.8.8.8
- 8.8.4.4 - 8.8.4.4
provider: "{{ connection }}"
- name: configure name servers with VRF support - name: configure name servers with VRF support
nxos_system: nxos_system:
name_servers: name_servers:
- { server: 8.8.8.8, vrf: management } - { server: 8.8.8.8, vrf: management }
- { server: 8.8.4.4, vrf: management } - { server: 8.8.4.4, vrf: management }
provider: "{{ connection }}"
always: always:
- name: Re-configure hostname - name: Re-configure hostname

@ -8,12 +8,10 @@
nxos_config: nxos_config:
lines: hostname switch lines: hostname switch
match: none match: none
provider: "{{ connection }}"
- name: configure hostname - name: configure hostname
nxos_system: nxos_system:
hostname: foo hostname: foo
provider: "{{ connection }}"
register: result register: result
- assert: - assert:
@ -23,7 +21,6 @@
- name: verify hostname - name: verify hostname
nxos_system: nxos_system:
hostname: foo hostname: foo
provider: "{{ connection }}"
register: result register: result
- assert: - assert:
@ -35,7 +32,6 @@
nxos_config: nxos_config:
lines: hostname switch lines: hostname switch
match: none match: none
provider: "{{ connection }}"
- debug: msg="END connection={{ ansible_connection }}/set_hostname.yaml" - debug: msg="END connection={{ ansible_connection }}/set_hostname.yaml"

@ -11,7 +11,6 @@
- no ip domain-list ansible.com - no ip domain-list ansible.com
- no ip domain-list redhat.com - no ip domain-list redhat.com
match: none match: none
provider: "{{ nxapi }}"
ignore_errors: yes ignore_errors: yes
- name: configure domain_list using platform agnostic module - name: configure domain_list using platform agnostic module
@ -19,7 +18,6 @@
domain_search: domain_search:
- ansible.com - ansible.com
- redhat.com - redhat.com
provider: "{{ nxapi }}"
register: result register: result
- assert: - assert:
@ -34,6 +32,5 @@
- no ip domain-list ansible.com - no ip domain-list ansible.com
- no ip domain-list redhat.com - no ip domain-list redhat.com
match: none match: none
provider: "{{ nxapi }}"
- debug: msg="END nxos nxapi/net_system.yaml on connection={{ ansible_connection }}" - debug: msg="END nxos nxapi/net_system.yaml on connection={{ ansible_connection }}"

@ -9,7 +9,6 @@
lines: lines:
- no ip domain-list {{ item }} - no ip domain-list {{ item }}
match: none match: none
provider: "{{ nxapi }}"
ignore_errors: yes ignore_errors: yes
with_items: with_items:
- ansible.com - ansible.com
@ -20,7 +19,6 @@
domain_search: domain_search:
- ansible.com - ansible.com
- redhat.com - redhat.com
provider: "{{ nxapi }}"
register: result register: result
- assert: - assert:
@ -34,7 +32,6 @@
domain_search: domain_search:
- ansible.com - ansible.com
- redhat.com - redhat.com
provider: "{{ nxapi }}"
register: result register: result
- assert: - assert:
@ -45,7 +42,6 @@
nxos_system: nxos_system:
domain_search: domain_search:
- ansible.com - ansible.com
provider: "{{ nxapi }}"
register: result register: result
- assert: - assert:
@ -57,7 +53,6 @@
nxos_system: nxos_system:
domain_search: domain_search:
- ansible.com - ansible.com
provider: "{{ nxapi }}"
register: result register: result
- assert: - assert:
@ -69,7 +64,6 @@
domain_search: domain_search:
- ansible.com - ansible.com
- redhat.com - redhat.com
provider: "{{ nxapi }}"
register: result register: result
- assert: - assert:
@ -82,7 +76,6 @@
domain_search: domain_search:
- ansible.com - ansible.com
- redhat.com - redhat.com
provider: "{{ nxapi }}"
register: result register: result
- assert: - assert:
@ -94,7 +87,6 @@
domain_search: domain_search:
- ansible.com - ansible.com
- eng.ansible.com - eng.ansible.com
provider: "{{ nxapi }}"
register: result register: result
- assert: - assert:
@ -109,7 +101,6 @@
domain_search: domain_search:
- ansible.com - ansible.com
- eng.ansible.com - eng.ansible.com
provider: "{{ nxapi }}"
register: result register: result
- assert: - assert:
@ -121,7 +112,6 @@
lines: lines:
- no ip domain-list {{ item }} - no ip domain-list {{ item }}
match: none match: none
provider: "{{ nxapi }}"
ignore_errors: yes ignore_errors: yes
with_items: with_items:
- ansible.com - ansible.com

@ -5,14 +5,12 @@
nxos_config: nxos_config:
lines: no ip domain-name eng.ansible.com lines: no ip domain-name eng.ansible.com
match: none match: none
provider: "{{ nxapi }}"
# NXAPI errors if you try to remove something that doesn't exist # NXAPI errors if you try to remove something that doesn't exist
ignore_errors: yes ignore_errors: yes
- name: configure domain_name - name: configure domain_name
nxos_system: nxos_system:
domain_name: eng.ansible.com domain_name: eng.ansible.com
provider: "{{ nxapi }}"
register: result register: result
- assert: - assert:
@ -22,7 +20,6 @@
- name: verify domain_name - name: verify domain_name
nxos_system: nxos_system:
domain_name: eng.ansible.com domain_name: eng.ansible.com
provider: "{{ nxapi }}"
register: result register: result
- assert: - assert:
@ -33,6 +30,5 @@
nxos_config: nxos_config:
lines: no ip domain-name eng.ansible.com lines: no ip domain-name eng.ansible.com
match: none match: none
provider: "{{ nxapi }}"
- debug: msg="END nxapi/set_domain_name.yaml" - debug: msg="END nxapi/set_domain_name.yaml"

@ -9,7 +9,6 @@
lines: lines:
- no ip name-server {{ item }} - no ip name-server {{ item }}
match: none match: none
provider: "{{ nxapi }}"
ignore_errors: yes ignore_errors: yes
with_items: with_items:
- 1.1.1.1 - 1.1.1.1
@ -22,7 +21,6 @@
- 1.1.1.1 - 1.1.1.1
- 2.2.2.2 - 2.2.2.2
- 3.3.3.3 - 3.3.3.3
provider: "{{ nxapi }}"
register: result register: result
- assert: - assert:
@ -38,7 +36,6 @@
- 1.1.1.1 - 1.1.1.1
- 2.2.2.2 - 2.2.2.2
- 3.3.3.3 - 3.3.3.3
provider: "{{ nxapi }}"
register: result register: result
- assert: - assert:
@ -51,7 +48,6 @@
# - 1.1.1.1 # - 1.1.1.1
# - { server: 2.2.2.2, vrf: ansible } # - { server: 2.2.2.2, vrf: ansible }
# - 3.3.3.3 # - 3.3.3.3
# provider: "{{ nxapi }}"
# register: result # register: result
#- assert: #- assert:
@ -67,7 +63,6 @@
# - 1.1.1.1 # - 1.1.1.1
# - { server: 2.2.2.2, vrf: ansible } # - { server: 2.2.2.2, vrf: ansible }
# - 3.3.3.3 # - 3.3.3.3
# provider: "{{ nxapi }}"
# register: result # register: result
# #
#- assert: #- assert:
@ -79,7 +74,6 @@
name_servers: name_servers:
- 1.1.1.1 - 1.1.1.1
- 2.2.2.2 - 2.2.2.2
provider: "{{ nxapi }}"
register: result register: result
- assert: - assert:
@ -93,7 +87,6 @@
lines: lines:
- no ip lookup source-interface - no ip lookup source-interface
match: none match: none
provider: "{{ nxapi }}"
ignore_errors: yes ignore_errors: yes
# FIXME Copied from iosxr, not sure what we need here # FIXME Copied from iosxr, not sure what we need here

@ -14,13 +14,11 @@
nxos_feature: nxos_feature:
feature: udld feature: udld
state: enabled state: enabled
provider: "{{ connection }}"
- name: Configure udld - name: Configure udld
nxos_udld: &conf1 nxos_udld: &conf1
aggressive: enabled aggressive: enabled
msg_time: 20 msg_time: 20
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -38,12 +36,10 @@
- name: Reset udld - name: Reset udld
nxos_udld: nxos_udld:
reset: True reset: True
provider: "{{ connection }}"
- name: Configure udld2 - name: Configure udld2
nxos_udld: &conf2 nxos_udld: &conf2
aggressive: disabled aggressive: disabled
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -57,7 +53,6 @@
- name: Configure udld3 - name: Configure udld3
nxos_udld: &conf3 nxos_udld: &conf3
msg_time: default msg_time: default
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -77,7 +72,6 @@
- name: Remove udld config - name: Remove udld config
nxos_udld: &conf4 nxos_udld: &conf4
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -95,7 +89,6 @@
nxos_feature: nxos_feature:
feature: udld feature: udld
state: disabled state: disabled
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- debug: msg="END connection={{ ansible_connection }} nxos_udld sanity test" - debug: msg="END connection={{ ansible_connection }} nxos_udld sanity test"

@ -20,13 +20,11 @@
nxos_feature: nxos_feature:
feature: udld feature: udld
state: enabled state: enabled
provider: "{{ connection }}"
- name: "put the interface into default state" - name: "put the interface into default state"
nxos_config: nxos_config:
commands: commands:
- "default interface {{intname}}" - "default interface {{intname}}"
provider: "{{ connection }}"
match: none match: none
- name: ensure interface is configured to be in aggressive mode - name: ensure interface is configured to be in aggressive mode
@ -34,7 +32,6 @@
interface: "{{ intname }}" interface: "{{ intname }}"
mode: aggressive mode: aggressive
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -56,7 +53,6 @@
interface: "{{ intname }}" interface: "{{ intname }}"
mode: enabled mode: enabled
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -84,7 +80,6 @@
interface: "{{ intname }}" interface: "{{ intname }}"
mode: disabled mode: disabled
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -102,7 +97,6 @@
interface: "{{ intname }}" interface: "{{ intname }}"
mode: enabled mode: enabled
state: absent state: absent
provider: "{{ connection }}"
when: udld_run when: udld_run
@ -111,7 +105,6 @@
nxos_feature: nxos_feature:
feature: udld feature: udld
state: disabled state: disabled
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- debug: msg="END connection={{ ansible_connection }} nxos_udld_interface sanity test" - debug: msg="END connection={{ ansible_connection }} nxos_udld_interface sanity test"

@ -5,7 +5,6 @@
name: auth_user name: auth_user
role: network-operator role: network-operator
state: present state: present
provider: "{{ connection }}"
configured_password: pass123 configured_password: pass123
- name: test login - name: test login
@ -32,5 +31,4 @@
nxos_user: nxos_user:
name: auth_user name: auth_user
state: absent state: absent
provider: "{{ connection }}"
register: result register: result

@ -10,7 +10,6 @@
- { name: ansibletest2 } - { name: ansibletest2 }
- { name: ansibletest3 } - { name: ansibletest3 }
state: absent state: absent
provider: "{{ connection }}"
# Start tests # Start tests
- name: Create user - name: Create user
@ -18,7 +17,6 @@
name: ansibletest1 name: ansibletest1
roles: network-operator roles: network-operator
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: - assert:
@ -34,7 +32,6 @@
- { name: ansibletest3 } - { name: ansibletest3 }
state: present state: present
roles: network-admin roles: network-admin
provider: "{{ connection }}"
register: result register: result
- assert: - assert:
@ -48,7 +45,6 @@
- { name: ansibletest2 } - { name: ansibletest2 }
- { name: ansibletest3 } - { name: ansibletest3 }
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: - assert:

@ -10,7 +10,6 @@
net_user: net_user:
name: ansibletest1 name: ansibletest1
state: absent state: absent
provider: "{{ connection }}"
# Start tests # Start tests
- name: Create user with platform agnostic module - name: Create user with platform agnostic module
@ -18,7 +17,6 @@
name: ansibletest1 name: ansibletest1
roles: network-operator roles: network-operator
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: - assert:
@ -31,6 +29,5 @@
net_user: net_user:
name: ansibletest1 name: ansibletest1
state: absent state: absent
provider: "{{ connection }}"
- debug: msg="END connection={{ ansible_connection }} nxos common/net_user.yaml" - debug: msg="END connection={{ ansible_connection }} nxos common/net_user.yaml"

@ -15,7 +15,6 @@
update_password: on_create update_password: on_create
roles: network-operator roles: network-operator
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -36,7 +35,6 @@
nxos_user: &remove nxos_user: &remove
name: netend name: netend
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -54,7 +52,6 @@
# name: ansible # name: ansible
# sshkey: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}" # sshkey: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
# state: present # state: present
# provider: "{{ connection }}"
# register: result # register: result
# #
# - assert: *true # - assert: *true
@ -79,7 +76,6 @@
roles: roles:
- network-admin - network-admin
- network-operator - network-operator
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -97,7 +93,6 @@
nxos_user: &tear nxos_user: &tear
name: ansible name: ansible
purge: yes purge: yes
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true

@ -8,7 +8,6 @@
lines: lines:
- no vlan 102 - no vlan 102
- no vlan 103 - no vlan 103
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
@ -19,7 +18,6 @@
- { name: app03, vlan_id: 103 } - { name: app03, vlan_id: 103 }
vlan_state: active vlan_state: active
admin_state: up admin_state: up
provider: "{{ connection }}"
register: result register: result
- assert: - assert:
@ -45,7 +43,6 @@
- { name: app03, vlan_id: 103 } - { name: app03, vlan_id: 103 }
vlan_state: active vlan_state: active
admin_state: down admin_state: down
provider: "{{ connection }}"
register: result register: result
- assert: - assert:
@ -67,7 +64,6 @@
nxos_vlan: &purge nxos_vlan: &purge
vlan_id: 1 vlan_id: 1
purge: yes purge: yes
provider: "{{ connection }}"
register: result register: result
- assert: - assert:

@ -6,7 +6,6 @@
nxos_config: nxos_config:
lines: lines:
- no vlan 100 - no vlan 100
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- name: setup - remove vlan from interfaces used in test(part1) - name: setup - remove vlan from interfaces used in test(part1)
@ -15,7 +14,6 @@
- no switchport access vlan 100 - no switchport access vlan 100
parents: switchport parents: switchport
before: "interface {{ testint1 }}" before: "interface {{ testint1 }}"
provider: "{{ connection }}"
- name: setup - remove vlan from interfaces used in test(part2) - name: setup - remove vlan from interfaces used in test(part2)
nxos_config: nxos_config:
@ -23,12 +21,10 @@
- no switchport access vlan 100 - no switchport access vlan 100
parents: switchport parents: switchport
before: "interface {{ testint2 }}" before: "interface {{ testint2 }}"
provider: "{{ connection }}"
- name: create vlan - name: create vlan
nxos_vlan: nxos_vlan:
vlan_id: 100 vlan_id: 100
provider: "{{ connection }}"
- name: Add interfaces to vlan and check intent (config + intent) - name: Add interfaces to vlan and check intent (config + intent)
nxos_vlan: &interfaces nxos_vlan: &interfaces
@ -39,7 +35,6 @@
associated_interfaces: associated_interfaces:
- "{{ testint1 }}" - "{{ testint1 }}"
- "{{ testint2 }}" - "{{ testint2 }}"
provider: "{{ connection }}"
register: result register: result
- assert: - assert:
@ -68,7 +63,6 @@
associated_interfaces: associated_interfaces:
- "{{ testint1 }}" - "{{ testint1 }}"
- "{{ testint2 }}" - "{{ testint2 }}"
provider: "{{ connection }}"
register: result register: result
- assert: - assert:
@ -80,7 +74,6 @@
vlan_id: 100 vlan_id: 100
associated_interfaces: associated_interfaces:
- test - test
provider: "{{ connection }}"
register: result register: result
ignore_errors: yes ignore_errors: yes
@ -93,7 +86,6 @@
vlan_id: 100 vlan_id: 100
interfaces: interfaces:
- "{{ testint2 }}" - "{{ testint2 }}"
provider: "{{ connection }}"
register: result register: result
- assert: - assert:
@ -116,7 +108,6 @@
nxos_config: nxos_config:
lines: lines:
- no vlan 100 - no vlan 100
provider: "{{ connection }}"
- name: teardown - remove vlan from interfaces used in test(part1) - name: teardown - remove vlan from interfaces used in test(part1)
nxos_config: nxos_config:
@ -124,7 +115,6 @@
- no switchport access vlan 100 - no switchport access vlan 100
parents: switchport parents: switchport
before: "interface {{ testint1 }}" before: "interface {{ testint1 }}"
provider: "{{ connection }}"
- name: teardown - remove vlan from interfaces used in test(part2) - name: teardown - remove vlan from interfaces used in test(part2)
nxos_config: nxos_config:
@ -132,4 +122,3 @@
- no switchport access vlan 100 - no switchport access vlan 100
parents: switchport parents: switchport
before: "interface {{ testint2 }}" before: "interface {{ testint2 }}"
provider: "{{ connection }}"

@ -11,14 +11,12 @@
nxos_config: nxos_config:
commands: commands:
- feature vn-segment-vlan-based - feature vn-segment-vlan-based
provider: "{{ connection }}"
match: none match: none
when: platform is search('N9K') when: platform is search('N9K')
- name: Ensure a range of VLANs are present on the switch - name: Ensure a range of VLANs are present on the switch
nxos_vlan: &conf_vlan nxos_vlan: &conf_vlan
vlan_range: "2-10,20,50,55-60,100-150" vlan_range: "2-10,20,50,55-60,100-150"
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -40,7 +38,6 @@
admin_state: down admin_state: down
name: WEB name: WEB
mapped_vni: 5555 mapped_vni: 5555
provider: "{{ connection }}"
register: result register: result
when: platform is search('N9K') when: platform is search('N9K')
@ -62,7 +59,6 @@
admin_state: up admin_state: up
name: default name: default
mapped_vni: default mapped_vni: default
provider: "{{ connection }}"
register: result register: result
when: platform is search('N9K') when: platform is search('N9K')
@ -83,7 +79,6 @@
vlan_state: suspend vlan_state: suspend
admin_state: down admin_state: down
name: WEB name: WEB
provider: "{{ connection }}"
register: result register: result
when: platform is search('N3K|N7K') when: platform is search('N3K|N7K')
@ -104,7 +99,6 @@
vlan_state: active vlan_state: active
admin_state: up admin_state: up
name: default name: default
provider: "{{ connection }}"
register: result register: result
when: platform is search('N3K|N7K') when: platform is search('N3K|N7K')
@ -124,7 +118,6 @@
# nxos_vlan: &mode1 # nxos_vlan: &mode1
# vlan_id: 50 # vlan_id: 50
# mode: fabricpath # mode: fabricpath
# provider: "{{ connection }}"
# register: result # register: result
# when: platform is search('N5k|N7K') # when: platform is search('N5k|N7K')
# #
@ -143,7 +136,6 @@
# nxos_vlan: &mode2 # nxos_vlan: &mode2
# vlan_id: 50 # vlan_id: 50
# mode: ce # mode: ce
# provider: "{{ connection }}"
# register: result # register: result
# when: platform is search('N5k|N7K') # when: platform is search('N5k|N7K')
# #
@ -162,7 +154,6 @@
nxos_vlan: &no_vlan nxos_vlan: &no_vlan
vlan_id: 50 vlan_id: 50
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -180,7 +171,6 @@
interfaces: interfaces:
- "{{ testint1 }}" - "{{ testint1 }}"
- "{{ testint2 }}" - "{{ testint2 }}"
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -195,7 +185,6 @@
nxos_vlan: &remint nxos_vlan: &remint
vlan_id: 101 vlan_id: 101
interfaces: default interfaces: default
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -215,14 +204,12 @@
nxos_vlan: nxos_vlan:
vlan_range: "2-10,20,50,55-60,100-150" vlan_range: "2-10,20,50,55-60,100-150"
state: absent state: absent
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- name: "Disable feature vn segement" - name: "Disable feature vn segement"
nxos_feature: nxos_feature:
feature: vn-segment-vlan-based feature: vn-segment-vlan-based
state: disabled state: disabled
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
when: platform is search('N9K') when: platform is search('N9K')

@ -8,12 +8,10 @@
nxos_feature: nxos_feature:
feature: vpc feature: vpc
state: enabled state: enabled
provider: "{{ connection }}"
- name: Ensure ntc VRF exists on switch - name: Ensure ntc VRF exists on switch
nxos_vrf: nxos_vrf:
vrf: ntc vrf: ntc
provider: "{{ connection }}"
- name: Configure vpc - name: Configure vpc
nxos_vpc: &conf_vpc nxos_vpc: &conf_vpc
@ -22,7 +20,6 @@
pkl_dest: 192.168.100.4 pkl_dest: 192.168.100.4
pkl_src: 10.1.100.20 pkl_src: 10.1.100.20
pkl_vrf: ntc pkl_vrf: ntc
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -45,7 +42,6 @@
system_priority: 2000 system_priority: 2000
peer_gw: True peer_gw: True
delay_restore: 5 delay_restore: 5
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -62,7 +58,6 @@
state: present state: present
domain: 100 domain: 100
auto_recovery: False auto_recovery: False
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -78,7 +73,6 @@
state: present state: present
domain: 100 domain: 100
auto_recovery: True auto_recovery: True
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -97,7 +91,6 @@
state: present state: present
domain: 100 domain: 100
auto_recovery: True auto_recovery: True
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -113,7 +106,6 @@
state: present state: present
domain: 100 domain: 100
auto_recovery: False auto_recovery: False
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -134,7 +126,6 @@
system_priority: default system_priority: default
peer_gw: True peer_gw: True
delay_restore: default delay_restore: default
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -150,7 +141,6 @@
state: present state: present
domain: 100 domain: 100
peer_gw: False peer_gw: False
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -165,7 +155,6 @@
nxos_vpc: &rem_vpc nxos_vpc: &rem_vpc
state: absent state: absent
domain: 100 domain: 100
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -181,14 +170,12 @@
nxos_vrf: nxos_vrf:
vrf: ntc vrf: ntc
state: absent state: absent
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- name: disable feature vpc - name: disable feature vpc
nxos_feature: nxos_feature:
feature: vpc feature: vpc
state: disabled state: disabled
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- debug: msg="END connection={{ ansible_connection }} nxos_vpc sanity test" - debug: msg="END connection={{ ansible_connection }} nxos_vpc sanity test"

@ -8,7 +8,6 @@
nxos_feature: nxos_feature:
feature: vpc feature: vpc
state: enabled state: enabled
provider: "{{ connection }}"
- name: create port-channel10 - name: create port-channel10
nxos_config: nxos_config:
@ -16,7 +15,6 @@
- interface port-channel10 - interface port-channel10
- switchport - switchport
match: none match: none
provider: "{{ connection }}"
- name: create port-channel11 - name: create port-channel11
nxos_config: nxos_config:
@ -24,7 +22,6 @@
- interface port-channel11 - interface port-channel11
- switchport - switchport
match: none match: none
provider: "{{ connection }}"
- name: configure vpc - name: configure vpc
nxos_vpc: nxos_vpc:
@ -36,13 +33,11 @@
pkl_src: 10.1.100.20 pkl_src: 10.1.100.20
peer_gw: true peer_gw: true
auto_recovery: false auto_recovery: false
provider: "{{ connection }}"
- name: Configure vpc port channel - name: Configure vpc port channel
nxos_vpc_interface: &conf nxos_vpc_interface: &conf
portchannel: 10 portchannel: 10
vpc: 10 vpc: 10
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -61,7 +56,6 @@
nxos_vpc_interface: &conf1 nxos_vpc_interface: &conf1
portchannel: 11 portchannel: 11
peer_link: True peer_link: True
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -76,7 +70,6 @@
nxos_vpc_interface: &conf2 nxos_vpc_interface: &conf2
portchannel: 11 portchannel: 11
peer_link: False peer_link: False
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -92,7 +85,6 @@
portchannel: 10 portchannel: 10
vpc: 10 vpc: 10
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -114,7 +106,6 @@
pkl_src: 10.1.100.20 pkl_src: 10.1.100.20
peer_gw: true peer_gw: true
auto_recovery: false auto_recovery: false
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- name: remove vpc port channel - name: remove vpc port channel
@ -122,7 +113,6 @@
portchannel: 10 portchannel: 10
vpc: 10 vpc: 10
state: absent state: absent
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- name: remove port channel - name: remove port channel
@ -131,13 +121,11 @@
- no interface port-channel10 - no interface port-channel10
- no interface port-channel11 - no interface port-channel11
match: none match: none
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- name: disable feature vpc - name: disable feature vpc
nxos_feature: nxos_feature:
feature: vpc feature: vpc
state: disabled state: disabled
provider: "{{ connection }}"
- debug: msg="END connection={{ ansible_connection }} nxos_vpc_interface sanity test" - debug: msg="END connection={{ ansible_connection }} nxos_vpc_interface sanity test"

@ -12,7 +12,6 @@
- no vrf member test1 - no vrf member test1
parents: no switchport parents: no switchport
before: "interface {{ testint1 }}" before: "interface {{ testint1 }}"
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- name: setup - remove vrf from interfaces used in test(part2) - name: setup - remove vrf from interfaces used in test(part2)
@ -21,21 +20,18 @@
- no vrf member test1 - no vrf member test1
parents: no switchport parents: no switchport
before: "interface {{ testint2 }}" before: "interface {{ testint2 }}"
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- name: setup - delete VRF test1 used in test - name: setup - delete VRF test1 used in test
nxos_config: nxos_config:
lines: lines:
- no vrf context test1 - no vrf context test1
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- name: setup - remove VRF test2 used in test - name: setup - remove VRF test2 used in test
nxos_config: nxos_config:
lines: lines:
- no vrf context test2 - no vrf context test2
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- name: aggregate definitions of VRFs - name: aggregate definitions of VRFs
@ -43,7 +39,6 @@
aggregate: aggregate:
- { name: test1, description: Configured by Ansible } - { name: test1, description: Configured by Ansible }
- { name: test2, description: Testing, admin_state: down } - { name: test2, description: Testing, admin_state: down }
provider: "{{ connection }}"
register: result register: result
- assert: - assert:
@ -73,7 +68,6 @@
associated_interfaces: associated_interfaces:
- "{{ testint1 }}" - "{{ testint1 }}"
- "{{ testint2 }}" - "{{ testint2 }}"
provider: "{{ connection }}"
register: result register: result
- assert: - assert:
@ -99,7 +93,6 @@
associated_interfaces: associated_interfaces:
- "{{ testint1 }}" - "{{ testint1 }}"
- "{{ testint2 }}" - "{{ testint2 }}"
provider: "{{ connection }}"
register: result register: result
- assert: - assert:
@ -111,7 +104,6 @@
name: test1 name: test1
associated_interfaces: associated_interfaces:
- test - test
provider: "{{ connection }}"
register: result register: result
ignore_errors: yes ignore_errors: yes
@ -124,7 +116,6 @@
name: test1 name: test1
interfaces: interfaces:
- "{{ testint2 }}" - "{{ testint2 }}"
provider: "{{ connection }}"
register: result register: result
- assert: - assert:
@ -147,7 +138,6 @@
- { name: test1, description: Configured by Ansible } - { name: test1, description: Configured by Ansible }
- { name: test2, description: Testing, admin_state: down } - { name: test2, description: Testing, admin_state: down }
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: - assert:
@ -170,7 +160,6 @@
- no vrf member test1 - no vrf member test1
parents: no switchport parents: no switchport
before: "interface {{ testint1 }}" before: "interface {{ testint1 }}"
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- name: setup - remove vrf from interfaces used in test(part2) - name: setup - remove vrf from interfaces used in test(part2)
@ -179,21 +168,18 @@
- no vrf member test1 - no vrf member test1
parents: no switchport parents: no switchport
before: "interface {{ testint2 }}" before: "interface {{ testint2 }}"
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- name: setup - delete VRF test1 used in test - name: setup - delete VRF test1 used in test
nxos_config: nxos_config:
lines: lines:
- no vrf context test1 - no vrf context test1
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- name: setup - remove VRF test2 used in test - name: setup - remove VRF test2 used in test
nxos_config: nxos_config:
lines: lines:
- no vrf context test2 - no vrf context test2
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- debug: msg="END connection={{ ansible_connection }} nxos_vrf intent & aggregate test" - debug: msg="END connection={{ ansible_connection }} nxos_vrf intent & aggregate test"

@ -22,7 +22,6 @@
nxos_feature: nxos_feature:
feature: bgp feature: bgp
state: enabled state: enabled
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- block: - block:
@ -36,7 +35,6 @@
interfaces: interfaces:
- "{{ intname1 }}" - "{{ intname1 }}"
- "{{ intname2 }}" - "{{ intname2 }}"
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -61,7 +59,6 @@
vni: "{{vnid|default(omit)}}" vni: "{{vnid|default(omit)}}"
rd: "{{rdd|default(omit)}}" rd: "{{rdd|default(omit)}}"
interfaces: default interfaces: default
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -76,7 +73,6 @@
nxos_vrf: &remove nxos_vrf: &remove
vrf: ntc vrf: ntc
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -95,7 +91,6 @@
nxos_feature: nxos_feature:
feature: bgp feature: bgp
state: disabled state: disabled
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- debug: msg="END connection={{ ansible_connection }} nxos_vrf sanity test" - debug: msg="END connection={{ ansible_connection }} nxos_vrf sanity test"

@ -7,18 +7,15 @@
nxos_feature: nxos_feature:
feature: bgp feature: bgp
state: enabled state: enabled
provider: "{{ connection }}"
- name: Configure feature nv overlay - name: Configure feature nv overlay
nxos_config: nxos_config:
commands: "feature nv overlay" commands: "feature nv overlay"
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- name: Configure nv overlay evpn - name: Configure nv overlay evpn
nxos_config: nxos_config:
commands: "nv overlay evpn" commands: "nv overlay evpn"
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- block: - block:
@ -27,7 +24,6 @@
vrf: ansible vrf: ansible
afi: ipv4 afi: ipv4
route_target_both_auto_evpn: True route_target_both_auto_evpn: True
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -47,7 +43,6 @@
vrf: ansible vrf: ansible
afi: ipv6 afi: ipv6
route_target_both_auto_evpn: True route_target_both_auto_evpn: True
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -63,7 +58,6 @@
vrf: ansible vrf: ansible
afi: ipv4 afi: ipv4
route_target_both_auto_evpn: False route_target_both_auto_evpn: False
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -79,7 +73,6 @@
vrf: ansible vrf: ansible
afi: ipv6 afi: ipv6
route_target_both_auto_evpn: False route_target_both_auto_evpn: False
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -96,7 +89,6 @@
afi: ipv6 afi: ipv6
route_target_both_auto_evpn: True route_target_both_auto_evpn: True
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -116,7 +108,6 @@
afi: ipv4 afi: ipv4
route_target_both_auto_evpn: True route_target_both_auto_evpn: True
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -136,26 +127,22 @@
- name: Remove vrf - name: Remove vrf
nxos_config: nxos_config:
commands: "no vrf context ansible" commands: "no vrf context ansible"
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- name: Remove nv overlay evpn - name: Remove nv overlay evpn
nxos_config: nxos_config:
commands: "no nv overlay evpn" commands: "no nv overlay evpn"
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- name: Remove feature nv overlay - name: Remove feature nv overlay
nxos_config: nxos_config:
commands: "no feature nv overlay" commands: "no feature nv overlay"
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- name: Remove feature bgp - name: Remove feature bgp
nxos_feature: nxos_feature:
feature: bgp feature: bgp
state: disabled state: disabled
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- debug: msg="END connection={{ ansible_connection }} nxos_vrf_af sanity test" - debug: msg="END connection={{ ansible_connection }} nxos_vrf_af sanity test"

@ -14,14 +14,12 @@
parents: parents:
- "interface {{ intname }}" - "interface {{ intname }}"
match: none match: none
provider: "{{ connection }}"
- name: Ensure vrf ntc exists on interface - name: Ensure vrf ntc exists on interface
nxos_vrf_interface: &configure nxos_vrf_interface: &configure
vrf: ntc vrf: ntc
interface: "{{ intname }}" interface: "{{ intname }}"
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -41,7 +39,6 @@
vrf: ntc vrf: ntc
interface: "{{ intname }}" interface: "{{ intname }}"
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -56,7 +53,6 @@
- name: put interface in default mode - name: put interface in default mode
nxos_config: nxos_config:
lines: "default interface {{ intname }}" lines: "default interface {{ intname }}"
provider: "{{ connection }}"
match: none match: none
ignore_errors: yes ignore_errors: yes

@ -8,18 +8,15 @@
nxos_feature: nxos_feature:
feature: interface-vlan feature: interface-vlan
state: enabled state: enabled
provider: "{{ connection }}"
- name: "Enable vrrp" - name: "Enable vrrp"
nxos_feature: nxos_feature:
feature: vrrp feature: vrrp
state: enabled state: enabled
provider: "{{ connection }}"
- name: "create int vlan 10" - name: "create int vlan 10"
nxos_config: nxos_config:
commands: "int vlan 10" commands: "int vlan 10"
provider: "{{ connection }}"
- name: Ensure vrrp group 100 and vip 10.1.100.1 is on vlan10 - name: Ensure vrrp group 100 and vip 10.1.100.1 is on vlan10
nxos_vrrp: &configure nxos_vrrp: &configure
@ -27,7 +24,6 @@
group: 100 group: 100
vip: 10.1.100.1 vip: 10.1.100.1
admin_state: 'no shutdown' admin_state: 'no shutdown'
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -48,7 +44,6 @@
group: 100 group: 100
vip: default vip: default
admin_state: default admin_state: default
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -64,7 +59,6 @@
interface: vlan10 interface: vlan10
group: 100 group: 100
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -90,7 +84,6 @@
interval: 10 interval: 10
priority: 130 priority: 130
authentication: AUTHKEY authentication: AUTHKEY
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -110,7 +103,6 @@
interval: default interval: default
priority: default priority: default
authentication: default authentication: default
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -130,7 +122,6 @@
nxos_config: nxos_config:
commands: commands:
- no feature interface-vlan - no feature interface-vlan
provider: "{{ connection }}"
match: none match: none
ignore_errors: yes ignore_errors: yes
@ -138,7 +129,6 @@
nxos_feature: nxos_feature:
feature: vrrp feature: vrrp
state: disabled state: disabled
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- debug: msg="END connection={{ ansible_connection }} nxos_vrrp sanity test" - debug: msg="END connection={{ ansible_connection }} nxos_vrrp sanity test"

@ -8,12 +8,10 @@
nxos_feature: nxos_feature:
feature: vtp feature: vtp
state: enabled state: enabled
provider: "{{ connection }}"
- name: configure vtp domain - name: configure vtp domain
nxos_vtp_domain: &configure nxos_vtp_domain: &configure
domain: ntc domain: ntc
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -33,6 +31,5 @@
nxos_feature: nxos_feature:
feature: vtp feature: vtp
state: disabled state: disabled
provider: "{{ connection }}"
- debug: msg="END connection={{ ansible_connection }} nxos_vtp_domain sanity test" - debug: msg="END connection={{ ansible_connection }} nxos_vtp_domain sanity test"

@ -8,18 +8,15 @@
nxos_feature: nxos_feature:
feature: vtp feature: vtp
state: enabled state: enabled
provider: "{{ connection }}"
- name: configure vtp domain - name: configure vtp domain
nxos_vtp_domain: nxos_vtp_domain:
domain: testing domain: testing
provider: "{{ connection }}"
- name: configure vtp password - name: configure vtp password
nxos_vtp_password: &configure nxos_vtp_password: &configure
vtp_password: ntc vtp_password: ntc
state: present state: present
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -38,7 +35,6 @@
nxos_vtp_password: &remove nxos_vtp_password: &remove
vtp_password: ntc vtp_password: ntc
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -54,6 +50,5 @@
nxos_feature: nxos_feature:
feature: vtp feature: vtp
state: disabled state: disabled
provider: "{{ connection }}"
- debug: msg="END connection={{ ansible_connection }} nxos_vtp_password sanity test" - debug: msg="END connection={{ ansible_connection }} nxos_vtp_password sanity test"

@ -8,12 +8,10 @@
nxos_feature: nxos_feature:
feature: vtp feature: vtp
state: enabled state: enabled
provider: "{{ connection }}"
- name: configure vtp version - name: configure vtp version
nxos_vtp_version: &configure nxos_vtp_version: &configure
version: 2 version: 2
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -33,6 +31,5 @@
nxos_feature: nxos_feature:
feature: vtp feature: vtp
state: disabled state: disabled
provider: "{{ connection }}"
- debug: msg="END connection={{ ansible_connection }} nxos_vtp_version sanity test" - debug: msg="END connection={{ ansible_connection }} nxos_vtp_version sanity test"

@ -12,7 +12,6 @@
nxos_config: nxos_config:
commands: commands:
- feature nv overlay - feature nv overlay
provider: "{{ connection }}"
match: none match: none
- block: - block:
@ -24,7 +23,6 @@
source_interface: Loopback0 source_interface: Loopback0
source_interface_hold_down_time: 30 source_interface_hold_down_time: 30
shutdown: false shutdown: false
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -47,7 +45,6 @@
source_interface_hold_down_time: default source_interface_hold_down_time: default
source_interface: default source_interface: default
shutdown: true shutdown: true
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -68,7 +65,6 @@
host_reachability: true host_reachability: true
source_interface: Loopback0 source_interface: Loopback0
shutdown: false shutdown: false
provider: "{{ connection }}"
register: result register: result
- assert: - assert:
@ -90,7 +86,6 @@
host_reachability: false host_reachability: false
source_interface: default source_interface: default
shutdown: true shutdown: true
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -112,7 +107,6 @@
source_interface_hold_down_time: 30 source_interface_hold_down_time: 30
shutdown: true shutdown: true
state: absent state: absent
provider: "{{ connection }}"
register: result register: result
- assert: - assert:
@ -138,7 +132,6 @@
nxos_feature: nxos_feature:
feature: nve feature: nve
state: disabled state: disabled
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- debug: msg="END connection={{ ansible_connection }} nxos_vxlan_vtep sanity test" - debug: msg="END connection={{ ansible_connection }} nxos_vxlan_vtep sanity test"

@ -12,21 +12,18 @@
nxos_config: nxos_config:
commands: commands:
- feature nv overlay - feature nv overlay
provider: "{{ connection }}"
match: none match: none
- name: configure vxlan_vtep - name: configure vxlan_vtep
nxos_vxlan_vtep: nxos_vxlan_vtep:
interface: nve1 interface: nve1
host_reachability: True host_reachability: True
provider: "{{ connection }}"
- name: configure vxlan_vtep_vni assoc-vrf - name: configure vxlan_vtep_vni assoc-vrf
nxos_vxlan_vtep_vni: &conf1 nxos_vxlan_vtep_vni: &conf1
interface: nve1 interface: nve1
vni: 6000 vni: 6000
assoc_vrf: True assoc_vrf: True
provider: "{{ connection }}"
register: result register: result
- assert: &true - assert: &true
@ -47,13 +44,11 @@
vni: 6000 vni: 6000
assoc_vrf: True assoc_vrf: True
state: absent state: absent
provider: "{{ connection }}"
- name: configure vxlan_vtep_vni - name: configure vxlan_vtep_vni
nxos_vxlan_vtep_vni: &conf2 nxos_vxlan_vtep_vni: &conf2
interface: nve1 interface: nve1
vni: 8000 vni: 8000
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -63,7 +58,6 @@
interface: nve1 interface: nve1
vni: 8000 vni: 8000
multicast_group: 224.1.1.1 multicast_group: 224.1.1.1
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -79,7 +73,6 @@
interface: nve1 interface: nve1
vni: 8000 vni: 8000
multicast_group: default multicast_group: default
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -95,20 +88,17 @@
interface: nve1 interface: nve1
vni: 8000 vni: 8000
state: absent state: absent
provider: "{{ connection }}"
- name: configure vxlan_vtep - name: configure vxlan_vtep
nxos_vxlan_vtep: nxos_vxlan_vtep:
interface: nve1 interface: nve1
host_reachability: False host_reachability: False
provider: "{{ connection }}"
- block: - block:
- name: configure vxlan_vtep_vni - name: configure vxlan_vtep_vni
nxos_vxlan_vtep_vni: &conf5 nxos_vxlan_vtep_vni: &conf5
interface: nve1 interface: nve1
vni: 8000 vni: 8000
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -118,7 +108,6 @@
interface: nve1 interface: nve1
vni: 8000 vni: 8000
ingress_replication: static ingress_replication: static
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -133,26 +122,22 @@
nxos_vxlan_vtep: &remove_vtep nxos_vxlan_vtep: &remove_vtep
interface: nve1 interface: nve1
state: absent state: absent
provider: "{{ connection }}"
- name: Configure vxlan_vtep with host reachability bgp - name: Configure vxlan_vtep with host reachability bgp
nxos_vxlan_vtep: nxos_vxlan_vtep:
interface: nve1 interface: nve1
host_reachability: True host_reachability: True
provider: "{{ connection }}"
- name: configure vxlan_vtep_vni - name: configure vxlan_vtep_vni
nxos_vxlan_vtep_vni: &config_vni nxos_vxlan_vtep_vni: &config_vni
interface: nve1 interface: nve1
vni: 8000 vni: 8000
provider: "{{ connection }}"
- name: configure vxlan_vtep_vni ingress bgp - name: configure vxlan_vtep_vni ingress bgp
nxos_vxlan_vtep_vni: &conf7 nxos_vxlan_vtep_vni: &conf7
interface: nve1 interface: nve1
vni: 8000 vni: 8000
ingress_replication: bgp ingress_replication: bgp
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -168,7 +153,6 @@
interface: nve1 interface: nve1
vni: 8000 vni: 8000
ingress_replication: default ingress_replication: default
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -186,7 +170,6 @@
nxos_vxlan_vtep: nxos_vxlan_vtep:
interface: nve1 interface: nve1
host_reachability: False host_reachability: False
provider: "{{ connection }}"
- name: configure vxlan_vtep_vni - name: configure vxlan_vtep_vni
nxos_vxlan_vtep_vni: *config_vni nxos_vxlan_vtep_vni: *config_vni
@ -201,7 +184,6 @@
- 3.3.3.3 - 3.3.3.3
- 4.4.4.4 - 4.4.4.4
ingress_replication: static ingress_replication: static
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -218,7 +200,6 @@
vni: 8000 vni: 8000
peer_list: default peer_list: default
ingress_replication: static ingress_replication: static
provider: "{{ connection }}"
register: result register: result
- assert: *true - assert: *true
@ -261,14 +242,12 @@
interface: nve1 interface: nve1
shutdown: true shutdown: true
state: absent state: absent
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- name: "Disable feature nv overlay" - name: "Disable feature nv overlay"
nxos_feature: nxos_feature:
feature: nve feature: nve
state: disabled state: disabled
provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
- debug: msg="END connection={{ ansible_connection }} nxos_vxlan_vtep_vni sanity test" - debug: msg="END connection={{ ansible_connection }} nxos_vxlan_vtep_vni sanity test"

Loading…
Cancel
Save