Search in sources :

Example 6 with Tlvs3Builder

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

the class PCEPStatefulPeerProposalTest method testSetPeerProposalSuccess.

@Test
public void testSetPeerProposalSuccess() throws Exception {
    updateBuilder(() -> {
        final var listeners = captor.getAllValues();
        assertEquals(2, listeners.size());
        // not entirely accurate, but works well enough
        final var modPath = TOPOLOGY_IID.child(Node.class, new NodeKey(ServerSessionManager.createNodeId(ADDRESS.getAddress())));
        final var dbverRoot = mock(DataObjectModification.class);
        doReturn(LSP_DB_VERSION).when(dbverRoot).getDataAfter();
        final var dbverMod = mock(DataTreeModification.class);
        doReturn(DataTreeIdentifier.create(LogicalDatastoreType.OPERATIONAL, modPath)).when(dbverMod).getRootPath();
        doReturn(dbverRoot).when(dbverMod).getRootNode();
        for (DataTreeChangeListener<?> listener : listeners) {
            if (listener instanceof LspDbVersionListener) {
                listener.onDataTreeChanged(List.of(dbverMod));
            }
        }
    // Mock lspdb
    });
    assertEquals(new Tlvs3Builder().setLspDbVersion(LSP_DB_VERSION).build(), tlvsBuilder.augmentation(Tlvs3.class));
}
Also used : LspDbVersionListener(org.opendaylight.bgpcep.pcep.topology.provider.PCEPStatefulPeerProposal.LspDbVersionListener) Tlvs3Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.Tlvs3Builder) Tlvs3(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.Tlvs3) NodeKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey) Test(org.junit.Test)

Example 7 with Tlvs3Builder

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

the class PCCServerPeerProposal method setPeerSpecificProposal.

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

Example 8 with Tlvs3Builder

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

the class SyncOptimizationsOpenObjectParser method addTlv.

@Override
public void addTlv(final TlvsBuilder tbuilder, final Tlv tlv) {
    super.addTlv(tbuilder, tlv);
    final Tlvs3Builder syncOptTlvsBuilder = new Tlvs3Builder();
    if (tbuilder.augmentation(Tlvs3.class) != null) {
        final Tlvs3 t = tbuilder.augmentation(Tlvs3.class);
        if (t.getLspDbVersion() != null) {
            syncOptTlvsBuilder.setLspDbVersion(t.getLspDbVersion());
        }
        if (t.getSpeakerEntityId() != null) {
            syncOptTlvsBuilder.setSpeakerEntityId(t.getSpeakerEntityId());
        }
    }
    if (tlv instanceof LspDbVersion) {
        syncOptTlvsBuilder.setLspDbVersion((LspDbVersion) tlv);
    }
    if (tlv instanceof SpeakerEntityId) {
        syncOptTlvsBuilder.setSpeakerEntityId((SpeakerEntityId) tlv);
    }
    tbuilder.addAugmentation(syncOptTlvsBuilder.build());
}
Also used : LspDbVersion(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.lsp.db.version.tlv.LspDbVersion) SpeakerEntityId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.speaker.entity.id.tlv.SpeakerEntityId) Tlvs3Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.Tlvs3Builder) Tlvs3(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.Tlvs3)

Aggregations

Tlvs3Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.Tlvs3Builder)7 Test (org.junit.Test)3 LspDbVersionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.lsp.db.version.tlv.LspDbVersionBuilder)3 ByteBuf (io.netty.buffer.ByteBuf)2 ObjectHeaderImpl (org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl)2 Tlvs3 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.Tlvs3)2 SpeakerEntityIdBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.speaker.entity.id.tlv.SpeakerEntityIdBuilder)2 ProtocolVersion (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ProtocolVersion)2 NodeKey (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey)2 Optional (com.google.common.base.Optional)1 ExecutionException (java.util.concurrent.ExecutionException)1 LspDbVersionListener (org.opendaylight.bgpcep.pcep.topology.provider.PCEPStatefulPeerProposal.LspDbVersionListener)1 ReadOnlyTransaction (org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction)1 SyncOptimizationsActivator (org.opendaylight.protocol.pcep.sync.optimizations.SyncOptimizationsActivator)1 SyncOptimizationsOpenObjectParser (org.opendaylight.protocol.pcep.sync.optimizations.SyncOptimizationsOpenObjectParser)1 Tlvs3 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs3)1 Tlvs3Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs3Builder)1 LspDbVersion (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.lsp.db.version.tlv.LspDbVersion)1 SpeakerEntityIdBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.speaker.entity.id.tlv.SpeakerEntityIdBuilder)1 Stateful1Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.Stateful1Builder)1