use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Metadata in project openflowplugin by opendaylight.
the class OpenflowPluginBulkTransactionProvider method createMetadataMatch.
private static MatchBuilder createMetadataMatch() {
MatchBuilder match = new MatchBuilder();
// metadata match
MetadataBuilder metadata = new MetadataBuilder();
metadata.setMetadata(BigInteger.valueOf(500L));
// metadata.setMetadataMask(metamask);
match.setMetadata(metadata.build());
return match;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Metadata in project openflowplugin by opendaylight.
the class OfToSalMetadataCase method process.
@Override
public Optional<MatchBuilder> process(@Nonnull MetadataCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final MetadataBuilder metadataBuilder = new MetadataBuilder();
final Metadata metadata = source.getMetadata();
if (metadata != null) {
metadataBuilder.setMetadata(new BigInteger(OFConstants.SIGNUM_UNSIGNED, metadata.getMetadata()));
byte[] metadataMask = metadata.getMask();
if (metadataMask != null) {
metadataBuilder.setMetadataMask(new BigInteger(OFConstants.SIGNUM_UNSIGNED, metadataMask));
}
matchBuilder.setMetadata(metadataBuilder.build());
}
return Optional.of(matchBuilder);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Metadata in project bgpcep by opendaylight.
the class AbstractTopologySessionListener method updateLsp.
/**
* Update an LSP in the data store.
*
* @param ctx Message context
* @param id Revision-specific LSP identifier
* @param lspName LSP name
* @param rlb Reported LSP builder
* @param solicited True if the update was solicited
* @param remove True if this is an LSP path removal
*/
protected final synchronized void updateLsp(final MessageContext ctx, final L id, final String lspName, final ReportedLspBuilder rlb, final boolean solicited, final boolean remove) {
final String name;
if (lspName == null) {
name = this.lsps.get(id);
if (name == null) {
LOG.error("PLSPID {} seen for the first time, not reporting the LSP", id);
return;
}
} else {
name = lspName;
}
LOG.debug("Saved LSP {} with name {}", id, name);
this.lsps.put(id, name);
final ReportedLsp previous = this.lspData.get(name);
// if no previous report about the lsp exist, just proceed
if (previous != null) {
final List<Path> updatedPaths = makeBeforeBreak(rlb, previous, name, remove);
// if all paths or the last path were deleted, delete whole tunnel
if (updatedPaths.isEmpty()) {
LOG.debug("All paths were removed, removing LSP with {}.", id);
removeLsp(ctx, id);
return;
}
rlb.setPath(updatedPaths);
}
rlb.setKey(new ReportedLspKey(name));
rlb.setName(name);
// If this is an unsolicited update. We need to make sure we retain the metadata already present
if (solicited) {
this.nodeState.setLspMetadata(name, rlb.getMetadata());
} else {
rlb.setMetadata(this.nodeState.getLspMetadata(name));
}
final ReportedLsp rl = rlb.build();
ctx.trans.put(LogicalDatastoreType.OPERATIONAL, this.pccIdentifier.child(ReportedLsp.class, rlb.getKey()), rl);
LOG.debug("LSP {} updated to MD-SAL", name);
this.lspData.put(name, rl);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Metadata in project openflowplugin by opendaylight.
the class MetadataEntryDeserializer method deserializeEntry.
@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
final boolean hasMask = processHeader(message);
final Metadata metadata = builder.getMetadata();
final byte[] metaByte = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
message.readBytes(metaByte);
final MetadataBuilder metadataBuilder = new MetadataBuilder().setMetadata(new BigInteger(1, metaByte));
if (hasMask) {
final byte[] metaMask = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
message.readBytes(metaMask);
metadataBuilder.setMetadataMask(new BigInteger(1, metaMask));
}
if (Objects.isNull(metadata)) {
builder.setMetadata(metadataBuilder.build());
} else {
throwErrorOnMalformed(builder, "metadata");
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Metadata in project openflowplugin by opendaylight.
the class OpenflowpluginTestCommandProvider method createMetadataMatch.
private static MatchBuilder createMetadataMatch() {
final MatchBuilder match = new MatchBuilder();
final byte[] metamask = new byte[] { (byte) -1, (byte) -1, (byte) -1, 0, 0, 0, (byte) 1, (byte) 1 };
// metadata match
final MetadataBuilder metadata = new MetadataBuilder();
metadata.setMetadata(BigInteger.valueOf(500L));
metadata.setMetadataMask(new BigInteger(1, metamask));
match.setMetadata(metadata.build());
return match;
}
Aggregations