Commit b7cf0122 authored by Ali Fahs's avatar Ali Fahs
Browse files

create a token for BYON nodes when NS is defined

parent cea2c203
Pipeline #15050 passed with stage
in 2 minutes and 7 seconds
......@@ -488,7 +488,7 @@ public class PAGateway {
filename = File.separator + "Define_NS_BYON.xml";
variables.put("NS_name", nodeSourceName);
variables.put("pa_protocol", "http");
variables.put("tokens", "ALL");
variables.put("tokens", "BYON_"+byonNode.getJob().getJobId());
variables.put("ssh_username", byonNode.getLoginCredential().getUsername());
variables.put("ssh_password", byonNode.getLoginCredential().getPassword());
/* IMPORTANT: Later we should relay only on the ssh_key. For now all the nodes must have the same login
......@@ -648,7 +648,6 @@ public class PAGateway {
return newByonNode;
/* TODO:
* Avoid duplicate nodes in the database
* Create the NC here
*/
}
......@@ -687,7 +686,6 @@ public class PAGateway {
Validate.notNull(byonIdPerComponent, "The received byonIdPerComponent structure is empty. Nothing to be added.");
EntityManagerHelper.begin();
byonIdPerComponent.forEach((byonNodeId, componentId) -> {
ByonNode byonNode = EntityManagerHelper.find(ByonNode.class, byonNodeId);
Task task = EntityManagerHelper.find(Task.class, componentId);
......@@ -699,7 +697,7 @@ public class PAGateway {
List<ByonNode> byonNodeList = new LinkedList<>();
byonNodeList.add(byonNode);
defineByonNodeSource(byonNodeList, byonNode.getName());
defineByonNodeSource(byonNodeList, "BYON_NS_"+jobId);
LOGGER.info("BYON node source defined.");
newDeployment.setTask(task);
......@@ -718,8 +716,6 @@ public class PAGateway {
return 0;
/*TODO:
* Create node sources per JobID
* Set NodeSource name should be BYON_<JobID>
* Create mapping in the DB between the nodes and the components
* */
}
......
......@@ -3,15 +3,15 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:proactive:jobdescriptor:3.12" xsi:schemaLocation="urn:proactive:jobdescriptor:3.12 http://www.activeeon.com/public_content/schemas/proactive/jobdescriptor/3.12/schedulerjob.xsd" name="Define_NS_BYON.xml" priority="normal" onTaskError="continueJobExecution" maxNumberOfExecution="2" >
<variables>
<variable name="pa_port" value="8080" />
<variable name="NS_name" value="SSH_INFRA" />
<variable name="pa_protocol" value="http" />
<variable name="rm_host_name" value="" model=""/>
<variable name="ssh_username" value="" model=""/>
<variable name="ssh_password" value="" model=""/>
<variable name="ssh_key" value="" />
<variable name="ssh_port" value="22" model=""/>
<variable name="list_of_ips" value="" model=""/>
<variable name="pa_port" value="8080" model="PA:Integer"/>
<variable name="NS_name" value="SSH_INFRA" model="PA:NOT_EMPTY_STRING"/>
<variable name="pa_protocol" value="http" model="PA:NOT_EMPTY_STRING"/>
<variable name="rm_host_name" value="example.com" model="PA:NOT_EMPTY_STRING"/>
<variable name="ssh_username" value="node" model="PA:NOT_EMPTY_STRING"/>
<variable name="ssh_password" value="" model="PA:HIDDEN"/>
<variable name="ssh_key" value="" model="PA:HIDDEN"/>
<variable name="ssh_port" value="22" model="PA:Integer"/>
<variable name="list_of_ips" value="127.0.0.1" model="PA:NOT_EMPTY_STRING"/>
<variable name="tokens" value="" model=""/>
</variables>
<description>
......@@ -51,9 +51,13 @@ def hosts = ""
for (ip in ips) {
hosts = hosts + ip + " 1\n"
}
if (tokens=="") {
tokens="ALL"
}
else {
tokens="tokens="+tokens
}
println "[+] Preparation of NodeSoure " + nodeSourceName
print "(1/4) Connecting to the RM at "+protocol+"://"+host+":"+port+"/ ..."
......@@ -97,10 +101,10 @@ return retCode;
</scriptExecutable>
<metadata>
<positionTop>
508
511
</positionTop>
<positionLeft>
510.5
514.5
</positionLeft>
</metadata>
</task>
......@@ -115,12 +119,12 @@ return retCode;
left:0 !important;
top:0 !important;
width:2726px;
height:3116px;
height:3360px;
}
</style>
</head>
<body>
<div id="workflow-visualization-view"><div id="workflow-visualization" style="position:relative;top:-503px;left:-505.5px"><div class="task _jsPlumb_endpoint_anchor_ ui-draggable" id="jsPlumb_1_13" style="top: 508px; left: 510.5px; z-index: 24;"><a class="task-name" data-toggle="tooltip" data-placement="right" title="The simplest task, ran by a Groovy engine."><img src="images/Groovy.png" width="20px">&nbsp;<span class="name">Create_NodeSource</span></a></div><div class="_jsPlumb_endpoint source-endpoint dependency-source-endpoint connected _jsPlumb_endpoint_anchor_ ui-draggable ui-droppable" style="position: absolute; height: 20px; width: 20px; left: 563px; top: 538px;"><svg style="position:absolute;left:0px;top:0px" width="20" height="20" pointer-events="all" position="absolute" version="1.1" xmlns="http://www.w3.org/1999/xhtml"><circle cx="10" cy="10" r="10" version="1.1" xmlns="http://www.w3.org/1999/xhtml" fill="#666" stroke="none" style=""></circle></svg></div></div></div>
<div id="workflow-visualization-view"><div id="workflow-visualization" style="position:relative;top:-506px;left:-509.5px"><div class="task _jsPlumb_endpoint_anchor_ ui-draggable" id="jsPlumb_1_19" style="top: 511px; left: 514.5px; z-index: 24;"><a class="task-name" data-toggle="tooltip" data-placement="right" title="The simplest task, ran by a Groovy engine."><img src="/studio/images/Groovy.png" width="20px">&nbsp;<span class="name">Create_NodeSource</span></a></div><div class="_jsPlumb_endpoint source-endpoint dependency-source-endpoint connected _jsPlumb_endpoint_anchor_ ui-draggable ui-droppable" style="position: absolute; height: 20px; width: 20px; left: 567px; top: 541px;"><svg style="position:absolute;left:0px;top:0px" width="20" height="20" pointer-events="all" position="absolute" version="1.1" xmlns="http://www.w3.org/1999/xhtml"><circle cx="10" cy="10" r="10" version="1.1" xmlns="http://www.w3.org/1999/xhtml" fill="#666" stroke="none" style=""></circle></svg></div></div></div>
</body>
</html>
]]>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment