Fix test cases variables for 'Rendered Service Path' test suite 56/38356/5
authorMiguel Angel Munoz Gonzalez <miguel.angel.munoz.gonzalez@ericsson.com>
Tue, 3 May 2016 10:16:00 +0000 (12:16 +0200)
committerJamo Luhrsen <jluhrsen@redhat.com>
Sat, 7 May 2016 00:50:32 +0000 (00:50 +0000)
Variables used in mentioned robot test suite should be properly initialized according to version.

There are also some minor fixes on several values used to check results, such as json paths and service funcion names

Change-Id: Ie4c49e31d258c5ed82c1368b15e26d3edd2f478e
Signed-off-by: Miguel Angel Munoz Gonzalez <miguel.angel.munoz.gonzalez@ericsson.com>
csit/suites/sfc/SFC_Basic/010__sfc_service_functions.robot
csit/suites/sfc/SFC_Basic/070__sfc_rendered_service_paths.robot

index 04feca39e2aecf1e43ec47a4ed2f82448a826f78..2cc5dab16dad8a853c80df80e9a4de0e65c676d2 100644 (file)
@@ -125,7 +125,8 @@ Init Suite
     Run Keyword If    '${ODL_STREAM}' == 'stable-lithium'    Set Suite Variable    ${VERSION_DIR}    lithium
     ...    ELSE    Set Suite Variable    ${VERSION_DIR}    master
     Set Suite Variable    ${SERVICE_FUNCTIONS_URI}    /restconf/config/service-function:service-functions/
-    Set Suite Variable    ${SERVICE_FUNCTIONS_FILE}    ../../../variables/sfc/${VERSION_DIR}/service-functions.json
+    Set Suite Variable    ${SERVICE_FUNCTIONS_FILE}    ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-functions.json
     Set Suite Variable    ${SF_DPI102100_URI}    /restconf/config/service-function:service-functions/service-function/dpi-102-100/
-    Set Suite Variable    ${SF_DPI102100_FILE}    ../../../variables/sfc/${VERSION_DIR}/sf_dpi_102_100.json
-    Set Suite Variable    ${SF_DPL101_FILE}    ../../../variables/sfc/${VERSION_DIR}/sf_dpl_101.json
+    Set Suite Variable    ${SF_DPI102100_FILE}    ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/sf_dpi_102_100.json
+    Set Suite Variable    ${SF_DPL101_FILE}    ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/sf_dpl_101.json
+
index 2c577d25b0553ceed47876be75ee557e8bff4262..e8a498aa947b51fb39347b76d2e34058fbbf197f 100644 (file)
@@ -1,52 +1,16 @@
 *** Settings ***
 Documentation     Test suite for SFC Service Functions, Operates functions from Restconf APIs.
-Suite Setup       Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
+Suite Setup       Init Suite
 Suite Teardown    Delete All Sessions
 Library           SSHLibrary
 Library           Collections
 Library           OperatingSystem
 Library           RequestsLibrary
+Library           HttpLibrary.HTTP
 Variables         ../../../variables/Variables.py
 Resource          ../../../libraries/Utils.robot
 
