use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.group.ipv4.flowspec.flowspec.type.protocol.ip._case.ProtocolIps in project bgpcep by opendaylight.
the class FlowspecIpv4NlriParserHelper method createProtocolsIps.
private static List<ProtocolIps> createProtocolsIps(final UnkeyedListNode protocolIpsData) {
final List<ProtocolIps> protocolIps = new ArrayList<>();
for (final UnkeyedListEntryNode node : protocolIpsData.body()) {
final ProtocolIpsBuilder ipsBuilder = new ProtocolIpsBuilder();
node.findChildByArg(AbstractFlowspecNlriParser.OP_NID).ifPresent(dataContainerChild -> ipsBuilder.setOp(NumericOneByteOperandParser.INSTANCE.create((Set<String>) dataContainerChild.body())));
node.findChildByArg(AbstractFlowspecNlriParser.VALUE_NID).ifPresent(dataContainerChild -> ipsBuilder.setValue((Uint8) dataContainerChild.body()));
protocolIps.add(ipsBuilder.build());
}
return protocolIps;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.group.ipv4.flowspec.flowspec.type.protocol.ip._case.ProtocolIps in project bgpcep by opendaylight.
the class FSIpProtocolHandler method parseProtocolIp.
private static List<ProtocolIps> parseProtocolIp(final ByteBuf nlri) {
final List<ProtocolIps> ips = new ArrayList<>();
boolean end = false;
// we can do this as all fields will be rewritten in the cycle
final ProtocolIpsBuilder builder = new ProtocolIpsBuilder();
while (!end) {
final byte b = nlri.readByte();
final NumericOperand op = NumericOneByteOperandParser.INSTANCE.parse(b);
builder.setOp(op);
builder.setValue(ByteBufUtils.readUint8(nlri));
end = op.getEndOfList();
ips.add(builder.build());
}
return ips;
}
Aggregations