Adding option to specify headers in Utils 76/30176/6
authorTomas Cechvala <tcechval@cisco.com>
Wed, 25 Nov 2015 09:08:35 +0000 (10:08 +0100)
committerTomas Cechvala <tcechval@cisco.com>
Wed, 25 Nov 2015 10:48:05 +0000 (11:48 +0100)
If not specified, default header is used.
Different header for POST request in GBP.

Change-Id: I8caa7152cc2076c97d573ebed9ca2290140c8e41
Signed-off-by: Tomas Cechvala <tcechval@cisco.com>
csit/libraries/GBP/RestconfUtils.robot
csit/libraries/Utils.robot
csit/suites/groupbasedpolicy/GBP/3-node/gbp1/001_set_odl.robot
csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/001_set_odl.robot
csit/variables/Variables.py

index 535c698eede3789e49d8c8c6aed8265d7fbb364d..6d496cc0392d16d4a813bdfdbfda66d71345e83b 100644 (file)
@@ -31,14 +31,14 @@ Unregister L2Endpoints
     [Documentation]    Unregister Endpoints L2Endpoints from ODL
     : FOR    ${endpoint}    IN    @{l2_eps}
     \    ${l2_data} =    Create L2 Endpoint JSON Data    ${endpoint}
-    \    Post Elements To URI    ${ENDPOINT_UNREG_PATH}    ${l2_data}
+    \    Post Elements To URI    ${ENDPOINT_UNREG_PATH}    ${l2_data}    ${HEADERS_YANG_JSON}
 
 Unregister L3Endpoints
     [Arguments]    ${l3_eps}
     [Documentation]    Unregister Endpoints L3Endpoints from ODL
     : FOR    ${endpoint}    IN    @{l3_eps}
     \    ${l3_data} =    Create L3 Endpoint JSON Data    ${endpoint}
-    \    Post Elements To URI    ${ENDPOINT_UNREG_PATH}    ${l3_data}
+    \    Post Elements To URI    ${ENDPOINT_UNREG_PATH}    ${l3_data}    ${HEADERS_YANG_JSON}
 
 Create L2 Endpoint JSON Data
     [Arguments]    ${endpoint}
index 85412c1aa28a04036d5af37d958f8aae757f9065..951bcc319fb5e5b98ee8dcb132c9aa8941d31168 100644 (file)
@@ -288,7 +288,7 @@ Concatenate the String
     [Return]    ${output}
 
 Post Elements To URI
-    [Arguments]    ${rest_uri}    ${data}
+    [Arguments]    ${rest_uri}    ${data}    ${headers}=${headers}
     [Documentation]    Perform a POST rest operation, using the URL and data provided
     ${resp} =    RequestsLibrary.Post Request    session    ${rest_uri}    data=${data}    headers=${headers}
     Should Be Equal As Strings    ${resp.status_code}    200
@@ -306,13 +306,13 @@ Remove All Elements At URI And Verify
     Should Be Equal As Strings    ${resp.status_code}    404
 
 Add Elements To URI From File
-    [Arguments]    ${dest_uri}    ${data_file}
+    [Arguments]    ${dest_uri}    ${data_file}    ${headers}=${headers}
     ${body}    OperatingSystem.Get File    ${data_file}
     ${resp}    RequestsLibrary.Put Request    session    ${dest_uri}    data=${body}    headers=${headers}
     Should Be Equal As Strings    ${resp.status_code}    200
 
 Post Elements To URI From File
-    [Arguments]    ${dest_uri}    ${data_file}
+    [Arguments]    ${dest_uri}    ${data_file}    ${headers}=${headers}
     ${body}    OperatingSystem.Get File    ${data_file}
     ${resp}    RequestsLibrary.Post Request    session    ${dest_uri}    data=${body}    headers=${headers}
     Should Be Equal As Strings    ${resp.status_code}    200
index fea2008905c009e804bbc2f108d0f2e3b268f718..4375aef4d1885fb4a6fceb197fabab495f1f7910 100644 (file)
@@ -25,7 +25,7 @@ Register Endpoints
     [Documentation]    Endpoints registration
     @{endpoint_files} =    OperatingSystem.List Files In Directory    ${ENDPOINTS_GBP1_DIR}    vethl*.*json    absolute
     : FOR    ${endpoint_file}    IN    @{endpoint_files}
-    \    Post Elements To URI From File    ${ENDPOINT_REG_PATH}    ${endpoint_file}
+    \    Post Elements To URI From File    ${ENDPOINT_REG_PATH}    ${endpoint_file}    ${HEADERS_YANG_JSON}
 
 Put Tenant
     [Documentation]    Send GBP policy to ODL
index 3ec1c83b2e90009e1b907b3206bc4847cf0222fa..7ce20cee2b64e61ba338ab327c2c608f94054122 100644 (file)
@@ -25,7 +25,7 @@ Register Endpoints
     [Documentation]    Endpoints registration
     @{endpoint_files} =    OperatingSystem.List Files In Directory    ${ENDPOINTS_GBP2_DIR}    vethl*.*json    absolute
     : FOR    ${endpoint_file}    IN    @{endpoint_files}
-    \    Post Elements To URI From File    ${ENDPOINT_REG_PATH}    ${endpoint_file}
+    \    Post Elements To URI From File    ${ENDPOINT_REG_PATH}    ${endpoint_file}    ${HEADERS_YANG_JSON}
 
 Put Tenants
     [Documentation]    Send GBP policy to ODL
index 8c4f71c86707ef64b5450be622c085f6d63188a2..228eb32aed554f6101fa9b9aa4e501c72fb3044a 100644 (file)
@@ -160,6 +160,7 @@ PASSWORD = 'EMPTY'
 AUTH = [u'admin', u'admin']
 SCOPE = 'sdn'
 HEADERS = {'Content-Type': 'application/json'}
+HEADERS_YANG_JSON = {'Content-Type': 'application/yang.data+json'}
 HEADERS_XML = {'Content-Type': 'application/xml'}
 ACCEPT_XML = {'Accept': 'application/xml'}
 ACCEPT_JSON = {'Accept': 'application/json'}