--- /dev/null
+*** Settings ***
+Documentation Basic tests for TELEMETRY information configuration and verification.
+... Copyright (c) 2018-2019 Zte, Inc. All rights reserved.
+... Test suite performs basic TELEMETRY information configuration and verification test cases for sensor, destination, and subscription as follows:
+... Test Case 1: Configure sensor with add and delete operation
+... Expected result: The Configure result with corresponding operation verified as expected
+... Test Case 2: Configure destination with add and delete operation
+... Expected result: The Configure result with corresponding operation verified as expected
+... Test Case 3: Configure subscription with add and query operation
+... Expected result: The Configure result with corresponding operation verified as expected
+... Test Case 4: Delete all resource
+... Expected result: The Configure result with corresponding operation verified as expected
+Suite Setup RequestsLibrary.Create_Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS_YANG_JSON}
+Resource ../../../libraries/TemplatedRequests.robot
+Resource ../../../variables/Variables.robot
+Library RequestsLibrary
+
+*** Variables ***
+@{SENSOR_ID_LIST} sensor1 sensor2
+@{PATH_LIST} path1 path2
+@{FILTER_LIST} filter1 filter2
+${TELEMETRY_VAR_FOLDER} ${CURDIR}/../../../variables/telemetry
+@{DESTINATION_ID_LIST} destination1 destination2
+@{ADDRESS_LIST} 10.42.89.15 10.96.33.30
+${PORT} 50051
+@{NODE_ID_LIST} node1 node2
+@{SUBSCRIPTION_ID_LIST} subscription1 subscription2
+@{PROTOCOL_TYPE_LIST} STREAM_SSH STREAM_GRPC STREAM_JSON_RPC STREAM_THRIFT_RPC STREAM_WEBSOCKET_RPC
+@{ENCODING_TYPE_LIST} ENC_XML ENC_JSON_IETF ENC_PROTO3
+${LOCAL_SOURCE_ADDRESS} 127.0.0.1
+@{QOS_MARKING_LIST} 0 1 2 3 4 5
+@{SAMPLE_INTERVAL_LIST} 100 200 300
+@{HEARTBEAT_INTERVAL_LIST} 30 60
+
+*** Test Cases ***
+TC1_Configure Sensor
+ [Documentation] Configure two sensors with sensor id list ${SENSOR_ID_LIST}, sensor path list ${PATH_LIST}, and sensor exclude filter list ${FILTER_LIST}.
+ ${mapping} = Create Dictionary SENSOR1=${SENSOR_ID_LIST[0]} SENSOR2=${SENSOR_ID_LIST[1]} PATH1=${PATH_LIST[0]} PATH2=${PATH_LIST[1]} FILTER1=${FILTER_LIST[0]}
+ ... FILTER2=${FILTER_LIST[1]}
+ ${resp} = TemplatedRequests.Post_As_Json_Templated ${TELEMETRY_VAR_FOLDER}/telemetry_sensor_configuration/configure_sensor ${mapping} session
+ Verify_Response_As_Json_Templated ${resp} ${TELEMETRY_VAR_FOLDER}/response success_response
+
+TC1_Delete Sensor
+ [Documentation] Delete the second sensor created in the test case TC1_Configure Sensor.
+ ${mapping} = Create Dictionary SENSOR=${SENSOR_ID_LIST[1]}
+ ${resp} = TemplatedRequests.Post_As_Json_Templated ${TELEMETRY_VAR_FOLDER}/telemetry_sensor_configuration/delete_sensor ${mapping} session
+ Verify_Response_As_Json_Templated ${resp} ${TELEMETRY_VAR_FOLDER}/response success_response
+
+TC1_Query Sensor
+ [Documentation] Query the sensor created in the datastore.
+ ${resp} = TemplatedRequests.Post_As_Json_Templated ${TELEMETRY_VAR_FOLDER}/telemetry_sensor_configuration/query_sensor {} session True
+
+TC2_Configure Destination
+ [Documentation] Configure two destinations with destination id list ${DESTINATION_ID_LIST}, address list ${ADDRESS_LIST} and port ${PORT}.
+ ${mapping} = Create Dictionary DESTINATION1=${DESTINATION_ID_LIST[0]} DESTINATION2=${DESTINATION_ID_LIST[1]} ADDRESS1=${ADDRESS_LIST[0]} ADDRESS2=${ADDRESS_LIST[1]} PORT=${PORT}
+ ${resp} = TemplatedRequests.Post_As_Json_Templated ${TELEMETRY_VAR_FOLDER}/telemetry_destination_configuration/configure_destination ${mapping} session
+ Verify_Response_As_Json_Templated ${resp} ${TELEMETRY_VAR_FOLDER}/response success_response
+
+TC2_Delete Destination
+ [Documentation] Delete the second destination created in the test case TC2_Configure Destination.
+ ${mapping} = Create Dictionary DESTINATION=${DESTINATION_ID_LIST[1]}
+ ${resp} = TemplatedRequests.Post_As_Json_Templated ${TELEMETRY_VAR_FOLDER}/telemetry_destination_configuration/delete_destination ${mapping} session
+ Verify_Response_As_Json_Templated ${resp} ${TELEMETRY_VAR_FOLDER}/response success_response
+
+TC2_Query Destination
+ [Documentation] Query the destination created in the datastore.
+ ${resp} = TemplatedRequests.Post_As_Json_Templated ${TELEMETRY_VAR_FOLDER}/telemetry_destination_configuration/query_destination {} session True
+
+TC3_Configure Subscription
+ [Documentation] Configure one node with two subscriptions with subscription id list ${SUBSCRIPTION_ID_LIST}, a series of parameters, and sensor destination configured in front.
+ ${mapping} = Create Dictionary NODE1=${NODE_ID_LIST[0]} SUBSCRIPTION1=${SUBSCRIPTION_ID_LIST[0]} PROTOCOLTYPE1=${PROTOCOL_TYPE_LIST[1]} ENCODINGTYPE1=${ENCODING_TYPE_LIST[2]} LOCALSOURCEADDRESS=${LOCAL_SOURCE_ADDRESS}
+ ... QOS1=${QOS_MARKING_LIST[3]} SENSOR1=${SENSOR_ID_LIST[0]} SAMPLE1=${SAMPLE_INTERVAL_LIST[0]} HEARTBEAT1=${HEARTBEAT_INTERVAL_LIST[0]} DESTINATION1=${DESTINATION_ID_LIST[0]} SUBSCRIPTION2=${SUBSCRIPTION_ID_LIST[1]}
+ ... PROTOCOLTYPE2=${PROTOCOL_TYPE_LIST[0]} ENCODINGTYPE2=${ENCODING_TYPE_LIST[0]} QOS2=${QOS_MARKING_LIST[5]} SAMPLE2=${SAMPLE_INTERVAL_LIST[1]} HEARTBEAT2=${HEARTBEAT_INTERVAL_LIST[1]}
+ ${resp} = TemplatedRequests.Post_As_Json_Templated ${TELEMETRY_VAR_FOLDER}/telemetry_subscription_configuration/configure_subscription ${mapping} session
+ Verify_Response_As_Json_Templated ${resp} ${TELEMETRY_VAR_FOLDER}/response success_response
+
+TC3_Query Subscription
+ [Documentation] Query the subscription created in the datastore.
+ ${resp} = TemplatedRequests.Post_As_Json_Templated ${TELEMETRY_VAR_FOLDER}/telemetry_subscription_configuration/query_subscription {} session True
+
+TC4_Delete Resource
+ [Documentation] Delete all sensor, destination and subscription.
+ ${mapping1} = Create Dictionary DESTINATION=${DESTINATION_ID_LIST[0]}
+ ${resp1} = TemplatedRequests.Post_As_Json_Templated ${TELEMETRY_VAR_FOLDER}/telemetry_destination_configuration/delete_destination ${mapping1} session
+ ${mapping2} = Create Dictionary SENSOR=${SENSOR_ID_LIST[0]}
+ ${resp2} = TemplatedRequests.Post_As_Json_Templated ${TELEMETRY_VAR_FOLDER}/telemetry_sensor_configuration/delete_sensor ${mapping2} session
--- /dev/null
+# Place the suites in run order:
+integration/test/csit/suites/telemetry/basic
--- /dev/null
+{
+ "output": {
+ "configure-result": {
+ "result": "SUCCESS"
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+restconf/operations/telemetry-configurator-api:add-telemetry-destination
\ No newline at end of file
--- /dev/null
+{
+ input:
+ {
+ telemetry-destination-group:[{
+ destination-group-id:$DESTINATION1,
+ destination-profile:[{
+ destination-address:$ADDRESS1,
+ destination-port:$PORT
+ }]
+ },
+ {
+ destination-group-id:$DESTINATION2,
+ destination-profile:[{
+ destination-address:$ADDRESS2,
+ destination-port:$PORT
+ }]
+ }]
+ }
+}
--- /dev/null
+restconf/operations/telemetry-configurator-api:delete-telemetry-destination
\ No newline at end of file
--- /dev/null
+{
+ input:
+ {
+ telemetry-destination-group:[{
+ destination-group-id:$DESTINATION
+ }]
+ }
+}
--- /dev/null
+/restconf/operations/telemetry-configurator-api:query-telemetry-destination
\ No newline at end of file
--- /dev/null
+{
+ input:
+ {
+
+ }
+}
--- /dev/null
+{
+ "output": {
+ "telemetry-destination-group":[{
+ "destination-group-id":"destination1",
+ "destination-profile":[{
+ "destination-address":"10.42.89.15",
+ "destination-port":50051
+ }]
+ }]
+ }
+}
\ No newline at end of file
--- /dev/null
+restconf/operations/telemetry-configurator-api:add-telemetry-sensor
\ No newline at end of file
--- /dev/null
+{
+ input:
+ {
+ telemetry-sensor-group:[{
+ telemetry-sensor-group-id:$SENSOR1,
+ telemetry-sensor-paths:[{
+ telemetry-sensor-path:$PATH1,
+ sensor-exclude-filter:$FILTER1
+ },
+ { telemetry-sensor-path:$PATH2,
+ sensor-exclude-filter:$FILTER2
+ }]
+ },
+ { telemetry-sensor-group-id:$SENSOR2,
+ telemetry-sensor-paths:[{
+ telemetry-sensor-path:$PATH1,
+ sensor-exclude-filter:$FILTER1
+ },
+ { telemetry-sensor-path:$PATH2,
+ sensor-exclude-filter:$FILTER2
+ }]
+
+ }]
+ }
+}
--- /dev/null
+restconf/operations/telemetry-configurator-api:delete-telemetry-sensor
\ No newline at end of file
--- /dev/null
+{
+ input:
+ {
+ telemetry-sensor-group:[{
+ sensor-group-id:$SENSOR
+ }]
+ }
+}
--- /dev/null
+/restconf/operations/telemetry-configurator-api:query-telemetry-sensor
\ No newline at end of file
--- /dev/null
+{
+ input:
+ {
+
+ }
+}
--- /dev/null
+{
+ "output": {
+ "telemetry-sensor-group":[{
+ "telemetry-sensor-group-id":"sensor1",
+ "telemetry-sensor-paths":[{
+ "telemetry-sensor-path":"path1",
+ "sensor-exclude-filter":"filter1"
+ },
+ { "telemetry-sensor-path":"path2",
+ "sensor-exclude-filter":"filter2"
+ }]
+ }]
+ }
+}
\ No newline at end of file
--- /dev/null
+restconf/operations/telemetry-configurator-api:configure-node-telemetry-subscription
\ No newline at end of file
--- /dev/null
+{
+ input:
+ {
+ telemetry-node:[{
+ node-id:$NODE1,
+ telemetry-subscription:[{
+ subscription-name:$SUBSCRIPTION1,
+ protocol-type:$PROTOCOLTYPE1,
+ encoding-type:$ENCODINGTYPE1,
+ local-source-address:$LOCALSOURCEADDRESS,
+ originated-qos-marking:$QOS1,
+ telemetry-sensor:[{
+ sensor-group-id:$SENSOR1,
+ sample-interval:$SAMPLE1,
+ heartbeat-interval:$HEARTBEAT1,
+ suppress-redundant:false
+ }],
+ telemetry-destination:[{
+ destination-group-id:$DESTINATION1
+ }]
+ },
+ {
+ subscription-name:$SUBSCRIPTION2,
+ protocol-type:$PROTOCOLTYPE2,
+ encoding-type:$ENCODINGTYPE2,
+ local-source-address:$LOCALSOURCEADDRESS,
+ originated-qos-marking:$QOS2,
+ telemetry-sensor:[{
+ sensor-group-id:$SENSOR1,
+ sample-interval:$SAMPLE2,
+ heartbeat-interval:$HEARTBEAT2,
+ suppress-redundant:false
+ }],
+ telemetry-destination:[{
+ destination-group-id:$DESTINATION1
+ }]
+ }]
+ }]
+ }
+}
--- /dev/null
+/restconf/operations/telemetry-configurator-api:query-node-telemetry-subscription
\ No newline at end of file
--- /dev/null
+{
+ input:
+ {
+
+ }
+}
--- /dev/null
+{
+ "output": {
+ "telemetry-node": [
+ {
+ "node-id": "node1",
+ "telemetry-subscription": [
+ {
+ "subscription-name": "subscription1",
+ "protocol-type": "STREAM_GRPC",
+ "originated-qos-marking": 3,
+ "telemetry-destination": [
+ {
+ "destination-group-id": "destination1"
+ }
+ ],
+ "telemetry-sensor": [
+ {
+ "sensor-group-id": "sensor1",
+ "sample-interval": 100,
+ "heartbeat-interval": 30,
+ "suppress-redundant": false
+ }
+ ],
+ "local-source-address": "127.0.0.1",
+ "encoding-type": "ENC_PROTO3"
+ },
+ {
+ "subscription-name": "subscription2",
+ "protocol-type": "STREAM_SSH",
+ "originated-qos-marking": 5,
+ "telemetry-destination": [
+ {
+ "destination-group-id": "destination1"
+ }
+ ],
+ "telemetry-sensor": [
+ {
+ "sensor-group-id": "sensor1",
+ "sample-interval": 200,
+ "heartbeat-interval": 60,
+ "suppress-redundant": false
+ }
+ ],
+ "local-source-address": "127.0.0.1",
+ "encoding-type": "ENC_XML"
+ }
+ ]
+ }
+ ]
+ }
+}
\ No newline at end of file