X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=csit%2Flibraries%2FRestconf.robot;h=a2118fdd65118d2e3d81b7fb4f02308662f9c74d;hb=7de9860fb6459cc5f64c59cc34c5e9191631bb03;hp=baed160b991af0f6e39edf71d74c646c2600df03;hpb=45dcfa0dd9c50f92eee4253237798586a46a64bb;p=integration%2Ftest.git diff --git a/csit/libraries/Restconf.robot b/csit/libraries/Restconf.robot index baed160b99..a2118fdd65 100644 --- a/csit/libraries/Restconf.robot +++ b/csit/libraries/Restconf.robot @@ -1,35 +1,51 @@ -*** Settings *** - *** Variables *** -${USE_RFC8040} = False +${USE_RFC8040} = True -*** Keywords *** +*** Keywords *** Generate URI - [Arguments] ${identifier} ${datastore}=config @{node_value_list} [Documentation] Returns the proper URI to use depending on if RFC8040 is to be used or not. Variable input - ... error checking is done to ensure the ${USE_RFC8040} Flag is one of True or False and the ${datastore} variable - ... must be config or operational. @{node_value_list} is expected to be in the format of node=value. RFC8040 can + ... error checking is done to ensure the ${USE_RFC8040} Flag is one of True or False and the ${datastore_flag} variable + ... must be config, operational or rpc. @{node_value_list} is expected to be in the format of node=value. RFC8040 can ... use that as is with '=' delimiter, but older restconf URI will convert the '=' to a '/' - ${uri} = Run Keyword If "${USE_RFC8040}" == "True" Generate RFC8040 URI ${identifier} ${datastore} @{node_value_list} - Return From Keyword If "${USE_RFC8040}" == "True" ${uri} - Run Keyword If "${USE_RFC8040}" != "False" Fail Invalid Value for RFC8040 Flag: ${USE_RFC8040} - Run Keyword If "${datastore}"!="config" and "${datastore}"!="operational" Fail Invalid value for datastore: ${datastore} - ${uri} = Run Keyword If "${datastore}"=="config" Set Variable ${CONFIG_API}/${identifier} - ... ELSE Set Variable ${OPERATIONAL_API}/${identifier} + [Arguments] ${identifier} ${datastore_flag}=config @{node_value_list} + IF "${USE_RFC8040}" == "True" + ${uri} = Generate RFC8040 URI ${identifier} ${datastore_flag} @{node_value_list} + ELSE + ${uri} = Set Variable ${None} + END + IF "${USE_RFC8040}" == "True" RETURN ${uri} + IF "${USE_RFC8040}" != "False" + Fail Invalid Value for RFC8040 Flag: ${USE_RFC8040} + END + IF "${datastore_flag}"!="config" and "${datastore_flag}"!="operational" and "${datastore_flag}"!="rpc" + Fail Invalid value for datastore: ${datastore_flag} + END + IF "${datastore_flag}"=="config" + ${uri} = Set Variable ${CONFIG_API}/${identifier} + ELSE IF "${datastore_flag}"=="operational" + ${uri} = Set Variable ${OPERATIONAL_API}/${identifier} + ELSE + ${uri} = Set Variable ${OPERATIONS_API}/${identifier} + END ${node_value_path} = Set Variable ${EMPTY} FOR ${nv} IN @{node_value_list} ${nv} = String.Replace String ${nv} = / ${node_value_path} = Set Variable ${node_value_path}/${nv} END - [Return] ${uri}${node_value_path} + RETURN ${uri}${node_value_path} Generate RFC8040 URI - [Arguments] ${identifier} ${datastore}=config @{node_value_list} + [Arguments] ${identifier} ${datastore_flag}=config @{node_value_list} ${node_value_path} = Set Variable ${EMPTY} FOR ${nv} IN @{node_value_list} ${node_value_path} = Set Variable ${node_value_path}/${nv} END - ${uri} = Run Keyword If "${datastore}" == "config" Set Variable rests/data/${identifier}${node_value_path}?content=config - ... ELSE Set Variable rests/data/${identifier}${node_value_path}?content=nonconfig - [Return] ${uri} + IF "${datastore_flag}" == "config" + ${uri} = Set Variable rests/data/${identifier}${node_value_path}?content=config + ELSE IF "${datastore_flag}"=="operational" + ${uri} = Set Variable rests/data/${identifier}${node_value_path}?content=nonconfig + ELSE + ${uri} = Set Variable rests/operations/${identifier} + END + RETURN ${uri}