Migrate Get Requests invocations(libraries)
[integration/test.git] / csit / suites / sxp / filtering / 100_Inbound_Filtering_Policy.robot
1 *** Settings ***
2 Documentation       Test suite to verify Inbound filtering functionality using manual policy
3
4 Library             RequestsLibrary
5 Library             SSHLibrary
6 Library             ../../../libraries/Sxp.py
7 Library             ../../../libraries/Common.py
8 Resource            ../../../libraries/SxpLib.robot
9 Resource            ../../../libraries/WaitForFailure.robot
10 Resource            ../../../libraries/SXP/FilteringResources.robot
11
12 Suite Setup         Setup SXP Environment    5
13 Suite Teardown      Clean SXP Environment    5
14 Test Teardown       Clean Nodes
15
16
17 *** Test Cases ***
18 Access List Filtering
19     [Documentation]    Test ACL filter behaviour during filter update
20     [Tags]    sxp    filtering
21     ${peers}    Add Peers    127.0.0.2    127.0.0.4
22     Add PeerGroup    GROUP    ${peers}
23     ${entry1}    Get Filter Entry    10    permit    acl=10.10.10.0,0.0.0.255
24     ${entry2}    Get Filter Entry    20    permit    acl=10.0.0.0,0.254.0.0
25     ${entries}    Combine Strings    ${entry1}    ${entry2}
26     Add Filter    GROUP    inbound    ${entries}    policy=manual-update
27     Setup Topology Complex
28     Wait Until Keyword Succeeds    4    2    Check One Group 4-2
29     Delete Filter    GROUP    inbound
30     Verify Keyword Does Not Fail Within Timeout    4    1    Check One Group 4-2
31     Reconnect Peers
32     ${entries}    Get Filter Entry    10    permit    acl=10.0.0.0,0.255.255.255
33     Add Filter    GROUP    inbound    ${entries}    policy=manual-update
34     Reconnect Peers
35     Wait Until Keyword Succeeds    4    2    Check Two Group 4-2
36     Delete Filter    GROUP    inbound
37     Verify Keyword Does Not Fail Within Timeout    4    1    Check Two Group 4-2
38     Reconnect Peers
39     ${entries}    Get Filter Entry    10    deny    acl=10.0.0.0,0.255.255.255
40     Add Filter    GROUP    inbound    ${entries}    policy=manual-update
41     Reconnect Peers
42     Wait Until Keyword Succeeds    4    2    Check Three Group 4-2
43
44 Access List Sgt Filtering
45     [Documentation]    Test ACL and SGT filter behaviour during filter update
46     [Tags]    sxp    filtering
47     ${peers}    Add Peers    127.0.0.3    127.0.0.5
48     Add PeerGroup    GROUP    ${peers}
49     ${entry1}    Get Filter Entry    10    permit    sgt=30    acl=10.10.10.0,0.0.0.255
50     ${entry2}    Get Filter Entry    20    permit    sgt=50    acl=10.0.0.0,0.254.0.0
51     ${entries}    Combine Strings    ${entry1}    ${entry2}
52     Add Filter    GROUP    inbound    ${entries}    policy=manual-update
53     Setup Topology Complex
54     Wait Until Keyword Succeeds    4    2    Check One Group 5-3
55     Delete Filter    GROUP    inbound
56     Verify Keyword Does Not Fail Within Timeout    4    1    Check One Group 5-3
57     Reconnect Peers
58     ${entries}    Get Filter Entry    10    permit    esgt=20,40    acl=10.0.0.0,0.255.255.255
59     Add Filter    GROUP    inbound    ${entries}    policy=manual-update
60     Reconnect Peers
61     Wait Until Keyword Succeeds    4    2    Check Two Group 5-3
62
63 Prefix List Filtering
64     [Documentation]    Test Prefix List filter behaviour during filter update
65     [Tags]    sxp    filtering
66     ${peers}    Add Peers    127.0.0.2    127.0.0.4
67     Add PeerGroup    GROUP    ${peers}
68     ${entry1}    Get Filter Entry    10    permit    pl=10.10.10.0/24
69     ${entry2}    Get Filter Entry    20    permit    epl=10.0.0.0/8,le,16
70     ${entries}    Combine Strings    ${entry1}    ${entry2}
71     Add Filter    GROUP    inbound    ${entries}    policy=manual-update
72     Setup Topology Complex
73     Wait Until Keyword Succeeds    4    2    Check One Group 4-2
74     Delete Filter    GROUP    inbound
75     Verify Keyword Does Not Fail Within Timeout    4    1    Check One Group 4-2
76     Reconnect Peers
77     ${entries}    Get Filter Entry    10    permit    pl=10.0.0.0/8
78     Add Filter    GROUP    inbound    ${entries}    policy=manual-update
79     Reconnect Peers
80     Wait Until Keyword Succeeds    4    2    Check Two Group 4-2
81     Delete Filter    GROUP    inbound
82     Verify Keyword Does Not Fail Within Timeout    4    1    Check Two Group 4-2
83     Reconnect Peers
84     ${entries}    Get Filter Entry    10    deny    pl=10.0.0.0/8
85     Add Filter    GROUP    inbound    ${entries}    policy=manual-update
86     Reconnect Peers
87     Wait Until Keyword Succeeds    4    2    Check Three Group 4-2
88
89 Prefix List Sgt Filtering
90     [Documentation]    Test Prefix List and SGT filter behaviour during filter update
91     [Tags]    sxp    filtering
92     ${peers}    Add Peers    127.0.0.3    127.0.0.5
93     Add PeerGroup    GROUP    ${peers}
94     ${entry1}    Get Filter Entry    10    permit    sgt=30    pl=10.10.10.0/24
95     ${entry2}    Get Filter Entry    20    permit    pl=10.50.0.0/16
96     ${entries}    Combine Strings    ${entry1}    ${entry2}
97     Add Filter    GROUP    inbound    ${entries}    policy=manual-update
98     Setup Topology Complex
99     Wait Until Keyword Succeeds    4    2    Check One Group 5-3
100     Delete Filter    GROUP    inbound
101     Verify Keyword Does Not Fail Within Timeout    4    1    Check One Group 5-3
102     Reconnect Peers
103     ${entries}    Get Filter Entry    10    permit    esgt=20,40    pl=10.0.0.0/8
104     Add Filter    GROUP    inbound    ${entries}    policy=manual-update
105     Reconnect Peers
106     Wait Until Keyword Succeeds    4    2    Check Two Group 5-3
107
108
109 *** Keywords ***
110 Reconnect Peers
111     [Documentation]    Reconnect all peers connected to node containing filters
112     [Arguments]    ${version}=version4    ${PASSWORD}=none
113     Clean Connections    127.0.0.1
114     FOR    ${node}    IN RANGE    2    6
115         Add Connection    ${version}    both    127.0.0.${node}    64999    127.0.0.1
116         ...    ${PASSWORD}
117     END