use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.destination.port._case.DestinationPorts in project bgpcep by opendaylight.
the class AbstractFlowspecNlriParser method createDestinationPorts.
private static List<DestinationPorts> createDestinationPorts(final UnkeyedListNode destinationPortsData) {
final List<DestinationPorts> destinationPorts = new ArrayList<>();
for (final UnkeyedListEntryNode node : destinationPortsData.body()) {
final DestinationPortsBuilder destPortsBuilder = new DestinationPortsBuilder();
node.findChildByArg(OP_NID).ifPresent(dataContainerChild -> destPortsBuilder.setOp(NumericTwoByteOperandParser.INSTANCE.create((Set<String>) dataContainerChild.body())));
node.findChildByArg(VALUE_NID).ifPresent(dataContainerChild -> destPortsBuilder.setValue((Uint16) dataContainerChild.body()));
destinationPorts.add(destPortsBuilder.build());
}
return destinationPorts;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.destination.port._case.DestinationPorts in project bgpcep by opendaylight.
the class FSDestinationPortHandler method parseDestinationPort.
private static List<DestinationPorts> parseDestinationPort(final ByteBuf nlri) {
final List<DestinationPorts> ports = new ArrayList<>();
boolean end = false;
// we can do this as all fields will be rewritten in the cycle
final DestinationPortsBuilder builder = new DestinationPortsBuilder();
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