2 * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.protocol.bgp.mode;
10 import java.util.List;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.attributes.as.path.Segments;
13 public final class BesthPathStateUtil {
14 private BesthPathStateUtil() {
15 throw new UnsupportedOperationException();
18 public static long getPeerAs(final List<Segments> segments) {
19 for (final Segments seg : segments) {
20 if (seg.getAsSequence() != null && !seg.getAsSequence().isEmpty()) {
21 return segments.get(0).getAsSequence().get(0).getValue();