Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure integration #118

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,12 @@ private void addLocalDefaultNSRegexSelectionScript(ScriptTask scriptTask) {
}

private String createIAASNodeConfigJson(Task task, Deployment deployment) {
String nodeConfigJson = "{";
ObjectMapper mapper = new ObjectMapper();
String imageId;
switch (deployment.getPaCloud().getCloudProvider()) {
case AWS_EC2:
// imageId
if (WhiteListedInstanceTypesUtils.isHandledHardwareInstanceType(deployment.getNode()
.getNodeCandidate()
.getHardware()
Expand All @@ -255,26 +257,40 @@ private String createIAASNodeConfigJson(Task task, Deployment deployment) {
imageId = deployment.getNode().getNodeCandidate().getLocation().getName() + "/" +
deployment.getNode().getNodeCandidate().getImage().getProviderId();
}
break;
case OPENSTACK:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you delete openstack here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

openstack and default branches are equivalent but ok to re-add the openstack branch

imageId = deployment.getNode().getNodeCandidate().getImage().getProviderId();
nodeConfigJson += "\"image\": \"" + imageId + "\"";
// vmType
nodeConfigJson += ", \"vmType\": \"" +
deployment.getNode().getNodeCandidate().getHardware().getProviderId() + "\"";
break;
case AZURE:
imageId = deployment.getNode().getNodeCandidate().getImage().getId();
// imageId
nodeConfigJson += "\"image\": \"" + deployment.getNode().getNodeCandidate().getImage().getId() + "\"";
// vmSizeType
nodeConfigJson += ", \"vmSizeType\": \"" +
deployment.getNode().getNodeCandidate().getHardware().getProviderId() + "\"";
break;
default:
imageId = deployment.getNode().getNodeCandidate().getImage().getProviderId();
// imageId
nodeConfigJson += "\"image\": \"" + deployment.getNode().getNodeCandidate().getImage().getProviderId() +
"\"";
// vmType
nodeConfigJson += ", \"vmType\": \"" +
deployment.getNode().getNodeCandidate().getHardware().getProviderId() + "\"";
}
String nodeConfigJson = "{\"image\": \"" + imageId + "\", " + "\"vmType\": \"" +
deployment.getNode().getNodeCandidate().getHardware().getProviderId() + "\", " +
"\"nodeTags\": \"" + deployment.getNodeName() + "\"";

// nodeTags
nodeConfigJson += ", \"nodeTags\": \"" + deployment.getNodeName() + "\"";

// portsToOpen
if (task.getPortsToOpen() != null && !task.getPortsToOpen().isEmpty()) {
try {
nodeConfigJson += ", \"portsToOpen\": " + mapper.writeValueAsString(task.getPortsToOpen()) + "\"";
} catch (IOException e) {
LOGGER.error(Arrays.toString(e.getStackTrace()));
}
}

// securityGroups
if (task.getSecurityGroup() != null) {
nodeConfigJson += ", \"securityGroups\": [\"" + task.getSecurityGroup() + "\"]";
}
Expand Down
8 changes: 4 additions & 4 deletions sal-service/src/main/resources/Define_NS_Azure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
<variable name="vmPublicKey" value="" />
<variable name="resourceGroup" value="" />
<variable name="region" value="" />
<variable name="numberOfInstances" value="1" model="PA:Integer" />
<variable name="numberOfNodesPerInstance" value="1" model="PA:Integer" />
<variable name="NS_nVMs" value="0" model="PA:Integer" />
<variable name="NS_nNodesPerVM" value="1" model="PA:Integer" />
<variable name="privateNetworkCIDR" value="" />
<variable name="resourceUsageRefreshFreqInMin" value="30" />
<variable name="rateCardRefreshFreqInMin" value="30" />
Expand Down Expand Up @@ -78,8 +78,8 @@ def infrastructureParameters = [variables.get("clientId"),
variables.get("vmPublicKey"),
variables.get("resourceGroup"),
variables.get("region"),
variables.get("numberOfInstances"),
variables.get("numberOfNodesPerInstance"),
variables.get("NS_nVMs"),
variables.get("NS_nNodesPerVM"),
protocol + "://" + variables.get("rm_host_name") + ":"+ variables.get("pa_port") + "/rest/node.jar", // nodeJarURL
variables.get("privateNetworkCIDR"),
"true", // staticPublicIP
Expand Down
Loading