Search in sources :

Example 11 with UpdateNetworkOverviewCommand

use of com.cloud.agent.api.UpdateNetworkOverviewCommand in project cosmic by MissionCriticalCloud.

the class VpcVirtualNetworkApplianceManagerImpl method refreshSite2SiteVpn.

@Override
public boolean refreshSite2SiteVpn(final Site2SiteVpnConnection conn, final VirtualRouter router) throws ResourceUnavailableException {
    if (router.getState() != State.Running) {
        s_logger.warn("Unable to apply site-to-site VPN configuration, virtual router is not in the right state " + router.getState());
        throw new ResourceUnavailableException("Unable to apply site-to-site VPN configuration," + " virtual router is not in the right state", DataCenter.class, router.getDataCenterId());
    }
    final Commands cmds = new Commands(Command.OnError.Continue);
    final NetworkOverviewTO networkOverview = _commandSetupHelper.createNetworkOverviewFromRouter(router, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), null, null);
    final UpdateNetworkOverviewCommand updateNetworkOverviewCommand = _commandSetupHelper.createUpdateNetworkOverviewCommand(router, networkOverview);
    cmds.addCommand(updateNetworkOverviewCommand);
    return _nwHelper.sendCommandsToRouter(router, cmds);
}
Also used : ResourceUnavailableException(com.cloud.exception.ResourceUnavailableException) Commands(com.cloud.agent.manager.Commands) NetworkOverviewTO(com.cloud.agent.api.to.overviews.NetworkOverviewTO) UpdateNetworkOverviewCommand(com.cloud.agent.api.UpdateNetworkOverviewCommand)

Example 12 with UpdateNetworkOverviewCommand

use of com.cloud.agent.api.UpdateNetworkOverviewCommand in project cosmic by MissionCriticalCloud.

the class AdvancedNetworkVisitor method visit.

@Override
public boolean visit(final AdvancedVpnRules vpnRules) throws ResourceUnavailableException {
    final VirtualRouter router = vpnRules.getRouter();
    final Commands cmds = new Commands(Command.OnError.Continue);
    final NetworkOverviewTO networkOverview = _commandSetupHelper.createNetworkOverviewFromRouter(router, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), null, null);
    final UpdateNetworkOverviewCommand updateNetworkOverviewCommand = _commandSetupHelper.createUpdateNetworkOverviewCommand(router, networkOverview);
    cmds.addCommand(updateNetworkOverviewCommand);
    // results accordingly
    return _networkGeneralHelper.sendCommandsToRouter(router, cmds);
}
Also used : Commands(com.cloud.agent.manager.Commands) NetworkOverviewTO(com.cloud.agent.api.to.overviews.NetworkOverviewTO) UpdateNetworkOverviewCommand(com.cloud.agent.api.UpdateNetworkOverviewCommand) VirtualRouter(com.cloud.network.router.VirtualRouter)

Example 13 with UpdateNetworkOverviewCommand

use of com.cloud.agent.api.UpdateNetworkOverviewCommand in project cosmic by MissionCriticalCloud.

the class CommandSetupHelper method createUpdateNetworkOverviewCommand.

public UpdateNetworkOverviewCommand createUpdateNetworkOverviewCommand(final VirtualRouter router, final NetworkOverviewTO networkOverview) {
    final UpdateNetworkOverviewCommand cmd = new UpdateNetworkOverviewCommand(networkOverview);
    cmd.setAccessDetail(NetworkElementCommand.ROUTER_IP, _routerControlHelper.getRouterControlIp(router.getId()));
    cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName());
    final Zone zone = zoneRepository.findOne(router.getDataCenterId());
    cmd.setAccessDetail(NetworkElementCommand.ZONE_NETWORK_TYPE, zone.getNetworkType().toString());
    return cmd;
}
Also used : Zone(com.cloud.db.model.Zone) UpdateNetworkOverviewCommand(com.cloud.agent.api.UpdateNetworkOverviewCommand)

Aggregations

UpdateNetworkOverviewCommand (com.cloud.agent.api.UpdateNetworkOverviewCommand)13 NetworkOverviewTO (com.cloud.agent.api.to.overviews.NetworkOverviewTO)12 Commands (com.cloud.agent.manager.Commands)11 ResourceUnavailableException (com.cloud.exception.ResourceUnavailableException)8 ConcurrentOperationException (com.cloud.exception.ConcurrentOperationException)5 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)5 ArrayList (java.util.ArrayList)5 ConfigurationException (javax.naming.ConfigurationException)5 DataCenter (com.cloud.dc.DataCenter)4 Network (com.cloud.network.Network)4 VirtualRouter (com.cloud.network.router.VirtualRouter)4 Ip (com.cloud.utils.net.Ip)4 PrivateIpVO (com.cloud.network.vpc.PrivateIpVO)3 PublicIp (com.cloud.network.addr.PublicIp)2 PrivateIpAddress (com.cloud.network.vpc.PrivateIpAddress)2 Nic (com.cloud.vm.Nic)2 NicProfile (com.cloud.vm.NicProfile)2 Answer (com.cloud.agent.api.Answer)1 Command (com.cloud.agent.api.Command)1 NetworkUsageCommand (com.cloud.agent.api.NetworkUsageCommand)1