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] ${directory} ${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/${directory}
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 ${filename}= BuiltIn.Set_Variable ${name_prefix}${namepart}${name_suffix}
44 BuiltIn.Log ${filename}
45 ${response}= SSHLibrary.Execute_Command wget -q -N ${urlbase}/${version}/${filename} 2>&1
46 BuiltIn.Log ${response}
50 [Arguments] ${name} ${suffix}=executable ${type}=snapshot
51 [Documentation] Deploy a test tool.
52 ... The test tools have naming convention of the form
53 ... "${type}/some/dir/somewhere/<tool-name>/<tool-name>-<version-tag>-${suffix}.jar"
54 ... where "<tool-name>" is the name of the tool and "<version-tag>" is
55 ... the version tag that is digged out of the maven metadata. This
56 ... keyword calculates ${name_prefix} and ${name_suffix} for
57 ... "Deploy_Artifact" and then calls "Deploy_Artifact" to do the real
58 ... work of deploying the artifact.
59 ${name_part}= BuiltIn.Evaluate '${name}'.split("/").pop()
60 ${name_prefix}= BuiltIn.Set_Variable ${name_part}-
61 ${name_suffix}= BuiltIn.Set_Variable -${suffix}.jar
62 ${filename}= Deploy_Artifact ${name} ${name_prefix} ${name_suffix} ${type}