Search in sources :

Example 81 with NetworkOfferingVO

use of com.cloud.offerings.NetworkOfferingVO in project cosmic by MissionCriticalCloud.

the class CreateNetworkOfferingTest method createSharedNtwkOffWithoutSpecifyIpRanges.

@Test(expected = InvalidParameterValueException.class)
public void createSharedNtwkOffWithoutSpecifyIpRanges() {
    final NetworkOfferingVO off = configMgr.createNetworkOffering("shared", "shared", TrafficType.Guest, null, true, Availability.Optional, 200, null, false, Network.GuestType.Shared, false, null, null, false, null, false, false, null, false, null, true);
    assertNull("Shared network offering with specifyIpRanges=false was created", off);
}
Also used : NetworkOfferingVO(com.cloud.offerings.NetworkOfferingVO) Test(org.junit.Test)

Example 82 with NetworkOfferingVO

use of com.cloud.offerings.NetworkOfferingVO in project cosmic by MissionCriticalCloud.

the class CreateNetworkOfferingTest method createSharedNtwkOffWithSpecifyIpRanges.

@Test
public void createSharedNtwkOffWithSpecifyIpRanges() {
    final NetworkOfferingVO off = configMgr.createNetworkOffering("shared", "shared", TrafficType.Guest, null, true, Availability.Optional, 200, null, false, Network.GuestType.Shared, false, null, null, false, null, true, false, null, false, null, true);
    assertNotNull("Shared network offering with specifyIpRanges=true failed to create ", off);
}
Also used : NetworkOfferingVO(com.cloud.offerings.NetworkOfferingVO) Test(org.junit.Test)

Example 83 with NetworkOfferingVO

use of com.cloud.offerings.NetworkOfferingVO in project cosmic by MissionCriticalCloud.

the class CreateNetworkOfferingTest method createIsolatedNtwkOffWithSpecifyIpRangesAndNoSourceNat.

@Test
public void createIsolatedNtwkOffWithSpecifyIpRangesAndNoSourceNat() {
    final Map<Service, Set<Provider>> serviceProviderMap = new HashMap<>();
    final Set<Network.Provider> vrProvider = new HashSet<>();
    final NetworkOfferingVO off = configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, false, Availability.Optional, 200, serviceProviderMap, false, Network.GuestType.Isolated, false, null, null, false, null, true, false, null, false, null, true);
    assertNotNull("Isolated network offering with specifyIpRanges=true and with no sourceNatService, failed to create", off);
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) Service(com.cloud.network.Network.Service) NetworkOfferingVO(com.cloud.offerings.NetworkOfferingVO) Provider(com.cloud.network.Network.Provider) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 84 with NetworkOfferingVO

use of com.cloud.offerings.NetworkOfferingVO in project cosmic by MissionCriticalCloud.

the class CreateNetworkOfferingTest method createSharedNtwkOffWithVlan.

// Test Shared network offerings
@Test
public void createSharedNtwkOffWithVlan() {
    final NetworkOfferingVO off = configMgr.createNetworkOffering("shared", "shared", TrafficType.Guest, null, true, Availability.Optional, 200, null, false, Network.GuestType.Shared, false, null, null, false, null, true, false, null, false, null, true);
    assertNotNull("Shared network offering with specifyVlan=true failed to create ", off);
}
Also used : NetworkOfferingVO(com.cloud.offerings.NetworkOfferingVO) Test(org.junit.Test)

Example 85 with NetworkOfferingVO

use of com.cloud.offerings.NetworkOfferingVO in project cosmic by MissionCriticalCloud.

the class NetworkOrchestrator method restartNetwork.

