Search in sources :

Example 1 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 parseFlags.

@Override
protected void parseFlags(final StatefulBuilder sb, final ByteBuf buffer) {
    final BitArray flags = BitArray.valueOf(buffer, FLAGS_F_LENGTH);
    sb.setLspUpdateCapability(flags.get(U_FLAG_OFFSET));
    if (flags.get(I_FLAG_OFFSET)) {
        sb.addAugmentation(Stateful1.class, new Stateful1Builder().setInitiation(Boolean.TRUE).build());
    }
}
Also used : BitArray(org.opendaylight.protocol.util.BitArray) Stateful1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Stateful1Builder)

Example 2 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 BigInteger startingDBVersion, final BigInteger 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().getAugmentation(Tlvs1.class).getStateful().getAugmentation(Stateful1.class).isInitiation());
    final BigInteger pceDBVersion = session.getLocalTlvs().getAugmentation(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.rev131005.Message) BigInteger(java.math.BigInteger)

Example 3 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 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 4 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 Uint64 expectedeInitialDb) throws Exception {
    assertTrue(pceSessionListener.isUp());
    // Send Open with LspDBV = 1
    final int numberOfSyncMessage = 1;
    int numberOfLspExpected = numberOfLsp;
    if (!expectedeInitialDb.equals(Uint64.ZERO)) {
        checkEquals(() -> checkSequequenceDBVersionSync(pceSessionListener, expectedeInitialDb));
        numberOfLspExpected += numberOfSyncMessage;
    }
    checkReceivedMessages(pceSessionListener, numberOfLspExpected);
    final PCEPSession session = pceSessionListener.getSession();
    checkSession(session, DEAD_TIMER, KEEP_ALIVE);
    assertTrue(session.getRemoteTlvs().augmentation(Tlvs1.class).getStateful().augmentation(Stateful1.class).getInitiation());
    assertNull(session.getLocalTlvs().augmentation(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.rev200720.Tlvs3)

Example 5 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 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)

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