-*** Variables ***
-${SERVICE_FUNCTIONS_URI}    /restconf/config/service-function:service-functions/
-${SERVICE_FUNCTIONS_FILE}    ../../../variables/sfc/service-functions.json
-${SERVICE_FORWARDERS_URI}    /restconf/config/service-function-forwarder:service-function-forwarders/
-${SERVICE_FORWARDERS_FILE}    ../../../variables/sfc/service-function-forwarders.json
-${SERVICE_NODES_URI}    /restconf/config/service-node:service-nodes/
-${SERVICE_NODES_FILE}    ../../../variables/sfc/service-nodes.json
-${SERVICE_CHAINS_URI}    /restconf/config/service-function-chain:service-function-chains/
-${SERVICE_CHAINS_FILE}    ../../../variables/sfc/service-function-chains.json
-${SERVICE_FUNCTION_PATHS_URI}    /restconf/config/service-function-path:service-function-paths/
-${SERVICE_FUNCTION_PATHS_FILE}    ../../../variables/sfc/service-function-paths.json
-${SERVICE_SCHED_TYPES_URI}    /restconf/config/service-function-scheduler-type:service-function-scheduler-types/
-${SERVICE_SCHED_TYPE_URI_BASE}    ${SERVICE_SCHED_TYPES_URI}service-function-scheduler-type/service-function-scheduler-type:
-${SERVICE_RANDOM_SCHED_TYPE_URI}    ${SERVICE_SCHED_TYPE_URI_BASE}random
-${SERVICE_RANDOM_SCHED_TYPE_FILE}    ../../../variables/sfc/service-random-schedule-type.json
-${SERVICE_ROUNDROBIN_SCHED_TYPE_URI}    ${SERVICE_SCHED_TYPE_URI_BASE}round-robin
-${SERVICE_ROUNDROBIN_SCHED_TYPE_FILE}    ../../../variables/sfc/service-roundrobin-schedule-type.json
-${SERVICE_LOADBALANCE_SCHED_TYPE_URI}    ${SERVICE_SCHED_TYPE_URI_BASE}load-balance
-${SERVICE_LOADBALANCE_SCHED_TYPE_FILE}    ../../../variables/sfc/service-loadbalance-schedule-type.json
-${SERVICE_SHORTESTPATH_SCHED_TYPE_URI}    ${SERVICE_SCHED_TYPE_URI_BASE}shortest-path
-${SERVICE_SHORTESTPATH_SCHED_TYPE_FILE}    ../../../variables/sfc/service-loadbalance-schedule-type.json
-${RENDERED_SERVICE_PATHS_URI}    /restconf/config/rendered-service-path:rendered-service-paths/
-${OPERATIONAL_RSPS_URI}    /restconf/operational/rendered-service-path:rendered-service-paths/
-${OPERATIONS_CREATE_RSP_URI}    /restconf/operations/rendered-service-path:create-rendered-path/
-${OPERATIONS_DELETE_RSP_URI}    /restconf/operations/rendered-service-path:delete-rendered-path
-${CREATE_RSP1_INPUT}    {"input":{"parent-service-function-path":"SFC1-100","name":"SFC1-100-Path-1"}}
-${CREATE_RSP2_INPUT}    {"input":{"parent-service-function-path":"SFC1-100","name":"SFC1-100-Path-2"}}
-${CREATE_RSP3_INPUT}    {"input":{"parent-service-function-path":"SFC1-100","name":"SFC1-100-Path-3"}}
-${CREATE_RSP4_INPUT}    {"input":{"parent-service-function-path":"SFC1-100","name":"SFC1-100-Path-4"}}
-${CREATE_RSP5_INPUT}    {"input":{"parent-service-function-path":"SFC1-100","name":"SFC1-100-Path-5"}}
-${CREATE_RSP6_INPUT}    {"input":{"parent-service-function-path":"SFC1-100","name":"SFC1-100-Path-6"}}
-${CREATE_RSP_FAILURE_INPUT}    {"input":{"parent-service-function-path":"SFC1-empty","name":"SFC1-empty-Path-1"}}
-${DELETE_RSP1_INPUT}    {"input":{"name":"SFC1-100-Path-1"}}
-${DELETE_RSP2_INPUT}    {"input":{"name":"SFC1-100-Path-2"}}
-${DELETE_RSP3_INPUT}    {"input":{"name":"SFC1-100-Path-3"}}
-${DELETE_RSP4_INPUT}    {"input":{"name":"SFC1-100-Path-4"}}
-${DELETE_RSP5_INPUT}    {"input":{"name":"SFC1-100-Path-5"}}
-${DELETE_RSP6_INPUT}    {"input":{"name":"SFC1-100-Path-6"}}
+
 
 *** Test Cases ***
 Basic Environment Setup Tests
@@ -56,7 +20,6 @@ Basic Environment Setup Tests
     Add Elements To URI From File    ${SERVICE_FUNCTIONS_URI}    ${SERVICE_FUNCTIONS_FILE}
     Add Elements To URI From File    ${SERVICE_CHAINS_URI}    ${SERVICE_CHAINS_FILE}
     Add Elements To URI From File    ${SERVICE_FUNCTION_PATHS_URI}    ${SERVICE_FUNCTION_PATHS_FILE}
-
 Create and Get Rendered Service Path
     [Documentation]    Create and Get Rendered Service Path Through RESTConf APIs
     Post Elements To URI As JSON    ${OPERATIONS_CREATE_RSP_URI}    ${CREATE_RSP1_INPUT}
