Search in sources :

Example 81 with State

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.flow.capable.port.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());
}
Also used : Messages(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.network.instances.network.instance.protocols.protocol.bgp.neighbors.neighbor.state.Messages) Received(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.network.instances.network.instance.protocols.protocol.bgp.neighbors.neighbor.state.messages.Received) BgpNeighborStateAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.BgpNeighborStateAugmentation) Sent(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.network.instances.network.instance.protocols.protocol.bgp.neighbors.neighbor.state.messages.Sent)

Example 82 with State

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.flow.capable.port.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());
}
Also used : NeighborAfiSafiStateAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborAfiSafiStateAugmentation) Prefixes(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.operational.rev151009.bgp.neighbor.prefix.counters_state.Prefixes)

Example 83 with State

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.flow.capable.port.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());
}
Also used : NeighborTransportStateAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborTransportStateAugmentation) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)

Example 84 with State

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.flow.capable.port.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);
}
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)

Example 85 with State

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.flow.capable.port.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));
}
Also used : AddPathBestPath(org.opendaylight.protocol.bgp.mode.impl.add.AddPathBestPath) BestPathState(org.opendaylight.protocol.bgp.mode.api.BestPathState) BestPathStateImpl(org.opendaylight.protocol.bgp.mode.impl.BestPathStateImpl) ArrayList(java.util.ArrayList) Attributes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes) RouteKey(org.opendaylight.protocol.bgp.mode.impl.add.RouteKey)

Aggregations

ArrayList (java.util.ArrayList)31 Test (org.junit.Test)28 BigInteger (java.math.BigInteger)27 List (java.util.List)15 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)14 Collections (java.util.Collections)13 Interface (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface)13 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)12 Logger (org.slf4j.Logger)12 LoggerFactory (org.slf4j.LoggerFactory)12 Optional (com.google.common.base.Optional)11 Inject (javax.inject.Inject)11 Singleton (javax.inject.Singleton)11 ManagedNewTransactionRunner (org.opendaylight.genius.infra.ManagedNewTransactionRunner)10 ManagedNewTransactionRunnerImpl (org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl)10 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)10 ParentRefs (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs)10 FutureCallback (com.google.common.util.concurrent.FutureCallback)9 ByteBuf (io.netty.buffer.ByteBuf)9 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)9