Search in sources :

Example 6 with Site2SiteCustomerGatewayVO

use of com.cloud.network.dao.Site2SiteCustomerGatewayVO in project cloudstack by apache.

the class CommandSetupHelper method createSite2SiteVpnCfgCommands.

public void createSite2SiteVpnCfgCommands(final Site2SiteVpnConnection conn, final boolean isCreate, final VirtualRouter router, final Commands cmds) {
    final Site2SiteCustomerGatewayVO gw = _s2sCustomerGatewayDao.findById(conn.getCustomerGatewayId());
    final Site2SiteVpnGatewayVO vpnGw = _s2sVpnGatewayDao.findById(conn.getVpnGatewayId());
    final IpAddress ip = _ipAddressDao.findById(vpnGw.getAddrId());
    final Vpc vpc = _vpcDao.findById(ip.getVpcId());
    final String localPublicIp = ip.getAddress().toString();
    final String localGuestCidr = vpc.getCidr();
    final String localPublicGateway = _vlanDao.findById(ip.getVlanId()).getVlanGateway();
    final String peerGatewayIp = gw.getGatewayIp();
    final String peerGuestCidrList = gw.getGuestCidrList();
    final String ipsecPsk = gw.getIpsecPsk();
    final String ikePolicy = gw.getIkePolicy();
    final String espPolicy = gw.getEspPolicy();
    final Long ikeLifetime = gw.getIkeLifetime();
    final Long espLifetime = gw.getEspLifetime();
    final Boolean dpd = gw.getDpd();
    final Boolean encap = gw.getEncap();
    final Site2SiteVpnCfgCommand cmd = new Site2SiteVpnCfgCommand(isCreate, localPublicIp, localPublicGateway, localGuestCidr, peerGatewayIp, peerGuestCidrList, ikePolicy, espPolicy, ipsecPsk, ikeLifetime, espLifetime, dpd, conn.isPassive(), encap);
    cmd.setAccessDetail(NetworkElementCommand.ROUTER_IP, _routerControlHelper.getRouterControlIp(router.getId()));
    cmd.setAccessDetail(NetworkElementCommand.ROUTER_IP, _routerControlHelper.getRouterControlIp(router.getId()));
    cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName());
    final DataCenterVO dcVo = _dcDao.findById(router.getDataCenterId());
    cmd.setAccessDetail(NetworkElementCommand.ZONE_NETWORK_TYPE, dcVo.getNetworkType().toString());
    cmds.addCommand("applyS2SVpn", cmd);
}
Also used : DataCenterVO(com.cloud.dc.DataCenterVO) Site2SiteVpnCfgCommand(com.cloud.agent.api.routing.Site2SiteVpnCfgCommand) Site2SiteCustomerGatewayVO(com.cloud.network.dao.Site2SiteCustomerGatewayVO) Vpc(com.cloud.network.vpc.Vpc) Site2SiteVpnGatewayVO(com.cloud.network.dao.Site2SiteVpnGatewayVO) PrivateIpAddress(com.cloud.network.vpc.PrivateIpAddress) IpAddress(com.cloud.network.IpAddress) PublicIpAddress(com.cloud.network.PublicIpAddress)

Aggregations

Site2SiteCustomerGatewayVO (com.cloud.network.dao.Site2SiteCustomerGatewayVO)6 Account (com.cloud.user.Account)4 ActionEvent (com.cloud.event.ActionEvent)3 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)3 Site2SiteVpnConnectionVO (com.cloud.network.dao.Site2SiteVpnConnectionVO)2 Site2SiteVpnCfgCommand (com.cloud.agent.api.routing.Site2SiteVpnCfgCommand)1 DataCenterVO (com.cloud.dc.DataCenterVO)1 IpAddress (com.cloud.network.IpAddress)1 PublicIpAddress (com.cloud.network.PublicIpAddress)1 Site2SiteCustomerGateway (com.cloud.network.Site2SiteCustomerGateway)1 Site2SiteVpnConnection (com.cloud.network.Site2SiteVpnConnection)1 Site2SiteVpnGateway (com.cloud.network.Site2SiteVpnGateway)1 Site2SiteVpnGatewayVO (com.cloud.network.dao.Site2SiteVpnGatewayVO)1 PrivateIpAddress (com.cloud.network.vpc.PrivateIpAddress)1 Vpc (com.cloud.network.vpc.Vpc)1 ListProjectResourcesCriteria (com.cloud.projects.Project.ListProjectResourcesCriteria)1 Pair (com.cloud.utils.Pair)1 Ternary (com.cloud.utils.Ternary)1 Filter (com.cloud.utils.db.Filter)1 ArrayList (java.util.ArrayList)1