... * netconf-connector feature installed on ODL.
... * Setup_Config_Via_Restconf called from suite Setup
... (or before any other call to a keyword from this library) at least once.
-...
-... FIXME: This module needs merging with NetconfViaRestconf.robot and fixing.
-... See comments in NetconfViaRestconf.robot for more details.
Library OperatingSystem
Library RequestsLibrary
Library String
Library DateTime
Library RequestsLibrary
Library SSHLibrary
-Resource NetconfViaRestconf.robot
Resource NexusKeywords.robot
Resource SSHKeywords.robot
+Resource TemplatedRequests.robot
Resource Utils.robot
*** Variables ***
*** Keywords ***
Setup_NetconfKeywords
+ [Arguments] ${create_session_for_templated_requests}=True
[Documentation] Setup the environment for the other keywords of this Resource to work properly.
${tmp}= BuiltIn.Create_Dictionary
BuiltIn.Set_Suite_Variable ${NetconfKeywords__mounted_device_types} ${tmp}
- NetconfViaRestconf.Setup_Netconf_Via_Restconf
+ BuiltIn.Run_Keyword_If ${create_session_for_templated_requests} TemplatedRequests.Create_Default_Session
NexusKeywords.Initialize_Artifact_Deployment_And_Usage
Configure_Device_In_Netconf
[Arguments] ${device_name} ${device_type}=default ${device_port}=${FIRST_TESTTOOL_PORT} ${device_address}=${TOOLS_SYSTEM_IP} ${device_user}=admin ${device_password}=topsecret
+ ... ${session}=default
[Documentation] Tell Netconf about the specified device so it can add it into its configuration.
${template_as_string}= BuiltIn.Set_Variable {'DEVICE_IP': '${device_address}', 'DEVICE_NAME': '${device_name}', 'DEVICE_PORT': '${device_port}', 'DEVICE_USER': '${device_user}', 'DEVICE_PASSWORD': '${device_password}'}
- NetconfViaRestconf.Put_Xml_Template_Folder_Via_Restconf ${DIRECTORY_WITH_DEVICE_TEMPLATES}${/}${device_type} ${template_as_string}
+ TemplatedRequests.Put_As_Xml_Templated ${DIRECTORY_WITH_DEVICE_TEMPLATES}${/}${device_type} ${template_as_string} session=${session}
Collections.Set_To_Dictionary ${NetconfKeywords__mounted_device_types} ${device_name} ${device_type}
Count_Netconf_Connectors_For_Device
- [Arguments] ${device_name}
+ [Arguments] ${device_name} ${session}=default
[Documentation] Count all instances of the specified device in the Netconf topology (usually 0 or 1).
# FIXME: This no longer counts netconf connectors, it counts "device instances in Netconf topology".
# This keyword should be renamed but without an automatic keyword naming standards checker this is
# potentially destabilizing change so right now it is as FIXME. Proposed new name:
# Count_Device_Instances_In_Netconf_Topology
- ${mounts}= NetconfViaRestconf.Get_Operational_Data_From_URI network-topology:network-topology/topology/topology-netconf
+ ${mounts}= TemplatedRequests.Get_As_Json_From_Uri ${OPERATIONAL_API}/network-topology:network-topology/topology/topology-netconf session=${session}
Builtin.Log ${mounts}
- ${actual_count}= Builtin.Evaluate len('''${mounts}'''.split('"node-id":"${device_name}"'))-1
+ ${actual_count}= Builtin.Evaluate len('''${mounts}'''.split('"node-id": "${device_name}"'))-1
Builtin.Return_From_Keyword ${actual_count}
Check_Device_Has_No_Netconf_Connector
- [Arguments] ${device_name}
+ [Arguments] ${device_name} ${session}=default
[Documentation] Check that there are no instances of the specified device in the Netconf topology.
# FIXME: Similarlt to "Count_Netconf_Connectors_For_Device", this does not check whether the device has
# no netconf connector but whether the device is present in the netconf topology or not. Rename, proposed
# new name: Check_Device_Not_Present_In_Netconf_Topology
- ${count} Count_Netconf_Connectors_For_Device ${device_name}
+ ${count} Count_Netconf_Connectors_For_Device ${device_name} session=${session}
Builtin.Should_Be_Equal_As_Strings ${count} 0
Check_Device_Completely_Gone
- [Arguments] ${device_name}
+ [Arguments] ${device_name} ${session}=default
[Documentation] Check that the specified device has no Netconf connectors nor associated data.
- Check_Device_Has_No_Netconf_Connector ${device_name}
- ${uri}= Builtin.Set_Variable network-topology:network-topology/topology/topology-netconf/node/${device_name}
- ${response}= RequestsLibrary.Get Request nvr_session ${uri} ${ACCEPT_XML}
- BuiltIn.Should_Be_Equal_As_Integers ${response.status_code} 404
+ Check_Device_Has_No_Netconf_Connector ${device_name} session=${session}
+ ${uri}= Builtin.Set_Variable ${CONFIG_API}/network-topology:network-topology/topology/topology-netconf/node/${device_name}
+ ${status} ${response}= BuiltIn.Run_Keyword_And_Ignore_Error TemplatedRequests.Get_As_Xml_From_Uri ${uri} session=${session}
+ BuiltIn.Should_Be_Equal_As_Strings ${status} FAIL
+ BuiltIn.Should_Contain ${response} 404
Check_Device_Connected
- [Arguments] ${device_name}
+ [Arguments] ${device_name} ${session}=default
[Documentation] Check that the specified device is accessible from Netconf.
- ${device_status}= NetconfViaRestconf.Get_Operational_Data_From_URI network-topology:network-topology/topology/topology-netconf/node/${device_name}
- Builtin.Should_Contain ${device_status} "netconf-node-topology:connection-status":"connected"
+ ${device_status}= TemplatedRequests.Get_As_Json_From_Uri ${OPERATIONAL_API}/network-topology:network-topology/topology/topology-netconf/node/${device_name} session=${session}
+ Builtin.Should_Contain ${device_status} "netconf-node-topology:connection-status": "connected"
Wait_Device_Connected
- [Arguments] ${device_name} ${timeout}=10s ${period}=1s
+ [Arguments] ${device_name} ${timeout}=10s ${period}=1s ${session}=default
[Documentation] Wait for the device to become connected.
... It is more readable to use this keyword in a test case than to put the whole WUKS below into it.
- BuiltIn.Wait_Until_Keyword_Succeeds ${timeout} ${period} Check_Device_Connected ${device_name}
+ BuiltIn.Wait_Until_Keyword_Succeeds ${timeout} ${period} Check_Device_Connected ${device_name} session=${session}
Remove_Device_From_Netconf
- [Arguments] ${device_name}
+ [Arguments] ${device_name} ${session}=default
[Documentation] Tell Netconf to deconfigure the specified device
${device_type}= Collections.Pop_From_Dictionary ${NetconfKeywords__mounted_device_types} ${device_name}
${template_as_string}= BuiltIn.Set_Variable {'DEVICE_NAME': '${device_name}'}
- NetconfViaRestconf.Delete_Xml_Template_Folder_Via_Restconf ${DIRECTORY_WITH_DEVICE_TEMPLATES}${/}${device_type} ${template_as_string}
+ TemplatedRequests.Delete_Templated ${DIRECTORY_WITH_DEVICE_TEMPLATES}${/}${device_type} ${template_as_string} session=${session}
Wait_Device_Fully_Removed
- [Arguments] ${device_name} ${timeout}=10s ${period}=1s
+ [Arguments] ${device_name} ${timeout}=10s ${period}=1s ${session}=default
[Documentation] Wait until all netconf connectors for the device with the given name disappear.
... Call of Remove_Device_From_Netconf returns before netconf gets
... around deleting the device's connector. To ensure the device is
... is not made before using this keyword, the wait will fail.
... Using this keyword is more readable than putting the WUKS below
... into a test case.
- BuiltIn.Wait_Until_Keyword_Succeeds ${timeout} ${period} Check_Device_Completely_Gone ${device_name}
+ BuiltIn.Wait_Until_Keyword_Succeeds ${timeout} ${period} Check_Device_Completely_Gone ${device_name} session=${session}
NetconfKeywords__Deploy_Additional_Schemas
[Arguments] ${schemas}
+++ /dev/null
-*** Settings ***
-Documentation Access Netconf via Restconf.
-...
-... Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
-...
-... This program and the accompanying materials are made available under the
-... terms of the Eclipse Public License v1.0 which accompanies this distribution,
-... and is available at http://www.eclipse.org/legal/epl-v10.html
-...
-... FIXME: This whole thing needs to be refactored and merged with
-... "ConfigViaRestconf.robot" which contains nearly identical (or even completely
-... identical) pieces of code.
-...
-... FIXME: This module (along with "ConfigViaRestconf.robot") uses the deprecated
-... "RequestsLibrary.Put" keyword to issue requests to the ODL. Convert these
-... statements to use "RequestsLibrary.Put_Request" instead. Similarly for
-... "RequestsLibrary.Post" and "RequestsLibrary.Delete". It might be best to do
-... this change after the code duplication in these two modules is removed (see
-... the previous FIXME).
-Library RequestsLibrary
-Library OperatingSystem
-Resource Utils.robot
-
-*** Variables ***
-@{allowed_status_codes} ${200} ${201} ${204} # List of integers, not strings. Used by both PUT and DELETE.
-
-*** Keywords ***
-FIXME__POLISH_THIS
- # The following code has a bunch of problems which are very hard to fix in
- # terms of debugging and review times. Therefore I propose to merge this test
- # first "as is" and solve the problems of this code in later commits. These
- # problems were identified so far:
- #
- # - Code duplication. The following code is almost identical to what is
- # present in ConfigViaRestconf.robot. Fixing this means refactoring
- # ConfigViaRestconf.robot to use this library instead of doing
- # everything on its own.
- # - The interface of this code might be too optimized for the needs of
- # one test suite. Maybe it should be generalized.
- # - The Teardown_Netconf_Via_Restconf seems to be incomplete. It is
- # supposed to close the session but (as the code suggests in a
- # comment), the functionality needed is not implemented.
- #
- # Issues identified when trying to make this a library:
- #
- # - A better name might be necessary (this actually allows not only
- # netconf to be accessed but other restconf accessible subsystems as
- # well).
- # - The ConfigViaRestconf might need to be merged with this code to avoid
- # strange name clashes when using both in a suite.
-
-Setup_Netconf_Via_Restconf
- [Documentation] Creates a default requests session to be used by subsequent keywords.
- # Do not append slash at the end uf URL, Requests would add another, resulting in error.
- Create_NVR_Session nvr_session ${ODL_SYSTEM_IP}
- Activate_NVR_Session nvr_session
-
-Teardown_Netconf_Via_Restconf
- [Documentation] Teardown to pair with Setup (otherwise no-op).
- BuiltIn.Comment TODO: The following line does not seem to be implemented by RequestsLibrary. Look for a workaround.
- BuiltIn.Comment Delete_Session nvr_session
-
-Resolve_URI_From_Template_Folder
- [Arguments] ${folder} ${mapping_as_string}
- [Documentation] Read URI template from folder, strip endline, make changes according to mapping, return the result.
- ${uri_template}= OperatingSystem.Get_File ${folder}${/}config.uri
- BuiltIn.Log ${uri_template}
- ${uri_part}= Strip_Endline_And_Apply_Substitutions_From_Mapping ${uri_template} ${mapping_as_string}
- [Return] ${uri_part}
-
-Resolve_Xml_Data_From_Template_Folder
- [Arguments] ${folder} ${mapping_as_string}
- [Documentation] Read data template from folder, strip endline, make changes according to mapping, return the result.
- ${data_template}= OperatingSystem.Get_File ${folder}${/}data.xml
- BuiltIn.Log ${data_template}
- ${xml_data}= Strip_Endline_And_Apply_Substitutions_From_Mapping ${data_template} ${mapping_as_string}
- [Return] ${xml_data}
-
-Resolve_Json_Data_From_Template_Folder
- [Arguments] ${folder} ${mapping_as_string}
- [Documentation] Read data template from folder, strip endline, make changes according to mapping, return the result.
- ${data_template}= OperatingSystem.Get_File ${folder}${/}data.json
- BuiltIn.Log ${data_template}
- ${json_data}= Strip_Endline_And_Apply_Substitutions_From_Mapping ${data_template} ${mapping_as_string}
- [Return] ${json_data}
-
-Strip_Endline_And_Apply_Substitutions_From_Mapping
- [Arguments] ${template_as_string} ${mapping_as_string}
- [Documentation] Strip endline, apply substitutions, Log and return the result.
- # Robot Framework does not understand dictionaries well, so resort to Evaluate.
- # Needs python module "string", and since the template string is expected to contain newline, it has to be enclosed in triple quotes.
- # Using rstrip() removes all trailing whitespace, which is what we want if there is something more than an endline.
- ${final_text}= BuiltIn.Evaluate string.Template('''${template_as_string}'''.rstrip()).substitute(${mapping_as_string}) modules=string
- BuiltIn.Log ${final_text}
- [Return] ${final_text}
-
-Post_Xml_Via_Restconf
- [Arguments] ${uri_part} ${xml_data}
- [Documentation] Post XML data to given controller-config URI, check reponse text is empty and status_code is 204.
- BuiltIn.Log ${uri_part}
- BuiltIn.Log ${xml_data}
- # As seen in previous two Keywords, Post does not need long specific URI.
- # But during Lithium development, Post ceased to do merge, so those Keywords do not work anymore.
- # This Keyword can still be used with specific URI to create a new container and fail if a container was already present.
- ${response}= RequestsLibrary.Post Request ${NetconfViaRestconf__active_config_session} ${uri_part} data=${xml_data}
- BuiltIn.Log ${response.text}
- BuiltIn.Should_Be_Empty ${response.text}
- BuiltIn.Should_Be_Equal_As_Strings ${response.status_code} 204
-
-Post_Xml_Template_Folder_Via_Restconf
- [Arguments] ${folder} ${mapping_as_string}={}
- [Documentation] Resolve URI and data from folder, POST to restconf.
- ${uri_part}= Resolve_URI_From_Template_Folder ${folder} ${mapping_as_string}
- ${xml_data}= Resolve_Xml_Data_From_Template_Folder ${folder} ${mapping_as_string}
- Post_Xml_Via_Restconf ${uri_part} ${xml_data}
-
-Post_Json_Via_Restconf
- [Arguments] ${uri_part} ${json_data}
- [Documentation] Post JSON data to given controller-config URI, check reponse text is empty and status_code is 204.
- BuiltIn.Log ${uri_part}
- BuiltIn.Log ${json_data}
- # As seen in previous two Keywords, Post does not need long specific URI.
- # But during Lithium development, Post ceased to do merge, so those Keywords do not work anymore.
- # This Keyword can still be used with specific URI to create a new container and fail if a container was already present.
- ${response}= RequestsLibrary.Post ${NetconfViaRestconf__active_config_session} ${uri_part} data=${json_data} headers=${HEADERS_YANG_JSON}
- BuiltIn.Log ${response.text}
- BuiltIn.Should_Be_Empty ${response.text}
- BuiltIn.Should_Be_Equal_As_Strings ${response.status_code} 204
-
-Post_Json_Template_Folder_Via_Restconf
- [Arguments] ${folder} ${mapping_as_string}={}
- [Documentation] Resolve URI and data from folder, POST to restconf.
- ${uri_part}= Resolve_URI_From_Template_Folder ${folder} ${mapping_as_string}
- ${json_data}= Resolve_Json_Data_From_Template_Folder ${folder} ${mapping_as_string}
- Post_Json_Via_Restconf ${uri_part} ${json_data}
-
-Put_Xml_Via_Restconf
- [Arguments] ${uri_part} ${xml_data}
- [Documentation] Put XML data to given controller-config URI, check reponse text is empty and status_code is one of allowed ones.
- BuiltIn.Log ${uri_part}
- BuiltIn.Log ${xml_data}
- ${response}= RequestsLibrary.Put Request ${NetconfViaRestconf__active_config_session} ${uri_part} data=${xml_data}
- BuiltIn.Log ${response.text}
- BuiltIn.Log ${response.status_code}
- BuiltIn.Should_Be_Empty ${response.text}
- BuiltIn.Should_Contain ${allowed_status_codes} ${response.status_code}
-
-Put_Xml_Template_Folder_Via_Restconf
- [Arguments] ${folder} ${mapping_as_string}={}
- [Documentation] Resolve URI and data from folder, PUT to controller config.
- ${uri_part}= Resolve_URI_From_Template_Folder ${folder} ${mapping_as_string}
- ${xml_data}= Resolve_Xml_Data_From_Template_Folder ${folder} ${mapping_as_string}
- Put_Xml_Via_Restconf ${uri_part} ${xml_data}
-
-Put_Json_Via_Restconf
- [Arguments] ${uri_part} ${json_data}
- [Documentation] Put JSON data to given controller-config URI, check reponse text is empty and status_code is one of allowed ones.
- BuiltIn.Log ${uri_part}
- BuiltIn.Log ${json_data}
- ${response}= RequestsLibrary.Put Request ${NetconfViaRestconf__active_config_session} ${uri_part} data=${json_data} headers=${HEADERS_YANG_JSON}
- BuiltIn.Log ${response.text}
- BuiltIn.Log ${response.status_code}
- BuiltIn.Should_Be_Empty ${response.text}
- BuiltIn.Should_Contain ${allowed_status_codes} ${response.status_code}
-
-Put_Json_Template_Folder_Via_Restconf
- [Arguments] ${folder} ${mapping_as_string}={}
- [Documentation] Resolve URI and data from folder, PUT to controller config.
- ${uri_part}= Resolve_URI_From_Template_Folder ${folder} ${mapping_as_string}
- ${json_data}= Resolve_Json_Data_From_Template_Folder ${folder} ${mapping_as_string}
- Put_Json_Via_Restconf ${uri_part} ${json_data}
-
-Delete_Via_Restconf
- [Arguments] ${uri_part}
- [Documentation] Delete resource at controller-config URI, check reponse text is empty and status_code is 204.
- BuiltIn.Log ${uri_part}
- ${response}= RequestsLibrary.Delete Request ${NetconfViaRestconf__active_config_session} ${uri_part}
- BuiltIn.Log ${response.text}
- BuiltIn.Should_Be_Empty ${response.text}
- BuiltIn.Should_Contain ${allowed_status_codes} ${response.status_code}
-
-Delete_Xml_Template_Folder_Via_Restconf
- [Arguments] ${folder} ${mapping_as_string}={}
- [Documentation] Resolve URI from folder, DELETE from controller config.
- ${uri_part}= Resolve_URI_From_Template_Folder ${folder} ${mapping_as_string}
- Delete_Via_Restconf ${uri_part}
-
-Create_NVR_Session
- [Arguments] ${name} ${host}
- [Documentation] Create a Netconf Via Restconf session pointing to the given host with the given name. The new session is NOT made active.
- RequestsLibrary.Create_Session ${name} http://${host}:${RESTCONFPORT}${CONFIG_API} headers=${HEADERS_XML} auth=${AUTH}
- RequestsLibrary.Create_Session ${name}_operational http://${host}:${RESTCONFPORT}${OPERATIONAL_API} headers=${HEADERS_XML} auth=${AUTH}
-
-Get_Active_NVR_Session
- [Documentation] Get the name of the currently active NVR session.
- [Return] ${NetconfViaRestconf__active_config_session}
-
-Activate_NVR_Session
- [Arguments] ${name}
- [Documentation] Activate the given NVR session.
- BuiltIn.Set_Suite_Variable ${NetconfViaRestconf__active_config_session} ${name}
- BuiltIn.Set_Suite_Variable ${NetconfViaRestconf__active_operational_session} ${name}_operational
-
-Get_Config_Data_From_URI
- [Arguments] ${uri} ${headers}=${NONE}
- ${data}= Utils.Get_Data_From_URI ${NetconfViaRestconf__active_config_session} ${uri} ${headers}
- [Return] ${data}
-
-Get_Operational_Data_From_URI
- [Arguments] ${uri} ${headers}=${NONE}
- ${data}= Utils.Get_Data_From_URI ${NetconfViaRestconf__active_operational_session} ${uri} ${headers}
- [Return] ${data}
Resource ${CURDIR}/../../../libraries/FailFast.robot
Resource ${CURDIR}/../../../libraries/KarafKeywords.robot
Resource ${CURDIR}/../../../libraries/NetconfKeywords.robot
-Resource ${CURDIR}/../../../libraries/NetconfViaRestconf.robot
Resource ${CURDIR}/../../../libraries/SetupUtils.robot
+Resource ${CURDIR}/../../../libraries/TemplatedRequests.robot
Resource ${CURDIR}/../../../libraries/Utils.robot
Variables ${CURDIR}/../../../variables/Variables.py
Create_Device_Data_Label_Via_Xml
[Documentation] Send a sample test data label into the device and check that the request went OK.
${template_as_string}= BuiltIn.Set_Variable {'DEVICE_NAME': '${device_name}'}
- NetconfViaRestconf.Post_Xml_Template_Folder_Via_Restconf ${directory_with_template_folders}${/}dataorig ${template_as_string}
+ TemplatedRequests.Post_As_Xml_Templated ${directory_with_template_folders}${/}dataorig ${template_as_string}
Check_Device_Data_Label_Is_Created
[Documentation] Get the device data label and make sure it contains the created content.
Modify_Device_Data_Label_Via_Xml
[Documentation] Send a request to change the sample test data label and check that the request went OK.
${template_as_string}= BuiltIn.Set_Variable {'DEVICE_NAME': '${device_name}'}
- NetconfViaRestconf.Put_Xml_Template_Folder_Via_Restconf ${directory_with_template_folders}${/}datamod1 ${template_as_string}
+ TemplatedRequests.Put_As_Xml_Templated ${directory_with_template_folders}${/}datamod1 ${template_as_string}
Check_Device_Data_Label_Is_Modified
[Documentation] Get the device data label and make sure it contains the modified content.
Modify_Device_Data_Again
[Documentation] Send a request to change the sample test data and check that the request went OK.
${template_as_string}= BuiltIn.Set_Variable {'DEVICE_NAME': '${device_name}'}
- NetconfViaRestconf.Put_Xml_Template_Folder_Via_Restconf ${DIRECTORY_WITH_TEMPLATE_FOLDERS}${/}datamod2 ${template_as_string}
+ TemplatedRequests.Put_As_Xml_Templated ${DIRECTORY_WITH_TEMPLATE_FOLDERS}${/}datamod2 ${template_as_string}
Check_Device_Data_Is_Modified_Again
[Documentation] Get the device data and make sure it contains the created content.
Modify_Device_Data_Label_Via_Json
[Documentation] Send a JSON request to change the sample test data label and check that the request went OK.
${template_as_string}= BuiltIn.Set_Variable {'DEVICE_NAME': '${device_name}'}
- NetconfViaRestconf.Put_Json_Template_Folder_Via_Restconf ${directory_with_template_folders}${/}datamodjson ${template_as_string}
+ TemplatedRequests.Put_As_Json_Templated ${directory_with_template_folders}${/}datamodjson ${template_as_string}
Check_Device_Data_Label_Is_Modified_Via_Json
[Documentation] Get the device data label as XML and make sure it matches the content posted as JSON in the previous case.
Create_Car_List
[Documentation] Send a request to create a list of cars in the sample test data label and check that the request went OK.
${template_as_string}= BuiltIn.Set_Variable {'DEVICE_NAME': '${device_name}'}
- NetconfViaRestconf.Post_Xml_Template_Folder_Via_Restconf ${directory_with_template_folders}${/}cars ${template_as_string}
+ TemplatedRequests.Post_As_Xml_Templated ${directory_with_template_folders}${/}cars ${template_as_string}
Check_Car_List_Created
[Documentation] Get the device data label as XML and make sure it matches the content posted as JSON in the previous case.
Add_Device_Data_Item_1_Via_XML_Post
[Documentation] Send a request to create a data item in the test list and check that the request went OK.
${template_as_string}= BuiltIn.Set_Variable {'DEVICE_NAME': '${device_name}'}
- NetconfViaRestconf.Post_Xml_Template_Folder_Via_Restconf ${directory_with_template_folders}${/}item1 ${template_as_string}
+ TemplatedRequests.Post_As_Xml_Templated ${directory_with_template_folders}${/}item1 ${template_as_string}
Check_Item1_Is_Created
[Documentation] Get the device data as XML and make sure it matches the content posted as JSON in the previous case.
Add_Device_Data_Item_2_Via_JSON_Post
[Documentation] Send a JSON request to change the sample test data and check that the request went OK.
${template_as_string}= BuiltIn.Set_Variable {'DEVICE_NAME': '${device_name}'}
- NetconfViaRestconf.Post_Json_Template_Folder_Via_Restconf ${directory_with_template_folders}${/}item2 ${template_as_string}
+ TemplatedRequests.Post_As_Json_Templated ${directory_with_template_folders}${/}item2 ${template_as_string}
Check_Item2_Is_Created
[Documentation] Get the device data as XML and make sure it matches the content posted as JSON in the previous case.
Delete_Device_Data
[Documentation] Send a request to delete the sample test data on the device and check that the request went OK.
${template_as_string}= BuiltIn.Set_Variable {'DEVICE_NAME': '${device_name}'}
- NetconfViaRestconf.Delete_Xml_Template_Folder_Via_Restconf ${directory_with_template_folders}${/}datamod1 ${template_as_string}
- NetconfViaRestconf.Delete_Xml_Template_Folder_Via_Restconf ${directory_with_template_folders}${/}item1 ${template_as_string}
+ TemplatedRequests.Delete_Templated ${directory_with_template_folders}${/}datamod1 ${template_as_string}
+ TemplatedRequests.Delete_Templated ${directory_with_template_folders}${/}item1 ${template_as_string}
Check_Device_Data_Is_Deleted
[Documentation] Get the device data and make sure it is empty again.
Teardown_Everything
[Documentation] Teardown the test infrastructure, perform cleanup and release all resources.
- Teardown_Netconf_Via_Restconf
RequestsLibrary.Delete_All_Sessions
BuiltIn.Run_Keyword_And_Ignore_Error NetconfKeywords.Stop_Testtool
Get_Config_Data
[Documentation] Get and return the config data from the device.
- ${url}= Builtin.Set_Variable network-topology:network-topology/topology/topology-netconf/node/${device_name}/yang-ext:mount
- ${data}= Utils.Get_Data_From_URI nvr_session ${url} headers=${ACCEPT_XML}
+ ${url}= Builtin.Set_Variable ${CONFIG_API}/network-topology:network-topology/topology/topology-netconf/node/${device_name}/yang-ext:mount
+ ${data}= TemplatedRequests.Get_As_Xml_From_Uri ${url}
[Return] ${data}
Check_Config_Data
Resource ${CURDIR}/../../../libraries/FailFast.robot
Resource ${CURDIR}/../../../libraries/KarafKeywords.robot
Resource ${CURDIR}/../../../libraries/NetconfKeywords.robot
-Resource ${CURDIR}/../../../libraries/NetconfViaRestconf.robot
Resource ${CURDIR}/../../../libraries/SetupUtils.robot
+Resource ${CURDIR}/../../../libraries/TemplatedRequests.robot
Resource ${CURDIR}/../../../libraries/Utils.robot
Variables ${CURDIR}/../../../variables/Variables.py
Check_Device_Is_Not_Mounted_At_Beginning
[Documentation] Sanity check making sure our device is not there. Fail if found.
[Tags] critical
- NetconfViaRestconf.Activate_NVR_Session ${NODE_CONFIGURER}
- NetconfKeywords.Check_Device_Has_No_Netconf_Connector ${DEVICE_NAME}
+ NetconfKeywords.Check_Device_Has_No_Netconf_Connector ${DEVICE_NAME} session=${NODE_CONFIGURER}
Configure_Device_On_Netconf
[Documentation] Make request to configure a testtool device on Netconf connector
[Tags] critical
- NetconfViaRestconf.Activate_NVR_Session ${NODE_CONFIGURER}
- NetconfKeywords.Configure_Device_In_Netconf ${DEVICE_NAME} device_type=configure-via-topology
+ NetconfKeywords.Configure_Device_In_Netconf ${DEVICE_NAME} device_type=configure-via-topology session=${NODE_CONFIGURER}
[Teardown] Utils.Report_Failure_Due_To_Bug 5089
Check_Configurer_Has_Netconf_Connector_For_Device
[Documentation] Get the list of mounts and search for our device there. Fail if not found.
[Tags] critical
- NetconfViaRestconf.Activate_NVR_Session ${NODE_CONFIGURER}
- BuiltIn.Wait_Until_Keyword_Succeeds ${DEVICE_CHECK_TIMEOUT} 1s Check_Device_Instance_Count 1
+ BuiltIn.Wait_Until_Keyword_Succeeds ${DEVICE_CHECK_TIMEOUT} 1s Check_Device_Instance_Count 1 session=${NODE_CONFIGURER}
Wait_For_Device_To_Become_Visible_For_Configurer
[Documentation] Wait until the device becomes visible on configurer node.
- NetconfViaRestconf.Activate_NVR_Session ${NODE_CONFIGURER}
- NetconfKeywords.Wait_Device_Connected ${DEVICE_NAME}
+ NetconfKeywords.Wait_Device_Connected ${DEVICE_NAME} session=${NODE_CONFIGURER}
Wait_For_Device_To_Become_Visible_For_Checker
[Documentation] Wait until the device becomes visible on checker node.
- NetconfViaRestconf.Activate_NVR_Session ${NODE_CHECKER}
- NetconfKeywords.Wait_Device_Connected ${DEVICE_NAME}
+ NetconfKeywords.Wait_Device_Connected ${DEVICE_NAME} session=${NODE_CHECKER}
Wait_For_Device_To_Become_Visible_For_Setter
[Documentation] Wait until the device becomes visible on setter node.
- NetconfViaRestconf.Activate_NVR_Session ${NODE_SETTER}
- NetconfKeywords.Wait_Device_Connected ${DEVICE_NAME}
+ NetconfKeywords.Wait_Device_Connected ${DEVICE_NAME} session=${NODE_SETTER}
Check_Device_Data_Is_Seen_As_Empty_On_Configurer
[Documentation] Get the device data as seen by configurer and make sure it is empty.
Create_Device_Data
[Documentation] Send some sample test data into the device and check that the request went OK.
- NetconfViaRestconf.Activate_NVR_Session ${NODE_SETTER}
${template_as_string}= BuiltIn.Set_Variable {'DEVICE_NAME': '${DEVICE_NAME}'}
- NetconfViaRestconf.Post_Xml_Template_Folder_Via_Restconf ${directory_with_template_folders}${/}dataorig ${template_as_string}
+ TemplatedRequests.Post_As_Xml_Templated ${directory_with_template_folders}${/}dataorig ${template_as_string} session=${NODE_SETTER}
Check_New_Device_Data_Is_Visible_On_Setter
[Documentation] Get the device data and make sure it contains the created content.
Modify_Device_Data
[Documentation] Send a request to change the sample test data and check that the request went OK.
- NetconfViaRestconf.Activate_NVR_Session ${NODE_SETTER}
${template_as_string}= BuiltIn.Set_Variable {'DEVICE_NAME': '${DEVICE_NAME}'}
- NetconfViaRestconf.Put_Xml_Template_Folder_Via_Restconf ${directory_with_template_folders}${/}datamod1 ${template_as_string}
+ TemplatedRequests.Put_As_Xml_Templated ${directory_with_template_folders}${/}datamod1 ${template_as_string} session=${NODE_SETTER}
[Teardown] Utils.Report_Failure_Due_To_Bug 4968
Check_Device_Data_Is_Modified
Delete_Device_Data
[Documentation] Send a request to delete the sample test data on the device and check that the request went OK.
- NetconfViaRestconf.Activate_NVR_Session ${NODE_SETTER}
${template_as_string}= BuiltIn.Set_Variable {'DEVICE_NAME': '${DEVICE_NAME}'}
- NetconfViaRestconf.Delete_Xml_Template_Folder_Via_Restconf ${directory_with_template_folders}${/}datamod1 ${template_as_string}
+ TemplatedRequests.Delete_Templated ${directory_with_template_folders}${/}datamod1 ${template_as_string} session=${NODE_SETTER}
[Teardown] Utils.Report_Failure_Due_To_Bug 4968
Check_Device_Data_Is_Deleted
[Documentation] Make request to deconfigure the device on Netconf connector.
[Tags] critical
[Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
- NetconfViaRestconf.Activate_NVR_Session ${NODE_CONFIGURER}
- NetconfKeywords.Remove_Device_From_Netconf ${DEVICE_NAME}
+ NetconfKeywords.Remove_Device_From_Netconf ${DEVICE_NAME} session=${NODE_CONFIGURER}
Check_Device_Deconfigured_On_Configurer
[Documentation] Check that the device is really going to be gone. Fail if still there after one minute.
... data once completed. This test makes sure this asynchronous operation does not take
... unreasonable amount of time.
[Tags] critical
- NetconfViaRestconf.Activate_NVR_Session ${NODE_CONFIGURER}
- NetconfKeywords.Wait_Device_Fully_Removed ${DEVICE_NAME}
+ NetconfKeywords.Wait_Device_Fully_Removed ${DEVICE_NAME} session=${NODE_CONFIGURER}
Check_Device_Deconfigured_On_Checker
[Documentation] Check that the device is going to be gone from the checker node. Fail if still there after one minute.
[Tags] critical
- NetconfViaRestconf.Activate_NVR_Session ${NODE_CHECKER}
- NetconfKeywords.Wait_Device_Fully_Removed ${DEVICE_NAME}
+ NetconfKeywords.Wait_Device_Fully_Removed ${DEVICE_NAME} session=${NODE_CHECKER}
Check_Device_Deconfigured_On_Setter
[Documentation] Check that the device is going to be gone from the setter node. Fail if still there after one minute.
[Tags] critical
- NetconfViaRestconf.Activate_NVR_Session ${NODE_SETTER}
- NetconfKeywords.Wait_Device_Fully_Removed ${DEVICE_NAME}
+ NetconfKeywords.Wait_Device_Fully_Removed ${DEVICE_NAME} session=${NODE_SETTER}
*** Keywords ***
Setup_Everything
[Documentation] Setup everything needed for the test cases.
# Setup resources used by the suite.
SetupUtils.Setup_Utils_For_Setup_And_Teardown
- NetconfKeywords.Setup_Netconf_Keywords
- NetconfViaRestconf.Create_NVR_Session node1 ${ODL_SYSTEM_1_IP}
- NetconfViaRestconf.Create_NVR_Session node2 ${ODL_SYSTEM_2_IP}
- NetconfViaRestconf.Create_NVR_Session node3 ${ODL_SYSTEM_3_IP}
+ NetconfKeywords.Setup_Netconf_Keywords create_session_for_templated_requests=False
+ RequestsLibrary.Create_Session node1 http://${ODL_SYSTEM_1_IP}:${RESTCONFPORT} headers=${HEADERS_XML} auth=${AUTH}
+ RequestsLibrary.Create_Session node2 http://${ODL_SYSTEM_2_IP}:${RESTCONFPORT} headers=${HEADERS_XML} auth=${AUTH}
+ RequestsLibrary.Create_Session node3 http://${ODL_SYSTEM_3_IP}:${RESTCONFPORT} headers=${HEADERS_XML} auth=${AUTH}
Teardown_Everything
[Documentation] Teardown the test infrastructure, perform cleanup and release all resources.
- Teardown_Netconf_Via_Restconf
RequestsLibrary.Delete_All_Sessions
NetconfKeywords.Stop_Testtool
Check_Device_Instance_Count
- [Arguments] ${expected}
- ${count} NetconfKeywords.Count_Netconf_Connectors_For_Device ${DEVICE_NAME}
+ [Arguments] ${expected} ${session}
+ ${count} NetconfKeywords.Count_Netconf_Connectors_For_Device ${DEVICE_NAME} session=${session}
Builtin.Should_Be_Equal_As_Strings ${count} ${expected}
Check_Config_Data
[Arguments] ${node} ${expected} ${contains}=False
- NetconfViaRestconf.Activate_NVR_Session ${node}
- ${url}= Builtin.Set_Variable network-topology:network-topology/topology/topology-netconf/node/${DEVICE_NAME}/yang-ext:mount
- ${data}= NetconfViaRestconf.Get_Config_Data_From_URI ${url} headers=${ACCEPT_XML}
+ ${url}= Builtin.Set_Variable ${CONFIG_API}/network-topology:network-topology/topology/topology-netconf/node/${DEVICE_NAME}/yang-ext:mount
+ ${data}= TemplatedRequests.Get_As_Xml_From_Uri ${url} session=${node}
BuiltIn.Run_Keyword_Unless ${contains} BuiltIn.Should_Be_Equal_As_Strings ${data} ${expected}
BuiltIn.Run_Keyword_If ${contains} BuiltIn.Should_Contain ${data} ${expected}
Library OperatingSystem
Library SSHLibrary timeout=10s
Resource ${CURDIR}/../../../libraries/NetconfKeywords.robot
-Resource ${CURDIR}/../../../libraries/NetconfViaRestconf.robot
Resource ${CURDIR}/../../../libraries/NexusKeywords.robot
Resource ${CURDIR}/../../../libraries/RestPerfClient.robot
Resource ${CURDIR}/../../../libraries/SetupUtils.robot
+Resource ${CURDIR}/../../../libraries/TemplatedRequests.robot
Resource ${CURDIR}/../../../libraries/Utils.robot
Variables ${CURDIR}/../../../variables/Variables.py
*** Test Cases ***
Create_Test_Data_For_Direct_Access
[Documentation] Send some sample test data into the device and check that the request went OK.
- NetconfViaRestconf.Post_Xml_Template_Folder_Via_Restconf ${DIRECTORY_WITH_TEMPLATE_FOLDERS}${/}cars {}
+ TemplatedRequests.Post_As_Xml_Templated ${DIRECTORY_WITH_TEMPLATE_FOLDERS}${/}cars {}
Run_RestPerfClient_Directly_On_MDSAL
[Documentation] Deploy and execute restperfclient, asking it to send the specified amount of requests to the MDSAL via Restconf.
[Documentation] Cleanup the test data produced by the direct MDSAL access.
[Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
RestPerfClient.Collect_From_Restperfclient
- NetconfViaRestconf.Delete_Xml_Template_Folder_Via_Restconf ${DIRECTORY_WITH_TEMPLATE_FOLDERS}${/}cars-delete {}
+ TemplatedRequests.Delete_Templated ${DIRECTORY_WITH_TEMPLATE_FOLDERS}${/}cars-delete {}
Create_Test_Data_For_Connector_Access
[Documentation] Create the test data container again so it is ready for the netconf connector test.
[Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
- NetconfViaRestconf.Post_Xml_Template_Folder_Via_Restconf ${DIRECTORY_WITH_TEMPLATE_FOLDERS}${/}cars {}
+ TemplatedRequests.Post_As_Xml_Templated ${DIRECTORY_WITH_TEMPLATE_FOLDERS}${/}cars {}
Configure_ODL_As_A_Device_On_Netconf
[Documentation] Configure ODL MDSAL Northbound as a Netconf device on a Netconf connector.
[Documentation] Delete the test data produced by the Netconf connector MDSAL access.
[Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
RestPerfClient.Collect_From_Restperfclient
- NetconfViaRestconf.Delete_Xml_Template_Folder_Via_Restconf ${DIRECTORY_WITH_TEMPLATE_FOLDERS}${/}cars-delete {}
+ TemplatedRequests.Delete_Templated ${DIRECTORY_WITH_TEMPLATE_FOLDERS}${/}cars-delete {}
*** Keywords ***
Setup_Everything
Teardown_Everything
[Documentation] Teardown the test infrastructure, perform cleanup and release all resources.
- Teardown_Netconf_Via_Restconf
RequestsLibrary.Delete_All_Sessions
RestPerfClient.Teardown_Restperfclient
Library SSHLibrary timeout=10s
Resource ${CURDIR}/../../../libraries/KarafKeywords.robot
Resource ${CURDIR}/../../../libraries/NetconfKeywords.robot
-Resource ${CURDIR}/../../../libraries/NetconfViaRestconf.robot
Resource ${CURDIR}/../../../libraries/NexusKeywords.robot
Resource ${CURDIR}/../../../libraries/RestPerfClient.robot
Resource ${CURDIR}/../../../libraries/SetupUtils.robot
+Resource ${CURDIR}/../../../libraries/TemplatedRequests.robot
Resource ${CURDIR}/../../../libraries/Utils.robot
Variables ${CURDIR}/../../../variables/Variables.py
Create_Device_Data
[Documentation] Send some sample test data into the device and check that the request went OK.
${template_as_string}= BuiltIn.Set_Variable {'DEVICE_NAME': '${DEVICE_NAME}'}
- NetconfViaRestconf.Post_Xml_Template_Folder_Via_Restconf ${directory_with_crud_templates}${/}cars ${template_as_string}
+ TemplatedRequests.Post_As_Xml_Templated ${directory_with_crud_templates}${/}cars ${template_as_string}
Run_Restperfclient
[Documentation] Deploy and execute restperfclient, asking it to send the specified amount of requests to the netconf connector of the device.
Teardown_Everything
[Documentation] Teardown the test infrastructure, perform cleanup and release all resources.
- Teardown_Netconf_Via_Restconf
RequestsLibrary.Delete_All_Sessions
RestPerfClient.Teardown_Restperfclient
SSHLibrary.Switch_Connection ${testtool}
Teardown_Everything
[Documentation] Teardown the test infrastructure, perform cleanup and release all resources.
- Teardown_Netconf_Via_Restconf
RequestsLibrary.Delete_All_Sessions
NetconfKeywords.Stop_Testtool
Teardown_Everything
[Documentation] Teardown the test infrastructure, perform cleanup and release all resources.
- Teardown_Netconf_Via_Restconf
RequestsLibrary.Delete_All_Sessions
NetconfKeywords.Stop_Testtool
+++ /dev/null
-network-topology:network-topology/topology/topology-netconf/node/$DEVICE_NAME/yang-ext:mount
--- /dev/null
+restconf/config/network-topology:network-topology/topology/topology-netconf/node/$DEVICE_NAME/yang-ext:mount
+++ /dev/null
-network-topology:network-topology/topology/topology-netconf/node/$DEVICE_NAME/yang-ext:mount/test:cont
--- /dev/null
+restconf/config/network-topology:network-topology/topology/topology-netconf/node/$DEVICE_NAME/yang-ext:mount/test:cont
+++ /dev/null
-network-topology:network-topology/topology/topology-netconf/node/$DEVICE_NAME/yang-ext:mount/test:cont
--- /dev/null
+restconf/config/network-topology:network-topology/topology/topology-netconf/node/$DEVICE_NAME/yang-ext:mount/test:cont
+++ /dev/null
-network-topology:network-topology/topology/topology-netconf/node/$DEVICE_NAME/yang-ext:mount/test:cont
--- /dev/null
+restconf/config/network-topology:network-topology/topology/topology-netconf/node/$DEVICE_NAME/yang-ext:mount/test:cont
+++ /dev/null
-network-topology:network-topology/topology/topology-netconf/node/$DEVICE_NAME/yang-ext:mount/test:cont
--- /dev/null
+restconf/config/network-topology:network-topology/topology/topology-netconf/node/$DEVICE_NAME/yang-ext:mount/test:cont
+++ /dev/null
-network-topology:network-topology/topology/topology-netconf/node/$DEVICE_NAME/yang-ext:mount
--- /dev/null
+restconf/config/network-topology:network-topology/topology/topology-netconf/node/$DEVICE_NAME/yang-ext:mount
+++ /dev/null
-network-topology:network-topology/topology/topology-netconf/node/$DEVICE_NAME/yang-ext:mount/car:cars
--- /dev/null
+restconf/config/network-topology:network-topology/topology/topology-netconf/node/$DEVICE_NAME/yang-ext:mount/car:cars
+++ /dev/null
-network-topology:network-topology/topology/topology-netconf/node/$DEVICE_NAME/yang-ext:mount/car:cars
--- /dev/null
+restconf/config/network-topology:network-topology/topology/topology-netconf/node/$DEVICE_NAME/yang-ext:mount/car:cars
--- /dev/null
+restconf/config/car:cars
--- /dev/null
+restconf/config
+++ /dev/null
-network-topology:network-topology/topology/topology-netconf/node/$DEVICE_NAME
--- /dev/null
+restconf/config/network-topology:network-topology/topology/topology-netconf/node/$DEVICE_NAME
+++ /dev/null
-network-topology:network-topology/topology/topology-netconf/node/controller-config/yang-ext:mount/config:modules/module/odl-sal-netconf-connector-cfg:sal-netconf-connector/$DEVICE_NAME
--- /dev/null
+restconf/config/network-topology:network-topology/topology/topology-netconf/node/controller-config/yang-ext:mount/config:modules/module/odl-sal-netconf-connector-cfg:sal-netconf-connector/$DEVICE_NAME