use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.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.getValue()) {
final ProtocolIpsBuilder ipsBuilder = new ProtocolIpsBuilder();
final Optional<DataContainerChild<? extends PathArgument, ?>> opValue = node.getChild(AbstractFlowspecNlriParser.OP_NID);
if (opValue.isPresent()) {
ipsBuilder.setOp(NumericOneByteOperandParser.INSTANCE.create((Set<String>) opValue.get().getValue()));
}
final Optional<DataContainerChild<? extends PathArgument, ?>> valueNode = node.getChild(AbstractFlowspecNlriParser.VALUE_NID);
if (valueNode.isPresent()) {
ipsBuilder.setValue((Short) valueNode.get().getValue());
}
protocolIps.add(ipsBuilder.build());
}
return protocolIps;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.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(nlri.readUnsignedByte());
end = op.isEndOfList();
ips.add(builder.build());
}
return ips;
}
Aggregations