@@ -148,7 +111,6 @@ Generate RSPs with Random Schedule Algorithm type
     Check For Elements At URI    ${OPERATIONAL_RSPS_URI}rendered-service-path/SFC1-100-Path-2/rendered-service-path-hop/2/    ${elements}
     Post Elements To URI As JSON    ${OPERATIONS_DELETE_RSP_URI}    ${DELETE_RSP1_INPUT}
     Post Elements To URI As JSON    ${OPERATIONS_DELETE_RSP_URI}    ${DELETE_RSP2_INPUT}
-
 Generate RSPs with Round Robin Schedule Algorithm type
     [Documentation]    Generate RSPs with Round Robin Schedule Algorithm type
     Remove All Elements At URI    ${SERVICE_SCHED_TYPES_URI}
@@ -201,13 +163,12 @@ Generate RSPs with Round Robin Schedule Algorithm type
     Post Elements To URI As JSON    ${OPERATIONS_DELETE_RSP_URI}    ${DELETE_RSP4_INPUT}
     Post Elements To URI As JSON    ${OPERATIONS_DELETE_RSP_URI}    ${DELETE_RSP5_INPUT}
     Post Elements To URI As JSON    ${OPERATIONS_DELETE_RSP_URI}    ${DELETE_RSP6_INPUT}
-
 Generate RSPs with Shortest Path Schedule Algorithm type
     [Documentation]    Generate RSPs with Shortest Path Schedule Algorithm type Through RESTConf APIs
     Remove All Elements At URI    ${SERVICE_SCHED_TYPES_URI}
     Add Elements To URI From File    ${SERVICE_SHORTESTPATH_SCHED_TYPE_URI}    ${SERVICE_SHORTESTPATH_SCHED_TYPE_FILE}
     Post Elements To URI As JSON    ${OPERATIONS_CREATE_RSP_URI}    ${CREATE_RSP1_INPUT}
-    ${elements}=    Create List    "hop-number":0    "service-index":255    "service-function-name":"dpi
+    ${elements}=    Create List    "hop-number":0    "service-index":255    "service-function-name":"dpi-1
     Check For Elements At URI    ${OPERATIONAL_RSPS_URI}rendered-service-path/SFC1-100-Path-1/rendered-service-path-hop/0/    ${elements}
     ${elements}=    Create List    "hop-number":1    "service-index":254    "service-function-name":"napt44
     Check For Elements At URI    ${OPERATIONAL_RSPS_URI}rendered-service-path/SFC1-100-Path-1/rendered-service-path-hop/1/    ${elements}
@@ -215,30 +176,29 @@ Generate RSPs with Shortest Path Schedule Algorithm type
     Check For Elements At URI    ${OPERATIONAL_RSPS_URI}rendered-service-path/SFC1-100-Path-1/rendered-service-path-hop/2/    ${elements}
     ${resp}    RequestsLibrary.Get Request    session    ${OPERATIONAL_RSPS_URI}rendered-service-path/SFC1-100-Path-1/rendered-service-path-hop/0/
     Should Be Equal As Strings    ${resp.status_code}    200
-    ${fwd_hop1}    Extract Value From Content    ${resp.content}    service-function-forwarder
+    ${fwd_hop1}    Extract Value From Content    ${resp.content}    /rendered-service-path-hop/0/service-function-forwarder
     ${resp}    RequestsLibrary.Get Request    session    ${OPERATIONAL_RSPS_URI}rendered-service-path/SFC1-100-Path-1/rendered-service-path-hop/1/
     Should Be Equal As Strings    ${resp.status_code}    200
-    ${fwd_hop2}    Extract Value From Content    ${resp.content}    service-function-forwarder
+    ${fwd_hop2}    Extract Value From Content    ${resp.content}    /rendered-service-path-hop/0/service-function-forwarder
     ${resp}    RequestsLibrary.Get Request    session    ${OPERATIONAL_RSPS_URI}rendered-service-path/SFC1-100-Path-1/rendered-service-path-hop/2/
     Should Be Equal As Strings    ${resp.status_code}    200
