@Override
  public List<CiscoVnmcControllerVO> listCiscoVnmcResources(ListCiscoVnmcResourcesCmd cmd) {
    Long physicalNetworkId = cmd.getPhysicalNetworkId();
    Long ciscoVnmcResourceId = cmd.getCiscoVnmcResourceId();
    List<CiscoVnmcControllerVO> responseList = new ArrayList<CiscoVnmcControllerVO>();

    if (physicalNetworkId == null && ciscoVnmcResourceId == null) {
      throw new InvalidParameterValueException(
          "Either physical network Id or vnmc device Id must be specified");
    }

    if (ciscoVnmcResourceId != null) {
      CiscoVnmcControllerVO ciscoVnmcResource = _ciscoVnmcDao.findById(ciscoVnmcResourceId);
      if (ciscoVnmcResource == null) {
        throw new InvalidParameterValueException(
            "Could not find Cisco Vnmc device with id: " + ciscoVnmcResource);
      }
      responseList.add(ciscoVnmcResource);
    } else {
      PhysicalNetworkVO physicalNetwork = _physicalNetworkDao.findById(physicalNetworkId);
      if (physicalNetwork == null) {
        throw new InvalidParameterValueException(
            "Could not find a physical network with id: " + physicalNetworkId);
      }
      responseList = _ciscoVnmcDao.listByPhysicalNetwork(physicalNetworkId);
    }

    return responseList;
  }
  @Override
  public boolean deleteCiscoVnmcResource(DeleteCiscoVnmcResourceCmd cmd) {
    Long vnmcResourceId = cmd.getCiscoVnmcResourceId();
    CiscoVnmcControllerVO vnmcResource = _ciscoVnmcDao.findById(vnmcResourceId);
    if (vnmcResource == null) {
      throw new InvalidParameterValueException(
          "Could not find a Cisco VNMC appliance with id " + vnmcResourceId);
    }

    // Check if there any ASA 1000v appliances
    Long physicalNetworkId = vnmcResource.getPhysicalNetworkId();
    PhysicalNetworkVO physicalNetwork = _physicalNetworkDao.findById(physicalNetworkId);
    if (physicalNetwork != null) {
      List<CiscoAsa1000vDeviceVO> responseList =
          _ciscoAsa1000vDao.listByPhysicalNetwork(physicalNetworkId);
      if (responseList.size() > 0) {
        throw new CloudRuntimeException(
            "Cisco VNMC appliance with id "
                + vnmcResourceId
                + " cannot be deleted as there Cisco ASA 1000v appliances using it");
      }
    }

    HostVO vnmcHost = _hostDao.findById(vnmcResource.getHostId());
    Long hostId = vnmcHost.getId();
    vnmcHost.setResourceState(ResourceState.Maintenance);
    _hostDao.update(hostId, vnmcHost);
    _resourceMgr.deleteHost(hostId, false, false);
    _ciscoVnmcDao.remove(vnmcResourceId);

    return true;
  }