+////////////////////////////////////////////////////////////////////////////////////////
+// Helper Functions
+////////////////////////////////////////////////////////////////////////////////////////
+void run_robot_systest(String tagName,
+ String testName,
+ String osmHostname,
+ String prometheusHostname,
+ Integer prometheusPort=null,
+ String envfile=null,
+ String portmappingfile=null,
+ String kubeconfig=null,
+ String clouds=null,
+ String hostfile=null,
+ String jujuPassword=null,
+ String osmRSAfile=null,
+ String passThreshold='0.0',
+ String unstableThreshold='0.0') {
+ tempdir = sh(returnStdout: true, script: 'mktemp -d').trim()
+ String environmentFile = ''
+ if (envfile) {
+ environmentFile = envfile
+ } else {
+ sh(script: "touch ${tempdir}/env")
+ environmentFile = "${tempdir}/env"
+ }
+ PROMETHEUS_PORT_VAR = ''
+ if (prometheusPort != null) {
+ PROMETHEUS_PORT_VAR = "--env PROMETHEUS_PORT=${prometheusPort}"
+ }
+ hostfilemount = ''
+ if (hostfile) {
+ hostfilemount = "-v ${hostfile}:/etc/hosts"
+ }
+
+ JUJU_PASSWORD_VAR = ''
+ if (jujuPassword != null) {
+ JUJU_PASSWORD_VAR = "--env JUJU_PASSWORD=${jujuPassword}"
+ }
+
+ try {
+ sh("""docker run --env OSM_HOSTNAME=${osmHostname} --env PROMETHEUS_HOSTNAME=${prometheusHostname} \
+ ${PROMETHEUS_PORT_VAR} ${JUJU_PASSWORD_VAR} --env-file ${environmentFile} \
+ -v ${clouds}:/etc/openstack/clouds.yaml \
+ -v ${osmRSAfile}:/root/osm_id_rsa -v ${kubeconfig}:/root/.kube/config -v ${tempdir}:/robot-systest/reports \
+ -v ${portmappingfile}:/root/port-mapping.yaml ${hostfilemount} opensourcemano/tests:${tagName} \
+ -c -t ${testName}""")
+ } finally {
+ sh("cp ${tempdir}/*.xml .")
+ sh("cp ${tempdir}/*.html .")
+ outputDirectory = sh(returnStdout: true, script: 'pwd').trim()
+ println("Present Directory is : ${outputDirectory}")
+ step([
+ $class : 'RobotPublisher',
+ outputPath : "${outputDirectory}",
+ outputFileName : '*.xml',
+ disableArchiveOutput : false,
+ reportFileName : 'report.html',
+ logFileName : 'log.html',
+ passThreshold : passThreshold,
+ unstableThreshold: unstableThreshold,
+ otherFiles : '*.png',
+ ])
+ }