use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborStateAugmentation in project bgpcep by opendaylight.
the class NeighborUtil method buildCapabilityState.
/**
* Builds Neighbor State containing Capabilities State, session State.
*
* @return Neighbor State
*/
public static NeighborStateAugmentation buildCapabilityState(@Nonnull final BGPSessionState neighbor) {
final List<Class<? extends BgpCapability>> supportedCapabilities = buildSupportedCapabilities(neighbor);
SessionState sessionState = null;
switch(neighbor.getSessionState()) {
case IDLE:
sessionState = SessionState.IDLE;
break;
case UP:
sessionState = SessionState.ESTABLISHED;
break;
case OPEN_CONFIRM:
sessionState = SessionState.OPENCONFIRM;
break;
default:
}
return new NeighborStateAugmentationBuilder().setSupportedCapabilities(supportedCapabilities).setSessionState(sessionState).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborStateAugmentation 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);
}
Aggregations