Sxp Topology tests update of Most Recent Rule test
[integration/test.git] / csit / suites / sxp / topology / 010_Topology_Features.robot
1 *** Settings ***
2 Documentation     Test suite to verify Behaviour in different topologies
3 Suite Setup       Setup SXP Environment
4 Suite Teardown    Clean SXP Environment
5 Test Teardown     Clean Nodes
6 Library           RequestsLibrary
7 Library           SSHLibrary
8 Library           ../../../libraries/Sxp.py
9 Resource          ../../../libraries/SxpLib.robot
10 Resource          ../../../libraries/Utils.robot
11 Resource          ../../../libraries/KarafKeywords.robot
12 Resource          ../../../variables/Variables.py
13
14 *** Variables ***
15
16 *** Test Cases ***
17 Export Test
18     [Documentation]    Test behaviour after shutting down connections in Version4
19     Setup Topology Triangel    version4
20     Wait Until Keyword Succeeds    4    1    Check Export Part One
21     Delete Connections    127.0.0.1    64999    127.0.0.3
22     Delete Connections    127.0.0.3    64999    127.0.0.1
23     Wait Until Keyword Succeeds    4    1    Check Export Part Two
24     Delete Connections    127.0.0.1    64999    127.0.0.2
25     Delete Connections    127.0.0.2    64999    127.0.0.1
26     Wait Until Keyword Succeeds    4    1    Check Export Part Three
27
28 Export Test Legacy
29     [Documentation]    Test behaviour after shutting down connections in Legacy versions
30     @{list} =    Create List    version1
31     : FOR    ${version}    IN    @{list}
32     \    Setup Topology Triangel    ${version}
33     \    Wait Until Keyword Succeeds    4    1    Check Export Part One
34     \    Delete Connections    127.0.0.1    64999    127.0.0.3
35     \    Delete Connections    127.0.0.3    64999    127.0.0.1
36     \    Wait Until Keyword Succeeds    4    1    Check Export Part Two
37     \    Delete Connections    127.0.0.1    64999    127.0.0.2
38     \    Delete Connections    127.0.0.2    64999    127.0.0.1
39     \    Wait Until Keyword Succeeds    4    1    Check Export Part Three
40     \    Clean Nodes
41
42 Forwarding Test V2=>V1
43     [Documentation]    Version 2 => 1 functionality
44     Setup Topology Linear    version2    version1
45     Wait Until Keyword Succeeds    4    1    Check Forwarding V2=>V1
46
47 Forwarding Test V3=>V2
48     [Documentation]    Version 3 => 2 functionality
49     Setup Topology Linear    version3    version2
50     Wait Until Keyword Succeeds    4    1    Check Forwarding V3=>V2
51
52 Forwarding Test V4=>V3
53     [Documentation]    Version 4 => 3 functionality
54     Setup Topology Linear    version4    version3
55     Wait Until Keyword Succeeds    4    1    Check Forwarding V4=>V3
56
57 Most Recent Rule Test
58     [Documentation]    Most Recent Rule
59     Setup Topology Fork    version4
60     Add Binding    542    5.5.5.5/32    127.0.0.2
61     Sleep    2s
62     Add Binding    543    5.5.5.5/32    127.0.0.3
63     Add Binding    100    15.15.15.15/32    127.0.0.3
64     Sleep    2s
65     Add Binding    99    15.15.15.15/32    127.0.0.2
66     Wait Until Keyword Succeeds    4    1    Check Most Recent
67
68 Shorthest Path Test
69     [Documentation]    Shorthes Path over Most Recent
70     Add Connection    version4    listener    127.0.0.5    64999    127.0.0.3
71     Add Connection    version4    speaker    127.0.0.3    64999    127.0.0.5
72     Wait Until Keyword Succeeds    15    1    Verify Connection    version4    listener    127.0.0.5
73     ...    64999    127.0.0.3
74     Setup Topology Fork    version4
75     Add Binding    542    5.5.5.5/32    127.0.0.2
76     Add Binding    545    5.5.5.5/32    127.0.0.5
77     Add Binding    99    15.15.15.15/32    127.0.0.2
78     Add Binding    9954    105.15.125.15/32    127.0.0.5
79     Add Binding    95    15.15.15.15/32    127.0.0.5
80     Wait Until Keyword Succeeds    4    1    Check Shorthest Path
81
82 *** Keywords ***
83 Setup Topology Triangel
84     [Arguments]    ${version}
85     [Documentation]    Setup 3 nodes connected to each other
86     Add Binding    542    5.5.5.5/32    127.0.0.2
87     Add Binding    543    5.5.5.5/32    127.0.0.3
88     Add Binding    99    15.15.15.15/32    127.0.0.3
89     Add Connection    ${version}    listener    127.0.0.2    64999    127.0.0.1
90     Add Connection    ${version}    speaker    127.0.0.1    64999    127.0.0.2
91     Wait Until Keyword Succeeds    15    1    Verify Connection    ${version}    listener    127.0.0.2
92     Sleep    1s
93     Add Connection    ${version}    listener    127.0.0.3    64999    127.0.0.1
94     Add Connection    ${version}    speaker    127.0.0.1    64999    127.0.0.3
95     Wait Until Keyword Succeeds    15    1    Verify Connection    ${version}    listener    127.0.0.3
96     Add Connection    ${version}    listener    127.0.0.3    64999    127.0.0.2
97     Add Connection    ${version}    speaker    127.0.0.2    64999    127.0.0.3
98     Wait Until Keyword Succeeds    15    1    Verify Connection    ${version}    speaker    127.0.0.2
99     ...    64999    127.0.0.3
100
101 Setup Topology Linear
102     [Arguments]    ${version}    ${r_version}
103     [Documentation]    Setup 3 nodes connected linearly
104     Add Binding    6    56.56.56.0/24    127.0.0.2
105     Add Binding    66    9.9.9.9/32    127.0.0.2
106     Add Binding    666    2001:db8:0:0:0:0:1428:57ab/128    127.0.0.2
107     Add Binding    555    2001:db8:85a3:8d3:0:0:0:0/64    127.0.0.2
108     Add Connection    ${version}    listener    127.0.0.2    64999    127.0.0.1
109     Add Connection    ${version}    speaker    127.0.0.1    64999    127.0.0.2
110     Wait Until Keyword Succeeds    15    1    Verify Connection    ${version}    listener    127.0.0.2
111     Add Connection    ${r_version}    speaker    127.0.0.3    64999    127.0.0.1
112     Add Connection    ${r_version}    listener    127.0.0.1    64999    127.0.0.3
113     Wait Until Keyword Succeeds    15    1    Verify Connection    ${r_version}    speaker    127.0.0.3
114
115 Setup Topology Fork
116     [Arguments]    ${version}
117     [Documentation]    Setup 4 nodes in to T topology
118     Add Connection    ${version}    speaker    127.0.0.1    64999    127.0.0.3
119     Add Connection    ${version}    listener    127.0.0.3    64999    127.0.0.1
120     Wait Until Keyword Succeeds    15    1    Verify Connection    ${version}    listener    127.0.0.3
121     Add Connection    ${version}    speaker    127.0.0.1    64999    127.0.0.2
122     Add Connection    ${version}    listener    127.0.0.2    64999    127.0.0.1
123     Wait Until Keyword Succeeds    15    1    Verify Connection    ${version}    listener    127.0.0.2
124     Add Connection    ${version}    speaker    127.0.0.4    64999    127.0.0.1
125     Add Connection    ${version}    listener    127.0.0.1    64999    127.0.0.4
126     Wait Until Keyword Succeeds    15    1    Verify Connection    ${version}    speaker    127.0.0.4
127
128 Check Export Part One
129     [Documentation]    Checks if Bindings 542 5.5.5.5/32 is replaced by 543 5.5.5.5/32
130     ${resp}    Get Bindings
131     log    ${resp}
132     Should Contain Binding    ${resp}    543    5.5.5.5/32
133     Should Not Contain Binding    ${resp}    542    5.5.5.5/32
134     Should Contain Binding    ${resp}    99    15.15.15.15/32
135
136 Check Export Part Two
137     [Documentation]    Checks if Bindings 542 5.5.5.5/32 was updated after peer shutdown
138     ${resp}    Get Bindings
139     log    ${resp}
140     Should Not Contain Binding    ${resp}    543    5.5.5.5/32
141     Should Contain Binding    ${resp}    542    5.5.5.5/32
142     Should Contain Binding    ${resp}    99    15.15.15.15/32
143
144 Check Export Part Three
145     [Documentation]    Checks if database is empty after peers shutdown
146     ${resp}    Get Bindings
147     log    ${resp}
148     Should Not Contain Binding    ${resp}    542    5.5.5.5/32
149     Should Not Contain Binding    ${resp}    99    15.15.15.15/32
150
151 Check Forwarding V2=>V1
152     [Documentation]    Check if appropriate bindings are exported per version
153     ${resp}    Get Bindings
154     Should Not Contain Binding    ${resp}    6    56.56.56.0/24    sxp
155     Should Contain Binding    ${resp}    66    9.9.9.9/32    sxp
156     Should Contain Binding    ${resp}    666    2001:db8:0:0:0:0:1428:57ab/128    sxp
157     Should Not Contain Binding    ${resp}    555    2001:db8:85a3:8d3:0:0:0:0/64    sxp
158     Log    Init OK
159     ${resp}    Get Bindings    127.0.0.3
160     Should Not Contain Binding    ${resp}    6    56.56.56.0/24    sxp
161     Should Contain Binding    ${resp}    66    9.9.9.9/32    sxp
162     Should Not Contain Binding    ${resp}    666    2001:db8:0:0:0:0:1428:57ab/128    sxp
163     Should Not Contain Binding    ${resp}    555    2001:db8:85a3:8d3:0:0:0:0/64    sxp
164     Log    Forward OK
165
166 Check Forwarding V3=>V2
167     [Documentation]    Check if appropriate bindings are exported per version
168     ${resp}    Get Bindings
169     Should Contain Binding    ${resp}    6    56.56.56.0/24    sxp
170     Should Contain Binding    ${resp}    66    9.9.9.9/32    sxp
171     Should Contain Binding    ${resp}    666    2001:db8:0:0:0:0:1428:57ab/128    sxp
172     Should Contain Binding    ${resp}    555    2001:db8:85a3:8d3:0:0:0:0/64    sxp
173     Log    Init OK
174     ${resp}    Get Bindings    127.0.0.3
175     Should Not Contain Binding    ${resp}    6    56.56.56.0/24    sxp
176     Should Contain Binding    ${resp}    66    9.9.9.9/32    sxp
177     Should Contain Binding    ${resp}    666    2001:db8:0:0:0:0:1428:57ab/128    sxp
178     Should Not Contain Binding    ${resp}    555    2001:db8:85a3:8d3:0:0:0:0/64    sxp
179     Log    Forward OK
180
181 Check Forwarding V4=>V3
182     [Documentation]    Check if appropriate bindings are exported per version
183     ${resp}    Get Bindings
184     Should Contain Binding    ${resp}    6    56.56.56.0/24
185     Should Contain Binding    ${resp}    66    9.9.9.9/32
186     Should Contain Binding    ${resp}    666    2001:db8:0:0:0:0:1428:57ab/128
187     Should Contain Binding    ${resp}    555    2001:db8:85a3:8d3:0:0:0:0/64
188     Log    Init OK
189     ${resp}    Get Bindings    127.0.0.3
190     Should Contain Binding    ${resp}    6    56.56.56.0/24    sxp
191     Should Contain Binding    ${resp}    66    9.9.9.9/32    sxp
192     Should Contain Binding    ${resp}    666    2001:db8:0:0:0:0:1428:57ab/128    sxp
193     Should Contain Binding    ${resp}    555    2001:db8:85a3:8d3:0:0:0:0/64    sxp
194     Log    Forward OK
195
196 Check Shorthest Path
197     [Documentation]    Checks if Shorthest path rule is applied onto bindings
198     ${resp}    Get Bindings
199     Should Contain Binding    ${resp}    542    5.5.5.5/32
200     Should Contain Binding    ${resp}    9954    105.15.125.15/32
201     Should Contain Binding    ${resp}    99    15.15.15.15/32
202     ${resp}    Get Bindings    127.0.0.4
203     Should Contain Binding    ${resp}    542    5.5.5.5/32
204     Should Contain Binding    ${resp}    9954    105.15.125.15/32
205     Should Contain Binding    ${resp}    99    15.15.15.15/32
206
207 Check Most Recent
208     [Documentation]    Checks if MostRecent rule is applied onto bindings
209     ${resp}    Get Bindings
210     Should Contain Binding    ${resp}    543    5.5.5.5/32
211     Should Contain Binding    ${resp}    99    15.15.15.15/32
212     ${resp}    Get Bindings    127.0.0.4
213     Should Contain Binding    ${resp}    543    5.5.5.5/32
214     Should Contain Binding    ${resp}    99    15.15.15.15/32
215
216 Clean Nodes
217     Clean Connections    127.0.0.1
218     Clean Connections    127.0.0.2
219     Clean Connections    127.0.0.3
220     Clean Connections    127.0.0.4
221     Clean Connections    127.0.0.5
222     Clean Bindings    127.0.0.1
223     Clean Bindings    127.0.0.2
224     Clean Bindings    127.0.0.3
225     Clean Bindings    127.0.0.4
226     Clean Bindings    127.0.0.5