public NshMapBuilder setMappedNsp(final Long value) { if (value != null) { checkMappedNspRange(value); } this._mappedNsp = value; return this; }
public NshMapBuilder setNsi(final Short value) { if (value != null) { checkNsiRange(value); } this._nsi = value; return this; } private static void checkNspRange(final long value) {
public NshMapBuilder setMappedNsi(final Short value) { if (value != null) { checkMappedNsiRange(value); } this._mappedNsi = value; return this; } private static void checkMappedNspRange(final long value) {
public NshMapBuilder(NshMap base) { if (base.key() == null) { this.key = new NshMapKey( base.getName() ); this._name = base.getName(); } else { this.key = base.key(); this._name = key.getName(); } this._encapIfName = base.getEncapIfName(); this._encapType = base.getEncapType(); this._mappedNsi = base.getMappedNsi(); this._mappedNsp = base.getMappedNsp(); this._nshAction = base.getNshAction(); 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<NshMap> casted =(AugmentationHolder<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(_mappedNsi, other.getMappedNsi())) { return false; if (!Objects.equals(_mappedNsp, other.getMappedNsp())) { return false; if (!Objects.equals(_name, other.getName())) { return false; if (!Objects.equals(_nshAction, other.getNshAction())) { return false; if (!Objects.equals(_nsi, other.getNsi())) { return false; if (!Objects.equals(_nsp, other.getNsp())) { return false; if (!e.getValue().equals(other.augmentation(e.getKey()))) { return false;
private NshMapImpl(NshMapBuilder base) { if (base.key() == null) { this.key = new NshMapKey( base.getName() ); this._name = base.getName(); } else { this.key = base.key(); this._name = key.getName(); } this._encapIfName = base.getEncapIfName(); this._encapType = base.getEncapType(); this._mappedNsi = base.getMappedNsi(); this._mappedNsp = base.getMappedNsp(); this._nshAction = base.getNshAction(); this._nsi = base.getNsi(); this._nsp = base.getNsp(); this.augmentation = ImmutableMap.copyOf(base.augmentation); }
request.isAdd = booleanToByte(isAdd); request.nspNsi = (map.getNsp().intValue() << 8) | map.getNsi(); request.mappedNspNsi = (map.getMappedNsp().intValue() << 8) | map.getMappedNsi(); if (map.getNshAction() == Swap.class) { request.nshAction = 0; } else if (map.getNshAction() == Push.class) { request.nshAction = 1; } else if (map.getNshAction() == Pop.class) { request.nshAction = 2; if (map.getEncapType() == VxlanGpe.class) { request.nextNode = 2; } else if (map.getEncapType() == Vxlan4.class) { request.nextNode = 3; } else if (map.getEncapType() == Vxlan6.class) { request.nextNode = 4; } else if (map.getEncapType() == None.class) { request.nextNode = 5; if (map.getEncapType() != None.class) { 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);
@Override public Initialized<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev170315.vpp.nsh.nsh.maps.NshMap> init( @Nonnull final InstanceIdentifier<NshMap> id, @Nonnull final NshMap readValue, @Nonnull final ReadContext ctx) { return Initialized.create( InstanceIdentifier.create(VppNsh.class).child( org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev170315.vpp.nsh.NshMaps.class).child( org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev170315.vpp.nsh.nsh.maps.NshMap.class, new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev170315.vpp.nsh.nsh.maps.NshMapKey(id.firstKeyOf(NshMap.class).getName())), new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev170315.vpp.nsh.nsh.maps.NshMapBuilder(readValue).setName(readValue.getName()).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); 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); }
@Override public NshMap build() { return new NshMapImpl(this); }
public NshMapBuilder setNsp(final Long value) { if (value != null) { checkNspRange(value); } this._nsp = value; return this; }
public NshMapBuilder addAugmentation(Class<? extends Augmentation<NshMap>> augmentationType, Augmentation<NshMap> augmentationValue) { if (augmentationValue == null) { return removeAugmentation(augmentationType); } if (!(this.augmentation instanceof HashMap)) { this.augmentation = new HashMap<>(); } this.augmentation.put(augmentationType, augmentationValue); 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()); 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); }