@Override
  public boolean stopVpn(Network config, RemoteAccessVpn vpn) throws ResourceUnavailableException {
    if (!canHandle(config)) {
      return false;
    }

    return _externalNetworkManager.manageRemoteAccessVpn(false, config, vpn);
  }
  @Override
  public boolean applyPFRules(Network network, List<PortForwardingRule> rules)
      throws ResourceUnavailableException {
    if (!canHandle(network)) {
      return false;
    }

    return _externalNetworkManager.applyFirewallRules(network, rules);
  }
  @Override
  public boolean applyFWRules(Network config, List<? extends FirewallRule> rules)
      throws ResourceUnavailableException {
    if (!canHandle(config)) {
      return false;
    }

    return _externalNetworkManager.applyFirewallRules(config, rules);
  }
  @Override
  public boolean applyIps(Network network, List<? extends PublicIpAddress> ipAddresses)
      throws ResourceUnavailableException {
    if (!canHandle(network)) {
      return false;
    }

    return _externalNetworkManager.applyIps(network, ipAddresses);
  }
 @Override
 public void execute()
     throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException,
         ConcurrentOperationException, ResourceAllocationException {
   try {
     ExternalNetworkDeviceManager nwDeviceMgr;
     ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
     nwDeviceMgr = locator.getManager(ExternalNetworkDeviceManager.class);
     Host device = nwDeviceMgr.addNetworkDevice(this);
     NetworkDeviceResponse response = nwDeviceMgr.getApiResponse(device);
     response.setObjectName("networkdevice");
     response.setResponseName(getCommandName());
     this.setResponseObject(response);
   } catch (InvalidParameterValueException ipve) {
     throw new ServerApiException(BaseCmd.PARAM_ERROR, ipve.getMessage());
   } catch (CloudRuntimeException cre) {
     throw new ServerApiException(BaseCmd.INTERNAL_ERROR, cre.getMessage());
   }
 }
  @Override
  public String[] applyVpnUsers(RemoteAccessVpn vpn, List<? extends VpnUser> users)
      throws ResourceUnavailableException {
    Network config = _networksDao.findById(vpn.getNetworkId());

    if (!canHandle(config)) {
      return null;
    }

    boolean result = _externalNetworkManager.manageRemoteAccessVpnUsers(config, vpn, users);
    String[] results = new String[users.size()];
    for (int i = 0; i < results.length; i++) {
      results[i] = String.valueOf(result);
    }

    return results;
  }
  @Override
  public boolean shutdown(Network network, ReservationContext context, boolean cleanup)
      throws ResourceUnavailableException, ConcurrentOperationException {
    DataCenter zone = _configMgr.getZone(network.getDataCenterId());

    // don't have to implement network is Basic zone
    if (zone.getNetworkType() == NetworkType.Basic) {
      s_logger.debug("Not handling network shutdown in zone of type " + NetworkType.Basic);
      return false;
    }

    if (!canHandle(network)) {
      return false;
    }
    try {
      return _externalNetworkManager.manageGuestNetworkWithExternalFirewall(false, network);
    } catch (InsufficientCapacityException capacityException) {
      // TODO: handle out of capacity exception
      return false;
    }
  }