-    ${fwd_hop3}    Extract Value From Content    ${resp.content}    service-function-forwarder
+    ${fwd_hop3}    Extract Value From Content    ${resp.content}    /rendered-service-path-hop/0/service-function-forwarder
     Should Be Equal    ${fwd_hop1}    ${fwd_hop2}
     Should Be Equal    ${fwd_hop2}    ${fwd_hop3}
     Post Elements To URI As JSON    ${OPERATIONS_CREATE_RSP_URI}    ${CREATE_RSP2_INPUT}
     ${resp}    RequestsLibrary.Get Request    session    ${OPERATIONAL_RSPS_URI}rendered-service-path/SFC1-100-Path-2/rendered-service-path-hop/0/
     Should Be Equal As Strings    ${resp.status_code}    200
-    ${fwd_hop1}    Extract Value From Content    ${resp.content}    service-function-forwarder
+    ${fwd_hop1}    Extract Value From Content    ${resp.content}    /rendered-service-path-hop/0/service-function-forwarder
     ${resp}    RequestsLibrary.Get Request    session    ${OPERATIONAL_RSPS_URI}rendered-service-path/SFC1-100-Path-2/rendered-service-path-hop/1/
     Should Be Equal As Strings    ${resp.status_code}    200
-    ${fwd_hop2}    Extract Value From Content    ${resp.content}    service-function-forwarder
+    ${fwd_hop2}    Extract Value From Content    ${resp.content}    /rendered-service-path-hop/0/service-function-forwarder
     ${resp}    RequestsLibrary.Get Request    session    ${OPERATIONAL_RSPS_URI}rendered-service-path/SFC1-100-Path-2/rendered-service-path-hop/2/
     Should Be Equal As Strings    ${resp.status_code}    200
-    ${fwd_hop3}    Extract Value From Content    ${resp.content}    service-function-forwarder
+    ${fwd_hop3}    Extract Value From Content    ${resp.content}    /rendered-service-path-hop/0/service-function-forwarder
     Should Be Equal    ${fwd_hop1}    ${fwd_hop2}
     Should Be Equal    ${fwd_hop2}    ${fwd_hop3}
     Post Elements To URI As JSON    ${OPERATIONS_DELETE_RSP_URI}    ${DELETE_RSP1_INPUT}
     Post Elements To URI As JSON    ${OPERATIONS_DELETE_RSP_URI}    ${DELETE_RSP2_INPUT}
-
 Clean Datastore After Tests
     [Documentation]    Clean All Items In Datastore After Tests
     Remove All Elements At URI    ${SERVICE_FUNCTIONS_URI}
@@ -259,3 +219,49 @@ Get JSON Elements From URI
     ${resp}    RequestsLibrary.Get Request    session    ${uri}
     ${value}    To Json    ${resp.content}
     [Return]    ${value}
