Topoprocessing - corrected tests for filtration on links
[integration/test.git] / csit / suites / topoprocessing / basic-topology-operations / 040_Filtration_links.robot
1 *** Settings ***
2 Documentation     Test suite to verify fitration operation on different models.
3 ...               Before test starts, configurational file have to be rewriten to change listners registration datastore type from CONFIGURATION to OPERATIONAL.
4 ...               Need for this change is also a reason why main feature (odl-topoprocessing-framework) is installed after file change and not during boot.
5 ...               Tests themselves install feature required for specific model, clear karaf logs for futher synchronization, send configurational xmls and verify output.
6 ...               Topology-id on the end of each urls must match topology-id from xml. Yang models of components in topology are defined in xmls.
7 Suite Setup       Setup Environment
8 Suite Teardown    Clean Environment
9 Test Teardown     Test Teardown    network-topology:network-topology/topology/topo:1
10 Library           RequestsLibrary
11 Library           SSHLibrary
12 Library           XML
13 Variables         ../../../variables/topoprocessing/TopologyRequests.py
14 Variables         ../../../variables/Variables.py
15 Resource          ../../../libraries/KarafKeywords.robot
16 Resource          ../../../libraries/Utils.robot
17 Resource          ../../../libraries/TopoprocessingKeywords.robot
18
19 *** Test Cases ***
20 Filtration Range Number Network Topology Model
21     [Documentation]    Test of range number type of filtration operation on Network Topology model
22     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    network-topology-model    link    network-topo:1
23     ${request}    Insert Filter    ${request}    ${FILTER_RANGE_NUMBER}    l3-unicast-igp-topology:igp-link-attributes/l3-unicast-igp-topology:metric
24     ${request}    Set Range Number Filter    ${request}    11    13
25     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
26     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
27     Should Contain X Times    ${resp.content}    <link-id>link:    3
28     Check Supporting Links in Links    ${resp.content}    3
29     Should Contain X Times    ${resp.content}    <link-ref>/network-topology/topology/network-topo:1/link/link:1:4</link-ref>    1
30     Should Contain X Times    ${resp.content}    <link-ref>/network-topology/topology/network-topo:1/link/link:1:3</link-ref>    1
31     Should Contain X Times    ${resp.content}    <link-ref>/network-topology/topology/network-topo:1/link/link:1:2-1</link-ref>    1
32
33 Filtration Range Number Inventory Model
34     [Documentation]    Test of range number type of filtration operation on Inventory model
35     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    opendaylight-inventory-model    link    openflow-topo:3
36     ${request}    Insert Filter    ${request}    ${FILTER_RANGE_NUMBER}    l3-unicast-igp-topology:igp-link-attributes/l3-unicast-igp-topology:metric
37     ${request}    Set Range Number Filter    ${request}    14    15
38     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
39     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
40     Should Contain X Times    ${resp.content}    <link-id>link:    2
41     Check Supporting Links in Links    ${resp.content}    2
42     Should Contain X Times    ${resp.content}    <link-ref>/network-topology/topology/openflow-topo:3/link/link:14:12</link-ref>    1
43     Should Contain X Times    ${resp.content}    <link-ref>/network-topology/topology/openflow-topo:3/link/link:15:13</link-ref>    1
44
45 Filtration Specific String Network Topology Model
46     [Documentation]    Test of specific string type of filtration operation on Network Topology model
47     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    network-topology-model    link    network-topo:1
48     ${request}    Insert Filter    ${request}    ${FILTER_SPECIFIC_STRING}    l3-unicast-igp-topology:igp-link-attributes/l3-unicast-igp-topology:name
49     ${request}    Set Specific String Filter    ${request}    linkA
50     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
51     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
52     Should Contain X Times    ${resp.content}    <link-id>link:    2
53     Check Supporting Links in Links    ${resp.content}    2
54     Should Contain X Times    ${resp.content}    <link-ref>/network-topology/topology/network-topo:1/link/link:1:4</link-ref>    1
55     Should Contain X Times    ${resp.content}    <link-ref>/network-topology/topology/network-topo:1/link/link:1:2-1</link-ref>    1
56
57 Filtration Specific String Inventory Model
58     [Documentation]    Test of specific string type of filtration operation on Inventory model
59     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    opendaylight-inventory-model    link    openflow-topo:3
60     ${request}    Insert Filter    ${request}    ${FILTER_SPECIFIC_STRING}    l3-unicast-igp-topology:igp-link-attributes/l3-unicast-igp-topology:name
61     ${request}    Set Specific String Filter    ${request}    linkD
62     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
63     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
64     Should Contain X Times    ${resp.content}    <link-id>link:    1
65     Check Supporting Links in Links    ${resp.content}    1
66     Should Contain X Times    ${resp.content}    <link-ref>/network-topology/topology/openflow-topo:3/link/link:15:13</link-ref>    1
67
68 Filtration Range String Network Topology Model
69     [Documentation]    Test of range string type of filtration operation on Network Topology model
70     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    network-topology-model    link    network-topo:1
71     ${request}    Insert Filter    ${request}    ${FILTER_RANGE_STRING}    l3-unicast-igp-topology:igp-link-attributes/l3-unicast-igp-topology:name
72     ${request}    Set Range String Filter    ${request}    linkA    linkB
73     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
74     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
75     Should Contain X Times    ${resp.content}    <link-id>link:    3
76     Check Supporting Links in Links    ${resp.content}    3
77     Should Contain X Times    ${resp.content}    <link-ref>/network-topology/topology/network-topo:1/link/link:1:4</link-ref>    1
78     Should Contain X Times    ${resp.content}    <link-ref>/network-topology/topology/network-topo:1/link/link:1:2-1</link-ref>    1
79     Should Contain X Times    ${resp.content}    <link-ref>/network-topology/topology/network-topo:1/link/link:1:3</link-ref>    1
80
81 Filtration Range String Inventory Model
82     [Documentation]    Test of range string type of filtration operation on Inventory model
83     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    opendaylight-inventory-model    link    openflow-topo:3
84     ${request}    Insert Filter    ${request}    ${FILTER_RANGE_STRING}    l3-unicast-igp-topology:igp-link-attributes/l3-unicast-igp-topology:name
85     ${request}    Set Range String Filter    ${request}    linkC    linkD
86     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
87     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
88     Should Contain X Times    ${resp.content}    <link-id>link:    2
89     Check Supporting Links in Links    ${resp.content}    2
90     Should Contain X Times    ${resp.content}    <link-ref>/network-topology/topology/openflow-topo:3/link/link:14:12</link-ref>    1
91     Should Contain X Times    ${resp.content}    <link-ref>/network-topology/topology/openflow-topo:3/link/link:15:13</link-ref>    1
92
93 Filtration Script Network Topology Model
94     [Documentation]    Test of script type of filtration operation on Network Topology model
95     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    network-topology-model    link    network-topo:1
96     ${request}    Insert Filter    ${request}    ${FILTER_SCRIPT}    l3-unicast-igp-topology:igp-link-attributes/l3-unicast-igp-topology:name
97     ${script}    Set Variable    if (node.getValue().indexOf("linkA") > -1 ) {filterOut.setResult(true);} else {filterOut.setResult(false);}
98     ${request}    Set Script Filter    ${request}    javascript    ${script}
99     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
100     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
101     Should Contain X Times    ${resp.content}    <link-id>link:    2
102     Check Supporting Links in Links    ${resp.content}    2
103     Should Contain X Times    ${resp.content}    <link-ref>/network-topology/topology/network-topo:1/link/link:1:3</link-ref>    1
104     Should Contain X Times    ${resp.content}    <link-ref>/network-topology/topology/network-topo:1/link/link:1:2-2</link-ref>    1
105
106 Filtration Script Inventory Model
107     [Documentation]    Test of script type of filtration operation on Inventory model
108     ${request}    Prepare Filtration Topology Request    ${FILTRATION_NT}    opendaylight-inventory-model    link    openflow-topo:3
109     ${request}    Insert Filter    ${request}    ${FILTER_SCRIPT}    l3-unicast-igp-topology:igp-link-attributes/l3-unicast-igp-topology:name
110     ${script}    Set Variable    if (node.getValue().indexOf("linkA") > -1 ) {filterOut.setResult(true);} else {filterOut.setResult(false);}
111     ${request}    Set Script Filter    ${request}    javascript    ${script}
112     ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
113     Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
114     Should Contain X Times    ${resp.content}    <link-id>link:    3
115     Check Supporting Links in Links    ${resp.content}    3
116     Should Contain X Times    ${resp.content}    <link-ref>/network-topology/topology/openflow-topo:3/link/link:11:12</link-ref>    1
117     Should Contain X Times    ${resp.content}    <link-ref>/network-topology/topology/openflow-topo:3/link/link:14:12</link-ref>    1
118     Should Contain X Times    ${resp.content}    <link-ref>/network-topology/topology/openflow-topo:3/link/link:15:13</link-ref>    1
119
120 *** Keywords ***
121 Check Supporting Links in Links
122     [Arguments]    ${content}    ${number_of_links}
123     : FOR    ${index}    IN RANGE    1    ${number_of_links} + 1
124     \    ${link}    Get Element    ${content}    xpath=.//link[${index}]
125     \    ${link}    Element To String    ${link}
126     \    Should Contain X Times    ${link}    <link-ref>    1