@Override
public boolean restartNetwork(final Long networkId, final Account callerAccount, final User callerUser, final boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
    final NetworkVO network = _networksDao.findById(networkId);
    s_logger.debug("Restarting network " + networkId + "...");
    final ReservationContext context = new ReservationContextImpl(null, null, callerUser, callerAccount);
    if (cleanup) {
        if (_networkOfferingDao.findByIdIncludingRemoved(network.getNetworkOfferingId()).getRedundantRouter()) {
            final List<DomainRouterVO> routers = _routerDao.findByNetwork(network.getId());
            if (routers != null && !routers.isEmpty()) {
                return rollingRestartIsolatedNetwork(network, routers, context);
            }
        }
        // shutdown the network
        s_logger.debug("Shutting down the network id=" + networkId + " as a part of network restart");
        if (!shutdownNetworkElementsAndResources(context, true, network)) {
            s_logger.debug("Failed to shutdown the network elements and resources as a part of network restart: " + network.getState());
            setRestartRequired(network, true);
            return false;
        }
    } else {
        s_logger.debug("Skip the shutting down of network id=" + networkId);
    }
    // implement the network elements and rules again
    final DeployDestination dest = new DeployDestination(_zoneRepository.findOne(network.getDataCenterId()), null, null, null);
    s_logger.debug("Implementing the network " + network + " elements and resources as a part of network restart");
    final NetworkOfferingVO offering = _networkOfferingDao.findById(network.getNetworkOfferingId());
    try {
        implementNetworkElementsAndResources(dest, context, network, offering);
        setRestartRequired(network, true);
        return true;
    } catch (final Exception ex) {
        s_logger.warn("Failed to implement network " + network + " elements and resources as a part of network restart due to ", ex);
        return false;
    }
}
Also used : PhysicalNetworkVO(com.cloud.network.dao.PhysicalNetworkVO) NetworkVO(com.cloud.network.dao.NetworkVO) DeployDestination(com.cloud.deploy.DeployDestination) NetworkOfferingVO(com.cloud.offerings.NetworkOfferingVO) ReservationContextImpl(com.cloud.vm.ReservationContextImpl) DomainRouterVO(com.cloud.vm.DomainRouterVO) ConnectionException(com.cloud.exception.ConnectionException) NoTransitionException(com.cloud.utils.fsm.NoTransitionException) InsufficientCapacityException(com.cloud.exception.InsufficientCapacityException) IllegalVirtualMachineException(com.cloud.exception.IllegalVirtualMachineException) InsufficientAddressCapacityException(com.cloud.exception.InsufficientAddressCapacityException) ResourceUnavailableException(com.cloud.exception.ResourceUnavailableException) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) ResourceAllocationException(com.cloud.exception.ResourceAllocationException) ConcurrentOperationException(com.cloud.exception.ConcurrentOperationException) InsufficientVirtualNetworkCapacityException(com.cloud.exception.InsufficientVirtualNetworkCapacityException) InvalidParameterValueException(com.cloud.utils.exception.InvalidParameterValueException) UnsupportedServiceException(com.cloud.exception.UnsupportedServiceException) ConfigurationException(javax.naming.ConfigurationException) ReservationContext(com.cloud.vm.ReservationContext)

Aggregations

NetworkOfferingVO (com.cloud.offerings.NetworkOfferingVO)128 NetworkVO (com.cloud.network.dao.NetworkVO)45 ArrayList (java.util.ArrayList)34 PhysicalNetworkVO (com.cloud.network.dao.PhysicalNetworkVO)32 Network (com.cloud.network.Network)27 DB (com.cloud.utils.db.DB)27 Test (org.junit.Test)27 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)26 Service (com.cloud.network.Network.Service)26 Account (com.cloud.user.Account)24 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)23 Provider (com.cloud.network.Network.Provider)22 PhysicalNetwork (com.cloud.network.PhysicalNetwork)21 HashSet (java.util.HashSet)21 TransactionStatus (com.cloud.utils.db.TransactionStatus)20 HashMap (java.util.HashMap)20 Set (java.util.Set)20 DataCenterVO (com.cloud.dc.DataCenterVO)19 NetworkOffering (com.cloud.offering.NetworkOffering)19 ResourceUnavailableException (com.cloud.exception.ResourceUnavailableException)18