+
+Init Suite
+    [Documentation]    Create session and initialize ODL version specific variables
+    Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
+    log    ${ODL_STREAM}
+    Run Keyword If    '${ODL_STREAM}' == 'stable-lithium'    Set Suite Variable    ${VERSION_DIR}    lithium
+    ...    ELSE    Set Suite Variable    ${VERSION_DIR}    master
+
+    Set Suite Variable    ${SERVICE_FUNCTIONS_URI}    /restconf/config/service-function:service-functions/
+    Set Suite Variable    ${SERVICE_FUNCTIONS_FILE}    ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-functions.json
+    Set Suite Variable    ${SERVICE_FORWARDERS_URI}    /restconf/config/service-function-forwarder:service-function-forwarders/
+    Set Suite Variable    ${SERVICE_FORWARDERS_FILE}    ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-function-forwarders.json
+    Set Suite Variable    ${SERVICE_NODES_URI}    /restconf/config/service-node:service-nodes/
+    Set Suite Variable    ${SERVICE_NODES_FILE}    ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-nodes.json
+    Set Suite Variable    ${SERVICE_CHAINS_URI}    /restconf/config/service-function-chain:service-function-chains/
+    Set Suite Variable    ${SERVICE_CHAINS_FILE}    ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-function-chains.json
+    Set Suite Variable    ${SERVICE_FUNCTION_PATHS_URI}    /restconf/config/service-function-path:service-function-paths/
+    Set Suite Variable    ${SERVICE_FUNCTION_PATHS_FILE}    ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-function-paths.json
+    Set Suite Variable    ${SERVICE_SCHED_TYPES_URI}    /restconf/config/service-function-scheduler-type:service-function-scheduler-types/
+    Set Suite Variable    ${SERVICE_SCHED_TYPE_URI_BASE}    ${SERVICE_SCHED_TYPES_URI}service-function-scheduler-type/service-function-scheduler-type:
+    Set Suite Variable    ${SERVICE_RANDOM_SCHED_TYPE_URI}    ${SERVICE_SCHED_TYPE_URI_BASE}random
+    Set Suite Variable    ${SERVICE_RANDOM_SCHED_TYPE_FILE}    ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-random-schedule-type.json
+    Set Suite Variable    ${SERVICE_ROUNDROBIN_SCHED_TYPE_URI}    ${SERVICE_SCHED_TYPE_URI_BASE}round-robin
+    Set Suite Variable    ${SERVICE_ROUNDROBIN_SCHED_TYPE_FILE}    ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-roundrobin-schedule-type.json
+    Set Suite Variable    ${SERVICE_LOADBALANCE_SCHED_TYPE_URI}    ${SERVICE_SCHED_TYPE_URI_BASE}load-balance
+    Set Suite Variable    ${SERVICE_LOADBALANCE_SCHED_TYPE_FILE}    ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-loadbalance-schedule-type.json
+    Set Suite Variable    ${SERVICE_SHORTESTPATH_SCHED_TYPE_URI}    ${SERVICE_SCHED_TYPE_URI_BASE}shortest-path
+    Set Suite Variable    ${SERVICE_SHORTESTPATH_SCHED_TYPE_FILE}    ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-shortestpath-schedule-type.json
+    Set Suite Variable    ${RENDERED_SERVICE_PATHS_URI}    /restconf/config/rendered-service-path:rendered-service-paths/
+    Set Suite Variable    ${OPERATIONAL_RSPS_URI}    /restconf/operational/rendered-service-path:rendered-service-paths/
+    Set Suite Variable    ${OPERATIONS_CREATE_RSP_URI}    /restconf/operations/rendered-service-path:create-rendered-path/
+    Set Suite Variable    ${OPERATIONS_DELETE_RSP_URI}    /restconf/operations/rendered-service-path:delete-rendered-path
+    Set Suite Variable    ${CREATE_RSP1_INPUT}    {"input":{"parent-service-function-path":"SFC1-100","name":"SFC1-100-Path-1"}}
+    Set Suite Variable    ${CREATE_RSP2_INPUT}    {"input":{"parent-service-function-path":"SFC1-100","name":"SFC1-100-Path-2"}}
+    Set Suite Variable    ${CREATE_RSP3_INPUT}    {"input":{"parent-service-function-path":"SFC1-100","name":"SFC1-100-Path-3"}}
+    Set Suite Variable    ${CREATE_RSP4_INPUT}    {"input":{"parent-service-function-path":"SFC1-100","name":"SFC1-100-Path-4"}}
+    Set Suite Variable    ${CREATE_RSP5_INPUT}    {"input":{"parent-service-function-path":"SFC1-100","name":"SFC1-100-Path-5"}}
+    Set Suite Variable    ${CREATE_RSP6_INPUT}    {"input":{"parent-service-function-path":"SFC1-100","name":"SFC1-100-Path-6"}}
+    Set Suite Variable    ${CREATE_RSP_FAILURE_INPUT}    {"input":{"parent-service-function-path":"SFC1-empty","name":"SFC1-empty-Path-1"}}
+    Set Suite Variable    ${DELETE_RSP1_INPUT}    {"input":{"name":"SFC1-100-Path-1"}}
+    Set Suite Variable    ${DELETE_RSP2_INPUT}    {"input":{"name":"SFC1-100-Path-2"}}
+    Set Suite Variable    ${DELETE_RSP3_INPUT}    {"input":{"name":"SFC1-100-Path-3"}}
+    Set Suite Variable    ${DELETE_RSP4_INPUT}    {"input":{"name":"SFC1-100-Path-4"}}
+    Set Suite Variable    ${DELETE_RSP5_INPUT}    {"input":{"name":"SFC1-100-Path-5"}}
+    Set Suite Variable    ${DELETE_RSP6_INPUT}    {"input":{"name":"SFC1-100-Path-6"}}
+