Skip to content

Commit b14f43c

Browse files
committed
CLOUDSTACK-9450: Network Offering for VPC based on DB flag
1 parent 3381c38 commit b14f43c

16 files changed

Lines changed: 141 additions & 71 deletions

File tree

api/src/com/cloud/offering/NetworkOffering.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ public enum Detail {
7878
*/
7979
Integer getMulticastRateMbps();
8080

81+
boolean getForVpc();
82+
8183
TrafficType getTrafficType();
8284

8385
boolean getSpecifyVlan();

api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
112112
description = "true if network offering supports persistent networks; defaulted to false if not specified")
113113
private Boolean isPersistent;
114114

115+
@Parameter(name = ApiConstants.FOR_VPC,
116+
type = CommandType.BOOLEAN,
117+
description = "true if network offering is meant to be used for VPC, false otherwise.")
118+
private Boolean forVpc;
119+
115120
@Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, since = "4.2.0", description = "Network offering details in key/value pairs."
116121
+ " Supported keys are internallbprovider/publiclbprovider with service provider as a value")
117122
protected Map details;
@@ -195,6 +200,10 @@ public Boolean getIsPersistent() {
195200
return isPersistent == null ? false : isPersistent;
196201
}
197202

203+
public Boolean getForVpc() {
204+
return forVpc;
205+
}
206+
198207
public Boolean getEgressDefaultPolicy() {
199208
if (egressDefaultPolicy == null) {
200209
return true;

engine/components-api/src/com/cloud/configuration/ConfigurationManager.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,14 +204,14 @@ DataCenterVO createZone(long userId, String zoneName, String dns1, String dns2,
204204
* @param isPersistent
205205
* ;
206206
* @param details TODO
207-
* @param id
207+
* @param forVpc
208208
* @return network offering object
209209
*/
210210

211211
NetworkOfferingVO createNetworkOffering(String name, String displayText, TrafficType trafficType, String tags, boolean specifyVlan, Availability availability,
212-
Integer networkRate, Map<Service, Set<Provider>> serviceProviderMap, boolean isDefault, Network.GuestType type, boolean systemOnly, Long serviceOfferingId,
213-
boolean conserveMode, Map<Service, Map<Capability, String>> serviceCapabilityMap, boolean specifyIpRanges, boolean isPersistent,
214-
Map<NetworkOffering.Detail, String> details, boolean egressDefaultPolicy, Integer maxconn, boolean enableKeepAlive);
212+
Integer networkRate, Map<Service, Set<Provider>> serviceProviderMap, boolean isDefault, Network.GuestType type, boolean systemOnly, Long serviceOfferingId,
213+
boolean conserveMode, Map<Service, Map<Capability, String>> serviceCapabilityMap, boolean specifyIpRanges, boolean isPersistent,
214+
Map<NetworkOffering.Detail, String> details, boolean egressDefaultPolicy, Integer maxconn, boolean enableKeepAlive, Boolean forVpc);
215215

216216
Vlan createVlanAndPublicIpRange(long zoneId, long networkId, long physicalNetworkId, boolean forVirtualNetwork, Long podId, String startIP, String endIP,
217217
String vlanGateway, String vlanNetmask, String vlanId, Domain domain, Account vlanOwner, String startIPv6, String endIPv6, String vlanIp6Gateway, String vlanIp6Cidr)

engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ public void doInTransactionWithoutResult(final TransactionStatus status) {
444444
if (_networkOfferingDao.findByUniqueName(NetworkOffering.QuickCloudNoServices) == null) {
445445
offering = _configMgr.createNetworkOffering(NetworkOffering.QuickCloudNoServices, "Offering for QuickCloud with no services", TrafficType.Guest, null, true,
446446
Availability.Optional, null, new HashMap<Network.Service, Set<Network.Provider>>(), true, Network.GuestType.Shared, false, null, true, null, true,
447-
false, null, false, null, true);
447+
false, null, false, null, true, false);
448448
offering.setState(NetworkOffering.State.Enabled);
449449
_networkOfferingDao.update(offering.getId(), offering);
450450
}
@@ -453,7 +453,7 @@ public void doInTransactionWithoutResult(final TransactionStatus status) {
453453
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOfferingWithSGService) == null) {
454454
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedNetworkOfferingWithSGService, "Offering for Shared Security group enabled networks",
455455
TrafficType.Guest, null, true, Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true,
456-
null, true, false, null, false, null, true);
456+
null, true, false, null, false, null, true, false);
457457
offering.setState(NetworkOffering.State.Enabled);
458458
_networkOfferingDao.update(offering.getId(), offering);
459459
}
@@ -462,7 +462,7 @@ public void doInTransactionWithoutResult(final TransactionStatus status) {
462462
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOffering) == null) {
463463
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedNetworkOffering, "Offering for Shared networks", TrafficType.Guest, null, true,
464464
Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true, null, true, false, null, false,
465-
null, true);
465+
null, true, false);
466466
offering.setState(NetworkOffering.State.Enabled);
467467
_networkOfferingDao.update(offering.getId(), offering);
468468
}
@@ -472,7 +472,7 @@ public void doInTransactionWithoutResult(final TransactionStatus status) {
472472
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService,
473473
"Offering for Isolated networks with Source Nat service enabled", TrafficType.Guest, null, false, Availability.Required, null,
474474
defaultIsolatedSourceNatEnabledNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null, true, null, false, false, null, false, null,
475-
true);
475+
true, false);
476476

