1---
2- debug:
3    msg: "START ce_lacp merged integration tests on connection={{ ansible_connection }}"
4# befor removing, it should be merged
5- include_tasks: merge.yaml
6
7- name: Merge the provided configuration with the exisiting running configuration
8  ce_lacp: &absent
9    mode: Dynamic
10    trunk_id: 10
11    preempt_enable: True
12    state_flapping: True
13    port_id_extension_enable: True
14    unexpected_mac_disable: True
15    system_id: 1111-2222-3333
16    timeout_type: Fast
17    fast_timeout: 12
18    mixed_rate_link_enable: True
19    preempt_delay: 12
20    collector_delay: 12
21    max_active_linknumber: 2
22    select: Prority
23    priority: 23
24    global_priority: 123
25    state: absent
26  register: result
27
28- name: Assert the configuration is reflected on host
29  assert:
30    that:
31      - "result['changed'] == true"
32
33- name: Get lacp config by ce_netconf.
34  ce_netconf:
35    rpc: get
36    cfg_xml: "<filter type=\"subtree\">
37              <ifmtrunk xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
38                <TrunkIfs>
39                  <TrunkIf>
40                    <ifName>Eth-Trunk10</ifName>
41                    <lacpTrunk>
42                      <isSupportPrmpt></isSupportPrmpt>
43                      <rcvTimeoutType></rcvTimeoutType>
44                      <fastTimeoutUserDefinedValue></fastTimeoutUserDefinedValue>
45                      <selectPortStd></selectPortStd>
46                      <promptDelay></promptDelay>
47                      <maxActiveNum></maxActiveNum>
48                      <collectMaxDelay></collectMaxDelay>
49                      <mixRateEnable></mixRateEnable>
50                      <dampStaFlapEn></dampStaFlapEn>
51                      <dampUnexpMacEn></dampUnexpMacEn>
52                      <trunkSysMac></trunkSysMac>
53                      <trunkPortIdExt></trunkPortIdExt>
54                    </lacpTrunk>
55                  </TrunkIf>
56                </TrunkIfs>
57              </ifmtrunk>
58            </filter>"
59  register: result_ifs_merged
60
61- name: Get lacp config by ce_netconf.
62  ce_netconf:
63    rpc: get
64    cfg_xml: "<filter type=\"subtree\">
65              <ifmtrunk xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
66                <lacpSysInfo>
67                  <priority></priority>
68                </lacpSysInfo>
69              </ifmtrunk>
70            </filter>"
71  register: result_global_merged
72
73
74- name: Merge the provided configuration with the existing running configuration (IDEMPOTENT)
75  ce_lacp: *absent
76  register: result_re_merged
77
78- name: Assert that the previous task was idempotent, some become ot default values, others depend on devices.
79  assert:
80    that:
81      - "result_re_merged.changed == false"
82      - "'<isSupportPrmpt>false</isSupportPrmpt>' == result_ifs_merged.end_state.result"
83      - "'<rcvTimeoutType>Slow</rcvTimeoutType>' == result_ifs_merged.end_state.result"
84      - "'<fastTimeoutUserDefinedValue>90</fastTimeoutUserDefinedValue>' == result_ifs_merged.end_state.result"
85      - "'<selectPortStd>Prority</selectPortStd>' == result_ifs_merged.end_state.result"
86      - "'<promptDelay>30</promptDelay>' == result_ifs_merged.end_state.result"
87      - "'<collectMaxDelay>0</collectMaxDelay>' in result_ifs_merged.end_state.result"
88      - "'<mixRateEnable>false</mixRateEnable>' in result_ifs_merged.end_state.result"
89      - "'<dampStaFlapEn>false</dampStaFlapEn>' in result_ifs_merged.end_state.result"
90      - "'<dampUnexpMacEn>false</dampUnexpMacEn>' in result_ifs_merged.end_state.result"
91      - "'<trunkSysMac>false</trunkSysMac>' in result_ifs_merged.end_state.result"
92      - "'<priority>32768</priority>' in result_global_merged.end_state.result"
93
94- debug:
95    msg: "END ce_lacp merged integration tests on connection={{ ansible_connection }}"
96