Chore: Add gerrit maven verify GHA workflow
[sdnc/oam.git] / csit / tests / sdnc / resources / sdnc-keywords.robot
1 *** Settings ***
2
3 Resource          ./sdnc-properties.robot
4
5 Library           Collections
6 Library           RequestsLibrary
7 Library           OperatingSystem
8 # Library           HttpLibrary.HTTP
9
10
11 *** Keywords ***
12
13 Create SDNC RESTCONF Session
14     [Documentation]    Create session to OpenDaylight controller
15     ${auth}=  Create List  ${ODL_USER}  ${ODL_PASSWORD}
16     Create Session  sdnc_restconf  ${SDNC_RESTCONF_URL}  auth=${auth}
17
18 Send Post File And Validate Response
19     [Documentation]    POST file contents to OpenDaylight controller
20     [Arguments]  ${url}  ${path}  ${resp_code}
21     Create SDNC RESTCONF Session
22     ${body}=      Get File     ${path}
23     &{headers}=  Create Dictionary    Authorization=Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==    Content-Type=application/json    Accept=application/json
24     ${resp}=  POST On Session  sdnc_restconf  ${url}  headers=${headers}  data=${body}  expected_status=${resp_code}
25
26
27 Send Empty Post Request And Validate Response
28     [Documentation]    POST with no content to OpenDaylight controller
29     [Arguments]  ${url}   ${resp_code}
30     Create SDNC RESTCONF Session
31     &{headers}=  Create Dictionary    Content-Type=application/json    Content-Length=0  Accept=application/json
32     ${resp}=  POST On Session  sdnc_restconf  ${url}  headers=${headers}  expected_status=${resp_code}
33     
34 Send Get Request And Validate Response Sdnc
35     [Documentation]   GET from Opendaylight controller and validate received response
36     [Arguments]   ${url}  ${resp_code}
37     CREATE SDNC RESTCONF Session
38     &{headers}=  Create Dictionary    Content-Type=application/json    Accept=application/json
39     ${resp}=     GET On Session    sdnc_restconf    ${url}    headers=${headers}  expected_status=${resp_code}
40
41 Send Get Request And Validate TLS Connection Response
42     [Documentation]   Create NETCONF mount and validate TLS connection
43     [Arguments]   ${url}  ${resp_code}
44     Create SDNC RESTCONF Session
45     ${mount}=    Get File    ${REQUEST_DATA_PATH}${/}mount.xml
46     &{headers}=  Create Dictionary   Content-Type=application/xml    Accept=application/xml
47     ${resp}=    PUT On Session    sdnc_restconf    ${url}    data=${mount}    headers=${headers}  expected_status=201
48     Sleep  120
49     &{headers1}=  Create Dictionary  Content-Type=application/json    Accept=application/json
50     ${resp1}=    GET On Session    sdnc_restconf    ${PNFSIM_MOUNT_PATH}    headers=${headers1}  expected_status=${resp_code}
51
52
53 Send Delete Request And Validate PNF Mount Deleted
54     [Documentation]   Disconnect NETCONT mount and validate
55     [Arguments]   ${url}  ${resp_code}
56     Create SDNC RESTCONF Session
57     ${mount}=    Get File   ${REQUEST_DATA_PATH}${/}mount.xml
58     &{headers}=  Create Dictionary    Content-Type=application/json    Accept=application/json
59     ${deleteresponse}=    DELETE On Session    sdnc_restconf    ${url}    data=${mount}    headers=${headers}  expected_status=${resp_code}
60     Sleep  30
61     ${del_topology}=    DELETE On Session    sdnc_restconf    ${SDNC_NETWORK_TOPOLOGY}  expected_status=${resp_code}
62     ${del_keystore}=    DELETE On Session    sdnc_restconf    ${SDNC_KEYSTORE_CONFIG_PATH}
63
64