use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.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.getValue()) {
final DestinationPortsBuilder destPortsBuilder = new DestinationPortsBuilder();
final Optional<DataContainerChild<? extends PathArgument, ?>> opValue = node.getChild(OP_NID);
if (opValue.isPresent()) {
destPortsBuilder.setOp(NumericTwoByteOperandParser.INSTANCE.create((Set<String>) opValue.get().getValue()));
}
final Optional<DataContainerChild<? extends PathArgument, ?>> valueNode = node.getChild(VALUE_NID);
if (valueNode.isPresent()) {
destPortsBuilder.setValue((Integer) valueNode.get().getValue());
}
destinationPorts.add(destPortsBuilder.build());
}
return destinationPorts;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.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(ByteArray.bytesToInt(ByteArray.readBytes(nlri, length)));
end = op.isEndOfList();
ports.add(builder.build());
}
return ports;
}
Aggregations