summaryrefslogtreecommitdiff
path: root/tests/integration/targets/vyos_snmp_server/tests/cli/merged.yaml
blob: e3721664302ccd43406c816a671cab7efb7bfcac (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
---
- debug:
    msg: START vyos_snmp_server merged integration tests on connection={{
      ansible_connection }}

- include_tasks: _remove_config.yaml

- block:
    - name: Merge the provided configuration with the existing running configuration
      register: result
      vyos.vyos.vyos_snmp_server: &id001
        config:
          communities:
            - name: "switches"
              authorization_type: "rw"
            - name: "bridges"
              clients: ["1.1.1.1", "12.1.1.10"]
          contact: "admin2@ex.com"
          listen_addresses:
            - address: "20.1.1.1"
            - address: "100.1.2.1"
              port: 33
          snmp_v3:
            users:
              - user: adminuser
                authentication:
                  plaintext_key: "abc1234567"
                  type: "sha"
                privacy:
                  plaintext_key: "abc1234567"
                  type: "aes"
        state: merged

    - vyos.vyos.vyos_facts:
        gather_network_resources: snmp_server

    - assert:
        that:
          - result.commands|length == 10
          - result.changed == true
          - result.commands|symmetric_difference(merged.commands) == []
          - result.after == ansible_facts['network_resources']['snmp_server']
          - result.after == merged.after


    - name: Assert that before dicts were correctly generated
      assert:
        that:
          - result.before == {}

    - name:
        Merge the provided configuration with the existing running configuration
        (IDEMPOTENT)
      register: result
      vyos.vyos.vyos_snmp_server: *id001

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

  always:
    - include_tasks: _remove_config.yaml