Search in sources :

Example 1 with NeighborStateAugmentation

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.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.rev180329.network.instance.protocol.NeighborStateAugmentationBuilder) BgpNeighborStateAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.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.rev180329.network.instance.protocol.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.augmentation(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().nonnullAfiSafi().values(), table);
    table.print(stream);
}
Also used : ShellTable(org.apache.karaf.shell.support.table.ShellTable) State(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.State) BgpNeighborStateAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.BgpNeighborStateAugmentation) NeighborStateAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.NeighborStateAugmentation)

Aggregations

ShellTable (org.apache.karaf.shell.support.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.rev180329.network.instance.protocol.BgpNeighborStateAugmentation)1 BgpNeighborStateAugmentationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.BgpNeighborStateAugmentationBuilder)1 NeighborStateAugmentation (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.NeighborStateAugmentation)1 NeighborStateAugmentationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.NeighborStateAugmentationBuilder)1