Search in sources :

Example 6 with Uint8

use of org.opendaylight.yangtools.yang.common.Uint8 in project bgpcep by opendaylight.

the class PCEPNoPathObjectParser method parseObject.

@Override
public NoPath parseObject(final ObjectHeader header, final ByteBuf bytes) throws PCEPDeserializerException {
    checkArgument(bytes != null && bytes.isReadable(), "Array of bytes is mandatory. Cannot be null or empty.");
    final Uint8 issue = ByteBufUtils.readUint8(bytes);
    final BitArray flags = BitArray.valueOf(bytes, FLAGS_SIZE);
    bytes.skipBytes(RESERVED_F_LENGTH);
    final TlvsBuilder tlvsBuilder = new TlvsBuilder();
    parseTlvs(tlvsBuilder, bytes.slice());
    return new NoPathBuilder().setIgnore(header.getIgnore()).setProcessingRule(header.getProcessingRule()).setNatureOfIssue(issue).setUnsatisfiedConstraints(flags.get(C_FLAG_OFFSET)).setTlvs(tlvsBuilder.build()).build();
}
Also used : Uint8(org.opendaylight.yangtools.yang.common.Uint8) NoPathBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcrep.message.pcrep.message.replies.result.failure._case.NoPathBuilder) TlvsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcrep.message.pcrep.message.replies.result.failure._case.no.path.TlvsBuilder) BitArray(org.opendaylight.protocol.util.BitArray)

Example 7 with Uint8

use of org.opendaylight.yangtools.yang.common.Uint8 in project bgpcep by opendaylight.

the class SimpleAttributeRegistry method processUnrecognized.

private void processUnrecognized(final BitArray flags, final int type, final ByteBuf buffer, final int len) throws BGPDocumentedException {
    if (!flags.get(OPTIONAL_BIT)) {
        throw new BGPDocumentedException("Well known attribute not recognized.", BGPError.WELL_KNOWN_ATTR_NOT_RECOGNIZED);
    }
    final Uint8 typeVal = Uint8.valueOf(type);
    final UnrecognizedAttributes unrecognizedAttribute = new UnrecognizedAttributesBuilder().withKey(new UnrecognizedAttributesKey(typeVal)).setPartial(flags.get(PARTIAL_BIT)).setTransitive(flags.get(TRANSITIVE_BIT)).setType(typeVal).setValue(ByteArray.readBytes(buffer, len)).build();
    this.unrecognizedAttributes.add(unrecognizedAttribute);
    LOG.debug("Unrecognized attribute were parsed: {}", unrecognizedAttribute);
}
Also used : Uint8(org.opendaylight.yangtools.yang.common.Uint8) BGPDocumentedException(org.opendaylight.protocol.bgp.parser.BGPDocumentedException) UnrecognizedAttributesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.UnrecognizedAttributesKey) UnrecognizedAttributesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.UnrecognizedAttributesBuilder) UnrecognizedAttributes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.UnrecognizedAttributes)

Example 8 with Uint8

use of org.opendaylight.yangtools.yang.common.Uint8 in project bgpcep by opendaylight.

the class PCEPCloseObjectParser method parseObject.

@Override
public CClose parseObject(final ObjectHeader header, final ByteBuf bytes) throws PCEPDeserializerException {
    checkArgument(bytes != null && bytes.isReadable(), "Array of bytes is mandatory. Cannot be null or empty.");
    bytes.skipBytes(FLAGS_F_LENGTH + RESERVED);
    final Uint8 reason = ByteBufUtils.readUint8(bytes);
    final TlvsBuilder tlvsBuilder = new TlvsBuilder();
    parseTlvs(tlvsBuilder, bytes.slice());
    return new CCloseBuilder().setIgnore(header.getIgnore()).setProcessingRule(header.getProcessingRule()).setReason(reason).setTlvs(tlvsBuilder.build()).build();
}
Also used : Uint8(org.opendaylight.yangtools.yang.common.Uint8) TlvsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.close.object.c.close.TlvsBuilder) CCloseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.close.object.CCloseBuilder)

Example 9 with Uint8

use of org.opendaylight.yangtools.yang.common.Uint8 in project bgpcep by opendaylight.

the class AbstractFlowspecNlriParser method createTypes.

private static List<Types> createTypes(final UnkeyedListNode typesData) {
    final List<Types> types = new ArrayList<>();
    for (final UnkeyedListEntryNode node : typesData.body()) {
        final TypesBuilder typesBuilder = new TypesBuilder();
        node.findChildByArg(OP_NID).ifPresent(dataContainerChild -> typesBuilder.setOp(NumericOneByteOperandParser.INSTANCE.create((Set<String>) dataContainerChild.body())));
        node.findChildByArg(VALUE_NID).ifPresent(dataContainerChild -> typesBuilder.setValue((Uint8) dataContainerChild.body()));
        types.add(typesBuilder.build());
    }
    return types;
}
Also used : Types(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.icmp.type._case.Types) Uint8(org.opendaylight.yangtools.yang.common.Uint8) TypesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.icmp.type._case.TypesBuilder) ArrayList(java.util.ArrayList) UnkeyedListEntryNode(org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode)

Example 10 with Uint8

use of org.opendaylight.yangtools.yang.common.Uint8 in project bgpcep by opendaylight.

the class AbstractFlowspecNlriParser method createCodes.

private static List<Codes> createCodes(final UnkeyedListNode codesData) {
    final List<Codes> codes = new ArrayList<>();
    for (final UnkeyedListEntryNode node : codesData.body()) {
        final CodesBuilder codesBuilder = new CodesBuilder();
        node.findChildByArg(OP_NID).ifPresent(dataContainerChild -> codesBuilder.setOp(NumericOneByteOperandParser.INSTANCE.create((Set<String>) dataContainerChild.body())));
        node.findChildByArg(VALUE_NID).ifPresent(dataContainerChild -> codesBuilder.setValue((Uint8) dataContainerChild.body()));
        codes.add(codesBuilder.build());
    }
    return codes;
}
Also used : Uint8(org.opendaylight.yangtools.yang.common.Uint8) Codes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.icmp.code._case.Codes) ArrayList(java.util.ArrayList) UnkeyedListEntryNode(org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode) CodesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.icmp.code._case.CodesBuilder)

Aggregations

Uint8 (org.opendaylight.yangtools.yang.common.Uint8)12 ArrayList (java.util.ArrayList)4 UnkeyedListEntryNode (org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode)4 BGPDocumentedException (org.opendaylight.protocol.bgp.parser.BGPDocumentedException)1 BGPError (org.opendaylight.protocol.bgp.parser.BGPError)1 UnknownObject (org.opendaylight.protocol.pcep.spi.UnknownObject)1 BitArray (org.opendaylight.protocol.util.BitArray)1 Ace (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.Ace)1 AceIp (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.matches.ace.type.AceIp)1 AceIpVersion (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.matches.ace.type.ace.ip.AceIpVersion)1 AceIpv4 (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.matches.ace.type.ace.ip.ace.ip.version.AceIpv4)1 AceIpv6 (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.matches.ace.type.ace.ip.ace.ip.version.AceIpv6)1 Ipv4Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix)1 Ipv6Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix)1 DirectionEgress (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.DirectionEgress)1 SecurityRuleAttr (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.SecurityRuleAttr)1 Codes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.icmp.code._case.Codes)1 CodesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.icmp.code._case.CodesBuilder)1 Types (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.icmp.type._case.Types)1 TypesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.icmp.type._case.TypesBuilder)1