use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.State in project bgpcep by opendaylight.
the class NeighborStateCliUtils method printMessagesState.
private static void printMessagesState(final State neighborState, final ShellTable table) {
final BgpNeighborStateAugmentation state = neighborState.getAugmentation(BgpNeighborStateAugmentation.class);
if (state == null) {
return;
}
addHeader(table, "Messages state");
final Messages messages = state.getMessages();
table.addRow().addContent("Messages Received", "");
final Received received = messages.getReceived();
table.addRow().addContent("NOTIFICATION", received.getNOTIFICATION());
table.addRow().addContent("UPDATE", received.getUPDATE());
final Sent sent = messages.getSent();
table.addRow().addContent("Messages Sent", "");
table.addRow().addContent("NOTIFICATION", sent.getNOTIFICATION());
table.addRow().addContent("UPDATE", sent.getUPDATE());
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.State in project bgpcep by opendaylight.
the class NeighborStateCliUtils method printAfiSafiState.
private static void printAfiSafiState(final AfiSafi afiSafi, final ShellTable table) {
final NeighborAfiSafiStateAugmentation state = afiSafi.getState().getAugmentation(NeighborAfiSafiStateAugmentation.class);
addHeader(table, "AFI state");
table.addRow().addContent("Family", afiSafi.getAfiSafiName().getSimpleName());
table.addRow().addContent("Active", state.isActive());
final Prefixes prefixes = state.getPrefixes();
if (prefixes == null) {
return;
}
table.addRow().addContent("Prefixes", "");
table.addRow().addContent("Installed", prefixes.getInstalled());
table.addRow().addContent("Sent", prefixes.getSent());
table.addRow().addContent("Received", prefixes.getReceived());
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.State in project bgpcep by opendaylight.
the class NeighborStateCliUtils method printTransportState.
private static void printTransportState(final Transport transport, final ShellTable table) {
if (transport == null) {
return;
}
final NeighborTransportStateAugmentation state = transport.getState().getAugmentation(NeighborTransportStateAugmentation.class);
if (state == null) {
return;
}
addHeader(table, "Transport state");
final IpAddress remoteAddress = state.getRemoteAddress();
final String stringRemoteAddress;
if (remoteAddress.getIpv4Address() == null) {
stringRemoteAddress = remoteAddress.getIpv6Address().getValue();
} else {
stringRemoteAddress = remoteAddress.getIpv4Address().getValue();
}
table.addRow().addContent("Remote Address", stringRemoteAddress);
table.addRow().addContent("Remote Port", state.getRemotePort().getValue());
table.addRow().addContent("Local Port", state.getLocalPort().getValue());
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.State in project bgpcep by opendaylight.
the class NeighborStateCliUtils method displayNeighborOperationalState.
static void displayNeighborOperationalState(@NonNull final String neighborId, @NonNull final Neighbor neighbor, @NonNull final PrintStream stream) {
final State neighborState = neighbor.getState();
if (neighborState == null) {
stream.println(String.format("No BgpSessionState found for [%s]", neighborId));
return;
}
final ShellTable table = new ShellTable();
table.column("Attribute").alignLeft();
table.column("Value").alignLeft();
table.addRow().addContent("Neighbor Address", neighborId);
final NeighborStateAugmentation stateAug = neighborState.getAugmentation(NeighborStateAugmentation.class);
if (stateAug != null) {
table.addRow().addContent("Session State", stateAug.getSessionState());
printCapabilitiesState(stateAug.getSupportedCapabilities(), table);
}
printTimerState(neighbor.getTimers(), table);
printTransportState(neighbor.getTransport(), table);
printMessagesState(neighborState, table);
printAfiSafisState(neighbor.getAfiSafis().getAfiSafi(), table);
table.print(stream);
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.State in project bgpcep by opendaylight.
the class AbstractAllPathsRouteEntry method selectBest.
@Override
public final boolean selectBest(final long localAs) {
final List<AddPathBestPath> newBestPathList = new ArrayList<>();
final List<RouteKey> keyList = this.offsets.getRouteKeysList();
if (!keyList.isEmpty()) {
/* we set the best path first on List for not supported Add path cases*/
final AddPathBestPath newBest = selectBest(localAs, keyList);
newBestPathList.add(newBest);
keyList.remove(newBest.getRouteKey());
/*we add the rest of path, regardless in what order they are, since this is all path case */
for (final RouteKey key : keyList) {
final int offset = this.offsets.offsetOf(key);
final Attributes attributes = this.offsets.getValue(this.values, offset);
requireNonNull(key.getRouteId(), "Router ID may not be null");
if (attributes != null) {
final BestPathState state = new BestPathStateImpl(attributes);
final AddPathBestPath bestPath = new AddPathBestPath(state, key, offset, this.offsets.getValue(this.pathsId, offset));
newBestPathList.add(bestPath);
}
}
}
return isBestPathNew(ImmutableList.copyOf(newBestPathList));
}
Aggregations