Skip to content

Commit

Permalink
imp: add some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksander Gozman committed Feb 20, 2018
1 parent 1312faa commit bab3ce0
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/main/java/org/openbaton/drivers/amazon/AmazonDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,14 @@ public BaseVimInstance refresh(BaseVimInstance vimInstance) throws VimDriverExce
return (BaseVimInstance) amazon;
}

/**
* Waits for instance to go into status "running"
* @param name instance name
* @param vimInstance amazon vim instance
* @return server in status "running"
* @throws VimDriverException
* @throws InterruptedException
*/
private Server waitForInstance(String name, BaseVimInstance vimInstance)
throws VimDriverException, InterruptedException {
int timeOut = Integer.parseInt(properties.getProperty("launchTimeout"));
Expand All @@ -291,6 +299,11 @@ private Server waitForInstance(String name, BaseVimInstance vimInstance)
"Launch Timeout reached, seems that the instance never went into running status");
}

/**
* Associates elastic ips to servers interfaces
* @param client amazon client
* @param server server with iterfaces
*/
private void setupInstanceNetwork(AmazonEC2 client, Server server) {
List<Address> freeAddresses = getUnallocatedAddresses(client);
List<NetworkInterface> instanceInterfaces =
Expand All @@ -312,6 +325,11 @@ private void setupInstanceNetwork(AmazonEC2 client, Server server) {
}
}

/**
* Allocated a number of elastic ips
* @param client amazon client
* @param number number of addresses needed
*/
private void allocateElasticIps(AmazonEC2 client, int number) {
log.info("Allocating " + number + " elastic ips");
AllocateAddressRequest req = new AllocateAddressRequest();
Expand All @@ -320,6 +338,11 @@ private void allocateElasticIps(AmazonEC2 client, int number) {
}
}

/**
* Returns unallocated elastic ip addresses
* @param client
* @return list of elastic ips
*/
private List<Address> getUnallocatedAddresses(AmazonEC2 client) {
DescribeAddressesRequest addReq = new DescribeAddressesRequest();
DescribeAddressesResult re = client.describeAddresses(addReq);
Expand Down

0 comments on commit bab3ce0

Please sign in to comment.