summaryrefslogtreecommitdiff
path: root/test/integration/targets/nxos_lldp_global/tests/cli/merged.yml
blob: fce877e4b12e766f85e652df643f9832e7db2011 (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
67
68
69
70
71
72
---
  - debug:
      msg: "Start nxos_lldp_global merged integration tests connection={{ansible_connection}}"

  # N35 skips all tests, image issues.
  - block:
    - set_fact:
        port_id: 1
        tlv_power_mgmt:
          power_management: false
      when: platform is not search('N5K|N6K|N7K') and imagetag is not search("I[2345]")

    - name: feature off to cleanup lldp
      nxos_feature: &feature_off
        feature: lldp
        state: disabled

    - name: Enable lldp
      nxos_feature:
        feature: lldp

    - name: Merged
      nxos_lldp_global: &merged
        config:
          reinit: 5
          timer: 40
          port_id: "{{port_id|default(omit)}}"
          tlv_select: "{{tlv_power_mgmt|default(omit)}}"
        state: merged
      register: result

    - assert:
        that:
          - "result.before|length == 0"
          - "result.changed == true"
          - "'lldp reinit 5' in result.commands"
          - "'lldp timer 40' in result.commands"

    - assert:
        that:
          - "'lldp portid-subtype 1' in result.commands"
      when: port_id is defined

    - assert:
        that:
          - "'no lldp tlv-select power-management' in result.commands"
      when: tlv_power_mgmt is defined

    - name: Gather lldp_global facts
      nxos_facts:
        gather_subset:
          - '!all'
          - '!min'
        gather_network_resources: lldp_global

    - assert:
        that:
          - "ansible_facts.network_resources.lldp_global == result.after"

    - name: Idempotence - Merged
      nxos_lldp_global: *merged
      register: result

    - assert:
        that:
          - "result.changed == false"
          - "result.commands | length == 0"
    always:
    - name: teardown
      nxos_feature: *feature_off

    when: platform is not search('N35')