summaryrefslogtreecommitdiff
path: root/test/integration/targets/ce_is_is_instance/tests/netconf/ce_is_is_instance.yaml
blob: d7c5a7c6e13d4098ab56a7c90618b8188c5fb78c (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
---
- debug:
    msg: "START ce_is_is_instance merged integration tests on connection={{ ansible_connection }}"

- block:
  - name: berfore merged, there should be no isis 100.
    ce_is_is_instance: &delete
      instance_id: 100
      state: absent

  - name: Merge the provided configuration with the exisiting running configuration
    ce_is_is_instance: &merged
      instance_id: 100
      vpn_name: '__public__'
    register: result

  - name: change ansible_connection to network_cli
    ce_netconf:
      rpc: get
      cfg_xml: "<filter type=\"subtree\">
                  <isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
                    <isSites>
                      <isSite>
                        <instanceId></instanceId>
                        <vpnName></vpnName>
                      </isSite>
                    </isSites>
                  </isiscomm>
                </filter>"
    register: result_xml
 
  - name: Assert the configuration is reflected on host
    assert:
      that:
        - "result['changed'] == true"
        - "'<instanceId>100</instanceId>' in result_xml.end_state.result"
        - "'<vpnName>__public__</vpnName>' in result_xml.end_state.result"

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

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

  - name: delete the provided configuration with the exisiting running configuration
    ce_is_is_instance: *delete
    register: result

  - name: change ansible_connection to network_cli
    ce_netconf:
      rpc: get
      cfg_xml: "<filter type=\"subtree\">
                  <isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
                    <isSites>
                      <isSite>
                        <instanceId></instanceId>
                        <vpnName></vpnName>
                      </isSite>
                    </isSites>
                  </isiscomm>
                </filter>"
    register: result_xml
 
  - name: Assert the configuration is reflected on host
    assert:
      that:
        - "result['changed'] == true"
        - "'<instanceId>100</instanceId>' not in result_xml.end_state.result"
        - "'<vpnName>__public__</vpnName>' not in result_xml.end_state.result"

  - name: delete the provided configuration with the existing running configuration (IDEMPOTENT)
    ce_is_is_instance: *delete
    register: result

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


- debug:
    msg: "END ce_is_is_instance merged integration tests on connection={{ ansible_connection }}"