private VtnImpl(VtnBuilder base) { if (base.getKey() == null) { this._key = new VtnKey( base.getName() ); this._name = base.getName(); } else { this._key = base.getKey(); this._name = _key.getName(); } this._vbridge = base.getVbridge(); this._vtenantConfig = base.getVtenantConfig(); this._vterminal = base.getVterminal(); this._vtnInputFilter = base.getVtnInputFilter(); this._vtnPathMaps = base.getVtnPathMaps(); switch (base.augmentation.size()) { case 0: this.augmentation = Collections.emptyMap(); break; case 1: final Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.rev150328.vtns.Vtn>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.rev150328.vtns.Vtn>> e = base.augmentation.entrySet().iterator().next(); this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.rev150328.vtns.Vtn>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.rev150328.vtns.Vtn>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }
public VtnBuilder addAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.rev150328.vtns.Vtn>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.rev150328.vtns.Vtn> augmentation) { if (augmentation == null) { return removeAugmentation(augmentationType); } if (!(this.augmentation instanceof HashMap)) { this.augmentation = new HashMap<>(); } this.augmentation.put(augmentationType, augmentation); return this; }
/** * Create a new VTN. * * @param ctx A runtime context for transaction task. * @param ident The identifier for the new VTN. * @param cfg The configuration for the new VTN. * @throws VTNException An error occurred. */ @Override protected void create(TxContext ctx, VTenantIdentifier ident, VtenantConfig cfg) throws VTNException { // Create a new VTN. Vtn vtn = new VtnBuilder(). setName(ident.getTenantName()). setVtenantConfig(cfg). build(); ReadWriteTransaction tx = ctx.getReadWriteTransaction(); LogicalDatastoreType oper = LogicalDatastoreType.OPERATIONAL; tx.put(oper, ident.getIdentifier(), vtn, true); // Prepare a list of MAC address tables for a new VTN. InstanceIdentifier<TenantMacTable> mpath = getTenantMacTablePath(ident); TenantMacTable mtable = new TenantMacTableBuilder(). setName(ident.getTenantNameString()). build(); tx.put(oper, mpath, mtable, true); }
build(); VtnBuilder builder = new VtnBuilder(). setName(getName()). setVtenantConfig(vtconf); List<VtnFlowFilter> vflist = toVtnFlowFilterList(xlogger, getIdentifier(), inputFilters, false); VtnInputFilter in = new VtnInputFilterBuilder(). setVtnFlowFilter(vflist).build(); builder.setVtnInputFilter(in);
return builder.build();