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