Search in sources :

Example 1 with NeighborStateAugmentation

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();
}
Also used : BGPSessionState(org.opendaylight.protocol.bgp.rib.spi.state.BGPSessionState) SessionState(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.operational.rev151009.BgpNeighborState.SessionState) NeighborStateAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborStateAugmentationBuilder) BgpNeighborStateAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.BgpNeighborStateAugmentationBuilder) BgpCapability(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.BgpCapability)

Example 2 with NeighborStateAugmentation

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);
}
Also used : ShellTable(org.apache.karaf.shell.table.ShellTable) State(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.State) NeighborStateAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborStateAugmentation) BgpNeighborStateAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.BgpNeighborStateAugmentation)

Aggregations

ShellTable (org.apache.karaf.shell.table.ShellTable)1 BGPSessionState (org.opendaylight.protocol.bgp.rib.spi.state.BGPSessionState)1 SessionState (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.operational.rev151009.BgpNeighborState.SessionState)1 State (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.State)1 BgpCapability (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.BgpCapability)1 BgpNeighborStateAugmentation (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.BgpNeighborStateAugmentation)1 BgpNeighborStateAugmentationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.BgpNeighborStateAugmentationBuilder)1 NeighborStateAugmentation (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborStateAugmentation)1 NeighborStateAugmentationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborStateAugmentationBuilder)1