use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Sent in project netvirt by opendaylight.
the class ElanUtils method getEgressActionsForInterface.
/**
* Returns the list of Actions to be taken when sending the packet through
* an Elan interface. Note that this interface can refer to an ElanInterface
* where the Elan VM is attached to a DPN or an ITM tunnel interface where
* Elan traffic can be sent through. In this latter case, the tunnelKey is
* mandatory and it can hold serviceId for internal tunnels or the VNI for
* external tunnels.
*
* @param ifName
* the if name
* @param tunnelKey
* the tunnel key
* @return the egress actions for interface
*/
@SuppressWarnings("checkstyle:IllegalCatch")
@NonNull
public List<Action> getEgressActionsForInterface(String ifName, @Nullable Long tunnelKey) {
List<Action> listAction = new ArrayList<>();
try {
GetEgressActionsForInterfaceInput getEgressActionInput = new GetEgressActionsForInterfaceInputBuilder().setIntfName(ifName).setTunnelKey(tunnelKey).build();
Future<RpcResult<GetEgressActionsForInterfaceOutput>> result = interfaceManagerRpcService.getEgressActionsForInterface(getEgressActionInput);
RpcResult<GetEgressActionsForInterfaceOutput> rpcResult = result.get();
if (!rpcResult.isSuccessful()) {
LOG.debug("RPC Call to Get egress actions for interface {} returned with Errors {}", ifName, rpcResult.getErrors());
} else {
listAction = new ArrayList<>(rpcResult.getResult().nonnullAction().values());
}
} catch (Exception e) {
LOG.warn("Exception when egress actions for interface {}", ifName, e);
}
return listAction;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Sent 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().augmentation(NeighborAfiSafiStateAugmentation.class);
addHeader(table, "AFI state");
table.addRow().addContent("Family", afiSafi.getAfiSafiName().getSimpleName());
table.addRow().addContent("Active", state.getActive());
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.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Sent in project bgpcep by opendaylight.
the class NeighborStateCliUtils method printMessagesState.
private static void printMessagesState(final State neighborState, final ShellTable table) {
final BgpNeighborStateAugmentation state = neighborState.augmentation(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.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Sent in project bgpcep by opendaylight.
the class BGPSessionImpl method terminate.
/**
* Closes BGP session from the parent with given reason. A message needs to be sent, but parent doesn't have to be
* modified, because he initiated the closing. (To prevent concurrent modification exception).
*
* @param cause BGPDocumentedException
*/
@VisibleForTesting
@Holding({ "this.listener", "this" })
void terminate(final BGPDocumentedException cause) {
final BGPError error = cause.getError();
final byte[] data = cause.getData();
final NotifyBuilder builder = new NotifyBuilder().setErrorCode(error.getCode()).setErrorSubcode(error.getSubcode());
if (data != null && data.length != 0) {
builder.setData(data);
}
writeAndFlush(builder.build());
notifyTerminationReasonAndCloseWithoutMessage(error);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Sent in project bgpcep by opendaylight.
the class AbstractBGPSessionNegotiator method startNegotiation.
@SuppressWarnings("checkstyle:illegalCatch")
private synchronized void startNegotiation() {
LOG.debug("Starting negotiating with {}, current state: {}", channel.remoteAddress(), state);
if (!(this.state == State.IDLE || this.state == State.OPEN_CONFIRM)) {
return;
}
// Open can be sent first either from ODL (IDLE) or from peer (OPEN_CONFIRM)
final IpAddressNoZone remoteIp = getRemoteIp();
try {
// Check if peer is configured in registry before retrieving preferences
if (!this.registry.isPeerConfigured(remoteIp)) {
final BGPDocumentedException cause = new BGPDocumentedException(String.format("BGP peer with ip: %s not configured, check configured peers in : %s", remoteIp, this.registry), BGPError.CONNECTION_REJECTED);
negotiationFailed(cause);
return;
}
final BGPSessionPreferences preferences = this.registry.getPeerPreferences(remoteIp);
final Uint16 as = openASNumber(preferences.getMyAs().getValue().longValue());
sendMessage(new OpenBuilder().setMyAsNumber(as).setHoldTimer(Uint16.valueOf(preferences.getHoldTime())).setBgpIdentifier(preferences.getBgpId()).setBgpParameters(preferences.getParams()).build());
if (this.state != State.FINISHED) {
this.state = State.OPEN_SENT;
this.pending = this.channel.eventLoop().schedule(() -> {
synchronized (AbstractBGPSessionNegotiator.this) {
AbstractBGPSessionNegotiator.this.pending = null;
if (AbstractBGPSessionNegotiator.this.state != State.FINISHED) {
AbstractBGPSessionNegotiator.this.sendMessage(buildErrorNotify(BGPError.HOLD_TIMER_EXPIRED));
negotiationFailed(new BGPDocumentedException("HoldTimer expired", BGPError.FSM_ERROR));
AbstractBGPSessionNegotiator.this.state = State.FINISHED;
}
}
}, INITIAL_HOLDTIMER, TimeUnit.MINUTES);
}
} catch (final Exception e) {
LOG.warn("Unexpected negotiation failure", e);
negotiationFailedCloseChannel(e);
}
}
Aggregations