summaryrefslogtreecommitdiff
path: root/test/integration/targets/nxos_acl/tests/common/sanity.yaml
blob: 56bdac267ddf27bffd57e8578713c4757f3cfdbe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
---
- debug: msg="START connection={{ ansible_connection }} nxos_acl sanity test"
- debug: msg="Using provider={{ connection.transport }}"
  when: ansible_connection == "local"

- set_fact: time_range="ans-range"
  when: not ( platform is match("N5K"))

- name: "Setup: Cleanup possibly existing acl."
  nxos_acl: &remove
    name: TEST_ACL
    seq: 10
    state: absent
    provider: "{{ connection }}"
  ignore_errors: yes

- name: "Configure ACL"
  nxos_acl: &configure
    name: TEST_ACL
    seq: 10
    action: permit
    proto: tcp
    src: 1.1.1.1/24
    src_port_op: range
    src_port1: 1900
    src_port2: 1910
    ack: 'enable'
    dscp: 'af43'
    dest: any
    urg: 'enable'
    psh: 'enable'
    established: 'enable'
    log: 'enable'
    fin: 'enable'
    rst: 'enable'
    syn: 'enable'
    time_range: "{{time_range|default(omit)}}"
    state: present
    provider: "{{ connection }}"
  register: result

- assert: &true
    that:
      - "result.changed == true"

- name: "Check Idempotence"
  nxos_acl: *configure
  register: result

- assert: &false
    that:
      - "result.changed == false"

- name: "Remove ACL"
  nxos_acl: *remove
  register: result

- assert: *true

- name: "Check Idempotence"
  nxos_acl: *remove
  register: result

- assert: *false

- debug: msg="END connection={{ ansible_connection }} nxos_acl sanity test"