public NshMapBuilder setNsp(final java.lang.Long value) { if (value != null) { checkNspRange(value); } this._nsp = value; return this; }
public NshMapBuilder setMappedNsi(final java.lang.Short value) { if (value != null) { checkMappedNsiRange(value); } this._mappedNsi = value; return this; }
public NshMap build() { return new NshMapImpl(this); }
public NshMapBuilder(NshMap base) { if (base.getKey() == null) { this._key = new NshMapKey( base.getName() ); this._name = base.getName(); } else { this._key = base.getKey(); this._name = _key.getName(); } this._encapIfName = base.getEncapIfName(); this._encapType = base.getEncapType(); this._mappedNsi = base.getMappedNsi(); this._mappedNsp = base.getMappedNsp(); this._nsi = base.getNsi(); this._nsp = base.getNsp(); if (base instanceof NshMapImpl) { NshMapImpl impl = (NshMapImpl) 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.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.maps.NshMap> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.maps.NshMap>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
if (!Objects.equals(_encapIfName, other.getEncapIfName())) { return false; if (!Objects.equals(_encapType, other.getEncapType())) { return false; if (!Objects.equals(_key, other.getKey())) { return false; if (!Objects.equals(_mappedNsi, other.getMappedNsi())) { return false; if (!Objects.equals(_mappedNsp, other.getMappedNsp())) { return false; if (!Objects.equals(_name, other.getName())) { return false; if (!Objects.equals(_nsi, other.getNsi())) { return false; if (!Objects.equals(_nsp, other.getNsp())) { return false; if (!e.getValue().equals(other.getAugmentation(e.getKey()))) { return false;
private NshAddDelMap getNshAddDelMapRequest(final boolean isAdd, final int mapIndex, @Nonnull final NshMap map, @Nonnull final MappingContext ctx) { final NshAddDelMap request = new NshAddDelMap(); request.isAdd = booleanToByte(isAdd); request.nspNsi = (map.getNsp().intValue()<<8) | map.getNsi(); request.mappedNspNsi = (map.getMappedNsp().intValue()<<8) | map.getMappedNsi(); if (map.getEncapType() == VxlanGpe.class) { request.nextNode = 2; } checkState(interfaceContext.containsIndex(map.getEncapIfName(), ctx), "Mapping does not contains mapping for provider interface Name ".concat(map.getEncapIfName())); request.swIfIndex = interfaceContext.getIndex(map.getEncapIfName(), ctx); return request; } }
private NshMapImpl(NshMapBuilder base) { if (base.getKey() == null) { this._key = new NshMapKey( base.getName() ); this._name = base.getName(); } else { this._key = base.getKey(); this._name = _key.getName(); } this._encapIfName = base.getEncapIfName(); this._encapType = base.getEncapType(); this._mappedNsi = base.getMappedNsi(); this._mappedNsp = base.getMappedNsp(); this._nsi = base.getNsi(); this._nsp = base.getNsp(); 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.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.maps.NshMap>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.maps.NshMap>> e = base.augmentation.entrySet().iterator().next(); this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.maps.NshMap>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.maps.NshMap>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }
@Override protected VppNsh convert(final VppNshState operationalData) { // Just convert operational data into config data // The operational data are queried from lower layer using readerCustomizers from this plugin LOG.info("Initializing VppNsh config data from: {}", operationalData); VppNshBuilder vppNshBuilder = new VppNshBuilder(); NshEntriesBuilder nshEntriesBuilder = new NshEntriesBuilder() .setNshEntry(operationalData.getNshEntries().getNshEntry().stream() .map(oper -> new NshEntryBuilder(oper).setName(oper.getName()).build()) .collect(Collectors.toList())); vppNshBuilder.setNshEntries(nshEntriesBuilder.build()); NshMapsBuilder nshMapsBuilder = new NshMapsBuilder() .setNshMap(operationalData.getNshMaps().getNshMap().stream() .map(oper -> new NshMapBuilder(oper).setName(oper.getName()).build()) .collect(Collectors.toList())); vppNshBuilder.setNshMaps(nshMapsBuilder.build()); return vppNshBuilder.build(); } }
@Override public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<NshMap> id, @Nonnull final NshMap dataAfter, @Nonnull final WriteContext writeContext) throws WriteFailedException { LOG.debug("Creating nsh map: iid={} dataAfter={}", id, dataAfter); try { final int newMapIndex = nshAddDelMap(true, id, dataAfter, ~0 /* value not present */, writeContext.getMappingContext()); // Add nsh map name <-> vpp index mapping to the naming context: nshMapContext.addName(newMapIndex, dataAfter.getName(), writeContext.getMappingContext()); LOG.debug("Successfully created nsh map(id={]): iid={} dataAfter={}", newMapIndex, id, dataAfter); } catch (VppBaseCallException e) { throw new WriteFailedException.CreateFailedException(id, dataAfter, e); } }
public NshMapBuilder setMappedNsp(final java.lang.Long value) { if (value != null) { checkMappedNspRange(value); } this._mappedNsp = value; return this; }
public NshMapBuilder setNsi(final java.lang.Short value) { if (value != null) { checkNsiRange(value); } this._nsi = value; return this; }
public NshMapBuilder addAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.maps.NshMap>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.maps.NshMap> augmentation) { if (augmentation == null) { return removeAugmentation(augmentationType); } if (!(this.augmentation instanceof HashMap)) { this.augmentation = new HashMap<>(); } this.augmentation.put(augmentationType, augmentation); return this; }
@Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<NshMap> id, @Nonnull final NshMap dataBefore, @Nonnull final WriteContext writeContext) throws WriteFailedException { LOG.debug("Removing nsh map: iid={} dataBefore={}", id, dataBefore); final String mapName = dataBefore.getName(); checkState(nshMapContext.containsIndex(mapName, writeContext.getMappingContext()), "Removing nsh map {}, but index could not be found in the nsh map context", mapName); final int mapIndex = nshMapContext.getIndex(mapName, writeContext.getMappingContext()); try { nshAddDelMap(false, id, dataBefore, mapIndex, writeContext.getMappingContext()); // Remove deleted interface from interface context: nshMapContext.removeName(dataBefore.getName(), writeContext.getMappingContext()); LOG.debug("Successfully removed nsh map(id={]): iid={} dataAfter={}", mapIndex, id, dataBefore); } catch (VppBaseCallException e) { throw new WriteFailedException.DeleteFailedException(id, e); } }