Use RFC 8040 URL for 'odl-mdsal-lowlevel-*' RPCs
[integration/test.git] / csit / libraries / Restconf.robot
1 *** Keywords ***
2 Generate URI
3     [Documentation]    Returns the proper URI to use. Variable input error checking is done to ensure the ${datastore_flag} variable
4     ...    is config, operational or rpc. @{node_value_list} is expected to be in the format of node=value. RFC8040 can
5     ...    use that as is with '=' delimiter
6     [Arguments]    ${identifier}    ${datastore_flag}=config    @{node_value_list}
7     ${uri} =    Generate RFC8040 URI    ${identifier}    ${datastore_flag}    @{node_value_list}
8     RETURN    ${uri}
9
10 Generate RFC8040 URI
11     [Arguments]    ${identifier}    ${datastore_flag}=config    @{node_value_list}
12     ${node_value_path} =    Set Variable    ${EMPTY}
13     FOR    ${nv}    IN    @{node_value_list}
14         ${node_value_path} =    Set Variable    ${node_value_path}/${nv}
15     END
16     IF    "${datastore_flag}" == "config"
17         ${uri} =    Set Variable    rests/data/${identifier}${node_value_path}?content=config
18     ELSE IF    "${datastore_flag}"=="operational"
19         ${uri} =    Set Variable    rests/data/${identifier}${node_value_path}?content=nonconfig
20     ELSE
21         ${uri} =    Set Variable    rests/operations/${identifier}
22     END
23     RETURN    ${uri}