Basic tests - Unification Scripting Node 93/30293/3
authorSamuel Kontriš <samuel.kontris@pantheon.sk>
Fri, 27 Nov 2015 13:08:12 +0000 (14:08 +0100)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 9 Dec 2015 21:41:29 +0000 (21:41 +0000)
Change-Id: I11c597d1fb932f3353c4f3096642fd46bf7b4e91
Signed-off-by: Samuel Kontriš <samuel.kontris@pantheon.sk>
csit/libraries/TopoprocessingKeywords.robot
csit/suites/topoprocessing/basic-topology-operations/010_Aggregation.robot
csit/variables/topoprocessing/TopologyRequests.py

index 476a5fa08e909a65a89b6a9e7aa47719cf7885bf..a52e478dcc52f9c87092d4d9344daec34aa18084 100644 (file)
@@ -126,3 +126,12 @@ Get Installed Features
     Log    Installed features:
     Log    ${features}
     [Return]    ${features}
+
+Insert Scripting into Request
+    [Arguments]    ${request}    ${language}    ${script}
+    [Documentation]    Insert Scripting into Request under aggregation node
+    ${request}    Add Element    ${request}    ${SCRIPTING}    xpath=.//correlation/aggregation
+    ${request}    Set Element Text    ${request}    ${script}    xpath=.//correlation/aggregation/scripting/script
+    ${request}    Set Element Text    ${request}    ${language}    xpath=.//correlation/aggregation/scripting/language
+    ${request}    Element to String    ${request}
+    [Return]    ${request}
index f8e441e86252b24e5666704c2cc2d09a54d4e2fc..92e7537f1676ee167bdc88e3149ed783afeff592 100644 (file)
@@ -48,3 +48,33 @@ Unification Node Inventory
     ${node}    Element to String    ${node}
     Should Contain X Times    ${node}    <node-ref>of-node:10</node-ref>    1
     Should Contain X Times    ${node}    <node-ref>of-node:4</node-ref>    1
+
+Unification Scripting Node
+    [Documentation]    Test unification operation on Network Topology model using scripting
+    ${request}    Prepare Unification Topology Request    ${UNIFICATION_NT}    network-topology-model    node    network-topology-pcep:path-computation-client/network-topology-pcep:ip-address    network-topo:1
+    ...    network-topo:2
+    ${request}    Insert Scripting into Request    ${request}    javascript    if (originalItem.getLeafNode().getValue().indexOf("192.168.1.1") > -1 && newItem.getLeafNode().getValue().indexOf("192.168.1.3") > -1 || originalItem.getLeafNode().getValue().indexOf("192.168.1.3") > -1 && newItem.getLeafNode().getValue().indexOf("192.168.1.1") > -1) {aggregable.setResult(true);} else { aggregable.setResult(false);}
+    ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
+    Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
+    Should Contain X Times    ${resp.content}    <node-id>node:    9
+    : FOR    ${index}    IN RANGE    1    10
+    \    Should Contain X Times    ${resp.content}    <node-ref>pcep:${index}</node-ref>    1
+    ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='pcep:1']/..
+    ${node}    Element to String    ${node}
+    Should Contain X Times    ${node}    <node-ref>pcep:1</node-ref>    1
+    Should Contain X Times    ${node}    <node-ref>pcep:6</node-ref>    1
+
+Unification Scripting Node Inventory
+    [Documentation]    Test unification operation on inventory model using scripting
+    ${request}    Prepare Unification Topology Request    ${UNIFICATION_NT}    opendaylight-inventory-model    node    flow-node-inventory:ip-address    openflow-topo:1
+    ...    openflow-topo:2
+    ${request}    Insert Scripting into Request    ${request}    javascript    if (originalItem.getLeafNode().getValue().indexOf("192.168.1.2") > -1 && newItem.getLeafNode().getValue().indexOf("192.168.1.4") > -1 || originalItem.getLeafNode().getValue().indexOf("192.168.1.4") > -1 && newItem.getLeafNode().getValue().indexOf("192.168.1.2") > -1) {aggregable.setResult(true);} else { aggregable.setResult(false);}
+    ${resp}    Send Basic Request    ${request}    network-topology:network-topology/topology/topo:1
+    Should Contain    ${resp.content}    <topology-id>topo:1</topology-id>
+    Should Contain X Times    ${resp.content}    <node-id>node:    9
+    : FOR    ${index}    IN RANGE    1    10
+    \    Should Contain X Times    ${resp.content}    <node-ref>of-node:${index}</node-ref>    1
+    ${node}    Get Element    ${resp.content}    xpath=.//node/supporting-node[node-ref='of-node:2']/..
+    ${node}    Element to String    ${node}
+    Should Contain X Times    ${node}    <node-ref>of-node:2</node-ref>    1
+    Should Contain X Times    ${node}    <node-ref>of-node:8</node-ref>    1
index 163f0de80138f16de6def6b1c0f152326c7e245e..03a459a49bdc22de47ed1beac34c8fe2b974ad41 100644 (file)
@@ -62,6 +62,15 @@ FILTRATION_NT = '''<topology xmlns="urn:opendaylight:topology:correlation" xmlns
                     </correlations>
                 </topology>'''
 
+SCRIPTING = '''
+<scripting>
+    <language>{language}</language>
+    <script>
+        {script}
+    </script>
+</scripting>
+'''
+
 FILTER_IPV4 = '''<filter>
                         <input-model>{input-model}</input-model>
                         <filter-id>1</filter-id>