97 lines
No EOL
3.1 KiB
Groovy
97 lines
No EOL
3.1 KiB
Groovy
|
|
import java.nio.file.Paths
|
|
import groovy.json.JsonSlurper
|
|
import groovy.json.JsonOutput
|
|
|
|
def SwapHMBTarget(testCoreRoot,profileName,product,NewTarget){
|
|
//To support both the static profile model and dynamic changing of target IP address, jenkins must swap the target Ip address of the file.
|
|
println("Updating ${product} IP for profile ${profileName} to ${NewTarget}.");
|
|
def parser = new JsonSlurper()
|
|
def ProfilePath = "${testCoreRoot}/CoreUtils/machineprofiles/${profileName}.json"
|
|
println("Selected path " + ProfilePath + " HMB IP address too " + NewTarget)
|
|
|
|
JsonData = parser.parse(new File (ProfilePath));
|
|
println(JsonData)
|
|
JsonData[product]["Address"] = NewTarget;
|
|
println(JsonData)
|
|
File Writefile = new File(ProfilePath);
|
|
Writefile.write(JsonOutput.prettyPrint(JsonOutput.toJson(JsonData)));
|
|
println("Updating " + ProfilePath + "Complete")
|
|
return;
|
|
}
|
|
|
|
def LookUpProduct(JenkinsProductKey,variant=""){
|
|
//TODO Unify this with test profiles to avoid repetition and mapping.
|
|
//Translates from Autobuild Product name to test profile HMB entity name.
|
|
def ProductLookup = [
|
|
"HMB-SE-D3000":"HMB_SE_D3000",
|
|
"HMB-SE-S800":"HMB_SE_S800",
|
|
"HMB-FD-HV":[
|
|
"sg600":"HMB_FD_HV",
|
|
"sg1024":"HMB_FD_HV",
|
|
],
|
|
"AHB-KM-1024A": [
|
|
"she":"AHB_KM_1024A",
|
|
"lhg":"AHB_KM_1024A"
|
|
],
|
|
"HMB-SI-1536":"HMB_SI_1536",
|
|
"HMB-KY-M16ST":"HMB_KY_M16ST"
|
|
];
|
|
return ProductLookup[JenkinsProductKey]
|
|
}
|
|
|
|
def LookUpTestArgument(JenkinsProductKey,variant=""){
|
|
//Translates from Autobuild Product name to include filter for tests targetting that product.
|
|
def TestFilters = [
|
|
"HMB-SE-D3000":"--hmbsed3000",
|
|
"HMB-SE-S800":"--hmbses800",
|
|
"HMB-FD-HV":[
|
|
"sg600":"--hmbsg600",
|
|
"sg1024":"hmbsg1024",
|
|
],
|
|
"AHB-KM-1024A": [
|
|
"she":"--hmbkm1024a",
|
|
"lhg":"--hmbkm1024a"
|
|
],
|
|
"HMB-SI-1536":"--hmbsi1536",
|
|
"HMB-KY-M16ST":"--hmbkym16st"
|
|
];
|
|
return TestFilters[JenkinsProductKey]
|
|
}
|
|
|
|
def LookUpTestFilter(JenkinsProductKey,variant=""){
|
|
//Translates from Autobuild Product name to include filter for tests targetting that product.
|
|
def TestFilters = [
|
|
"HMB-SE-D3000":".*d3000",
|
|
"HMB-SE-D3000":".*s800",
|
|
"HMB-FD-HV":[
|
|
"sg600":".*sg600",
|
|
"sg1024":".*sg1024",
|
|
],
|
|
"AHB-KM-1024A": [
|
|
"she":".*km1024a",
|
|
"lhg":".*km1024a"
|
|
],
|
|
"HMB-SI-1536":".*si1536",
|
|
"HMB-KY-M16ST":".*kym16st"
|
|
];
|
|
if (variant == ""){
|
|
return TestFilters[JenkinsProductKey]
|
|
}
|
|
else{
|
|
TestFilters[JenkinsProductKey][variant]
|
|
}
|
|
}
|
|
|
|
def ReverseProduct(TestProductKey){
|
|
//TODO Unify this with test profiles to avoid repetition and mapping.
|
|
//Translates from test profile HMB entity name to Autobuild Product name.
|
|
def ReverseProductLookup = ["HMB_SE_D3000":"HMB-SE-D3000",
|
|
];
|
|
return ReverseProductLookup[JenkinsProductKey]
|
|
}
|
|
|
|
|
|
testprofileutilsutils = this;
|
|
|
|
return this; |