use of com.cloud.network.RemoteAccessVpn in project cloudstack by apache.
the class CreateRemoteAccessVpnCmd method execute.
@Override
public void execute() {
try {
RemoteAccessVpn result = _ravService.startRemoteAccessVpn(publicIpId, getOpenFirewall());
if (result != null) {
RemoteAccessVpnResponse response = _responseGenerator.createRemoteAccessVpnResponse(result);
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create remote access vpn");
}
} catch (ResourceUnavailableException ex) {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
}
}
use of com.cloud.network.RemoteAccessVpn in project cloudstack by apache.
the class ListRemoteAccessVpnsCmd method execute.
@Override
public void execute() {
Pair<List<? extends RemoteAccessVpn>, Integer> vpns = _ravService.searchForRemoteAccessVpns(this);
ListResponse<RemoteAccessVpnResponse> response = new ListResponse<RemoteAccessVpnResponse>();
List<RemoteAccessVpnResponse> vpnResponses = new ArrayList<RemoteAccessVpnResponse>();
if (vpns.first() != null && !vpns.first().isEmpty()) {
for (RemoteAccessVpn vpn : vpns.first()) {
vpnResponses.add(_responseGenerator.createRemoteAccessVpnResponse(vpn));
}
}
response.setResponses(vpnResponses, vpns.second());
response.setResponseName(getCommandName());
setResponseObject(response);
}
use of com.cloud.network.RemoteAccessVpn in project cosmic by MissionCriticalCloud.
the class ListRemoteAccessVpnsCmd method execute.
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
final Pair<List<? extends RemoteAccessVpn>, Integer> vpns = _ravService.searchForRemoteAccessVpns(this);
final ListResponse<RemoteAccessVpnResponse> response = new ListResponse<>();
final List<RemoteAccessVpnResponse> vpnResponses = new ArrayList<>();
if (vpns.first() != null && !vpns.first().isEmpty()) {
for (final RemoteAccessVpn vpn : vpns.first()) {
vpnResponses.add(_responseGenerator.createRemoteAccessVpnResponse(vpn));
}
}
response.setResponses(vpnResponses, vpns.second());
response.setResponseName(getCommandName());
setResponseObject(response);
}
use of com.cloud.network.RemoteAccessVpn in project cosmic by MissionCriticalCloud.
the class UpdateRemoteAccessVpnCmd method execute.
@Override
public void execute() {
final RemoteAccessVpn result = _ravService.updateRemoteAccessVpn(id, this.getCustomId(), getDisplay());
final RemoteAccessVpnResponse response = _responseGenerator.createRemoteAccessVpnResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
use of com.cloud.network.RemoteAccessVpn in project cosmic by MissionCriticalCloud.
the class VpcVirtualRouterElementTest method testApplyVpnUsersException2.
@Test
public void testApplyVpnUsersException2() {
vpcVirtualRouterElement._vpcRouterMgr = _vpcRouterMgr;
final AdvancedNetworkTopology advancedNetworkTopology = Mockito.mock(AdvancedNetworkTopology.class);
final BasicNetworkTopology basicNetworkTopology = Mockito.mock(BasicNetworkTopology.class);
networkTopologyContext.setAdvancedNetworkTopology(advancedNetworkTopology);
networkTopologyContext.setBasicNetworkTopology(basicNetworkTopology);
networkTopologyContext.init();
final RemoteAccessVpn remoteAccessVpn = Mockito.mock(RemoteAccessVpn.class);
final List<VpnUser> users = new ArrayList<>();
final Long vpcId = new Long(1l);
when(remoteAccessVpn.getVpcId()).thenReturn(vpcId);
when(_vpcRouterMgr.getVpcRouters(vpcId)).thenReturn(null);
try {
final String[] results = vpcVirtualRouterElement.applyVpnUsers(remoteAccessVpn, users);
assertNull(results);
} catch (final ResourceUnavailableException e) {
fail(e.getMessage());
}
verify(remoteAccessVpn, times(1)).getVpcId();
}
Aggregations