diff --git a/api/src/com/cloud/api/commands/CreateNetworkOfferingCmd.java b/api/src/com/cloud/api/commands/CreateNetworkOfferingCmd.java index fdafc1ef035..c61f9f36e28 100644 --- a/api/src/com/cloud/api/commands/CreateNetworkOfferingCmd.java +++ b/api/src/com/cloud/api/commands/CreateNetworkOfferingCmd.java @@ -52,7 +52,7 @@ public class CreateNetworkOfferingCmd extends BaseCmd { @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, required=true, description="the display text of the network offering") private String displayText; - @Parameter(name=ApiConstants.TRAFFIC_TYPE, type=CommandType.STRING, required=true, description="the traffic type for the network offering, supported types are Public, Management, Control, Guest, Vlan or Storage") + @Parameter(name=ApiConstants.TRAFFIC_TYPE, type=CommandType.STRING, required=true, description="the traffic type for the network offering. Supported type in current release is GUEST only") private String traffictype; @Parameter(name=ApiConstants.MAX_CONNECTIONS, type=CommandType.INTEGER, description="maximum number of concurrent connections supported by the network offering") @@ -64,7 +64,7 @@ public class CreateNetworkOfferingCmd extends BaseCmd { @Parameter(name=ApiConstants.SPECIFY_VLAN, type=CommandType.BOOLEAN, description="true if network offering supports vlans") private Boolean specifyVlan; - @Parameter(name=ApiConstants.AVAILABILITY, type=CommandType.STRING, description="the availability of network offering. Default value is Required") + @Parameter(name=ApiConstants.AVAILABILITY, type=CommandType.STRING, description="the availability of network offering. Default value is Optional") private String availability; @Parameter(name=ApiConstants.NETWORKRATE, type=CommandType.INTEGER, description="data transfer rate in megabits per second allowed") diff --git a/api/src/com/cloud/api/commands/UpdateNetworkOfferingCmd.java b/api/src/com/cloud/api/commands/UpdateNetworkOfferingCmd.java index d9b5a8b11ef..93ebaf3c230 100644 --- a/api/src/com/cloud/api/commands/UpdateNetworkOfferingCmd.java +++ b/api/src/com/cloud/api/commands/UpdateNetworkOfferingCmd.java @@ -55,7 +55,7 @@ public class UpdateNetworkOfferingCmd extends BaseCmd { @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="the display text of the network offering") private String displayText; - @Parameter(name=ApiConstants.AVAILABILITY, type=CommandType.STRING, description="the availability of network offering. Default value is Required for Guest Virtual network offering; Optional for Guest Direct network offering") + @Parameter(name=ApiConstants.AVAILABILITY, type=CommandType.STRING, description="the availability of network offering") private String availability; @Parameter(name=ApiConstants.DHCP_SERVICE, type=CommandType.BOOLEAN, description="true is network offering supports dhcp service") @@ -114,7 +114,7 @@ public class UpdateNetworkOfferingCmd extends BaseCmd { } public String getAvailability() { - return availability == null ? Availability.Required.toString() : availability; + return availability; } public Boolean getDhcpService() { diff --git a/api/src/com/cloud/offering/NetworkOffering.java b/api/src/com/cloud/offering/NetworkOffering.java index 0ae8c4a1a6e..764b3d0e4d3 100644 --- a/api/src/com/cloud/offering/NetworkOffering.java +++ b/api/src/com/cloud/offering/NetworkOffering.java @@ -42,10 +42,11 @@ public interface NetworkOffering { public final static String SystemControlNetwork = "System-Control-Network"; public final static String SystemManagementNetwork = "System-Management-Network"; public final static String SystemStorageNetwork = "System-Storage-Network"; - public final static String SystemGuestNetwork = "System-Guest-Network"; - public final static String DefaultVirtualizedNetworkOffering = "DefaultVirtualizedNetworkOffering"; - public final static String DefaultDirectNetworkOffering = "DefaultDirectNetworkOffering"; + public final static String DefaultSharedNetworkOfferingWithSGService = "DefaultSharedNetworkOfferingWithSGService"; + public final static String DefaultIsolatedNetworkOfferingWithSourceNatService = "DefaultIsolatedNetworkOfferingWithSourceNatService"; + public final static String DefaultSharedNetworkOffering = "DefaultSharedNetworkOffering"; + public final static String DefaultIsolatedNetworkOffering= "DefaultIsolatedNetworkOffering"; long getId(); diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index a2048f47611..12259ee6697 100755 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -2825,7 +2825,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura String displayText = cmd.getDisplayText(); String tags = cmd.getTags(); String trafficTypeString = cmd.getTraffictype(); - Boolean specifyVlan = cmd.getSpecifyVlan(); + boolean specifyVlan = cmd.getSpecifyVlan(); String availabilityStr = cmd.getAvailability(); Integer networkRate = cmd.getNetworkRate(); @@ -2844,7 +2844,12 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura if (trafficType == null) { throw new InvalidParameterValueException("Invalid value for traffictype. Supported traffic types: Public, Management, Control, Guest, Vlan or Storage"); } - + + //Only GUEST traffic type is supported in Acton + if (trafficType != TrafficType.Guest) { + throw new InvalidParameterValueException("Only traffic type " + TrafficType.Guest + " is supported in the current release"); + } + // Verify offering type for (Network.GuestType offType : Network.GuestType.values()) { if (offType.name().equalsIgnoreCase(cmd.getGuestIpType())) { @@ -2856,6 +2861,13 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura if (guestType == null) { throw new InvalidParameterValueException("Invalid \"type\" parameter is given; can have Shared and Isolated values"); } + + //specifyVlan can be true for Shared network offering only in Acton + if (specifyVlan && guestType != GuestType.Shared) { + + } + + // Verify availability for (Availability avlb : Availability.values()) { diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java index e1ff10768a4..e1465d36e6f 100755 --- a/server/src/com/cloud/network/NetworkManagerImpl.java +++ b/server/src/com/cloud/network/NetworkManagerImpl.java @@ -857,56 +857,60 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag _systemNetworks.put(NetworkOfferingVO.SystemStorageNetwork, storageNetworkOffering); //populate providers - Map> defaultDirectNetworkOfferingProviders = new HashMap>(); + Map> defaultSharedNetworkOfferingProviders = new HashMap>(); Set defaultProviders = new HashSet(); + defaultProviders.add(Network.Provider.VirtualRouter); - defaultDirectNetworkOfferingProviders.put(Service.Dhcp, defaultProviders); - defaultDirectNetworkOfferingProviders.put(Service.Dns, defaultProviders); - defaultDirectNetworkOfferingProviders.put(Service.UserData, defaultProviders); + defaultSharedNetworkOfferingProviders.put(Service.Dhcp, defaultProviders); + defaultSharedNetworkOfferingProviders.put(Service.Dns, defaultProviders); + defaultSharedNetworkOfferingProviders.put(Service.UserData, defaultProviders); + Map> defaultIsolatedNetworkOfferingProviders = defaultSharedNetworkOfferingProviders; - Map> defaultDirectBasicZoneNetworkOfferingProviders = new HashMap>(); - defaultDirectBasicZoneNetworkOfferingProviders.put(Service.Dhcp, defaultProviders); - defaultDirectBasicZoneNetworkOfferingProviders.put(Service.Dns, defaultProviders); - defaultDirectBasicZoneNetworkOfferingProviders.put(Service.UserData, defaultProviders); + Map> defaultSharedSGEnabledNetworkOfferingProviders = new HashMap>(); + defaultSharedSGEnabledNetworkOfferingProviders.put(Service.Dhcp, defaultProviders); + defaultSharedSGEnabledNetworkOfferingProviders.put(Service.Dns, defaultProviders); + defaultSharedSGEnabledNetworkOfferingProviders.put(Service.UserData, defaultProviders); Set sgProviders = new HashSet(); sgProviders.add(Provider.SecurityGroupProvider); - defaultDirectBasicZoneNetworkOfferingProviders.put(Service.SecurityGroup, sgProviders); + defaultSharedSGEnabledNetworkOfferingProviders.put(Service.SecurityGroup, sgProviders); - Map> defaultVirtualNetworkOfferingProviders = new HashMap>(); + Map> defaultIsolatedSourceNatEnabledNetworkOfferingProviders = new HashMap>(); defaultProviders.clear(); defaultProviders.add(Network.Provider.VirtualRouter); - defaultVirtualNetworkOfferingProviders.put(Service.Dhcp, defaultProviders); - defaultVirtualNetworkOfferingProviders.put(Service.Dns, defaultProviders); - defaultVirtualNetworkOfferingProviders.put(Service.UserData, defaultProviders); - defaultVirtualNetworkOfferingProviders.put(Service.Firewall, defaultProviders); - defaultVirtualNetworkOfferingProviders.put(Service.Gateway, defaultProviders); - defaultVirtualNetworkOfferingProviders.put(Service.Lb, defaultProviders); - defaultVirtualNetworkOfferingProviders.put(Service.SourceNat, defaultProviders); - defaultVirtualNetworkOfferingProviders.put(Service.StaticNat, defaultProviders); - defaultVirtualNetworkOfferingProviders.put(Service.PortForwarding, defaultProviders); - defaultVirtualNetworkOfferingProviders.put(Service.Vpn, defaultProviders); + defaultIsolatedSourceNatEnabledNetworkOfferingProviders.put(Service.Dhcp, defaultProviders); + defaultIsolatedSourceNatEnabledNetworkOfferingProviders.put(Service.Dns, defaultProviders); + defaultIsolatedSourceNatEnabledNetworkOfferingProviders.put(Service.UserData, defaultProviders); + defaultIsolatedSourceNatEnabledNetworkOfferingProviders.put(Service.Firewall, defaultProviders); + defaultIsolatedSourceNatEnabledNetworkOfferingProviders.put(Service.Gateway, defaultProviders); + defaultIsolatedSourceNatEnabledNetworkOfferingProviders.put(Service.Lb, defaultProviders); + defaultIsolatedSourceNatEnabledNetworkOfferingProviders.put(Service.SourceNat, defaultProviders); + defaultIsolatedSourceNatEnabledNetworkOfferingProviders.put(Service.StaticNat, defaultProviders); + defaultIsolatedSourceNatEnabledNetworkOfferingProviders.put(Service.PortForwarding, defaultProviders); + defaultIsolatedSourceNatEnabledNetworkOfferingProviders.put(Service.Vpn, defaultProviders); Transaction txn = Transaction.currentTxn(); txn.start(); - //there is only 1 diff between offering #1 and #3 - securityGroup is enabled for the first, and disabled for the third - //TODO - networkOffering 1 should probably become non-system - //check that offering already exists - - NetworkOfferingVO defaultGuestOffering = _networkOfferingDao.findByUniqueName(NetworkOffering.SystemGuestNetwork); - if (defaultGuestOffering == null) { - defaultGuestOffering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM, NetworkOffering.SystemGuestNetwork, "System Offering for System-Guest-Network", TrafficType.Guest, null, null, false, Availability.Optional, null, defaultDirectNetworkOfferingProviders, true, Network.GuestType.Shared, false, null); - _networkOfferingDao.update(defaultGuestOffering.getId(), defaultGuestOffering); - } + //diff between offering #1 and #2 - securityGroup is enabled for the first, and disabled for the third NetworkOfferingVO offering = null; - if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultVirtualizedNetworkOffering) == null) { - offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM,NetworkOffering.DefaultVirtualizedNetworkOffering, "Virtual Vlan", TrafficType.Guest, null, null, false, Availability.Required, null, defaultVirtualNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null); + if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOfferingWithSGService) == null) { + offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM, NetworkOffering.DefaultSharedNetworkOfferingWithSGService, "Offering for Shared Security group enabled networks", TrafficType.Guest, null, null, false, Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null); + _networkOfferingDao.update(offering.getId(), offering); + } + + if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOffering) == null) { + offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM, NetworkOffering.DefaultSharedNetworkOffering, "Offering for Shared networks", TrafficType.Guest, null, null, true, Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null); + _networkOfferingDao.update(offering.getId(), offering); + } + + if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService) == null) { + offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM,NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService, "Offering for Isolated networks with Source Nat service enabled", TrafficType.Guest, null, null, false, Availability.Required, null, defaultIsolatedSourceNatEnabledNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null); _networkOfferingDao.update(offering.getId(), offering); } - - if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultDirectNetworkOffering) == null) { - offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM, NetworkOffering.DefaultDirectNetworkOffering, "Direct", TrafficType.Guest, null, null, true, Availability.Optional, null, defaultDirectNetworkOfferingProviders, true, Network.GuestType.Shared, false, null); + + if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOffering) == null) { + offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM, NetworkOffering.DefaultIsolatedNetworkOffering, "Offering for Isolated networks with no Source Nat service", TrafficType.Guest, null, null, true, Availability.Optional, null, defaultIsolatedNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null); _networkOfferingDao.update(offering.getId(), offering); } @@ -1715,7 +1719,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag throw new InvalidParameterValueException("Can't use network offering id=" + networkOfferingId + " as its state is not " + NetworkOffering.State.Enabled); } - // Check if the network is domain specific + // Check if the network is domain specific. If yes, only guestType = Shared is allowed if (cmd.getDomainId() != null && cmd.getAccountName() == null) { if (networkOffering.getTrafficType() != TrafficType.Guest || networkOffering.getGuestType() != Network.GuestType.Shared) { throw new InvalidParameterValueException("Domain level networks are supported just for traffic type " + TrafficType.Guest + " and type " + Network.GuestType.Shared); @@ -1800,10 +1804,10 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag cidr = NetUtils.ipAndNetMaskToCidr(gateway, netmask); } - // Regular user can create Guest Isolated network only - if (caller.getType() == Account.ACCOUNT_TYPE_NORMAL && (networkOffering.getTrafficType() != TrafficType.Guest || networkOffering.getGuestType() != Network.GuestType.Isolated)) { + // Regular user can create Guest Isolated Source Nat enabled network only + if (caller.getType() == Account.ACCOUNT_TYPE_NORMAL && (networkOffering.getTrafficType() != TrafficType.Guest || networkOffering.getGuestType() != Network.GuestType.Isolated && isServiceSupportedByNetworkOffering(networkOffering.getId(), Service.SourceNat))) { throw new InvalidParameterValueException("Regular user can create a network only from the network offering having traffic type " + TrafficType.Guest + " and network type " - + Network.GuestType.Isolated); + + Network.GuestType.Isolated + " with a service " + Service.SourceNat + " enabled"); } // Don't allow to specify cidr if the caller is a regular user @@ -1836,8 +1840,13 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag if (network.getGuestType() == Network.GuestType.Shared) { owner = null; } + + //Vlan is created in 2 cases: + //1) GuestType is Shared + //2) GuestType is Isolated, but SourceNat service is disabled + boolean createVlan = ((network.getGuestType() == Network.GuestType.Shared) || (network.getGuestType() == GuestType.Isolated && !isServiceSupportedByNetworkOffering(networkOffering.getId(), Service.SourceNat))); - if (caller.getType() == Account.ACCOUNT_TYPE_ADMIN && network.getGuestType() == Network.GuestType.Shared && defineNetworkConfig) { + if (caller.getType() == Account.ACCOUNT_TYPE_ADMIN && createVlan && defineNetworkConfig) { // Create vlan ip range _configMgr.createVlanAndPublicIpRange(userId, pNtwk.getDataCenterId(), null, startIP, endIP, gateway, netmask, false, vlanId, owner, network.getId(), physicalNetworkId); } diff --git a/server/src/com/cloud/network/ovs/OvsNetworkManager.java b/server/src/com/cloud/network/ovs/OvsNetworkManager.java index 50dc5b57c1b..96ba499a0b9 100644 --- a/server/src/com/cloud/network/ovs/OvsNetworkManager.java +++ b/server/src/com/cloud/network/ovs/OvsNetworkManager.java @@ -21,15 +21,12 @@ package com.cloud.network.ovs; import java.util.List; import java.util.Set; -import com.cloud.agent.manager.Commands; import com.cloud.deploy.DeployDestination; import com.cloud.utils.Pair; import com.cloud.utils.component.Manager; -import com.cloud.vm.DomainRouterVO; -import com.cloud.vm.VirtualMachine.State; -import com.cloud.vm.UserVmVO; import com.cloud.vm.VMInstanceVO; import com.cloud.vm.VirtualMachine; +import com.cloud.vm.VirtualMachine.State; import com.cloud.vm.VirtualMachineProfile; public interface OvsNetworkManager extends Manager { diff --git a/server/src/com/cloud/server/ConfigurationServerImpl.java b/server/src/com/cloud/server/ConfigurationServerImpl.java index 9d4d8228673..72f456746e1 100644 --- a/server/src/com/cloud/server/ConfigurationServerImpl.java +++ b/server/src/com/cloud/server/ConfigurationServerImpl.java @@ -38,6 +38,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Properties; +import java.util.Set; import java.util.UUID; import java.util.regex.Pattern; @@ -838,29 +839,33 @@ public class ConfigurationServerImpl implements ConfigurationServer { defaultSharedNetworkOfferingProviders.put(Service.Dns, Provider.VirtualRouter); defaultSharedNetworkOfferingProviders.put(Service.UserData, Provider.VirtualRouter); + Map defaultIsolatedNetworkOfferingProviders = defaultSharedNetworkOfferingProviders; + Map defaultSharedSGNetworkOfferingProviders = new HashMap(); defaultSharedSGNetworkOfferingProviders.put(Service.Dhcp, Provider.VirtualRouter); defaultSharedSGNetworkOfferingProviders.put(Service.Dns, Provider.VirtualRouter); defaultSharedSGNetworkOfferingProviders.put(Service.UserData, Provider.VirtualRouter); defaultSharedSGNetworkOfferingProviders.put(Service.SecurityGroup, Provider.SecurityGroupProvider); - Map defaultIsolatedNetworkOfferingProviders = new HashMap(); - defaultIsolatedNetworkOfferingProviders.put(Service.Dhcp, Provider.VirtualRouter); - defaultIsolatedNetworkOfferingProviders.put(Service.Dns, Provider.VirtualRouter); - defaultIsolatedNetworkOfferingProviders.put(Service.UserData, Provider.VirtualRouter); - defaultIsolatedNetworkOfferingProviders.put(Service.Firewall, Provider.VirtualRouter); - defaultIsolatedNetworkOfferingProviders.put(Service.Gateway, Provider.VirtualRouter); - defaultIsolatedNetworkOfferingProviders.put(Service.Lb, Provider.VirtualRouter); - defaultIsolatedNetworkOfferingProviders.put(Service.SourceNat, Provider.VirtualRouter); - defaultIsolatedNetworkOfferingProviders.put(Service.StaticNat, Provider.VirtualRouter); - defaultIsolatedNetworkOfferingProviders.put(Service.PortForwarding, Provider.VirtualRouter); - defaultIsolatedNetworkOfferingProviders.put(Service.Vpn, Provider.VirtualRouter); + Map defaultIsolatedSourceNatEnabledNetworkOfferingProviders = new HashMap(); + defaultIsolatedSourceNatEnabledNetworkOfferingProviders.put(Service.Dhcp, Provider.VirtualRouter); + defaultIsolatedSourceNatEnabledNetworkOfferingProviders.put(Service.Dns, Provider.VirtualRouter); + defaultIsolatedSourceNatEnabledNetworkOfferingProviders.put(Service.UserData, Provider.VirtualRouter); + defaultIsolatedSourceNatEnabledNetworkOfferingProviders.put(Service.Firewall, Provider.VirtualRouter); + defaultIsolatedSourceNatEnabledNetworkOfferingProviders.put(Service.Gateway, Provider.VirtualRouter); + defaultIsolatedSourceNatEnabledNetworkOfferingProviders.put(Service.Lb, Provider.VirtualRouter); + defaultIsolatedSourceNatEnabledNetworkOfferingProviders.put(Service.SourceNat, Provider.VirtualRouter); + defaultIsolatedSourceNatEnabledNetworkOfferingProviders.put(Service.StaticNat, Provider.VirtualRouter); + defaultIsolatedSourceNatEnabledNetworkOfferingProviders.put(Service.PortForwarding, Provider.VirtualRouter); + defaultIsolatedSourceNatEnabledNetworkOfferingProviders.put(Service.Vpn, Provider.VirtualRouter); - //The only one diff between 1 and 3 network offerings is that the first one has SG enabled. In Basic zone only first network offering has to be enabled, in Advance zone - the third one + //The only one diff between 1 and 2 network offerings is that the first one has SG enabled. In Basic zone only first network offering has to be enabled, in Advance zone - the second one + + //Offering #1 NetworkOfferingVO deafultSharedSGNetworkOffering = new NetworkOfferingVO( - NetworkOffering.SystemGuestNetwork, - "System-Guest-Network", + NetworkOffering.DefaultSharedNetworkOfferingWithSGService, + "Offering for Shared Security group enabled networks", TrafficType.Guest, false, false, null, null, null, true, Availability.Optional, null, Network.GuestType.Shared); @@ -873,25 +878,10 @@ public class ConfigurationServerImpl implements ConfigurationServer { s_logger.trace("Added service for the network offering: " + offService); } - NetworkOfferingVO defaultIsolatedNetworkOffering = new NetworkOfferingVO( - NetworkOffering.DefaultVirtualizedNetworkOffering, - "Virtual Vlan", - TrafficType.Guest, - false, false, null, null, null, true, - Availability.Required, null, Network.GuestType.Isolated); - - defaultIsolatedNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(defaultIsolatedNetworkOffering); - - - for (Service service : defaultIsolatedNetworkOfferingProviders.keySet()) { - NetworkOfferingServiceMapVO offService = new NetworkOfferingServiceMapVO(defaultIsolatedNetworkOffering.getId(), service, defaultIsolatedNetworkOfferingProviders.get(service)); - _offeringServiceMapDao.persist(offService); - s_logger.trace("Added service for the network offering: " + offService); - } - + //Offering #2 NetworkOfferingVO defaultSharedNetworkOffering = new NetworkOfferingVO( - NetworkOffering.DefaultDirectNetworkOffering, - "Direct", + NetworkOffering.DefaultSharedNetworkOffering, + "Offering for Shared networks", TrafficType.Guest, false, true, null, null, null, true, Availability.Optional, null, Network.GuestType.Shared); @@ -903,6 +893,40 @@ public class ConfigurationServerImpl implements ConfigurationServer { _offeringServiceMapDao.persist(offService); s_logger.trace("Added service for the network offering: " + offService); } + + //Offering #3 + NetworkOfferingVO defaultIsolatedSourceNatEnabledNetworkOffering = new NetworkOfferingVO( + NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService, + "Offering for Isolated networks with Source Nat service enabled", + TrafficType.Guest, + false, false, null, null, null, true, + Availability.Required, null, Network.GuestType.Isolated); + + defaultIsolatedSourceNatEnabledNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(defaultIsolatedSourceNatEnabledNetworkOffering); + + + for (Service service : defaultIsolatedSourceNatEnabledNetworkOfferingProviders.keySet()) { + NetworkOfferingServiceMapVO offService = new NetworkOfferingServiceMapVO(defaultIsolatedSourceNatEnabledNetworkOffering.getId(), service, defaultIsolatedSourceNatEnabledNetworkOfferingProviders.get(service)); + _offeringServiceMapDao.persist(offService); + s_logger.trace("Added service for the network offering: " + offService); + } + + //Offering #4 + NetworkOfferingVO defaultIsolatedEnabledNetworkOffering = new NetworkOfferingVO( + NetworkOffering.DefaultIsolatedNetworkOffering, + "Offering for Isolated networks with no Source Nat service", + TrafficType.Guest, + false, true, null, null, null, true, + Availability.Optional, null, Network.GuestType.Isolated); + + defaultSharedNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(defaultIsolatedEnabledNetworkOffering); + + for (Service service : defaultIsolatedNetworkOfferingProviders.keySet()) { + NetworkOfferingServiceMapVO offService = new NetworkOfferingServiceMapVO(defaultSharedNetworkOffering.getId(), service, defaultIsolatedNetworkOfferingProviders.get(service)); + _offeringServiceMapDao.persist(offService); + s_logger.trace("Added service for the network offering: " + offService); + } + } private void createDefaultNetworks() {