use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.source.port._case.SourcePorts in project bgpcep by opendaylight.
the class AbstractFlowspecNlriParser method createSourcePorts.
private static List<SourcePorts> createSourcePorts(final UnkeyedListNode sourcePortsData) {
final List<SourcePorts> sourcePorts = new ArrayList<>();
for (final UnkeyedListEntryNode node : sourcePortsData.body()) {
final SourcePortsBuilder sourcePortsBuilder = new SourcePortsBuilder();
node.findChildByArg(OP_NID).ifPresent(dataContainerChild -> sourcePortsBuilder.setOp(NumericTwoByteOperandParser.INSTANCE.create((Set<String>) dataContainerChild.body())));
node.findChildByArg(VALUE_NID).ifPresent(dataContainerChild -> sourcePortsBuilder.setValue((Uint16) dataContainerChild.body()));
sourcePorts.add(sourcePortsBuilder.build());
}
return sourcePorts;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.source.port._case.SourcePorts in project bgpcep by opendaylight.
the class FSSourcePortHandler method parseSourcePort.
private static List<SourcePorts> parseSourcePort(final ByteBuf nlri) {
final List<SourcePorts> ports = new ArrayList<>();
boolean end = false;
// we can do this as all fields will be rewritten in the cycle
final SourcePortsBuilder builder = new SourcePortsBuilder();
while (!end) {
final byte b = nlri.readByte();
final NumericOperand op = NumericOneByteOperandParser.INSTANCE.parse(b);
builder.setOp(op);
final short length = AbstractOperandParser.parseLength(b);
builder.setValue(Uint16.valueOf(ByteArray.bytesToInt(ByteArray.readBytes(nlri, length))));
end = op.getEndOfList();
ports.add(builder.build());
}
return ports;
}
Aggregations