Library DateTime
Library RequestsLibrary
Resource NetconfViaRestconf.robot
+Resource NexusKeywords.robot
Resource SSHKeywords.robot
*** Variables ***
... for the additional schemas is deleted on the remote machine and
... the additional schemas argument is left out.
# Install test tool on the machine.
- # TODO: The "urlbase" line is very similar to what pcep suites do. Reduce this code duplication.
- ${urlbase}= BuiltIn.Set_Variable ${NEXUSURL_PREFIX}/content/repositories/opendaylight.snapshot/org/opendaylight/netconf/netconf-testtool
- ${version}= SSHLibrary.Execute_Command curl ${urlbase}/maven-metadata.xml | grep '<latest>' | cut -d '>' -f 2 | cut -d '<' -f 1
- BuiltIn.Log ${version}
- ${namepart}= SSHLibrary.Execute_Command curl ${urlbase}/${version}/maven-metadata.xml | grep value | head -n 1 | cut -d '>' -f 2 | cut -d '<' -f 1
- BuiltIn.Log ${namepart}
- BuiltIn.Set_Suite_Variable ${filename} netconf-testtool-${namepart}-executable.jar
- BuiltIn.Log ${filename}
- ${response}= SSHLibrary.Execute_Command curl ${urlbase}/${version}/${filename} >${filename}
- BuiltIn.Log ${response}
+ ${filename}= NexusKeywords.Deploy_Test_Tool netconf/netconf-testtool
${schemas_option}= NetconfKeywords__Deploy_Additional_Schemas ${schemas}
# Start the testtool
${command} BuiltIn.Set_Variable java -Xmx1G -XX:MaxPermSize=256M -jar ${filename} ${options} --device-count ${device-count} --debug ${debug} ${schemas_option}
--- /dev/null
+*** Settings ***
+Documentation Nexus repository access keywords.
+...
+... 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
+...
+...
+... This library encapsulates a bunch of somewhat complex and commonly used
+... netconf operations into reusable keywords to make writing netconf
+... test suites easier.
+Library SSHLibrary
+
+*** Keywords ***
+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}
+ BuiltIn.Return_From_Keyword_If '${version}' != '' ${version}
+ ${version}= SSHLibrary.Execute_Command cat metadata.xml | grep '<version>' | sort | tail -n 1 | cut -d '>' -f 2 | cut -d '<' -f 1
+ BuiltIn.Return_From_Keyword_If '${version}' != '' ${version}
+ BuiltIn.Fail Unrecognized metadata format, cannot determine the location of the requested artifact.
+
+Deploy_Artifact
+ [Arguments] ${directory} ${name_prefix} ${name_suffix}=-executable.jar ${type}=snapshot
+ [Documentation] Deploy the specified artifact from Nexus to the cwd of the machine to which the active SSHLibrary connection points.
+ ${urlbase}= BuiltIn.Set_Variable ${NEXUSURL_PREFIX}/content/repositories/opendaylight.${type}/org/opendaylight/${directory}
+ ${response}= SSHLibrary.Execute_Command curl ${urlbase}/maven-metadata.xml >metadata.xml
+ BuiltIn.Log ${response}
+ # TODO: Use RequestsLibrary and String instead of curl and bash utilities?
+ ${version}= NexusKeywords__Get_Version_From_Metadata
+ ${namepart}= SSHLibrary.Execute_Command curl ${urlbase}/${version}/maven-metadata.xml | grep value | head -n 1 | cut -d '>' -f 2 | cut -d '<' -f 1
+ BuiltIn.Log ${namepart}
+ ${filename}= BuiltIn.Set_Variable ${name_prefix}${namepart}${name_suffix}
+ BuiltIn.Log ${filename}
+ ${response}= SSHLibrary.Execute_Command wget -q -N ${urlbase}/${version}/${filename} 2>&1
+ BuiltIn.Log ${response}
+ [Return] ${filename}
+
+Deploy_Test_Tool
+ [Arguments] ${name} ${suffix}=executable ${type}=snapshot
+ [Documentation] Deploy a test tool.
+ ... The test tools have naming convention of the form
+ ... "${type}/some/dir/somewhere/<tool-name>/<tool-name>-<version-tag>-${suffix}.jar"
+ ... where "<tool-name>" is the name of the tool and "<version-tag>" is
+ ... the version tag that is digged out of the maven metadata. This
+ ... keyword calculates ${name_prefix} and ${name_suffix} for
+ ... "Deploy_Artifact" and then calls "Deploy_Artifact" to do the real
+ ... work of deploying the artifact.
+ ${name_part}= BuiltIn.Evaluate '${name}'.split("/").pop()
+ ${name_prefix}= BuiltIn.Set_Variable ${name_part}-
+ ${name_suffix}= BuiltIn.Set_Variable -${suffix}.jar
+ ${filename}= Deploy_Artifact ${name} ${name_prefix} ${name_suffix} ${type}
+ [Return] ${filename}
Library SSHLibrary
Library RequestsLibrary
Library ${CURDIR}/../../../libraries/HsfJson/hsf_json.py
+Resource ${CURDIR}/../../../libraries/NexusKeywords.robot
Resource ${CURDIR}/../../../libraries/PcepOperations.robot
Resource ${CURDIR}/../../../libraries/Utils.robot
Variables ${CURDIR}/../../../variables/Variables.py
Utils.Flexible_Mininet_Login
# FIXME: Unify Module prefix usage across whole file.
Create_Session ses http://${CONTROLLER}:${RESTCONFPORT}/restconf/operational/network-topology:network-topology auth=${AUTH}
- ${urlbase}= Set_Variable ${NEXUSURL_PREFIX}/content/repositories/opendaylight.snapshot/org/opendaylight/bgpcep/pcep-pcc-mock
- ${version}= Execute_Command curl ${urlbase}/maven-metadata.xml | grep latest | cut -d '>' -f 2 | cut -d '<' -f 1
- Log ${version}
- ${namepart}= Execute_Command curl ${urlbase}/${version}/maven-metadata.xml | grep value | head -n 1 | cut -d '>' -f 2 | cut -d '<' -f 1
- Log ${namepart}
- Set_Suite_Variable ${filename} pcep-pcc-mock-${namepart}-executable.jar
- Log ${filename}
- ${response}= Execute_Command wget -q -N ${urlbase}/${version}/${filename} 2>&1
- Log ${response}
+ ${name}= NexusKeywords.Deploy_Test_Tool bgpcep/pcep-pcc-mock
+ BuiltIn.Set_Suite_Variable ${filename} ${name}
Remove_Directory ${ExpDir}
Remove_Directory ${ActDir}
Create_Directory ${ExpDir}
Library ${CURDIR}/../../../libraries/HsfJson/hsf_json.py
Resource ${CURDIR}/../../../libraries/ConfigViaRestconf.robot
Resource ${CURDIR}/../../../libraries/FailFast.robot
+Resource ${CURDIR}/../../../libraries/NexusKeywords.robot
Resource ${CURDIR}/../../../libraries/PcepOperations.robot
Resource ${CURDIR}/../../../libraries/WaitForFailure.robot
Variables ${CURDIR}/../../../variables/Variables.py
BuiltIn.Log ${current_prompt}
BuiltIn.Set_Suite_Variable ${prompt} ${current_prompt}
RequestsLibrary.Create_Session ses http://${CONTROLLER}:${RESTCONFPORT}${OPERATIONAL_TOPO_API} auth=${AUTH}
- # TODO: See corresponding bgpuser TODO.
- ${urlbase}= BuiltIn.Set_Variable ${NEXUSURL_PREFIX}/content/repositories/opendaylight.snapshot/org/opendaylight/bgpcep/pcep-pcc-mock
- ${version}= SSHLibrary.Execute_Command curl ${urlbase}/maven-metadata.xml | grep latest | cut -d '>' -f 2 | cut -d '<' -f 1
- # TODO: Use RequestsLibrary and String instead of curl and bash utilities?
- BuiltIn.Log ${version}
- ${namepart}= SSHLibrary.Execute_Command curl ${urlbase}/${version}/maven-metadata.xml | grep value | head -n 1 | cut -d '>' -f 2 | cut -d '<' -f 1
- BuiltIn.Log ${namepart}
- BuiltIn.Set_Suite_Variable ${filename} pcep-pcc-mock-${namepart}-executable.jar
- BuiltIn.Log ${filename}
- ${response}= SSHLibrary.Execute_Command wget -q -N ${urlbase}/${version}/${filename} 2>&1
- BuiltIn.Log ${response}
+ ${name}= NexusKeywords.Deploy_Test_Tool bgpcep/pcep-pcc-mock
+ BuiltIn.Set_Suite_Variable ${filename} ${name}
OperatingSystem.Remove_Directory ${directory_for_expected_responses} recursive=True
OperatingSystem.Remove_Directory ${directory_for_actual_responses} recursive=True
# The previous suite may have been using the same directories.