From c09ce317c106c0f43633cd24787508ed8e7b95cc Mon Sep 17 00:00:00 2001 From: Jozef Behran Date: Wed, 3 Feb 2016 12:14:42 +0100 Subject: [PATCH] Add Nexus artifact deployment initialization keyword Currently this Nexus artifact deployment initialization keyword contains the code to connect to the tools system, which was extracted into a keyword in SSHKeywords. This artifact deployment initialization keyword is then called in all suites that need to deploy test tools so any code that explicitly opens this connection was removed from the suites that need the Nexus artifact deployment facility. For Netconf test suite this setup keyowrd gets called automatically from NetconfKeywords setup keyword so no explicit Nexus keywords initialization is done there. This is a part of working around the bug 5206. Change-Id: If46823d7aba92657b99d050e3098ec7c99895824 Signed-off-by: Jozef Behran --- csit/libraries/NetconfKeywords.robot | 1 + csit/libraries/NexusKeywords.robot | 8 ++++++++ csit/libraries/SSHKeywords.robot | 7 +++++++ csit/suites/bgpcep/pcepuser/pcepuser.robot | 3 +-- csit/suites/bgpcep/tcpmd5user/tcpmd5user.robot | 3 +-- csit/suites/netconf/CRUD/CRUD.robot | 3 --- csit/suites/netconf/clustering/CRUD.robot | 3 --- csit/suites/netconf/scale/getmulti.robot | 5 +---- csit/suites/netconf/scale/getsingle.robot | 3 --- 9 files changed, 19 insertions(+), 17 deletions(-) diff --git a/csit/libraries/NetconfKeywords.robot b/csit/libraries/NetconfKeywords.robot index 3abcb002ef..e420a64215 100644 --- a/csit/libraries/NetconfKeywords.robot +++ b/csit/libraries/NetconfKeywords.robot @@ -33,6 +33,7 @@ Setup_NetconfKeywords ${tmp}= BuiltIn.Create_Dictionary BuiltIn.Set_Suite_Variable ${NetconfKeywords__mounted_device_types} ${tmp} NetconfViaRestconf.Setup_Netconf_Via_Restconf + NexusKeywords.Initialize_Artifact_Deployment_And_Usage Configure_Device_In_Netconf [Arguments] ${device_name} ${device_type}=default ${device_port}=${FIRST_TESTTOOL_PORT} diff --git a/csit/libraries/NexusKeywords.robot b/csit/libraries/NexusKeywords.robot index 6928891a9d..f3fb87cda0 100644 --- a/csit/libraries/NexusKeywords.robot +++ b/csit/libraries/NexusKeywords.robot @@ -12,8 +12,16 @@ Documentation Nexus repository access keywords. ... netconf operations into reusable keywords to make writing netconf ... test suites easier. Library SSHLibrary +Resource SSHKeywords.robot *** Keywords *** +Initialize_Artifact_Deployment_And_Usage + [Documentation] Initialize Nexus artifact deployment and usage + ... Create and activate a connection to the tools system and perform + ... additional configuration to allow the remaining keywords to deploy + ... and use artifacts from Nexus on the tools system. + SSHKeywords.Open_Connection_To_Tools_System + NexusKeywords__Get_Version_From_Metadata ${version}= SSHLibrary.Execute_Command cat metadata.xml | grep latest | cut -d '>' -f 2 | cut -d '<' -f 1 BuiltIn.Log ${version} diff --git a/csit/libraries/SSHKeywords.robot b/csit/libraries/SSHKeywords.robot index 1e772fd6f4..e38cc5f32c 100644 --- a/csit/libraries/SSHKeywords.robot +++ b/csit/libraries/SSHKeywords.robot @@ -13,8 +13,15 @@ Documentation Resource enhancing SSHLibrary with Keywords used in multiple s ... and if the Keywords do not fit into a more specific Resource, ... you can place them here. Library SSHLibrary +Resource ${CURDIR}/Utils.robot *** Keywords *** +Open_Connection_To_Tools_System + [Documentation] Open a connection to the tools system and return its identifier. + ${tools}= SSHLibrary.Open_Connection ${TOOLS_SYSTEM_IP} prompt=${TOOLS_SYSTEM_PROMPT} + Utils.Flexible_Mininet_Login + [Return] ${tools} + Execute_Command_Passes [Arguments] ${command} [Documentation] Execute command via SSH. If RC is nonzero, log everything. Retrun bool string of command success. diff --git a/csit/suites/bgpcep/pcepuser/pcepuser.robot b/csit/suites/bgpcep/pcepuser/pcepuser.robot index 3f7d72c510..20b3d7972b 100644 --- a/csit/suites/bgpcep/pcepuser/pcepuser.robot +++ b/csit/suites/bgpcep/pcepuser/pcepuser.robot @@ -118,8 +118,7 @@ Set_It_Up [Documentation] Create SSH session to Mininet machine, prepare HTTP client session to Controller. ... Figure out latest pcc-mock version and download it from Nexus to Mininet. ... Also, delete and create directories for json diff handling. - SSHLibrary.Open_Connection ${MININET} prompt=${MININET_PROMPT} timeout=${OUTPUT_TIMEOUT} - Utils.Flexible_Mininet_Login + NexusKeywords.Initialize_Artifact_Deployment_And_Usage # FIXME: Unify Module prefix usage across whole file. Create_Session ses http://${CONTROLLER}:${RESTCONFPORT}/restconf/operational/network-topology:network-topology auth=${AUTH} ${name}= NexusKeywords.Deploy_Test_Tool bgpcep/pcep-pcc-mock diff --git a/csit/suites/bgpcep/tcpmd5user/tcpmd5user.robot b/csit/suites/bgpcep/tcpmd5user/tcpmd5user.robot index c53f2df142..6faaf4f6db 100644 --- a/csit/suites/bgpcep/tcpmd5user/tcpmd5user.robot +++ b/csit/suites/bgpcep/tcpmd5user/tcpmd5user.robot @@ -156,8 +156,7 @@ Set_It_Up [Documentation] Create SSH session to Mininet machine, prepare HTTP client session to Controller. ... Figure out latest pcc-mock version and download it from Nexus to Mininet. ... Also, delete and create directories for json diff handling. - SSHLibrary.Open_Connection ${MININET} - SSHLibrary.Login_With_Public_Key ${MININET_USER} ${USER_HOME}/.ssh/${SSH_KEY} any + NexusKeywords.Initialize_Artifact_Deployment_And_Usage ${current_connection}= SSHLibrary.Get_Connection ${current_prompt}= BuiltIn.Set_Variable ${current_connection.prompt} BuiltIn.Log ${current_prompt} diff --git a/csit/suites/netconf/CRUD/CRUD.robot b/csit/suites/netconf/CRUD/CRUD.robot index 7e96a57bd5..87431997c3 100644 --- a/csit/suites/netconf/CRUD/CRUD.robot +++ b/csit/suites/netconf/CRUD/CRUD.robot @@ -120,9 +120,6 @@ Setup_Everything SetupUtils.Setup_Utils_For_Setup_And_Teardown RequestsLibrary.Create_Session operational http://${ODL_SYSTEM_IP}:${RESTCONFPORT}${OPERATIONAL_API} auth=${AUTH} NetconfKeywords.Setup_Netconf_Keywords - # Connect to the Mininet machine - SSHLibrary.Open_Connection ${TOOLS_SYSTEM_IP} prompt=${TOOLS_SYSTEM_PROMPT} - Utils.Flexible_Mininet_Login Teardown_Everything [Documentation] Teardown the test infrastructure, perform cleanup and release all resources. diff --git a/csit/suites/netconf/clustering/CRUD.robot b/csit/suites/netconf/clustering/CRUD.robot index 85d68e0ff6..f29e6f2f84 100644 --- a/csit/suites/netconf/clustering/CRUD.robot +++ b/csit/suites/netconf/clustering/CRUD.robot @@ -210,9 +210,6 @@ Setup_Everything 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} - # Connect to the Mininet machine - SSHLibrary.Open_Connection ${TOOLS_SYSTEM_IP} prompt=${TOOLS_SYSTEM_PROMPT} - Utils.Flexible_Mininet_Login Teardown_Everything [Documentation] Teardown the test infrastructure, perform cleanup and release all resources. diff --git a/csit/suites/netconf/scale/getmulti.robot b/csit/suites/netconf/scale/getmulti.robot index c184713d07..b9eb4f67d9 100644 --- a/csit/suites/netconf/scale/getmulti.robot +++ b/csit/suites/netconf/scale/getmulti.robot @@ -77,10 +77,7 @@ Setup_Everything SSHLibrary.Set_Default_Configuration prompt=${TOOLS_SYSTEM_PROMPT} SetupUtils.Setup_Utils_For_Setup_And_Teardown NetconfKeywords.Setup_Netconf_Keywords - # Connect to the tools machine - SSHLibrary.Open_Connection ${TOOLS_SYSTEM_IP} - Utils.Flexible_Mininet_Login - # Deploy testing tools on it. + # Deploy testing tools. SSHLibrary.Put_File ${CURDIR}/../../../../tools/netconf_tools/getter.py SSHLibrary.Put_File ${CURDIR}/../../../libraries/AuthStandalone.py diff --git a/csit/suites/netconf/scale/getsingle.robot b/csit/suites/netconf/scale/getsingle.robot index a239b500f1..c00425fc6e 100644 --- a/csit/suites/netconf/scale/getsingle.robot +++ b/csit/suites/netconf/scale/getsingle.robot @@ -58,9 +58,6 @@ Setup_Everything SetupUtils.Setup_Utils_For_Setup_And_Teardown NetconfKeywords.Setup_Netconf_Keywords KarafKeywords.Configure_Timeout_For_Karaf_Console 120s - # Connect to the tools machine - SSHLibrary.Open_Connection ${TOOLS_SYSTEM_IP} - Utils.Flexible_Mininet_Login Teardown_Everything [Documentation] Teardown the test infrastructure, perform cleanup and release all resources. -- 2.36.6