@Override public PhysicalNetworkServiceProvider getPhysicalNetworkServiceProvider(Long providerId) { return _pNSPDao.findById(providerId); }
public static PhysicalNetworkServiceProviderVO findPhysicalNetworkServiceProviderById(long providerId) { return s_physicalNetworkServiceProviderDao.findById(providerId); }
@Override public VirtualRouterProvider addInternalLoadBalancerElement(long ntwkSvcProviderId) { VirtualRouterProviderVO element = _vrProviderDao.findByNspIdAndType(ntwkSvcProviderId, Type.InternalLbVm); if (element != null) { s_logger.debug("There is already an " + getName() + " with service provider id " + ntwkSvcProviderId); return null; } PhysicalNetworkServiceProvider provider = _pNtwkSvcProviderDao.findById(ntwkSvcProviderId); if (provider == null || !provider.getProviderName().equalsIgnoreCase(getName())) { throw new InvalidParameterValueException("Invalid network service provider is specified"); } element = new VirtualRouterProviderVO(ntwkSvcProviderId, Type.InternalLbVm); element = _vrProviderDao.persist(element); return element; }
public VirtualRouterProvider addNetScalerLoadBalancerElement(long ntwkSvcProviderId) { VirtualRouterProviderVO element = _vrProviderDao.findByNspIdAndType(ntwkSvcProviderId, com.cloud.network.VirtualRouterProvider.Type.NetScalerVm); if (element != null) { s_logger.debug("There is already an " + getName() + " with service provider id " + ntwkSvcProviderId); return element; } PhysicalNetworkServiceProvider provider = _physicalProviderDao.findById(ntwkSvcProviderId); if (provider == null || !provider.getProviderName().equalsIgnoreCase(getName())) { throw new InvalidParameterValueException("Invalid network service provider is specified"); } element = new VirtualRouterProviderVO(ntwkSvcProviderId, com.cloud.network.VirtualRouterProvider.Type.NetScalerVm); element.setEnabled(true); element = _vrProviderDao.persist(element); return element; }
@Override @ActionEvent(eventType = EventTypes.EVENT_SERVICE_PROVIDER_DELETE, eventDescription = "Deleting physical network ServiceProvider", async = true) public boolean deleteNetworkServiceProvider(Long id) throws ConcurrentOperationException, ResourceUnavailableException { PhysicalNetworkServiceProviderVO provider = _pNSPDao.findById(id); if (provider == null) { throw new InvalidParameterValueException("Network Service Provider id=" + id + "doesn't exist in the system"); } // check if there are networks using this provider List<NetworkVO> networks = _networksDao.listByPhysicalNetworkAndProvider(provider.getPhysicalNetworkId(), provider.getProviderName()); if (networks != null && !networks.isEmpty()) { throw new CloudRuntimeException("Provider is not deletable because there are active networks using this provider, please upgrade these networks to new network offerings"); } User callerUser = _accountMgr.getActiveUser(CallContext.current().getCallingUserId()); Account callerAccount = _accountMgr.getActiveAccountById(callerUser.getAccountId()); // shutdown the provider instances ReservationContext context = new ReservationContextImpl(null, null, callerUser, callerAccount); if (s_logger.isDebugEnabled()) { s_logger.debug("Shutting down the service provider id=" + id + " on physical network: " + provider.getPhysicalNetworkId()); } NetworkElement element = _networkModel.getElementImplementingProvider(provider.getProviderName()); if (element == null) { throw new InvalidParameterValueException("Unable to find the Network Element implementing the Service Provider '" + provider.getProviderName() + "'"); } if (element != null && element.shutdownProviderInstances(provider, context)) { provider.setState(PhysicalNetworkServiceProvider.State.Shutdown); } return _pNSPDao.remove(id); }
public PhysicalNetworkServiceProvider updateNetworkServiceProvider(Long id, String stateStr, List<String> enabledServices) { PhysicalNetworkServiceProviderVO provider = _pNSPDao.findById(id); if (provider == null) { throw new InvalidParameterValueException("Network Service Provider id=" + id + "doesn't exist in the system");
@Override public BaremetalPxeResponse getApiResponse(BaremetalPxeVO vo) { BaremetalPxeResponse response = new BaremetalPxeResponse(); response.setId(vo.getUuid()); HostVO host = _hostDao.findById(vo.getHostId()); response.setUrl(host.getPrivateIpAddress()); PhysicalNetworkServiceProviderVO providerVO = _physicalNetworkServiceProviderDao.findById(vo.getNetworkServiceProviderId()); response.setPhysicalNetworkId(providerVO.getUuid()); PhysicalNetworkVO nwVO = _physicalNetworkDao.findById(vo.getPhysicalNetworkId()); response.setPhysicalNetworkId(nwVO.getUuid()); response.setObjectName("baremetalpxeserver"); return response; }
@Override public BaremetalDhcpResponse generateApiResponse(BaremetalDhcpVO vo) { BaremetalDhcpResponse response = new BaremetalDhcpResponse(); response.setDeviceType(vo.getDeviceType()); response.setId(vo.getUuid()); HostVO host = _hostDao.findById(vo.getHostId()); response.setUrl(host.getPrivateIpAddress()); PhysicalNetworkVO nwVO = _physicalNetworkDao.findById(vo.getPhysicalNetworkId()); response.setPhysicalNetworkId(nwVO.getUuid()); PhysicalNetworkServiceProviderVO providerVO = _physicalNetworkServiceProviderDao.findById(vo.getNetworkServiceProviderId()); response.setProviderId(providerVO.getUuid()); response.setObjectName("baremetaldhcp"); return response; }