@Test public void testDontRemoveDhcpServiceWhenNotProvided() { final VirtualMachineProfile vm = mock(VirtualMachineProfile.class); final NicVO nic = mock(NicVO.class); final NetworkVO network = mock(NetworkVO.class); when(vm.getType()).thenReturn(VirtualMachineType.User); when(testOrchastrator._networkModel.areServicesSupportedInNetwork(network.getId(), Service.Dhcp)).thenReturn(false); when(network.getGuruName()).thenReturn(guruName); when(testOrchastrator._networksDao.findById(nic.getNetworkId())).thenReturn(network); testOrchastrator.removeNic(vm, nic); verify(nic, times(1)).setState(Nic.State.Deallocating); verify(testOrchastrator._networkModel, never()).getElementImplementingProvider(dhcpProvider); verify(testOrchastrator._ntwkSrvcDao, never()).getProviderForServiceInNetwork(network.getId(), Service.Dhcp); verify(testOrchastrator._networksDao, times(1)).findById(nic.getNetworkId()); }
@Override public void removeNic(final VirtualMachineProfile vm, final Nic nic) { removeNic(vm, _nicDao.findById(nic.getId())); }
NetworkOrchestrator extends ManagerBase implements NetworkOrchestrationService, Listener, Configurable { @Override public void removeNic(final VirtualMachineProfile vm, final Nic nic) { removeNic(vm, _nicDao.findById(nic.getId())); } }
NetworkOrchestrator extends ManagerBase implements NetworkOrchestrationService, Listener, Configurable { @Override public void removeNic(final VirtualMachineProfile vm, final Nic nic) { removeNic(vm, _nicDao.findById(nic.getId())); } protected  NetworkOrchestrator(); }
NetworkOrchestrator extends ManagerBase implements NetworkOrchestrationService, Listener, Configurable { @Override public void removeNic(final VirtualMachineProfile vm, final Nic nic) { removeNic(vm, _nicDao.findById(nic.getId())); } protected  NetworkOrchestrator(); List<NetworkGuru> getNetworkGurus(); void setNetworkGurus(final List<NetworkGuru> networkGurus); List<NetworkElement> getNetworkElements(); void setNetworkElements(final List<NetworkElement> networkElements); List<IpDeployer> getIpDeployers(); void setIpDeployers(final List<IpDeployer> ipDeployers); List<DhcpServiceProvider> getDhcpProviders(); void setDhcpProviders(final List<DhcpServiceProvider> dhcpProviders); @Override @DB boolean configure(final String name, final Map<String, Object> params); @Override boolean start(); @Override boolean stop(); @Override List<? extends Network> setupNetwork(final Account owner, final NetworkOffering offering, final DeploymentPlan plan, final String name, final String displayText,
                                                final boolean isDefault); @Override @DB List<? extends Network> setupNetwork(final Account owner, final NetworkOffering offering, final Network predefined, final DeploymentPlan plan, final String name,
                                                final String displayText, final boolean errorIfAlreadySetup, final Long domainId, final ACLType aclType,
                                                final Boolean subdomainAccess, final Long vpcId, final Long relatedNetworkId, final Boolean isDisplayNetworkEnabled,
                                                final String dns1, final String dns2, final String ipExclusionList, final String dhcpTftpServer, final String dhcpBootfileName); @Override Network setupSyncNetwork(final Account owner, final DeploymentPlan plan, final boolean isVpcRouter, final Vpc vpc, final Network isolatedNetwork); @Override @DB void allocate(final VirtualMachineProfile vm, final LinkedHashMap<? extends Network, List<? extends NicProfile>> networks); @Override void prepare(final VirtualMachineProfile vmProfile, final DeployDestination dest, final ReservationContext context); @Override @DB void release(final VirtualMachineProfile vmProfile, final boolean forced); @Override void cleanupNics(final VirtualMachineProfile vm); @Override void expungeNics(final VirtualMachineProfile vm); @Override List<NicProfile> getNicProfiles(final VirtualMachine vm); @Override @DB Pair<NetworkGuru, NetworkVO> implementNetwork(final long networkId, final DeployDestination dest, final ReservationContext context); @Override void prepareNicForMigration(final VirtualMachineProfile vm, final DeployDestination dest); @Override void commitNicForMigration(final VirtualMachineProfile src, final VirtualMachineProfile dst); @Override void rollbackNicForMigration(final VirtualMachineProfile src, final VirtualMachineProfile dst); @Override @DB boolean shutdownNetwork(final long networkId, final ReservationContext context, final boolean cleanupElements); @Override @DB boolean removeAndShutdownSyncNetwork(final long networkId); @Override @DB boolean destroyNetwork(final long networkId, final ReservationContext context, final boolean forced); @Override @DB Network createGuestNetwork(final long networkOfferingId, final String name, final String displayText, final String gateway, final String cidr, String vlanId,
                                      String networkDomain, final Account owner, final Long domainId, final PhysicalNetwork pNtwk, final long zoneId, final ACLType aclType,
                                      Boolean subdomainAccess, final Long vpcId, final String ip6Gateway, final String ip6Cidr, final Boolean isDisplayNetworkEnabled,
                                      final String isolatedPvlan, final String dns1, final String dns2, final String ipExclusionList, final String dhcpTftpServer,
                                      final String dhcpBootfileName); @Override UserDataServiceProvider getPasswordResetProvider(final Network network); @Override UserDataServiceProvider getSSHKeyResetProvider(final Network network); @Override boolean startNetwork(final long networkId, final DeployDestination dest, final ReservationContext context); @DB @Override boolean reallocate(final VirtualMachineProfile vm, final DataCenterDeployment dest); @DB @Override NicProfile allocateNic(final NicProfile requested, final Network network, final Boolean isDefaultNic, final VirtualMachineProfile vm); @Override NicProfile prepareNic(final VirtualMachineProfile vmProfile, final DeployDestination dest, final ReservationContext context, final long nicId, final Network network); @Override void removeNic(final VirtualMachineProfile vm, final Nic nic); @Override @DB void releaseNic(final VirtualMachineProfile vmProfile, final Nic nic); @Override NicProfile createNicForVm(final Network network, final NicProfile requested, final ReservationContext context, final VirtualMachineProfile vmProfile, final boolean
            prepare); @Override NetworkProfile convertNetworkToNetworkProfile(final long networkId); @Override boolean restartNetwork(final Long networkId, final Account callerAccount, final User callerUser, final boolean cleanup); @Override boolean shutdownNetworkElementsAndResources(final ReservationContext context, final boolean cleanupElements, final Network network); @Override void implementNetworkElementsAndResources(final DeployDestination dest, final ReservationContext context, final Network network, final NetworkOffering offering); @Override Map<String, String> finalizeServicesAndProvidersForNetwork(final NetworkOffering offering, final Long physicalNetworkId); @Override List<Provider> getProvidersForServiceInNetwork(final Network network, final Service service); @Override StaticNatServiceProvider getStaticNatProviderForNetwork(final Network network); @Override boolean isNetworkInlineMode(final Network network); @Override LoadBalancingServiceProvider getLoadBalancingProviderForNetwork(final Network network, final Scheme lbScheme); @Override boolean isSecondaryIpSetForNic(final long nicId); @Override List<? extends Nic> listVmNics(final long vmId, final Long nicId, final Long networkId); @Override NicVO savePlaceholderNic(final Network network, final String ip4Address, final String ip6Address, final VirtualMachineType vmType); @Override DhcpServiceProvider getDhcpServiceProvider(final Network network); @Override boolean resourceCountNeedsUpdate(final NetworkOffering ntwkOff, final ACLType aclType); @Override void prepareAllNicsForMigration(final VirtualMachineProfile vm, final DeployDestination dest); boolean isDhcpAccrossMultipleSubnetsSupported(final DhcpServiceProvider dhcpServiceProvider); @Override boolean processAnswers(final long agentId, final long seq, final Answer[] answers); @Override boolean processCommands(final long agentId, final long seq, final Command[] commands); @Override AgentControlAnswer processControlCommand(final long agentId, final AgentControlCommand cmd); @Override void processConnect(final Host host, final StartupCommand[] startupCommands, final boolean forRebalance); @Override boolean processDisconnect(final long agentId, final HostStatus state); @Override boolean isRecurring(); @Override int getTimeout(); @Override boolean processTimeout(final long agentId, final long seq); @Override String getConfigComponentName(); @Override ConfigKey<?>[] getConfigKeys(); }
