Search in sources :

Example 6 with Stateful

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());
}
Also used : Stateful1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.Stateful1)

Example 7 with Stateful

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());
}
Also used : StatefulMessagesStatsAug(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.StatefulMessagesStatsAug)

Example 8 with Stateful

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());
    }
}
Also used : Stateful1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.Stateful1)

Example 9 with Stateful

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();
}
Also used : SpeakerEntityIdBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.speaker.entity.id.tlv.SpeakerEntityIdBuilder) Tlvs3Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.Tlvs3Builder)

Example 10 with Stateful

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();
}
Also used : LocalPrefBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.LocalPrefBuilder) StatefulCapabilitiesStatsAug(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.StatefulCapabilitiesStatsAug) Messages(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.Messages) PcepEntityIdRpcAugBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.PcepEntityIdRpcAugBuilder) StatefulCapabilitiesRpcAugBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.StatefulCapabilitiesRpcAugBuilder) MessagesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.MessagesBuilder) PcepEntityIdStatsAug(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.PcepEntityIdStatsAug) LocalPref(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.LocalPref) PcepSessionStateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.grouping.PcepSessionStateBuilder) StatefulMessagesRpcAugBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.StatefulMessagesRpcAugBuilder) PeerCapabilities(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.PeerCapabilities) PeerCapabilitiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.PeerCapabilitiesBuilder) StatefulMessagesStatsAug(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.StatefulMessagesStatsAug)

Aggregations

Stateful (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.stateful.capability.tlv.Stateful)6 Stateful1 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.Stateful1)4 StatefulBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.stateful.capability.tlv.StatefulBuilder)4 ByteBuf (io.netty.buffer.ByteBuf)3 Test (org.junit.Test)3 BitArray (org.opendaylight.protocol.util.BitArray)3 Stateful (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.stateful.capability.tlv.Stateful)3 InetAddress (java.net.InetAddress)2 PCEPDeserializerException (org.opendaylight.protocol.pcep.spi.PCEPDeserializerException)2 Tlvs3Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.Tlvs3Builder)2 SpeakerEntityIdBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.speaker.entity.id.tlv.SpeakerEntityIdBuilder)2 Stateful1 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Stateful1)2 Tlvs1 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Tlvs1)2 Tlvs1 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Tlvs1)2 Tlvs1Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Tlvs1Builder)2 StatefulCapabilitiesStatsAug (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.StatefulCapabilitiesStatsAug)2 StatefulMessagesStatsAug (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.StatefulMessagesStatsAug)2 StatefulStatefulCapabilityTlvParser (org.opendaylight.protocol.pcep.ietf.stateful.StatefulStatefulCapabilityTlvParser)1 ObjectHeaderImpl (org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl)1 SyncOptimizationsActivator (org.opendaylight.protocol.pcep.sync.optimizations.SyncOptimizationsActivator)1