_networkOfferingDao.update(id, voffer);
return _networkOfferingDao.findById(id);
}
private VpcOffering locateVpcOffering() {
VpcOffering vpcOffer = _vpcOffDao.findByUniqueName(juniperVPCOfferingName);
if (vpcOffer != null) {
if (((VpcOfferingVO)vpcOffer).getState() == VpcOffering.State.Enabled) {
return vpcOffer;
}
((VpcOfferingVO)vpcOffer).setState(VpcOffering.State.Enabled);
long id = vpcOffer.getId();
_vpcOffDao.update(id, (VpcOfferingVO)vpcOffer);
return vpcOffer;
}
Map<String, List<String>> serviceProviderMap = new HashMap<String, List<String>>();
List<String> providerSet = new ArrayList<String>();
providerSet.add(Provider.JuniperContrailVpcRouter.getName());
final List<String> services = new ArrayList<String>();
services.add(Service.Connectivity.getName());
services.add(Service.Dhcp.getName());
services.add(Service.NetworkACL.getName());
services.add(Service.StaticNat.getName());
services.add(Service.SourceNat.getName());
services.add(Service.Gateway.getName());
services.add(Service.Lb.getName());
for (String svc: services) {
if (svc.equals(Service.Lb.getName())) {
List<String> lbProviderSet = new ArrayList<String>();
lbProviderSet.add(Provider.InternalLbVm.getName());
serviceProviderMap.put(svc, lbProviderSet);
continue;
}
serviceProviderMap.put(svc, providerSet);
}
vpcOffer = _vpcProvSvc.createVpcOffering(juniperVPCOfferingName, juniperVPCOfferingDisplayText, services, serviceProviderMap, null, null);
((VpcOfferingVO)vpcOffer).setState(VpcOffering.State.Enabled);
long id = vpcOffer.getId();
_vpcOffDao.update(id, (VpcOfferingVO)vpcOffer);
return _vpcOffDao.findById(id);
}