-*** Variables ***
-${USE_RFC8040} = True
-
-
*** Keywords ***
Generate URI
- [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_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 '/'
+ [Documentation] Returns the proper URI to use. Variable input error checking is done to ensure the ${datastore_flag} variable
+ ... is 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
[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}
+ ${uri} = Generate RFC8040 URI ${identifier} ${datastore_flag} @{node_value_list}
+ RETURN ${uri}
Generate RFC8040 URI
[Arguments] ${identifier} ${datastore_flag}=config @{node_value_list}
*** Variables ***
${TEMPLATE_FOLDER} ${CURDIR}/templates
-${DRAFT_STREAMS_URI} restconf/streams
${RFC8040_STREAMS_URI} rests/data/ietf-restconf-monitoring:restconf-state/streams
${NODES_STREAM_PATH} network-topology:network-topology/datastore=CONFIGURATION/scope=BASE
-${DRAFT_DCN_STREAM_URI} ${DRAFT_STREAMS_URI}/stream/data-change-event-subscription/${NODES_STREAM_PATH}
${RFC8040_DCN_STREAM_URI} ${RFC8040_STREAMS_URI}/stream/data-change-event-subscription/${NODES_STREAM_PATH}
${RESTCONF_SUBSCRIBE_DATA} subscribe.xml
${RESTCONF_CONFIG_DATA} config_data.xml
${RECEIVER_LOG_FILE} receiver.log
-${RECEIVER_OPTIONS} ${EMPTY}
${CONTROLLER_LOG_LEVEL} INFO
Subscribe_To_DCN_Stream
[Documentation] Subscribe to DCN streams.
[Tags] critical
- ${uri} = Set Variable If "${USE_RFC8040}" == "False" ${DRAFT_DCN_STREAM_URI} ${RFC8040_DCN_STREAM_URI}
- ${resp} = RequestsLibrary.Get_On_Session restconf url=${uri} headers=${SEND_ACCEPT_XML_HEADERS}
+ ${resp} = RequestsLibrary.Get_On_Session restconf url=${RFC8040_DCN_STREAM_URI} headers=${SEND_ACCEPT_XML_HEADERS}
Log_Response ${resp}
BuiltIn.Should_Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
${location} = XML.Get_Element_Text ${resp.content}
List_DCN_Streams
[Documentation] List DCN streams.
[Tags] critical
- ${uri} = BuiltIn.Set_Variable_If
- ... "${USE_RFC8040}" == "False"
- ... ${DRAFT_STREAMS_URI}
- ... ${RFC8040_STREAMS_URI}
- ${resp} = RequestsLibrary.Get_On_Session restconf url=${uri} headers=${SEND_ACCEPT_XML_HEADERS}
+ ${resp} = RequestsLibrary.Get_On_Session restconf url=${RFC8040_DCN_STREAM_URI} headers=${SEND_ACCEPT_XML_HEADERS}
Log_Response ${resp}
BuiltIn.Should_Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
Comment Stream only shows in RFC URL.
- IF "${USE_RFC8040}" == "True"
- BuiltIn.Should_Contain ${resp.text} ${NODES_STREAM_PATH}
- END
+ BuiltIn.Should_Contain ${resp.text} ${NODES_STREAM_PATH}
Start_Receiver
[Documentation] Start the websocket listener
- IF "${USE_RFC8040}" == "False"
- ${output} = SSHLibrary.Write
- ... python3 wsreceiver.py --uri ${location} --count 2 --logfile ${RECEIVER_LOG_FILE} ${RECEIVER_OPTIONS}
- ELSE
- ${output} = SSHLibrary.Write python3 ssereceiver.py --uri ${location} --logfile ${RECEIVER_LOG_FILE}
- END
+ ${output} = SSHLibrary.Write python3 ssereceiver.py --uri ${location} --logfile ${RECEIVER_LOG_FILE}
BuiltIn.Log ${output}
${output} = SSHLibrary.Read delay=2s
BuiltIn.Log ${output}
[Documentation] Make a change in DS configuration.
[Tags] critical
${body} = OperatingSystem.Get_File ${TEMPLATE_FOLDER}/${RESTCONF_CONFIG_DATA}
- ${uri} = BuiltIn.Set_Variable_If
- ... "${USE_RFC8040}" == "False"
- ... /restconf/config/network-topology:network-topology
- ... /rests/data/network-topology:network-topology
+ ${uri} = BuiltIn.Set_Variable /rests/data/network-topology:network-topology
${resp} = RequestsLibrary.Put_On_Session
... restconf
... ${uri}
... data=${body}
Log_Response ${resp}
BuiltIn.Should_Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
- ${uri} = BuiltIn.Set_Variable_If
- ... "${USE_RFC8040}" == "False"
- ... /restconf/config/network-topology:network-topology/topology/netconf-notif
- ... /rests/data/network-topology:network-topology/topology=netconf-notif
+ ${uri} = BuiltIn.Set_Variable /rests/data/network-topology:network-topology/topology=netconf-notif
${resp} = RequestsLibrary.Delete_On_Session restconf ${uri} headers=${SEND_ACCEPT_XML_HEADERS}
Log_Response ${resp}
BuiltIn.Should_Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}