Test cases for GBP-SFC integration demo
[integration/test.git] / csit / suites / groupbasedpolicy / GBPSFC / 6-node / demo-asymmetric-chain / 010_set_odl.robot
index 549973cb3806b6c70153c04f62c65b0b8aecc803..aca76c4cb07d6172af052291db0f22dfd9765d03 100644 (file)
@@ -7,71 +7,62 @@ Library           OperatingSystem
 Variables         ../../../../../variables/Variables.py
 Resource          ../../../../../libraries/Utils.robot
 Resource          ../Variables.robot
-
-*** Variables ***
-${GBP_TENANT_ID}    f5c7d344-d1c7-4208-8531-2c2693657e12
-${TENANT_PATH}    /restconf/config/policy:tenants/tenant/${GBP_TENANT_ID}
-${TENANT_FILE}    ${CURDIR}/../../../../../variables/gbp/demo-asymmetric-chain/tenants.json
-${TUNNELS_PATH}    /restconf/config/opendaylight-inventory:nodes
-${TUNNELS_FILE}    ${CURDIR}/../../../../../variables/gbp/demo-asymmetric-chain/tunnels.json
-${ENDPOINTS_PATH}    /restconf/operations/endpoint:register-endpoint
-${SF_PATH}        /restconf/config/service-function:service-functions
-${SF_FILE}        ${CURDIR}/../../../../../variables/gbp/demo-asymmetric-chain/service_functions.json
-${SFF_PATH}       /restconf/config/service-function-forwarder:service-function-forwarders
-${SFF_FILE}       ${CURDIR}/../../../../../variables/gbp/demo-asymmetric-chain/service_function_forwarders.json
-${SFC_PATH}       /restconf/config/service-function-chain:service-function-chains
-${SFC_FILE}       ${CURDIR}/../../../../../variables/gbp/demo-asymmetric-chain/service_function_chains.json
-${SFP_PATH}       /restconf/config/service-function-path:service-function-paths
-${SFP_FILE}       ${CURDIR}/../../../../../variables/gbp/demo-asymmetric-chain/service_function_paths.json
-${h35_2_FILE}     ${CURDIR}/../../../../../variables/gbp/demo-asymmetric-chain/vethl-h35_2.json
-${h35_3_FILE}     ${CURDIR}/../../../../../variables/gbp/demo-asymmetric-chain/vethl-h35_3.json
-${h35_4_FILE}     ${CURDIR}/../../../../../variables/gbp/demo-asymmetric-chain/vethl-h35_4.json
-${h35_5_FILE}     ${CURDIR}/../../../../../variables/gbp/demo-asymmetric-chain/vethl-h35_5.json
-${h36_2_FILE}     ${CURDIR}/../../../../../variables/gbp/demo-asymmetric-chain/vethl-h36_2.json
-${h36_3_FILE}     ${CURDIR}/../../../../../variables/gbp/demo-asymmetric-chain/vethl-h36_3.json
-${h36_4_FILE}     ${CURDIR}/../../../../../variables/gbp/demo-asymmetric-chain/vethl-h36_4.json
-${h36_5_FILE}     ${CURDIR}/../../../../../variables/gbp/demo-asymmetric-chain/vethl-h36_5.json
-@{ENDPOINT_FILES}    ${h35_2_FILE}    ${h35_3_FILE}    ${h35_4_FILE}    ${h35_5_FILE}    ${h36_2_FILE}    ${h36_3_FILE}    ${h36_4_FILE}
-...               ${h36_5_FILE}
+Resource          ../../../../../libraries/GBP/OpenFlowUtils.robot
 
 *** Test Cases ***
 Put Service Functions
     [Documentation]    Register Service Functions to ODL
     ${json_to_edit}    OperatingSystem.Get File    ${SF_FILE}
