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);
}
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);
}
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);
}
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);
}
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;
}
}
Aggregations