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.
17 NexusKeywords__Get_Version_From_Metadata
18 ${version}= SSHLibrary.Execute_Command cat metadata.xml | grep latest | cut -d '>' -f 2 | cut -d '<' -f 1
19 BuiltIn.Log ${version}
20 BuiltIn.Return_From_Keyword_If '${version}' != '' ${version}
21 ${version}= SSHLibrary.Execute_Command cat metadata.xml | grep '<version>' | sort | tail -n 1 | cut -d '>' -f 2 | cut -d '<' -f 1
22 BuiltIn.Return_From_Keyword_If '${version}' != '' ${version}
23 BuiltIn.Fail Unrecognized metadata format, cannot determine the location of the requested artifact.
26 [Arguments] ${directory} ${name_prefix} ${name_suffix}=-executable.jar ${type}=snapshot
27 [Documentation] Deploy the specified artifact from Nexus to the cwd of the machine to which the active SSHLibrary connection points.
28 ${urlbase}= BuiltIn.Set_Variable ${NEXUSURL_PREFIX}/content/repositories/opendaylight.${type}/org/opendaylight/${directory}
29 ${response}= SSHLibrary.Execute_Command curl ${urlbase}/maven-metadata.xml >metadata.xml
30 BuiltIn.Log ${response}
31 # TODO: Use RequestsLibrary and String instead of curl and bash utilities?
32 ${version}= NexusKeywords__Get_Version_From_Metadata
33 ${namepart}= SSHLibrary.Execute_Command curl ${urlbase}/${version}/maven-metadata.xml | grep value | head -n 1 | cut -d '>' -f 2 | cut -d '<' -f 1
34 BuiltIn.Log ${namepart}
35 ${filename}= BuiltIn.Set_Variable ${name_prefix}${namepart}${name_suffix}
36 BuiltIn.Log ${filename}
37 ${response}= SSHLibrary.Execute_Command wget -q -N ${urlbase}/${version}/${filename} 2>&1
38 BuiltIn.Log ${response}
42 [Arguments] ${name} ${suffix}=executable ${type}=snapshot
43 [Documentation] Deploy a test tool.
44 ... The test tools have naming convention of the form
45 ... "${type}/some/dir/somewhere/<tool-name>/<tool-name>-<version-tag>-${suffix}.jar"
46 ... where "<tool-name>" is the name of the tool and "<version-tag>" is
47 ... the version tag that is digged out of the maven metadata. This
48 ... keyword calculates ${name_prefix} and ${name_suffix} for
49 ... "Deploy_Artifact" and then calls "Deploy_Artifact" to do the real
50 ... work of deploying the artifact.
51 ${name_part}= BuiltIn.Evaluate '${name}'.split("/").pop()
52 ${name_prefix}= BuiltIn.Set_Variable ${name_part}-
53 ${name_suffix}= BuiltIn.Set_Variable -${suffix}.jar
54 ${filename}= Deploy_Artifact ${name} ${name_prefix} ${name_suffix} ${type}