Introduction

Nexus repository access keywords, and supporting Java and Maven handling.

Copyright (c) 2015,2016 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 Nexus operations into reusable keywords to make writing test suites easier.

Currently, Java version detection is incorporated so that Java tools can be run reliably. Also, suport for installing and running Maven is added, as that needs the Java detection. TODO: Move Java detection and Maven to a separate Resource, or rename this Resource.

Keywords

Arguments

openjdk
= ${JDKVERSION}

Documentation

Return string suitable for launching Java programs over SSHLibrary, depending on JRE version needed. This requires that the SSH connection on which the command is going to be used is active as it is needed for querying files. Commands composed for one SSH connection shall not be reused on other SSH connections as the two connections may have different Java setups. Not directly related to Nexus, but versioned Java tools may need this.

Arguments

default_path specific_path

Documentation

Query active SSH connection, return specific path if it exists else default path.

Arguments

options openjdk
= ${JDKVERSION}

Documentation

Return full Bash command to run Java with given options. This requires that the SSH connection on which the command is going to be used is active as it is needed for querying files. The options may include JVM options, application command line arguments, Bash redirects and other constructs.

Arguments

openjdk
= ${JDKVERSION}

Documentation

Compose base java command and strip trailing "/bin/java".

Arguments

component artifact name_prefix
= ${artifact}-
name_suffix
= -executable.jar
fallback_url
= ${NEXUS_FALLBACK_URL}
explicit_url
= ${EMPTY}
build_version
= ${EMPTY}
build_location
= ${EMPTY}

Documentation

Deploy the specified artifact from Nexus to the cwd of the machine to which the active SSHLibrary connection points. ${component} is a name part of an artifact present in system/ of ODl installation with the same version as ${artifact} should have. Must have ${BUNDLE_URL} variable set to the URL from which the tested ODL distribution was downloaded and this place must be inside a repository created by a standard distribution construction job. If this is detected to ne be the case, fallback URL is used. If ${explicit_url} is non-empty, Deploy_From_Utrl is called instead. TODO: Allow deploying to a specific directory, we have SSHKeywords.Execute_Command_At_Cwd_Should_Pass now.

Arguments

url

Documentation

On active SSH conenction execute download ${url} command, log output, check RC and return file name.

Arguments

component artifact suffix
= executable
fallback_url
= ${NEXUS_FALLBACK_URL}
explicit_url
= ${EMPTY}
build_version
= ${EMPTY}
build_location
= ${EMPTY}

Documentation

Deploy a test tool. The test tools have naming convention of the form "<repository_url>/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.

Arguments

stream
= ${ODL_STREAM}

Documentation

Returns name for last release for previous stream of specified stream. Note: If specified stream is not found on nexus, then it is taken as new one (not released yet). So in this case, latest release version is return.

NOTE: the below logic is stripping the initial 0. values from the 0.x.x version string that is the current (and future) version numbering scheme. There is always a leading 0. to the version strings and stripping it makes is easier to do int comparison to find the largest version in the list. Comparing as strings does not work. There are some python libs like distutils.version or packaging that can do a better job comparing versions, but since ODL version numbering is simple at this point, this convention will suffice. The leading 0. will be added back after the the latest version is found from the list. The CompareStream.robot library keeps a mapping of major version numbers to the global variable ${ODL_STREAM} so that is used to ensure we get a major version that is older than the current running major version.

Arguments

stream
= ${ODL_STREAM}
format
= .zip

Documentation

Returns URL for last release for previous stream of specified stream. Default format is .zip.

Documentation

Returns name of last release found on nexus

Arguments

stream
= latest

Documentation

Returns name for last release for specified stream.

Arguments

stream
= latest
format
= .zip

Documentation

Returns URL for last release for specified stream. Default format is .zip.

Documentation

Returns name of last release found on nexus and list of all versions.

Arguments

tools_system_connect
= True

Documentation

Places search utility to ODL system, which will be needed for version detection. By default also initialize a SSH connection to Tools system, as following Keywords assume a working connection towards target system.

Arguments

component artifact suffix
= executable
tool_options
= ${EMPTY}
java_options
= ${EMPTY}
openjdk
= ${JDKVERSION}
fallback_url
= ${NEXUS_FALLBACK_URL}
explicit_url
= ${EMPTY}

Documentation

Deploy the artifact, assign name for log file, figure out java command, write the command to active SSH connection and return the log name. This keyword does not examine whether the artifact was started successfully or whether is still running upon return.

Arguments

maven_version
= 3.3.9
openjdk
= ${JDKVERSION}
branch
= ${EMPTY}
patches
= ${EMPTY}

Documentation

Install Maven. Depending on arguments, perform a multipatch build to populate local Maven repository with patched artifacts.

Arguments

maven_version
= 3.3.9
openjdk
= ${JDKVERSION}

Documentation

Download and unpack Maven, prepare launch command with proper Java version and download settings file. This Keyword requires an active SSH connection to target machine. This Keyword sets global variables, so that suites can reuse existing installation. This Keyword can only place Maven (and settings) to remote current working directory. This Keyword does not perform any initial or final cleanup.

Arguments

component

Documentation

Determine the exact Nexus directory to be used as a source for a particular test tool Figure out what version of the tool needs to be pulled out of the Nexus by looking at the version directory of the subsystem from which the tool is being pulled. This code is REALLY UGLY but there is no way around it until the bug https://bugs.opendaylight.org/show_bug.cgi?id=5206 gets fixed. I also don't want to depend on maven-metadata-local.xml and other bits and pieces of ODL distribution which are not required for ODL to function properly.

Arguments

component

Documentation

Get a list of items that might contain the version number that we are looking for.

&{COMPONENT_MAPPING} is the centralized place to maintain the mapping from a stream independent component nickname to the list of artifact names to search for.

Arguments

pom_file
= pom.xml
log_file
= ${MAVEN_DEFAULT_OUTPUT_FILENAME}

Documentation

Determine arguments to use and call mvn command against given pom file.

NexusKeywords

image/svg+xml