/** * Fetch the VTN name from the given path argument, and set it into * {@code VNodePathConverter} instance. * * @param conv A {@link VNodePathConverter} instance. * @param arg A path argument which contains the VTN name. */ @Override public void fetch(VNodePathConverter conv, PathArgument arg) { @SuppressWarnings("unchecked") IdentifiableItem<Vtn, VtnKey> item = (IdentifiableItem<Vtn, VtnKey>)arg; conv.tenantName = item.getKey().getName(); }
/** * Create a brief description about the path map specified by the given * instance identifier. * * @param path The path to the path map. * @return A brief description about the specified path map. */ private static String getDescription(InstanceIdentifier<VtnPathMap> path) { VtnKey key = path.firstKeyOf(Vtn.class); String desc; if (key == null) { desc = "Global"; } else { VTenantIdentifier vtnId = new VTenantIdentifier(key.getName()); desc = vtnId.toString() + ": VTN"; } return desc; } }
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(Vtn 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(); if (base instanceof VtnImpl) { VtnImpl impl = (VtnImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.rev150328.vtns.Vtn> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.rev150328.vtns.Vtn>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
/** * Return the identifier for the vBridge in the specified data. * * @param data An {@link IdentifiedData} instance. * Note that this must contain a vBridge or a child node * inside vBridge. * @return A {@link VBridgeIdentifier} instance. */ private static VBridgeIdentifier getVBridgeIdentifier( IdentifiedData<?> data) { InstanceIdentifier<?> path = data.getIdentifier(); VnodeName tname = path.firstKeyOf(Vtn.class).getName(); VnodeName bname = path.firstKeyOf(Vbridge.class).getName(); return new VBridgeIdentifier(tname, bname); }
/** * Return a data change listener for the given data. * * <p> * If the virual node specified by {@code data} contains the VTN * configuration, this method marks that VTN as updated. * </p> * * @param ectx A {@link VTenantChange} instance. * @param data A {@link IdentifiedData} instance. * @return A {@link VNodeChangeListener} instance for the given data. */ private VNodeChangeListener<?> getChangeListener( VTenantChange ectx, IdentifiedData<?> data) { InstanceIdentifier<?> path = data.getIdentifier(); Class<?> type = path.getTargetType(); VNodeChangeListener<?> listener = LISTENERS.get(type); if (listener.isConfiguration()) { // The VTN that contains the given data needs to be saved. VtnKey key = path.firstKeyOf(Vtn.class); String name = key.getName().getValue(); ectx.addTargetVtn(name); } return listener; }