477477
offering.setState(NetworkOffering.State.Enabled);
478478
_networkOfferingDao.update(offering.getId(), offering);
@@ -482,7 +482,7 @@ public void doInTransactionWithoutResult(final TransactionStatus status) {
482482
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworks) == null) {
483483
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworks,
484484
"Offering for Isolated VPC networks with Source Nat service enabled", TrafficType.Guest, null, false, Availability.Optional, null,
485-
defaultVPCOffProviders, true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true);
485+
defaultVPCOffProviders, true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, true);
486486
offering.setState(NetworkOffering.State.Enabled);
487487
_networkOfferingDao.update(offering.getId(), offering);
488488
}
@@ -493,7 +493,7 @@ public void doInTransactionWithoutResult(final TransactionStatus status) {
493493
defaultVPCOffProviders.remove(Service.Lb);
494494
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksNoLB,
495495
"Offering for Isolated VPC networks with Source Nat service enabled and LB service disabled", TrafficType.Guest, null, false, Availability.Optional,
496-
null, defaultVPCOffProviders, true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true);
496+
null, defaultVPCOffProviders, true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, true);
497497
offering.setState(NetworkOffering.State.Enabled);
498498
_networkOfferingDao.update(offering.getId(), offering);
499499
}
@@ -502,7 +502,7 @@ public void doInTransactionWithoutResult(final TransactionStatus status) {
502502
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOffering) == null) {
503503
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOffering, "Offering for Isolated networks with no Source Nat service",
504504
TrafficType.Guest, null, true, Availability.Optional, null, defaultIsolatedNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null,
505-
true, null, true, false, null, false, null, true);
505+
true, null, true, false, null, false, null, true, false);
506506
offering.setState(NetworkOffering.State.Enabled);
507507
_networkOfferingDao.update(offering.getId(), offering);
508508
}
@@ -526,7 +526,7 @@ public void doInTransactionWithoutResult(final TransactionStatus status) {
526526
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB) == null) {
527527
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB,
528528
"Offering for Isolated VPC networks with Internal Lb support", TrafficType.Guest, null, false, Availability.Optional, null, internalLbOffProviders,
529-
true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true);
529+
true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, true);
530530
offering.setState(NetworkOffering.State.Enabled);
531531
offering.setInternalLb(true);
532532
offering.setPublicLb(false);
@@ -558,7 +558,7 @@ public void doInTransactionWithoutResult(final TransactionStatus status) {
558558
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedEIPandELBNetworkOffering) == null) {
559559
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedEIPandELBNetworkOffering,
560560
"Offering for Shared networks with Elastic IP and Elastic LB capabilities", TrafficType.Guest, null, true, Availability.Optional, null,
561-
netscalerServiceProviders, true, Network.GuestType.Shared, false, null, true, serviceCapabilityMap, true, false, null, false, null, true);
561+
netscalerServiceProviders, true, Network.GuestType.Shared, false, null, true, serviceCapabilityMap, true, false, null, false, null, true, false);
562562
offering.setState(NetworkOffering.State.Enabled);
563563
offering.setDedicatedLB(false);
564564
_networkOfferingDao.update(offering.getId(), offering);

