mirror of https://github.com/apache/jclouds.git
Merge branch 'master' of git@github.com:jclouds/jclouds
* 'master' of git@github.com:jclouds/jclouds: fixed nat relationship in cloudstack
This commit is contained in:
commit
f459100c75
|
@ -73,14 +73,13 @@ public interface NATAsyncClient {
|
|||
ListenableFuture<IPForwardingRule> getIPForwardingRule(@QueryParam("id") long id);
|
||||
|
||||
/**
|
||||
* @see NATClient#createIPForwardingRuleForVirtualMachine
|
||||
* @see NATClient#createIPForwardingRule
|
||||
*/
|
||||
@GET
|
||||
@QueryParams(keys = "command", values = "createIpForwardingRule")
|
||||
@Unwrap
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
ListenableFuture<AsyncCreateResponse> createIPForwardingRuleForVirtualMachine(
|
||||
@QueryParam("virtualmachineid") long virtualMachineId, @QueryParam("ipaddressid") long IPAddressId,
|
||||
ListenableFuture<AsyncCreateResponse> createIPForwardingRule(@QueryParam("ipaddressid") long IPAddressId,
|
||||
@QueryParam("protocol") String protocol, @QueryParam("startport") int startPort,
|
||||
CreateIPForwardingRuleOptions... options);
|
||||
|
||||
|
|
|
@ -59,9 +59,6 @@ public interface NATClient {
|
|||
/**
|
||||
* Creates an ip forwarding rule
|
||||
*
|
||||
* @param virtualMachineId
|
||||
* the virtual machine this rule applies to.
|
||||
*
|
||||
* @param IPAddressId
|
||||
* the public IP address id of the forwarding rule, already associated via associateIp
|
||||
* @param protocol
|
||||
|
@ -70,8 +67,8 @@ public interface NATClient {
|
|||
* the start port for the rule
|
||||
* @return response used to track creation
|
||||
*/
|
||||
AsyncCreateResponse createIPForwardingRuleForVirtualMachine(long virtualMachineId, long IPAddressId,
|
||||
String protocol, int startPort, CreateIPForwardingRuleOptions... options);
|
||||
AsyncCreateResponse createIPForwardingRule(long IPAddressId, String protocol, int startPort,
|
||||
CreateIPForwardingRuleOptions... options);
|
||||
|
||||
/**
|
||||
* Deletes an ip forwarding rule
|
||||
|
|
|
@ -63,8 +63,8 @@ public class NATAsyncClientTest extends BaseCloudStackAsyncClientTest<NATAsyncCl
|
|||
|
||||
public void testListIPForwardingRulesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = NATAsyncClient.class.getMethod("listIPForwardingRules", ListIPForwardingRulesOptions[].class);
|
||||
HttpRequest httpRequest = processor.createRequest(method, ListIPForwardingRulesOptions.Builder
|
||||
.virtualMachineId(3));
|
||||
HttpRequest httpRequest = processor.createRequest(method,
|
||||
ListIPForwardingRulesOptions.Builder.virtualMachineId(3));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listIpForwardingRules&virtualmachineid=3 HTTP/1.1");
|
||||
|
@ -98,13 +98,13 @@ public class NATAsyncClientTest extends BaseCloudStackAsyncClientTest<NATAsyncCl
|
|||
|
||||
public void testCreateIPForwardingRuleForVirtualMachine() throws SecurityException, NoSuchMethodException,
|
||||
IOException {
|
||||
Method method = NATAsyncClient.class.getMethod("createIPForwardingRuleForVirtualMachine", long.class, long.class,
|
||||
String.class, int.class, CreateIPForwardingRuleOptions[].class);
|
||||
HttpRequest httpRequest = processor.createRequest(method, 6, 7, "tcp", 22);
|
||||
Method method = NATAsyncClient.class.getMethod("createIPForwardingRule", long.class, String.class, int.class,
|
||||
CreateIPForwardingRuleOptions[].class);
|
||||
HttpRequest httpRequest = processor.createRequest(method, 7, "tcp", 22);
|
||||
|
||||
assertRequestLineEquals(
|
||||
httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=createIpForwardingRule&virtualmachineid=6&protocol=tcp&ipaddressid=7&startport=22 HTTP/1.1");
|
||||
"GET http://localhost:8080/client/api?response=json&command=createIpForwardingRule&ipaddressid=7&startport=22&protocol=tcp HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||
assertPayloadEquals(httpRequest, null, null, false);
|
||||
|
||||
|
@ -118,14 +118,14 @@ public class NATAsyncClientTest extends BaseCloudStackAsyncClientTest<NATAsyncCl
|
|||
|
||||
public void testCreateIPForwardingRuleForVirtualMachineOptions() throws SecurityException, NoSuchMethodException,
|
||||
IOException {
|
||||
Method method = NATAsyncClient.class.getMethod("createIPForwardingRuleForVirtualMachine", long.class, long.class,
|
||||
String.class, int.class, CreateIPForwardingRuleOptions[].class);
|
||||
HttpRequest httpRequest = processor.createRequest(method, 6, 7, "tcp", 22, CreateIPForwardingRuleOptions.Builder
|
||||
.endPort(22));
|
||||
Method method = NATAsyncClient.class.getMethod("createIPForwardingRule", long.class, String.class, int.class,
|
||||
CreateIPForwardingRuleOptions[].class);
|
||||
HttpRequest httpRequest = processor.createRequest(method, 7, "tcp", 22,
|
||||
CreateIPForwardingRuleOptions.Builder.endPort(22));
|
||||
|
||||
assertRequestLineEquals(
|
||||
httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=createIpForwardingRule&virtualmachineid=6&protocol=tcp&ipaddressid=7&startport=22&endport=22 HTTP/1.1");
|
||||
"GET http://localhost:8080/client/api?response=json&command=createIpForwardingRule&ipaddressid=7&startport=22&protocol=tcp&endport=22 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||
assertPayloadEquals(httpRequest, null, null, false);
|
||||
|
||||
|
|
|
@ -64,8 +64,7 @@ public class NATClientLiveTest extends BaseCloudStackClientLiveTest {
|
|||
ip = client.getAddressClient().getPublicIPAddress(ip.getId());
|
||||
assert ip.isStaticNAT();
|
||||
|
||||
AsyncCreateResponse job = client.getNATClient().createIPForwardingRuleForVirtualMachine(vm.getId(), ip.getId(),
|
||||
"tcp", 22);
|
||||
AsyncCreateResponse job = client.getNATClient().createIPForwardingRule(ip.getId(), "tcp", 22);
|
||||
assert jobComplete.apply(job.getJobId());
|
||||
rule = client.getNATClient().getIPForwardingRule(job.getId());
|
||||
assertEquals(rule.getIPAddressId(), ip.getId());
|
||||
|
|
Loading…
Reference in New Issue