2 Documentation Nexus repository access keywords.
4 ... Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
6 ... This program and the accompanying materials are made available under the
7 ... terms of the Eclipse Public License v1.0 which accompanies this distribution,
8 ... and is available at http://www.eclipse.org/legal/epl-v10.html
11 ... This library encapsulates a bunch of somewhat complex and commonly used
12 ... netconf operations into reusable keywords to make writing netconf
13 ... test suites easier.
15 Resource SSHKeywords.robot
18 Initialize_Artifact_Deployment_And_Usage
19 [Documentation] Initialize Nexus artifact deployment and usage
20 ... Create and activate a connection to the tools system and perform
21 ... additional configuration to allow the remaining keywords to deploy
22 ... and use artifacts from Nexus on the tools system.
23 SSHKeywords.Open_Connection_To_Tools_System
25 NexusKeywords__Get_Version_From_Metadata
26 ${version}= SSHLibrary.Execute_Command cat metadata.xml | grep latest | cut -d '>' -f 2 | cut -d '<' -f 1
27 BuiltIn.Log ${version}
28 BuiltIn.Return_From_Keyword_If '${version}' != '' ${version}
29 ${version}= SSHLibrary.Execute_Command cat metadata.xml | grep '<version>' | sort | tail -n 1 | cut -d '>' -f 2 | cut -d '<' -f 1
30 BuiltIn.Return_From_Keyword_If '${version}' != '' ${version}
31 BuiltIn.Fail Unrecognized metadata format, cannot determine the location of the requested artifact.
34 [Arguments] ${component} ${artifact} ${name_prefix} ${name_suffix}=-executable.jar ${type}=snapshot
35 [Documentation] Deploy the specified artifact from Nexus to the cwd of the machine to which the active SSHLibrary connection points.
36 ${urlbase}= BuiltIn.Set_Variable ${NEXUSURL_PREFIX}/content/repositories/opendaylight.${type}/org/opendaylight/${component}/${artifact}
37 ${response}= SSHLibrary.Execute_Command curl ${urlbase}/maven-metadata.xml >metadata.xml
38 BuiltIn.Log ${response}
39 # TODO: Use RequestsLibrary and String instead of curl and bash utilities?
40 ${version}= NexusKeywords__Get_Version_From_Metadata
41 ${namepart}= SSHLibrary.Execute_Command curl ${urlbase}/${version}/maven-metadata.xml | grep value | head -n 1 | cut -d '>' -f 2 | cut -d '<' -f 1
42 BuiltIn.Log ${namepart}
43 ${length}= BuiltIn.Get_Length ${namepart}
44 BuiltIn.Run_Keyword_If ${length} == 0 BuiltIn.Fail Artifact "${artifact}" not found in component "${component}"
45 ${filename}= BuiltIn.Set_Variable ${name_prefix}${namepart}${name_suffix}
46 BuiltIn.Log ${filename}
47 ${url}= BuiltIn.Set_Variable ${urlbase}/${version}/${filename}
48 ${response} ${result}= SSHLibrary.Execute_Command wget -q -N ${url} 2>&1 return_rc=True
49 BuiltIn.Log ${response}
50 BuiltIn.Run_Keyword_If ${result} != 0 BuiltIn.Fail Artifact "${artifact}" in component "${component}" could not be downloaded from ${url}
54 [Arguments] ${component} ${artifact} ${suffix}=executable ${type}=snapshot
55 [Documentation] Deploy a test tool.
56 ... The test tools have naming convention of the form
57 ... "${type}/some/dir/somewhere/<tool-name>/<tool-name>-<version-tag>-${suffix}.jar"
58 ... where "<tool-name>" is the name of the tool and "<version-tag>" is
59 ... the version tag that is digged out of the maven metadata. This
60 ... keyword calculates ${name_prefix} and ${name_suffix} for
61 ... "Deploy_Artifact" and then calls "Deploy_Artifact" to do the real
62 ... work of deploying the artifact.
63 ${name_prefix}= BuiltIn.Set_Variable ${artifact}-
64 ${name_suffix}= BuiltIn.Set_Variable -${suffix}.jar
65 ${filename}= Deploy_Artifact ${component} ${artifact} ${name_prefix} ${name_suffix} ${type}