@Override public List<? extends Network> listBrocadeVcsDeviceNetworks(ListBrocadeVcsDeviceNetworksCmd cmd) { Long brocadeDeviceId = cmd.getBrocadeVcsDeviceId(); BrocadeVcsDeviceVO brocadeVcsDevice = _brocadeVcsDao.findById(brocadeDeviceId); if (brocadeVcsDevice == null) { throw new InvalidParameterValueException("Could not find a Brocade VCS Switch with id " + brocadeDeviceId); } // Find the physical network we work for Long physicalNetworkId = brocadeVcsDevice.getPhysicalNetworkId(); PhysicalNetworkVO physicalNetwork = _physicalNetworkDao.findById(physicalNetworkId); if (physicalNetwork == null) { // No such physical network, so no provisioned networks return Collections.emptyList(); } // Find the brocade networks on this physical network List<NetworkVO> networkList = _networkDao.listByPhysicalNetwork(physicalNetworkId); if (networkList == null) { return Collections.emptyList(); } // Networks with broadcast type vcs are ours List<NetworkVO> responseList = new ArrayList<NetworkVO>(); for (NetworkVO network : networkList) { if (network.getBroadcastDomainType() == Networks.BroadcastDomainType.Vcs) { responseList.add(network); } } return responseList; }
@Override public List<? extends Network> listNiciraNvpDeviceNetworks(ListNiciraNvpDeviceNetworksCmd cmd) { Long niciraDeviceId = cmd.getNiciraNvpDeviceId(); NiciraNvpDeviceVO niciraNvpDevice = niciraNvpDao.findById(niciraDeviceId); if (niciraNvpDevice == null) { throw new InvalidParameterValueException("Could not find a nicira device with id " + niciraDeviceId); } // Find the physical network we work for Long physicalNetworkId = niciraNvpDevice.getPhysicalNetworkId(); PhysicalNetworkVO physicalNetwork = physicalNetworkDao.findById(physicalNetworkId); if (physicalNetwork == null) { // No such physical network, so no provisioned networks return Collections.emptyList(); } // Find the nicira networks on this physical network List<NetworkVO> networkList = networkDao.listByPhysicalNetwork(physicalNetworkId); if (networkList == null) { return Collections.emptyList(); } // Networks with broadcast type lswitch are ours List<NetworkVO> responseList = new ArrayList<NetworkVO>(); for (NetworkVO network : networkList) { if (network.getBroadcastDomainType() == Networks.BroadcastDomainType.Lswitch) { responseList.add(network); } } return responseList; }
List<NetworkVO> networks = _networksDao.listByPhysicalNetwork(physicalNetworkId); if (networks != null && !networks.isEmpty()) { for (NetworkVO network : networks) {
List<NetworkVO> networkList = _networkDao.listByPhysicalNetwork(physicalNetworkId); if (networkList != null) {
List<NetworkVO> networkList = networkDao.listByPhysicalNetwork(physicalNetworkId); if (networkList != null) {
@Override public void deleteController(DeleteOpenDaylightControllerCmd cmd) throws InvalidParameterValueException { OpenDaylightControllerVO controller = openDaylightControllerMappingDao.findById(cmd.getId()); if (controller == null) { throw new InvalidParameterValueException("No ODL Controller with id " + cmd.getId()); } // Find the physical network we work for Long physicalNetworkId = controller.getPhysicalNetworkId(); PhysicalNetworkVO physicalNetwork = physicalNetworkDao.findById(physicalNetworkId); if (physicalNetwork != null) { // Lets see if there are networks that use us List<NetworkVO> networkList = networkDao.listByPhysicalNetwork(physicalNetworkId); if (networkList != null) { // Networks with broadcast type lswitch are ours for (NetworkVO network : networkList) { if (network.getBroadcastDomainType() == Networks.BroadcastDomainType.OpenDaylight) { if ((network.getState() != Network.State.Shutdown) && (network.getState() != Network.State.Destroy)) { throw new CloudRuntimeException("This Controller can not be deleted as there are one or more logical networks provisioned by cloudstack."); } } } } } HostVO host = hostDao.findById(controller.getHostId()); Long hostId = host.getId(); host.setResourceState(ResourceState.Maintenance); hostDao.update(hostId, host); resourceManager.deleteHost(hostId, false, false); openDaylightControllerMappingDao.remove(cmd.getId()); }
List<NetworkVO> networkList = _networkDao.listByPhysicalNetwork(physicalNetworkId);