blob: c5b4e60df483fb85e927351922f5ea5b39f593fa (
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
---
- debug:
msg: "START ce_is_is_view import route policy presented integration tests on connection={{ ansible_connection }}"
- include_tasks: setup.yaml
- name: present the provided configuration with the exisiting running configuration
ce_is_is_view: &present
instance_id: 100
protocol: ospf
processid: 100
cost_type: external
import_cost: 10
import_tag: 10
import_route_policy: routepolicy_name
impotr_leveltype: level_1
inheritcost: true
permitibgp: true
tag: 100
register: result
- name: Assert the configuration is reflected on host
assert:
that:
- "result['changed'] == true"
- name: Get basic config by ce_netconf.
ce_netconf: &get_config
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>100</instanceId>
<isSiteMTs>
<isSiteMT>
<addressFamily>afIpv4</addressFamily>
<mtId>0</mtId>
<isImportRoutes>
<isImportRoute>
<protocol></protocol>
<processId></processId>
<costType></costType>
<cost></cost>
<tag></tag>
<policyType></policyType>
<routePolicyName></routePolicyName>
<levelType></levelType>
<inheritCost></inheritCost>
<permitIbgp></permitIbgp>
</isImportRoute>
</isImportRoutes>
</isSiteMT>
</isSiteMTs>
</isSite>
</isSites>
</isiscomm>
</filter>"
register: result_xml
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
ce_is_is_view: *present
register: repeat
- name: Assert that the previous task was idempotent
assert:
that:
- "repeat.changed == false"
- "'<protocol>ospf</protocol>' in result_xml.end_state.result"
- "'<processId>100</processId>' in result_xml.end_state.result"
- "'<costType>external</costType>' in result_xml.end_state.result"
- "'<cost>10</cost>' in result_xml.end_state.result"
- "'<tag>10</tag>' in result_xml.end_state.result"
- "'<policyType>level_1</policyType>' in result_xml.end_state.result"
- "'<routePolicyName>routepolicy_name</routePolicyName>' in result_xml.end_state.result"
- "'<levelType>level_1</levelType>' in result_xml.end_state.result"
- "'<inheritCost>true</inheritCost>' in result_xml.end_state.result"
- "'<permitIbgp>true</permitIbgp>' in result_xml.end_state.result"
- name: present the provided configuration with the exisiting running configuration
ce_is_is_view: &absent
instance_id: 100
defaultmode: always
cost: 10
mode_tag: 10
level_type: level_1
avoid_learning: true
mode_routepolicyname: routepolicy_name
tag: 100
state: absent
register: result
- name: Assert the configuration is reflected on host
assert:
that:
- "result['changed'] == true"
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
ce_is_is_view: *absent
register: repeat
- name: Get basic config by ce_netconf.
ce_netconf: *get_config
register: result_xml
- name: Assert that the previous task was idempotent
assert:
that:
- "repeat.changed == false"
- "'<protocol>ospf</protocol>' not in result_xml.end_state.result"
- "'<processId>100</processId>' not in result_xml.end_state.result"
- "'<costType>external</costType>' not in result_xml.end_state.result"
- "'<cost>10</cost>' not in result_xml.end_state.result"
- "'<tag>10</tag>' not in result_xml.end_state.result"
- "'<policyType>level_1</policyType>' not in result_xml.end_state.result"
- "'<routePolicyName>routepolicy_name</routePolicyName>' not in result_xml.end_state.result"
- "'<levelType>level_1</levelType>' not in result_xml.end_state.result"
- "'<inheritCost>true</inheritCost>' not in result_xml.end_state.result"
- "'<permitIbgp>true</permitIbgp>' not in result_xml.end_state.result"
# after present, isis 100 should be deleted
- include_tasks: cleanup.yaml
- debug:
msg: "END ce_is_is_view import route policy resentd integration tests on connection={{ ansible_connection }}"
|