Search in sources :

Example 1 with 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 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;
}
Also used : Uint8(org.opendaylight.yangtools.yang.common.Uint8) ProtocolIpsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.group.ipv4.flowspec.flowspec.type.protocol.ip._case.ProtocolIpsBuilder) ProtocolIps(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) ArrayList(java.util.ArrayList) UnkeyedListEntryNode(org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode)

Example 2 with 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;
}
Also used : NumericOperand(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.NumericOperand) ProtocolIpsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.group.ipv4.flowspec.flowspec.type.protocol.ip._case.ProtocolIpsBuilder) ProtocolIps(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) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)2 ProtocolIps (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)2 ProtocolIpsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.group.ipv4.flowspec.flowspec.type.protocol.ip._case.ProtocolIpsBuilder)2 NumericOperand (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.NumericOperand)1 Uint8 (org.opendaylight.yangtools.yang.common.Uint8)1 UnkeyedListEntryNode (org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode)1