-    ${edited_json}    Replace String    ${json_to_edit}    _SF1    ${GBPSFC3}
-    ${edited_json}    Replace String    ${edited_json}    _SF2    ${GBPSFC5}
+    ${edited_json}     Replace String    ${json_to_edit}    _SF1    ${GBPSFC3}
+    ${edited_json}     Replace String    ${edited_json}    _SF2    ${GBPSFC5}
     ${resp}    RequestsLibrary.Put    session    ${SF_PATH}    ${edited_json}    ${HEADERS}
     Should Be Equal As Strings    ${resp.status_code}    200
 
 Put Service Function Forwarders
     [Documentation]    Register Service Function Forwarders to ODL
     ${json_to_edit}    OperatingSystem.Get File    ${SFF_FILE}
-    ${edited_json}    Replace String    ${json_to_edit}    _SFF1    ${GBPSFC2}
-    ${edited_json}    Replace String    ${edited_json}    _SFF2    ${GBPSFC4}
+    ${edited_json}     Replace String    ${json_to_edit}    _SFF1    ${GBPSFC2}
+    ${edited_json}     Replace String    ${edited_json}    _SFF2    ${GBPSFC4}
     ${resp}    RequestsLibrary.Put    session    ${SFF_PATH}    ${edited_json}    ${HEADERS}
     Should Be Equal As Strings    ${resp.status_code}    200
 
+Wait For Manager and Switch Connected on GBPSFC2
+    [Documentation]    Making sure that manager is connected for further processing.
+    SSHLibrary.Open Connection    ${GBPSFC2}
+    Utils.Flexible Mininet Login
+    Wait Until Keyword Succeeds  2min  3s  Manager and Switch Connected  sw_name=sw2
+    SSHLibrary.Close Connection
+
+Wait For Manager and Switch Connected on GBPSFC4
+    [Documentation]    Making sure that manager is connected for further processing.
+    SSHLibrary.Open Connection    ${GBPSFC4}
+    Utils.Flexible Mininet Login
+    Wait Until Keyword Succeeds  2min  3s  Manager and Switch Connected  sw_name=sw4
+    SSHLibrary.Close Connection
+
 Put Service Function Chains
     [Documentation]    Register Service Function Chains to ODL
-    Add Elements To URI From File    ${SFC_PATH}    ${SFC_FILE}
+    Add Elements To URI From File    ${SFC_PATH}    ${SFC_ASYMM_FILE}
 
 Put Service Function Paths
     [Documentation]    Register Service Function Paths to ODL
-    Add Elements To URI From File    ${SFP_PATH}    ${SFP_FILE}
+    Add Elements To URI From File    ${SFP_PATH}    ${SFP_ASYMM_FILE}
 
 Put Tunnels
     [Documentation]    Send tunnel augmentation to ODL
     ${json_to_edit}    OperatingSystem.Get File    ${TUNNELS_FILE}
-    ${edited_json}    Replace String    ${json_to_edit}    _CLASSIFIER1    ${GBPSFC1}
-    ${edited_json}    Replace String    ${edited_json}    _CLASSIFIER2    ${GBPSFC6}
+    ${edited_json}     Replace String    ${json_to_edit}    _CLASSIFIER1    ${GBPSFC1}
+    ${edited_json}     Replace String    ${edited_json}    _CLASSIFIER2    ${GBPSFC6}
     ${resp}    RequestsLibrary.Put    session    ${TUNNELS_PATH}    ${edited_json}    ${HEADERS}
     Should Be Equal As Strings    ${resp.status_code}    200
 
 Put Tenant
     [Documentation]    Send Tenant Data to ODL
-    Add Elements To URI From File    ${TENANT_PATH}    ${TENANT_FILE}
+    Add Elements To URI From File    ${TENANT_PATH}    ${TENANT_ASYMM_FILE}
 
 Register Endpoints
     [Documentation]    Endpoints registration
-    : FOR    ${endpoint_file}    IN    @{ENDPOINT_FILES}
-    \    Post Elements To URI From File    ${ENDPOINTS_PATH}    ${endpoint_file}
+    @{endpoint_files} =  OperatingSystem.List Files In Directory    ${ENDPOINTS_ASYMM_DIR}    vethl*.*json    absolute
+    :FOR    ${endpoint_file}    IN    @{endpoint_files}
+    \    Post Elements To URI From File    ${ENDPOINT_REG_PATH}    ${endpoint_file}    ${HEADERS_YANG_JSON}
+