Search in sources :

Example 1 with LeafSetNode

use of org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode in project bgpcep by opendaylight.

the class BestPathStateImpl method extractAsList.

private static List<AsNumber> extractAsList(final UnkeyedListEntryNode segment, final NodeIdentifier nid) {
    final List<AsNumber> ases = new ArrayList<>();
    final Optional<NormalizedNode> maybeAsList = NormalizedNodes.findNode(segment, nid);
    if (maybeAsList.isPresent()) {
        final LeafSetNode<?> list = (LeafSetNode<?>) maybeAsList.get();
        for (final LeafSetEntryNode<?> as : list.body()) {
            ases.add(new AsNumber((Uint32) as.body()));
        }
        return ases;
    }
    return null;
}
Also used : ArrayList(java.util.ArrayList) NormalizedNode(org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode) AsNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber) LeafSetNode(org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode) Uint32(org.opendaylight.yangtools.yang.common.Uint32)

Aggregations

ArrayList (java.util.ArrayList)1 AsNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber)1 Uint32 (org.opendaylight.yangtools.yang.common.Uint32)1 LeafSetNode (org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode)1 NormalizedNode (org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode)1