Search in sources :

Example 6 with Stateful1

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.Stateful1 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 7 with Stateful1

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.Stateful1 in project bgpcep by opendaylight.

the class CInitiated00StatefulCapabilityTlvParser method serializeFlags.

@Override
protected BitArray serializeFlags(final Stateful sct) {
    final BitArray flags = new BitArray(FLAGS_F_LENGTH);
    final Stateful1 sfi = sct.getAugmentation(Stateful1.class);
    if (sfi != null) {
        flags.set(I_FLAG_OFFSET, sfi.isInitiation());
    }
    flags.set(U_FLAG_OFFSET, sct.isLspUpdateCapability());
    return flags;
}
Also used : Stateful1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Stateful1) BitArray(org.opendaylight.protocol.util.BitArray)

Example 8 with Stateful1

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.Stateful1 in project bgpcep by opendaylight.

the class Stateful07TopologySessionListener method setStatefulCapabilities.

private synchronized void setStatefulCapabilities(final Stateful stateful) {
    this.statefulCapability.set(true);
    if (stateful.isLspUpdateCapability() != null) {
        this.lspUpdateCapability.set(stateful.isLspUpdateCapability());
    }
    final Stateful1 stateful1 = stateful.getAugmentation(Stateful1.class);
    if (stateful1 != null && stateful1.isInitiation() != null) {
        this.initiationCapability.set(stateful1.isInitiation());
    }
}
Also used : Stateful1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Stateful1)

Example 9 with Stateful1

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.Stateful1 in project bgpcep by opendaylight.

the class PCCMockCommon method checkSynchronizedSession.

static void checkSynchronizedSession(final int numberOfLsp, final TestingSessionListener pceSessionListener, final BigInteger expectedeInitialDb) throws Exception {
    assertTrue(pceSessionListener.isUp());
    // Send Open with LspDBV = 1
    final int numberOfSyncMessage = 1;
    int numberOfLspExpected = numberOfLsp;
    if (!expectedeInitialDb.equals(BigInteger.ZERO)) {
        checkEquals(() -> checkSequequenceDBVersionSync(pceSessionListener, expectedeInitialDb));
        numberOfLspExpected += numberOfSyncMessage;
    }
    checkReceivedMessages(pceSessionListener, numberOfLspExpected);
    final PCEPSession session = pceSessionListener.getSession();
    checkSession(session, DEAD_TIMER, KEEP_ALIVE);
    assertTrue(session.getRemoteTlvs().getAugmentation(Tlvs1.class).getStateful().getAugmentation(Stateful1.class).isInitiation());
    assertNull(session.getLocalTlvs().getAugmentation(Tlvs3.class).getLspDbVersion().getLspDbVersionValue());
}
Also used : PCEPSession(org.opendaylight.protocol.pcep.PCEPSession) Tlvs3(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs3)

Example 10 with Stateful1

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.Stateful1 in project bgpcep by opendaylight.

the class PCCMockCommon method checkResyncSession.

static void checkResyncSession(final Optional<Integer> startAtNumberLsp, final int expectedNumberOfLsp, final int expectedTotalMessages, final Uint64 startingDBVersion, final Uint64 expectedDBVersion, final TestingSessionListener pceSessionListener) throws Exception {
    assertNotNull(pceSessionListener.getSession());
    assertTrue(pceSessionListener.isUp());
    final List<Message> messages;
    checkReceivedMessages(pceSessionListener, expectedTotalMessages);
    if (startAtNumberLsp.isPresent()) {
        messages = pceSessionListener.messages().subList(startAtNumberLsp.get(), startAtNumberLsp.get() + expectedNumberOfLsp);
    } else {
        messages = pceSessionListener.messages();
    }
    checkEquals(() -> checkSequequenceDBVersionSync(pceSessionListener, expectedDBVersion));
    assertEquals(expectedNumberOfLsp, messages.size());
    final PCEPSession session = pceSessionListener.getSession();
    checkSession(session, DEAD_TIMER, KEEP_ALIVE);
    assertTrue(session.getRemoteTlvs().augmentation(Tlvs1.class).getStateful().augmentation(Stateful1.class).getInitiation());
    final Uint64 pceDBVersion = session.getLocalTlvs().augmentation(Tlvs3.class).getLspDbVersion().getLspDbVersionValue();
    assertEquals(startingDBVersion, pceDBVersion);
}
Also used : PCEPSession(org.opendaylight.protocol.pcep.PCEPSession) Message(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message) Uint64(org.opendaylight.yangtools.yang.common.Uint64)

Aggregations

PCEPSession (org.opendaylight.protocol.pcep.PCEPSession)4 BitArray (org.opendaylight.protocol.util.BitArray)4 Stateful1 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.Stateful1)4 Stateful1 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Stateful1)2 BigInteger (java.math.BigInteger)1 Tlvs3 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs3)1 Tlvs3 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.Tlvs3)1 Tlvs3Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.Tlvs3Builder)1 SpeakerEntityIdBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.speaker.entity.id.tlv.SpeakerEntityIdBuilder)1 Stateful1Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Stateful1Builder)1 Message (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message)1 Message (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message)1 Uint64 (org.opendaylight.yangtools.yang.common.Uint64)1