NetworkOrchestrator extends ManagerBase implements NetworkOrchestrationService, Listener, Configurable { @Override public void removeNic(final VirtualMachineProfile vm, final Nic nic) { removeNic(vm, _nicDao.findById(nic.getId())); } protected  NetworkOrchestrator(); List<NetworkGuru> getNetworkGurus(); void setNetworkGurus(final List<NetworkGuru> networkGurus); List<NetworkElement> getNetworkElements(); void setNetworkElements(final List<NetworkElement> networkElements); List<IpDeployer> getIpDeployers(); void setIpDeployers(final List<IpDeployer> ipDeployers); List<DhcpServiceProvider> getDhcpProviders(); void setDhcpProviders(final List<DhcpServiceProvider> dhcpProviders); @Override @DB boolean configure(final String name, final Map<String, Object> params); @Override boolean start(); @Override boolean stop(); @Override List<? extends Network> setupNetwork(final Account owner, final NetworkOffering offering, final DeploymentPlan plan, final String name, final String displayText,
                                                final boolean isDefault); @Override @DB List<? extends Network> setupNetwork(final Account owner, final NetworkOffering offering, final Network predefined, final DeploymentPlan plan, final String name,
                                                final String displayText, final boolean errorIfAlreadySetup, final Long domainId, final ACLType aclType,
                                                final Boolean subdomainAccess, final Long vpcId, final Long relatedNetworkId, final Boolean isDisplayNetworkEnabled,
                                                final String dns1, final String dns2, final String ipExclusionList, final String dhcpTftpServer, final String dhcpBootfileName); @Override Network setupSyncNetwork(final Account owner, final DeploymentPlan plan, final boolean isVpcRouter, final Vpc vpc, final Network isolatedNetwork); @Override @DB void allocate(final VirtualMachineProfile vm, final LinkedHashMap<? extends Network, List<? extends NicProfile>> networks); @Override void prepare(final VirtualMachineProfile vmProfile, final DeployDestination dest, final ReservationContext context); @Override @DB void release(final VirtualMachineProfile vmProfile, final boolean forced); @Override void cleanupNics(final VirtualMachineProfile vm); @Override void expungeNics(final VirtualMachineProfile vm); @Override List<NicProfile> getNicProfiles(final VirtualMachine vm); @Override @DB Pair<NetworkGuru, NetworkVO> implementNetwork(final long networkId, final DeployDestination dest, final ReservationContext context); @Override void prepareNicForMigration(final VirtualMachineProfile vm, final DeployDestination dest); @Override void commitNicForMigration(final VirtualMachineProfile src, final VirtualMachineProfile dst); @Override void rollbackNicForMigration(final VirtualMachineProfile src, final VirtualMachineProfile dst); @Override @DB boolean shutdownNetwork(final long networkId, final ReservationContext context, final boolean cleanupElements); @Override @DB boolean removeAndShutdownSyncNetwork(final long networkId); @Override @DB boolean destroyNetwork(final long networkId, final ReservationContext context, final boolean forced); @Override @DB Network createGuestNetwork(final long networkOfferingId, final String name, final String displayText, final String gateway, final String cidr, String vlanId,
                                      String networkDomain, final Account owner, final Long domainId, final PhysicalNetwork pNtwk, final long zoneId, final ACLType aclType,
                                      Boolean subdomainAccess, final Long vpcId, final String ip6Gateway, final String ip6Cidr, final Boolean isDisplayNetworkEnabled,
                                      final String isolatedPvlan, final String dns1, final String dns2, final String ipExclusionList, final String dhcpTftpServer,
                                      final String dhcpBootfileName); @Override UserDataServiceProvider getPasswordResetProvider(final Network network); @Override UserDataServiceProvider getSSHKeyResetProvider(final Network network); @Override boolean startNetwork(final long networkId, final DeployDestination dest, final ReservationContext context); @DB @Override boolean reallocate(final VirtualMachineProfile vm, final DataCenterDeployment dest); @DB @Override NicProfile allocateNic(final NicProfile requested, final Network network, final Boolean isDefaultNic, final VirtualMachineProfile vm); @Override NicProfile prepareNic(final VirtualMachineProfile vmProfile, final DeployDestination dest, final ReservationContext context, final long nicId, final Network network); @Override void removeNic(final VirtualMachineProfile vm, final Nic nic); @Override @DB void releaseNic(final VirtualMachineProfile vmProfile, final Nic nic); @Override NicProfile createNicForVm(final Network network, final NicProfile requested, final ReservationContext context, final VirtualMachineProfile vmProfile, final boolean
            prepare); @Override NetworkProfile convertNetworkToNetworkProfile(final long networkId); @Override boolean restartNetwork(final Long networkId, final Account callerAccount, final User callerUser, final boolean cleanup); @Override boolean shutdownNetworkElementsAndResources(final ReservationContext context, final boolean cleanupElements, final Network network); @Override void implementNetworkElementsAndResources(final DeployDestination dest, final ReservationContext context, final Network network, final NetworkOffering offering); @Override Map<String, String> finalizeServicesAndProvidersForNetwork(final NetworkOffering offering, final Long physicalNetworkId); @Override List<Provider> getProvidersForServiceInNetwork(final Network network, final Service service); @Override StaticNatServiceProvider getStaticNatProviderForNetwork(final Network network); @Override boolean isNetworkInlineMode(final Network network); @Override LoadBalancingServiceProvider getLoadBalancingProviderForNetwork(final Network network, final Scheme lbScheme); @Override boolean isSecondaryIpSetForNic(final long nicId); @Override List<? extends Nic> listVmNics(final long vmId, final Long nicId, final Long networkId); @Override NicVO savePlaceholderNic(final Network network, final String ip4Address, final String ip6Address, final VirtualMachineType vmType); @Override DhcpServiceProvider getDhcpServiceProvider(final Network network); @Override boolean resourceCountNeedsUpdate(final NetworkOffering ntwkOff, final ACLType aclType); @Override void prepareAllNicsForMigration(final VirtualMachineProfile vm, final DeployDestination dest); boolean isDhcpAccrossMultipleSubnetsSupported(final DhcpServiceProvider dhcpServiceProvider); @Override boolean processAnswers(final long agentId, final long seq, final Answer[] answers); @Override boolean processCommands(final long agentId, final long seq, final Command[] commands); @Override AgentControlAnswer processControlCommand(final long agentId, final AgentControlCommand cmd); @Override void processConnect(final Host host, final StartupCommand[] startupCommands, final boolean forRebalance); @Override boolean processDisconnect(final long agentId, final HostStatus state); @Override boolean isRecurring(); @Override int getTimeout(); @Override boolean processTimeout(final long agentId, final long seq); @Override String getConfigComponentName(); @Override ConfigKey<?>[] getConfigKeys(); static final ConfigKey<Integer> NetworkGcWait; static final ConfigKey<Integer> NetworkGcInterval; }