Search in sources :

Example 1 with Tlvs3

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs3 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 2 with Tlvs3

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs3 in project bgpcep by opendaylight.

the class SrObjectParserTest method testOpenObjectWithSpcTlv.

@Test
public void testOpenObjectWithSpcTlv() throws PCEPDeserializerException {
    final PcepOpenObjectWithSpcTlvParser parser = new PcepOpenObjectWithSpcTlvParser(this.tlvRegistry, this.viTlvRegistry);
    final OpenBuilder builder = new OpenBuilder();
    builder.setProcessingRule(false);
    builder.setIgnore(false);
    builder.setVersion(new ProtocolVersion((short) 1));
    builder.setKeepalive((short) 30);
    builder.setDeadTimer((short) 120);
    builder.setSessionId((short) 1);
    final Tlvs1 tlv = new Tlvs1Builder().setSrPceCapability(new SrPceCapabilityBuilder().setMsd((short) 1).build()).build();
    builder.setTlvs(new TlvsBuilder().addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Tlvs1.class, new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Tlvs1Builder().build()).addAugmentation(Tlvs1.class, tlv).addAugmentation(Tlvs3.class, new Tlvs3Builder().build()).build());
    final ByteBuf result = Unpooled.wrappedBuffer(openObjectBytes);
    assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(false, false), result.slice(4, result.readableBytes() - 4)));
    final ByteBuf buffer = Unpooled.buffer();
    parser.serializeObject(builder.build(), buffer);
    parser.serializeTlvs(null, Unpooled.EMPTY_BUFFER);
    parser.serializeTlvs(new TlvsBuilder().build(), Unpooled.EMPTY_BUFFER);
    assertArrayEquals(openObjectBytes, ByteArray.getAllBytes(buffer));
}
Also used : OpenBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.OpenBuilder) ObjectHeaderImpl(org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl) Tlvs3Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs3Builder) ProtocolVersion(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ProtocolVersion) Tlvs1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.Tlvs1Builder) ByteBuf(io.netty.buffer.ByteBuf) Tlvs1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.Tlvs1) TlvsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.open.TlvsBuilder) SrPceCapabilityBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.sr.pce.capability.tlv.SrPceCapabilityBuilder) Test(org.junit.Test)

Example 3 with Tlvs3

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs3 in project bgpcep by opendaylight.

the class PCCPeerProposal method setPeerSpecificProposal.

@Override
public void setPeerSpecificProposal(@Nonnull final InetSocketAddress address, @Nonnull final TlvsBuilder openBuilder) {
    requireNonNull(address);
    final LspDbVersion lspDbVersion = new LspDbVersionBuilder().setLspDbVersionValue(this.dbVersion).build();
    openBuilder.addAugmentation(Tlvs3.class, new Tlvs3Builder().setLspDbVersion(lspDbVersion).build());
}
Also used : LspDbVersion(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.lsp.db.version.tlv.LspDbVersion) LspDbVersionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.lsp.db.version.tlv.LspDbVersionBuilder) Tlvs3Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs3Builder)

Example 4 with Tlvs3

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs3 in project bgpcep by opendaylight.

the class PCEPStatefulPeerProposalTest method testSetPeerProposalWithEntityIdSuccess.

@Test
public void testSetPeerProposalWithEntityIdSuccess() throws InterruptedException, ExecutionException {
    doReturn(Optional.of(LSP_DB_VERSION)).when(this.listenableFutureMock).get();
    final PCEPStatefulPeerProposal peerProposal = PCEPStatefulPeerProposal.createStatefulPeerProposal(this.dataBroker, TOPOLOGY_IID);
    peerProposal.setPeerProposal(NODE_ID, this.tlvsBuilder, SPEAKER_ID);
    final Tlvs3 aug = this.tlvsBuilder.getAugmentation(Tlvs3.class);
    assertEquals(LSP_DB_VERSION, aug.getLspDbVersion());
    assertArrayEquals(SPEAKER_ID, aug.getSpeakerEntityId().getSpeakerEntityIdValue());
}
Also used : Tlvs3(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs3) Test(org.junit.Test)

Example 5 with Tlvs3

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs3 in project bgpcep by opendaylight.

the class SessionStateImpl method init.

public synchronized void init(final PCEPSessionState session) {
    requireNonNull(session);
    this.pcepSessionState = session;
    final Open localOpen = session.getLocalOpen();
    if (localOpen.getTlvs() != null && localOpen.getTlvs().getAugmentation(Tlvs3.class) != null) {
        final SpeakerEntityId entityId = localOpen.getTlvs().getAugmentation(Tlvs3.class).getSpeakerEntityId();
        if (entityId != null) {
            this.localPref = new LocalPrefBuilder(session.getLocalPref()).addAugmentation(PcepEntityIdStatsAug.class, new PcepEntityIdStatsAugBuilder(entityId).build()).build();
        }
    } else {
        this.localPref = session.getLocalPref();
    }
    this.peerPref = session.getPeerPref();
    this.sessionUpDuration.start();
}
Also used : LocalPrefBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.LocalPrefBuilder) PcepEntityIdStatsAugBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev171113.PcepEntityIdStatsAugBuilder) SpeakerEntityId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.speaker.entity.id.tlv.SpeakerEntityId) Tlvs3(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs3) Open(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.Open)

Aggregations

Tlvs3Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs3Builder)6 Tlvs3 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs3)5 Test (org.junit.Test)4 LspDbVersion (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.lsp.db.version.tlv.LspDbVersion)3 LspDbVersionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.lsp.db.version.tlv.LspDbVersionBuilder)3 ByteBuf (io.netty.buffer.ByteBuf)2 BigInteger (java.math.BigInteger)2 PCEPSession (org.opendaylight.protocol.pcep.PCEPSession)2 ObjectHeaderImpl (org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl)2 SpeakerEntityId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.speaker.entity.id.tlv.SpeakerEntityId)2 SpeakerEntityIdBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.speaker.entity.id.tlv.SpeakerEntityIdBuilder)2 ProtocolVersion (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ProtocolVersion)2 Optional (com.google.common.base.Optional)1 Collections (java.util.Collections)1 ExecutionException (java.util.concurrent.ExecutionException)1 ReadOnlyTransaction (org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction)1 MsgBuilderUtil.createLspTlvs (org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.createLspTlvs)1 SyncOptimizationsActivator (org.opendaylight.protocol.pcep.sync.optimizations.SyncOptimizationsActivator)1 SyncOptimizationsOpenObjectParser (org.opendaylight.protocol.pcep.sync.optimizations.SyncOptimizationsOpenObjectParser)1 Stateful1 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Stateful1)1