diff --git a/api/src/main/java/com/cloud/offering/NetworkOffering.java b/api/src/main/java/com/cloud/offering/NetworkOffering.java index 5000a4f8c626..ef20e5e35331 100644 --- a/api/src/main/java/com/cloud/offering/NetworkOffering.java +++ b/api/src/main/java/com/cloud/offering/NetworkOffering.java @@ -70,6 +70,7 @@ enum RoutingMode { public static final String DEFAULT_ROUTED_NSX_OFFERING = "DefaultRoutedNSXNetworkOffering"; public final static String QuickCloudNoServices = "QuickCloudNoServices"; public final static String DefaultIsolatedNetworkOfferingWithSourceNatService = "DefaultIsolatedNetworkOfferingWithSourceNatService"; + public final static String DefaultIsolatedNetworkOfferingWithSourceNatServiceDefaultEgressAllowed = "DefaultIsolatedNetworkOfferingWithSourceNatServiceEgressAllowed"; public final static String OvsIsolatedNetworkOfferingWithSourceNatService = "OvsIsolatedNetworkOfferingWithSourceNatService"; public final static String DefaultSharedNetworkOffering = "DefaultSharedNetworkOffering"; public final static String DefaultIsolatedNetworkOffering = "DefaultIsolatedNetworkOffering"; diff --git a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java index 8af75562b31c..74e7fae2afd7 100644 --- a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java +++ b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java @@ -636,6 +636,14 @@ public void doInTransactionWithoutResult(final TransactionStatus status) { true, false, false, false, false, null, null, null, true, null, null, false); } + //#4-2 - default isolated offering with Source nat service and egress traffic allowed by default + if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatServiceDefaultEgressAllowed) == null) { + offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatServiceDefaultEgressAllowed, + "Offering for Isolated networks with Source Nat service enabled and egress traffic allowed by default", TrafficType.Guest, null, false, Availability.Optional, null, + defaultIsolatedSourceNatEnabledNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null, true, null, false, false, null, true, null, + true, false, false, false, false, null, null, null, true, null, null, false); + } + //#5 - default vpc offering with LB service if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworks) == null) { offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworks, diff --git a/engine/schema/src/main/java/com/cloud/offerings/NetworkOfferingVO.java b/engine/schema/src/main/java/com/cloud/offerings/NetworkOfferingVO.java index fc22e68985d2..d8e941e3e21e 100644 --- a/engine/schema/src/main/java/com/cloud/offerings/NetworkOfferingVO.java +++ b/engine/schema/src/main/java/com/cloud/offerings/NetworkOfferingVO.java @@ -138,7 +138,7 @@ public class NetworkOfferingVO implements NetworkOffering { NetworkMode networkMode; @Column(name = "egress_default_policy") - boolean egressdefaultpolicy; + boolean egressDefaultPolicy; @Column(name = "concurrent_connections") Integer concurrentConnections; @@ -343,12 +343,16 @@ public void setRedundantRouter(boolean redundantRouter) { @Override public boolean isEgressDefaultPolicy() { - return egressdefaultpolicy; + return egressDefaultPolicy; + } + + public void setEgressDefaultPolicy(boolean egressDefaultPolicy) { + this.egressDefaultPolicy = egressDefaultPolicy; } public NetworkOfferingVO(String name, String displayText, TrafficType trafficType, boolean systemOnly, boolean specifyVlan, Integer rateMbps, - Integer multicastRateMbps, boolean isDefault, Availability availability, String tags, Network.GuestType guestType, boolean conserveMode, - boolean specifyIpRanges, boolean isPersistent, boolean internalLb, boolean publicLb, boolean isForVpc) { + Integer multicastRateMbps, boolean isDefault, Availability availability, String tags, Network.GuestType guestType, boolean conserveMode, + boolean specifyIpRanges, boolean isPersistent, boolean internalLb, boolean publicLb, boolean isForVpc) { this.name = name; this.displayText = displayText; this.rateMbps = rateMbps; @@ -404,7 +408,7 @@ public NetworkOfferingVO(String name, String displayText, TrafficType trafficTyp this.elasticLb = elasticLb; this.inline = inline; this.eipAssociatePublicIp = associatePublicIP; - this.egressdefaultpolicy = egressdefaultpolicy; + this.egressDefaultPolicy = egressdefaultpolicy; this.supportsStrechedL2 = supportsStrechedL2; this.supportsPublicAccess = supportsPublicAccess; } diff --git a/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java b/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java index def564dfdc68..98095b6f188a 100644 --- a/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java +++ b/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java @@ -1070,12 +1070,29 @@ public void doInTransactionWithoutResult(TransactionStatus status) { defaultIsolatedSourceNatEnabledNetworkOffering.setSupportsVmAutoScaling(true); defaultIsolatedSourceNatEnabledNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(defaultIsolatedSourceNatEnabledNetworkOffering); + // Offering #3-2 + NetworkOfferingVO defaultIsolatedSourceNatEnabledNetworkOfferingWithDefaultEgressAllowed = + new NetworkOfferingVO(NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatServiceDefaultEgressAllowed, + "Offering for Isolated networks with Source Nat service enabled and egress traffic allowed by default", TrafficType.Guest, false, false, null, null, true, Availability.Optional, null, + Network.GuestType.Isolated, true, false, false, false, true, false); + + defaultIsolatedSourceNatEnabledNetworkOfferingWithDefaultEgressAllowed.setState(NetworkOffering.State.Enabled); + defaultIsolatedSourceNatEnabledNetworkOfferingWithDefaultEgressAllowed.setSupportsVmAutoScaling(true); + defaultIsolatedSourceNatEnabledNetworkOfferingWithDefaultEgressAllowed.setEgressDefaultPolicy(true); + defaultIsolatedSourceNatEnabledNetworkOfferingWithDefaultEgressAllowed = _networkOfferingDao.persistDefaultNetworkOffering(defaultIsolatedSourceNatEnabledNetworkOfferingWithDefaultEgressAllowed); + for (Service service : defaultIsolatedSourceNatEnabledNetworkOfferingProviders.keySet()) { NetworkOfferingServiceMapVO offService = new NetworkOfferingServiceMapVO(defaultIsolatedSourceNatEnabledNetworkOffering.getId(), service, defaultIsolatedSourceNatEnabledNetworkOfferingProviders.get(service)); _ntwkOfferingServiceMapDao.persist(offService); - logger.trace("Added service for the network offering: " + offService); + logger.trace("Added service {} for the network offering: {}", offService, defaultIsolatedSourceNatEnabledNetworkOffering.getUniqueName()); + + offService = + new NetworkOfferingServiceMapVO(defaultIsolatedSourceNatEnabledNetworkOfferingWithDefaultEgressAllowed.getId(), service, + defaultIsolatedSourceNatEnabledNetworkOfferingProviders.get(service)); + _ntwkOfferingServiceMapDao.persist(offService); + logger.trace("Added service {} for the network offering: {}", offService, defaultIsolatedSourceNatEnabledNetworkOfferingWithDefaultEgressAllowed.getUniqueName()); } // Offering #4