use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.stateful.capability.tlv.Stateful in project bgpcep by opendaylight.
the class PCCMockCommon method checkSession.
static void checkSession(final PCEPSession session, final int expectedDeadTimer, final int expectedKeepAlive) {
assertNotNull(session);
assertEquals(expectedDeadTimer, session.getPeerPref().getDeadtimer().shortValue());
assertEquals(expectedKeepAlive, session.getPeerPref().getKeepalive().shortValue());
final Stateful1 stateful = session.getRemoteTlvs().augmentation(Tlvs1.class).getStateful().augmentation(Stateful1.class);
assertTrue(stateful.getInitiation());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.stateful.capability.tlv.Stateful in project bgpcep by opendaylight.
the class PcepStateUtils method showMessages.
private static void showMessages(final ShellTable table, final Messages messages) {
if (messages == null) {
return;
}
addHeader(table, "Messages");
table.addRow().addContent("Last Sent Msg Timestamp", messages.getLastSentMsgTimestamp());
table.addRow().addContent("Received Msg Count", messages.getReceivedMsgCount());
table.addRow().addContent("Sent Msg Count", messages.getSentMsgCount());
table.addRow().addContent("Unknown Msg Received", messages.getUnknownMsgReceived());
final StatefulMessagesStatsAug statefulMessages = messages.augmentation(StatefulMessagesStatsAug.class);
if (statefulMessages == null) {
return;
}
addHeader(table, " Stateful Messages");
table.addRow().addContent("Last Received RptMsg Timestamp", statefulMessages.getLastReceivedRptMsgTimestamp());
table.addRow().addContent("Received RptMsg", statefulMessages.getReceivedRptMsgCount());
table.addRow().addContent("Sent Init Msg", statefulMessages.getSentInitMsgCount());
table.addRow().addContent("Sent Upd Msg", statefulMessages.getSentUpdMsgCount());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.stateful.capability.tlv.Stateful in project bgpcep by opendaylight.
the class PCEPTopologySessionListener method setStatefulCapabilities.
private synchronized void setStatefulCapabilities(final Stateful stateful) {
statefulCapability.set(true);
if (stateful.getLspUpdateCapability() != null) {
lspUpdateCapability.set(stateful.getLspUpdateCapability());
}
final Stateful1 stateful1 = stateful.augmentation(Stateful1.class);
if (stateful1 != null && stateful1.getInitiation() != null) {
initiationCapability.set(stateful1.getInitiation());
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.stateful.capability.tlv.Stateful in project bgpcep by opendaylight.
the class PCEPStatefulPeerProposal method setPeerSpecificProposal.
@Override
public void setPeerSpecificProposal(final InetSocketAddress address, final TlvsBuilder openBuilder) {
// Check if we are dealing with synchronization optimization
final var statefulTlv = openBuilder.augmentation(Tlvs1.class);
if (statefulTlv == null) {
return;
}
final var stateful = statefulTlv.getStateful();
if (stateful == null || stateful.augmentation(Stateful1.class) == null) {
return;
}
final var nodeId = ServerSessionManager.createNodeId(address.getAddress());
final var dbVersion = lspDbVersions.map.get(nodeId);
final var speakerId = speakerIds.map.get(nodeId);
if (speakerId == null && dbVersion == null) {
// Nothing to add
return;
}
final Tlvs3Builder syncBuilder = new Tlvs3Builder();
if (dbVersion != null) {
syncBuilder.setLspDbVersion(dbVersion);
}
if (speakerId != null) {
syncBuilder.setSpeakerEntityId(new SpeakerEntityIdBuilder().setSpeakerEntityIdValue(speakerId).build());
}
openBuilder.addAugmentation(syncBuilder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.stateful.capability.tlv.Stateful in project bgpcep by opendaylight.
the class TopologyStatsRpcServiceImpl method transformStatefulAugmentation.
/*
* Replace stateful topology augmentations with ones for rpc in PCEP session
* stats data
*/
private static PcepSessionState transformStatefulAugmentation(final PcepSessionState pcepSessionState) {
if (pcepSessionState == null) {
return null;
}
final PcepSessionStateBuilder sb = new PcepSessionStateBuilder(pcepSessionState);
final Messages topoMessage = pcepSessionState.getMessages();
if (topoMessage != null) {
final StatefulMessagesStatsAug messageStatsAug = topoMessage.augmentation(StatefulMessagesStatsAug.class);
if (messageStatsAug != null) {
sb.setMessages(new MessagesBuilder(topoMessage).removeAugmentation(StatefulMessagesStatsAug.class).addAugmentation(new StatefulMessagesRpcAugBuilder().setLastReceivedRptMsgTimestamp(messageStatsAug.getLastReceivedRptMsgTimestamp()).setReceivedRptMsgCount(messageStatsAug.getReceivedRptMsgCount()).setSentInitMsgCount(messageStatsAug.getSentInitMsgCount()).setSentUpdMsgCount(messageStatsAug.getSentUpdMsgCount()).build()).build());
}
}
final PeerCapabilities topoPeerCapability = pcepSessionState.getPeerCapabilities();
if (topoPeerCapability != null) {
final StatefulCapabilitiesStatsAug capabilityStatsAug = topoPeerCapability.augmentation(StatefulCapabilitiesStatsAug.class);
if (capabilityStatsAug != null) {
sb.setPeerCapabilities(new PeerCapabilitiesBuilder(topoPeerCapability).removeAugmentation(StatefulCapabilitiesStatsAug.class).addAugmentation(new StatefulCapabilitiesRpcAugBuilder().setActive(capabilityStatsAug.getActive()).setInstantiation(capabilityStatsAug.getInstantiation()).setStateful(capabilityStatsAug.getStateful()).build()).build());
}
}
final LocalPref topoLocalPref = pcepSessionState.getLocalPref();
if (topoLocalPref != null) {
final PcepEntityIdStatsAug entityStatsAug = topoLocalPref.augmentation(PcepEntityIdStatsAug.class);
if (entityStatsAug != null) {
sb.setLocalPref(new LocalPrefBuilder(topoLocalPref).removeAugmentation(PcepEntityIdStatsAug.class).addAugmentation(new PcepEntityIdRpcAugBuilder().setSpeakerEntityIdValue(entityStatsAug.getSpeakerEntityIdValue()).build()).build());
}
}
return sb.build();
}
Aggregations