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