@Override public void shutdown(NetworkProfile profile, NetworkOffering offering) { NetworkVO networkObject = _networkDao.findById(profile.getId()); if (networkObject.getBroadcastDomainType() != BroadcastDomainType.Vxlan || networkObject.getBroadcastUri() == null) { s_logger.warn("BroadcastUri is empty or incorrect for guestnetwork " + networkObject.getDisplayText()); return; } super.shutdown(profile, offering); }
@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; }
@Override public void shutdown(NetworkProfile profile, NetworkOffering offering) { NetworkVO networkObject = networkDao.findById(profile.getId()); if (networkObject.getBroadcastDomainType() != BroadcastDomainType.OpenDaylight || networkObject.getBroadcastUri() == null) { s_logger.warn("BroadcastUri is empty or incorrect for guestnetwork " + networkObject.getDisplayText()); return; } List<OpenDaylightControllerVO> devices = openDaylightControllerMappingDao.listByPhysicalNetwork(networkObject.getPhysicalNetworkId()); if (devices.isEmpty()) { s_logger.error("No Controller on physical network " + networkObject.getPhysicalNetworkId()); return; } OpenDaylightControllerVO controller = devices.get(0); DestroyNetworkCommand cmd = new DestroyNetworkCommand(BroadcastDomainType.getValue(networkObject.getBroadcastUri())); DestroyNetworkAnswer answer = (DestroyNetworkAnswer)agentManager.easySend(controller.getHostId(), cmd); if (answer == null || !answer.getResult()) { s_logger.error("DestroyNetworkCommand failed"); } super.shutdown(profile, offering); }
@Override public void shutdown(NetworkProfile profile, NetworkOffering offering) { NetworkVO networkObject = _networkDao.findById(profile.getId()); if (networkObject.getBroadcastDomainType() != BroadcastDomainType.Vlan || networkObject.getBroadcastUri() == null) { s_logger.warn("BroadcastUri is empty or incorrect for guestnetwork " + networkObject.getDisplayText()); return; } bcfUtilsInit(); // tenantId stored in network domain field at creation String tenantId = networkObject.getNetworkDomain(); String networkId = networkObject.getUuid(); DeleteBcfSegmentCommand cmd = new DeleteBcfSegmentCommand(tenantId, networkId); _bcfUtils.sendBcfCommandWithNetworkSyncCheck(cmd, networkObject); super.shutdown(profile, offering); }
@Override public void shutdown(final NetworkProfile profile, final NetworkOffering offering) { final NetworkVO networkObject = networkDao.findById(profile.getId()); if (networkObject.getBroadcastDomainType() != BroadcastDomainType.Lswitch || networkObject.getBroadcastUri() == null) { s_logger.warn("BroadcastUri is empty or incorrect for guestnetwork " + networkObject.getDisplayText()); return; } final List<NiciraNvpDeviceVO> devices = niciraNvpDao.listByPhysicalNetwork(networkObject.getPhysicalNetworkId()); if (devices.isEmpty()) { s_logger.error("No NiciraNvp Controller on physical network " + networkObject.getPhysicalNetworkId()); return; } final NiciraNvpDeviceVO niciraNvpDevice = devices.get(0); final HostVO niciraNvpHost = hostDao.findById(niciraNvpDevice.getHostId()); String logicalSwitchUuid = BroadcastDomainType.getValue(networkObject.getBroadcastUri()); if (offering.getGuestType().equals(GuestType.Shared)){ sharedNetworksCleanup(networkObject, logicalSwitchUuid, niciraNvpHost); } final DeleteLogicalSwitchCommand cmd = new DeleteLogicalSwitchCommand(logicalSwitchUuid); final DeleteLogicalSwitchAnswer answer = (DeleteLogicalSwitchAnswer) agentMgr.easySend(niciraNvpHost.getId(), cmd); if (answer == null || !answer.getResult()) { s_logger.error("DeleteLogicalSwitchCommand failed"); } super.shutdown(profile, offering); }
@Override public void shutdown(NetworkProfile profile, NetworkOffering offering) { NetworkVO networkObject = _networkDao.findById(profile.getId()); if (networkObject.getBroadcastDomainType() != BroadcastDomainType.Vswitch || networkObject.getBroadcastUri() == null) { s_logger.warn("BroadcastUri is empty or incorrect for guestnetwork " + networkObject.getDisplayText()); return; } if (profile.getBroadcastDomainType() == BroadcastDomainType.Vswitch ) { s_logger.debug("Releasing vnet for the network id=" + profile.getId()); _dcDao.releaseVnet(BroadcastDomainType.getValue(profile.getBroadcastUri()), profile.getDataCenterId(), profile.getPhysicalNetworkId(), profile.getAccountId(), profile.getReservationId()); } profile.setBroadcastUri(null); }
if (network.getBroadcastDomainType() == BroadcastDomainType.Lswitch) {
profile.setIPv4Gateway(publicIp.getGateway()); profile.setMacAddress(publicIp.getMacAddress()); profile.setBroadcastType(network.getBroadcastDomainType()); profile.setTrafficType(network.getTrafficType()); profile.setBroadcastUri(broadcastUri);
if (network.getBroadcastDomainType() == Networks.BroadcastDomainType.Vcs) { if ((network.getState() != Network.State.Shutdown) && (network.getState() != Network.State.Destroy)) { throw new CloudRuntimeException("This Brocade VCS Switch can not be deleted as there are one or more logical networks provisioned by cloudstack.");
if (network.getBroadcastDomainType() == Networks.BroadcastDomainType.Lswitch) { if ((network.getState() != Network.State.Shutdown) && (network.getState() != Network.State.Destroy)) { throw new CloudRuntimeException("This Nicira Nvp device can not be deleted as there are one or more logical networks provisioned by cloudstack.");
@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()); }
if (network.getBroadcastDomainType() == Networks.BroadcastDomainType.Vsp) { if ((network.getState() != Network.State.Shutdown) && (network.getState() != Network.State.Destroy)) { throw new CloudRuntimeException("This Nuage Vsp device can not be deleted as there are one or more logical networks provisioned by Cloudstack.");
protected NicTO toNicTO(final NicVO nic, final NicProfile profile, final NetworkVO config) { final NicTO to = new NicTO(); to.setDeviceId(nic.getDeviceId()); to.setBroadcastType(config.getBroadcastDomainType()); to.setType(config.getTrafficType()); to.setIp(nic.getIPv4Address()); to.setNetmask(nic.getIPv4Netmask()); to.setMac(nic.getMacAddress()); to.setDns1(profile.getIPv4Dns1()); to.setDns2(profile.getIPv4Dns2()); if (nic.getIPv4Gateway() != null) { to.setGateway(nic.getIPv4Gateway()); } else { to.setGateway(config.getGateway()); } if (nic.getVmType() != VirtualMachine.Type.User) { to.setPxeDisable(true); } to.setDefaultNic(nic.isDefaultNic()); to.setBroadcastUri(nic.getBroadcastUri()); to.setIsolationuri(nic.getIsolationUri()); if (profile != null) { to.setDns1(profile.getIPv4Dns1()); to.setDns2(profile.getIPv4Dns2()); } final Integer networkRate = _networkModel.getNetworkRate(config.getId(), null); to.setNetworkRateMbps(networkRate); to.setUuid(config.getUuid()); return to; }
AllFieldsSearch.and("trafficType", AllFieldsSearch.entity().getTrafficType(), Op.EQ); AllFieldsSearch.and("cidr", AllFieldsSearch.entity().getCidr(), Op.EQ); AllFieldsSearch.and("broadcastType", AllFieldsSearch.entity().getBroadcastDomainType(), Op.EQ); AllFieldsSearch.and("offering", AllFieldsSearch.entity().getNetworkOfferingId(), Op.EQ); AllFieldsSearch.and("datacenter", AllFieldsSearch.entity().getDataCenterId(), Op.EQ);