Add Flow Condition RestConfig for Vtn Manager 55/27955/12
authorpriya.ramasubbu <priya.ramasubbu@hcl.com>
Tue, 6 Oct 2015 15:24:10 +0000 (20:54 +0530)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 1 Dec 2015 07:22:47 +0000 (07:22 +0000)
    * Add new file 010__restconfig_vtn_manager.robot.
    * FlowCondition supports Restconfig features for Create, Retrieve and Remove features.

Change-Id: I1c839fd79c0f72ea7fa705981296d2b240ca783a
Signed-off-by: priya.ramasubbu <priya.ramasubbu@hcl.com>
csit/libraries/VtnMaKeywords.robot
csit/suites/vtn/VTN_Mgr_OF13/010__restconfig_vtn_manager.robot [new file with mode: 0644]

index 6eb581d035de6a62fd11ca6a241bb10bbc0e99c7..d8b38f4fdff8a413ae980f72f7959dcd4715e4eb 100644 (file)
@@ -34,6 +34,7 @@ ${custom}         ${CURDIR}/${CREATE_PATHPOLICY_TOPOLOGY_FILE_PATH}
 ${in_port}        1
 ${out_before_pathpolicy}    output:2
 ${out_after_pathpolicy}    output:3
+${flowcond_restconfigdata}    {"input":{"operation":"SET","present":"false","name":"cond_1","vtn-flow-match":[{"vtn-ether-match":{"destination-address":"ba:bd:0f:e3:a8:c8","ether-type":"2048","source-address":"ca:9e:58:0c:1e:f0","vlan-id": "1"},"vtn-inet-match":{"source-network":"10.0.0.1/32","protocol":1,"destination-network":"10.0.0.2/32"},"index":"1"}]}}
 
 *** Keywords ***
 Start SuiteVtnMa
@@ -51,6 +52,10 @@ Start SuiteVtnMaTest
     [Documentation]    Start VTN Manager Test Suite
     Create Session    session    http://${CONTROLLER}:${RESTPORT}    auth=${AUTH}    headers=${HEADERS}
 
+Start SuiteVtnMaRestConfTest
+    [Documentation]    Start VTN Manager Rest Config Api Test Suite
+    Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
+
 Stop SuiteVtnMaTest
     [Documentation]    Stop VTN Manager Test Suite
     Delete All Sessions
@@ -356,3 +361,26 @@ Verify Actions on Flow Entry
     ${result}    Read Until    mininet>
     : FOR    ${flowElement}    IN    @{FLOWELMENTS}
     \    should Contain    ${result}    ${flowElement}
+
+Add a flowcondition In Restconfig
+    [Documentation]    Create a flowcondition using Restconfig Api
+    ${resp}=    RequestsLibrary.Post    session    restconf/operations/vtn-flow-condition:set-flow-condition    data=${flowcond_restconfigdata}
+    Should Be Equal As Strings    ${resp.status_code}    200
+
+Get flowconditions In Restconfig
+    [Documentation]    Retrieve the list of flowconditions created
+    ${resp}=    RequestsLibrary.Get    session    restconf/operational/vtn-flow-condition:vtn-flow-conditions
+    Should Be Equal As Strings    ${resp.status_code}    200
+
+Get flowcondition In Restconfig
+    [Arguments]    ${flowcond_name}    ${retrieve}
+    [Documentation]    Retrieve the flowcondition by name
+    ${resp}=    RequestsLibrary.Get    session    restconf/operational/vtn-flow-condition:vtn-flow-conditions/vtn-flow-condition/${flowcond_name}
+    Run Keyword If    '${retrieve}' == 'retrieve'    Should Be Equal As Strings    ${resp.status_code}    200
+    ...    ELSE    Should Not Be Equal As Strings    ${resp.status_code}    200
+
+Remove flowcondition In Restconfig
+    [Arguments]    ${flowcond_name}
+    [Documentation]    Remove the flowcondition by name
+    ${resp}=    RequestsLibrary.Post    session    restconf/operations/vtn-flow-condition:remove-flow-condition    {"input": {"name": "${flowcond_name}"}}
+    Should Be Equal As Strings    ${resp.status_code}    200
diff --git a/csit/suites/vtn/VTN_Mgr_OF13/010__restconfig_vtn_manager.robot b/csit/suites/vtn/VTN_Mgr_OF13/010__restconfig_vtn_manager.robot
new file mode 100644 (file)
index 0000000..f879a41
--- /dev/null
@@ -0,0 +1,38 @@
+*** Settings ***
+Documentation     Test suite for VTN Manager using OF13
+Suite Setup       Start SuiteVtnMaRestConfTest
+Suite Teardown    Stop SuiteVtnMaTest
+Resource          ../../../libraries/VtnMaKeywords.robot
+
+*** Test Cases ***
+Check if switch1 detected
+    [Documentation]    Check if openflow:1 is detected
+    BuiltIn.Wait_Until_Keyword_Succeeds    12    3    Fetch vtn switch inventory    openflow:1
+
+Check if switch2 detected
+    [Documentation]    Check if openflow:2 is detected
+    BuiltIn.Wait_Until_Keyword_Succeeds    3    1    Fetch vtn switch inventory    openflow:2
+
+Check if switch3 detected
+    [Documentation]    Check if openflow:3 is detected
+    BuiltIn.Wait_Until_Keyword_Succeeds    3    1    Fetch vtn switch inventory    openflow:3
+
+Add a flowcondition in restconfig
+    [Documentation]    Create a flowcondition cond_1 using restconfig api
+    Add a flowcondition In Restconfig
+
+Get flowcondition
+    [Documentation]    Retrieve the flowcondition by name
+    Get flowcondition In Restconfig    cond_1    retrieve
+
+Get flowconditions
+    [Documentation]    Retrieve the list of flowconditions
+    Get flowconditions In Restconfig
+
+Remove flowcondition
+    [Documentation]    Remove the flowcondition by name
+    Remove flowcondition In Restconfig    cond_1
+
+Get flowcondition After Remove
+    [Documentation]    Verify the removed flowcondition
+    Get flowcondition In Restconfig    cond_1    retrieve_after_remove