use of com.cloud.legacymodel.network.vpc.Vpc in project cosmic by MissionCriticalCloud.
the class CommandSetupHelper method configureSyslog.
private void configureSyslog(final VirtualRouter router, final NetworkOverviewTO networkOverviewTO) {
final Vpc vpc = _vpcDao.findById(router.getVpcId());
if (StringUtils.isNotBlank(vpc.getSyslogServerList())) {
final NetworkOverviewTO.SyslogTO syslogTO = new NetworkOverviewTO.SyslogTO();
syslogTO.setServers(vpc.getSyslogServerList().split(","));
networkOverviewTO.setSyslog(syslogTO);
}
}
use of com.cloud.legacymodel.network.vpc.Vpc in project cosmic by MissionCriticalCloud.
the class CommandSetupHelper method configureRemoteAccessVpn.
private void configureRemoteAccessVpn(final VirtualRouter router, final RemoteAccessVpn remoteAccessVpnToExclude, final NetworkOverviewTO.VPNTO vpnTO) {
final RemoteAccessVpnVO vpn = _remoteAccessVpnDao.findByAccountAndVpc(router.getAccountId(), router.getVpcId());
if (vpn != null && !vpn.equals(remoteAccessVpnToExclude)) {
final NetworkOverviewTO.VPNTO.RemoteAccessTO remoteAccessTO = new NetworkOverviewTO.VPNTO.RemoteAccessTO();
final IpAddress serverIp = _networkModel.getIp(vpn.getServerAddressId());
remoteAccessTO.setVpnServerIp(serverIp.getAddress().addr());
remoteAccessTO.setPreSharedKey(vpn.getIpsecPresharedKey());
remoteAccessTO.setIpRange(vpn.getIpRange());
remoteAccessTO.setLocalIp(vpn.getLocalIp());
final Vpc vpc = _vpcDao.findById(vpn.getVpcId());
remoteAccessTO.setLocalCidr(vpc.getCidr());
remoteAccessTO.setVpnUsers(_vpnUsersDao.listByAccount(vpn.getAccountId()).stream().filter(vpnUser -> VpnUser.State.Add.equals(vpnUser.getState()) || VpnUser.State.Active.equals(vpnUser.getState())).map(vpnUser -> new NetworkOverviewTO.VPNTO.RemoteAccessTO.VPNUserTO(vpnUser.getUsername(), vpnUser.getPassword())).toArray(NetworkOverviewTO.VPNTO.RemoteAccessTO.VPNUserTO[]::new));
vpnTO.setRemoteAccess(remoteAccessTO);
}
}
use of com.cloud.legacymodel.network.vpc.Vpc in project cosmic by MissionCriticalCloud.
the class VpcRouterDeploymentDefinition method lock.
@Override
protected void lock() {
final Vpc vpcLock = vpcDao.acquireInLockTable(vpc.getId());
if (vpcLock == null) {
throw new ConcurrentOperationException("Unable to lock vpc " + vpc.getId());
}
tableLockId = vpcLock.getId();
}
use of com.cloud.legacymodel.network.vpc.Vpc in project cosmic by MissionCriticalCloud.
the class VpcRouterDeploymentDefinition method findOrDeployVirtualRouter.
@Override
protected void findOrDeployVirtualRouter() throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
final Vpc vpc = getVpc();
if (vpc != null) {
// This call will associate any existing router to the "routers" attribute.
// It's needed in order to continue with the VMs deployment.
planDeploymentRouters();
if (routers.size() == MAX_NUMBER_OF_ROUTERS) {
// If we have 2 routers already deployed, do nothing and return.
return;
}
}
super.findOrDeployVirtualRouter();
}
use of com.cloud.legacymodel.network.vpc.Vpc in project cosmic by MissionCriticalCloud.
the class CreateNetworkACLListCmd method getEntityOwnerId.
@Override
public long getEntityOwnerId() {
final Vpc vpc = _entityMgr.findById(Vpc.class, getVpcId());
if (vpc == null) {
throw new InvalidParameterValueException("Invalid vpcId is given");
}
final Account account = _accountService.getAccount(vpc.getAccountId());
return account.getId();
}
Aggregations