engine/schema/src/com/cloud/offerings/NetworkOfferingVO.java

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ public class NetworkOfferingVO implements NetworkOffering {
130130
@Column(name = "is_persistent")
131131
boolean isPersistent;
132132

133+
@Column(name = "for_vpc")
134+
boolean forVpc;
135+
133136
@Column(name = "egress_default_policy")
134137
boolean egressdefaultpolicy;
135138

@@ -168,6 +171,15 @@ public void setKeepAliveEnabled(boolean keepAliveEnabled) {
168171
this.keepAliveEnabled = keepAliveEnabled;
169172
}
170173

174+
@Override
175+
public boolean getForVpc() {
176+
return forVpc;
177+
}
178+
179+
public void setForVpc(boolean isForVpc) {
180+
this.forVpc = isForVpc;
181+
}
182+
171183
@Override
172184
public long getId() {
173185
return id;
@@ -309,7 +321,7 @@ public boolean getEgressDefaultPolicy() {
309321

310322
public NetworkOfferingVO(String name, String displayText, TrafficType trafficType, boolean systemOnly, boolean specifyVlan, Integer rateMbps,
311323
Integer multicastRateMbps, boolean isDefault, Availability availability, String tags, Network.GuestType guestType, boolean conserveMode,
312-
boolean specifyIpRanges, boolean isPersistent, boolean internalLb, boolean publicLb) {
324+
boolean specifyIpRanges, boolean isPersistent, boolean internalLb, boolean publicLb, boolean isForVpc) {
313325
this.name = name;
314326
this.displayText = displayText;
315327
this.rateMbps = rateMbps;
@@ -335,12 +347,13 @@ public NetworkOfferingVO(String name, String displayText, TrafficType trafficTyp
335347
this.isPersistent = isPersistent;
336348
this.publicLb = publicLb;
337349
this.internalLb = internalLb;
350+
this.forVpc = isForVpc;
338351
}
339352

340353
public NetworkOfferingVO(String name, String displayText, TrafficType trafficType, boolean systemOnly, boolean specifyVlan, Integer rateMbps,
341354
Integer multicastRateMbps, boolean isDefault, Availability availability, String tags, Network.GuestType guestType, boolean conserveMode, boolean dedicatedLb,
342355
boolean sharedSourceNat, boolean redundantRouter, boolean elasticIp, boolean elasticLb, boolean specifyIpRanges, boolean inline, boolean isPersistent,
343-
boolean associatePublicIP, boolean publicLb, boolean internalLb, boolean egressdefaultpolicy, boolean supportsStrechedL2, boolean supportsPublicAccess) {
356+
boolean associatePublicIP, boolean publicLb, boolean internalLb, boolean isForVpc, boolean egressdefaultpolicy, boolean supportsStrechedL2, boolean supportsPublicAccess) {
344357
this(name,
345358
displayText,
346359
trafficType,
@@ -356,7 +369,7 @@ public NetworkOfferingVO(String name, String displayText, TrafficType trafficTyp
356369
specifyIpRanges,
357370
isPersistent,
358371
internalLb,
359-
publicLb);
372+
publicLb, isForVpc);
360373
this.dedicatedLB = dedicatedLb;
361374
this.sharedSourceNat = sharedSourceNat;
362375
this.redundantRouter = redundantRouter;
@@ -381,7 +394,7 @@ public NetworkOfferingVO() {
381394
* TODO
382395
*/
383396
public NetworkOfferingVO(String name, TrafficType trafficType, boolean specifyIpRanges) {
384-
this(name, "System Offering for " + name, trafficType, true, false, 0, 0, true, Availability.Required, null, null, true, specifyIpRanges, false, false, false);
397+
this(name, "System Offering for " + name, trafficType, true, false, 0, 0, true, Availability.Required, null, null, true, specifyIpRanges, false, false, false, false);
385398
this.state = State.Enabled;
386399
}
387400

@@ -401,6 +414,7 @@ public NetworkOfferingVO(String name, Network.GuestType guestType) {
401414
false,
402415
false,
403416
false,
417+
false,
404418
false);
405419
this.state = State.Enabled;
406420
}

plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/ContrailManagerImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ private NetworkOffering locatePublicNetworkOffering(String offeringName,
219219
ConfigurationManager configMgr = (ConfigurationManager) _configService;
220220
NetworkOfferingVO voffer = configMgr.createNetworkOffering(offeringName, offeringDisplayText,
221221
TrafficType.Public, null, true, Availability.Optional, null, serviceProviderMap, true,
222-
Network.GuestType.Shared, false, null, false, null, true, false, null, true, null, false);
222+
Network.GuestType.Shared, false, null, false, null, true, false, null, true, null, false, false);
223223

224224
voffer.setState(NetworkOffering.State.Enabled);
225225
long id = voffer.getId();
@@ -256,7 +256,7 @@ private NetworkOffering locateNetworkOffering(String offeringName,
256256
ConfigurationManager configMgr = (ConfigurationManager)_configService;
257257
NetworkOfferingVO voffer =
258258
configMgr.createNetworkOffering(offeringName, offeringDisplayText, TrafficType.Guest, null, false, Availability.Optional, null, serviceProviderMap, true,
259-
Network.GuestType.Isolated, false, null, false, null, false, true, null, true, null, false);
259+
Network.GuestType.Isolated, false, null, false, null, false, true, null, true, null, false, offeringName.equals(vpcRouterOfferingName));
260260

261261
voffer.setState(NetworkOffering.State.Enabled);
262262
if (offeringName.equals(vpcRouterOfferingName)) {

plugins/network-elements/nuage-vsp/src/com/cloud/network/manager/NuageVspManagerImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,8 @@ public void doInTransactionWithoutResult(TransactionStatus status) {
10261026
if (sharedNetworkOfferingWithSG == null) {
10271027
NetworkOfferingVO defaultNuageVspSharedSGNetworkOffering =
10281028
new NetworkOfferingVO(nuageVspSharedNetworkOfferingWithSGServiceName, "Offering for NuageVsp Shared Security group enabled networks",
1029-
Networks.TrafficType.Guest, false, false, null, null, true, NetworkOffering.Availability.Optional, null, Network.GuestType.Shared, true, true, false, false, false);
1029+
Networks.TrafficType.Guest, false, false, null, null, true, NetworkOffering.Availability.Optional, null, Network.GuestType.Shared, true, true, false, false, false,
1030+
false);
10301031

10311032
defaultNuageVspSharedSGNetworkOffering.setState(NetworkOffering.State.Enabled);
10321033
defaultNuageVspSharedSGNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(defaultNuageVspSharedSGNetworkOffering);

0 commit comments

Comments
 (0)