summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/ce_lldp/tests/netconf/absent.yaml
blob: 1a148906775efc2dc942fcbe2ab07767b2ffde16 (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
---
- debug:
    msg: "START ce_lldp absent integration tests on connection={{ ansible_connection }}"

- block:

  - name: present the provided configuration befor absent
    ce_lldp:
      lldpenable: enabled
      mdnstatus: rxOnly
      interval: 35
      hold_multiplier: 5
      restart_delay: 3
      transmit_delay: 5
      notification_interval: 6
      fast_count: 5
      mdn_notification_interval: 10.1.1.1
      management_address: 10.10.10.1
      bind_name: vlanif100
    register: result

  - name: change ansible_connection to network_cli
    set_fact:
      ansible_connection: network_cli

  - name: display lldp
    ce_command:
      commands:
        - display current-configuration | include lldp
    register: result_display

  - name: change ansible_connection to netconf
    set_fact:
      ansible_connection: netconf

# There should be some configuration(LLDP) on host befor absent
  - name: Assert the configuration is reflected on host
    assert:
      that:
        - "'lldp enable' in result_display.stdout[0]"
        - "'undo lldp mdn disable' in result_display.stdout[0]"
        - "'lldp transmit interval 35' in result_display.stdout[0]"
        - "'lldp transmit multiplier 5' in result_display.stdout[0]"
        - "'lldp restart 3' in result_display.stdout[0]"
        - "'lldp transmit delay 5' in result_display.stdout[0]"
        - "'lldp fast-count 5' in result_display.stdout[0]"
        - "'lldp management-address 10.10.10.1' in result_display.stdout[0]"
        - "'lldp mdn trap-interval 6' in result_display.stdout[0]"
        - "'lldp trap-interval 6' in result_display.stdout[0]"
        - "'lldp management-address bind interface vlanif100' in result_display.stdout[0]"

  - name: absent the provided configuration with the exisiting running configuration
    ce_lldp: &absent
      lldpenable: enabled
      mdnstatus: rxOnly
      interval: 35
      hold_multiplier: 5
      restart_delay: 3
      transmit_delay: 5
      notification_interval: 6
      fast_count: 5
      mdn_notification_interval: 10.1.1.1
      management_address: 10.10.10.1
      bind_name: vlanif100
      state: absent
    register: result

  - name: change ansible_connection to network_cli
    set_fact:
      ansible_connection: network_cli

  - name: display lldp
    ce_command:
      commands:
        - display current-configuration | include lldp
    register: result_display

  - name: change ansible_connection to netconf
    set_fact:
      ansible_connection: netconf
 
  - name: Assert the configuration is reflected on host
    assert:
      that:
        - "result['changed'] == true"
        - "'lldp enable' not in result_display.stdout[0]"
        - "'undo lldp mdn disable' not in result_display.stdout[0]"
        - "'lldp transmit interval 35' not in result_display.stdout[0]"
        - "'lldp transmit multiplier 5' not in result_display.stdout[0]"
        - "'lldp restart 3' not in result_display.stdout[0]"
        - "'lldp transmit delay 5' not in result_display.stdout[0]"
        - "'lldp fast-count 5' not in result_display.stdout[0]"
        - "'lldp management-address 10.10.10.1' not in result_display.stdout[0]"
        - "'lldp mdn trap-interval 6' not in result_display.stdout[0]"
        - "'lldp trap-interval 6' not in result_display.stdout[0]"
        - "'lldp management-address bind interface vlanif100' not in result_display.stdout[0]"

  - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT)
    ce_lldp: *absent
    register: result

  - name: Assert that the previous task was idempotent
    assert:
      that:
        - "result['changed'] == false"

- debug:
    msg: "END ce_lldp absent integration tests on connection={{ ansible_connection }}"