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