Search in sources :

Example 16 with Tlvs

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.Tlvs in project bgpcep by opendaylight.

the class PcepOpenObjectWithSpcTlvParser method addTlv.

@Override
public void addTlv(final TlvsBuilder tbuilder, final Tlv tlv) {
    super.addTlv(tbuilder, tlv);
    final Tlvs1Builder tlvBuilder = new Tlvs1Builder();
    if (tbuilder.augmentation(Tlvs1.class) != null) {
        final Tlvs1 tlvs = tbuilder.augmentation(Tlvs1.class);
        if (tlvs.getSrPceCapability() != null) {
            tlvBuilder.setSrPceCapability(tlvs.getSrPceCapability());
        }
    }
    if (tlv instanceof SrPceCapability) {
        tlvBuilder.setSrPceCapability((SrPceCapability) tlv);
    }
    tbuilder.addAugmentation(tlvBuilder.build());
}
Also used : SrPceCapability(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.pce.capability.tlv.SrPceCapability) Tlvs1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.Tlvs1Builder) Tlvs1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.Tlvs1)

Example 17 with Tlvs

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.Tlvs in project bgpcep by opendaylight.

the class PCEPTopologySessionListener method buildPath.

private static Path buildPath(final Reports report, final Srp srp, final Lsp lsp) {
    final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.reported.lsp.PathBuilder pb = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.reported.lsp.PathBuilder();
    if (report.getPath() != null) {
        pb.fieldsFrom(report.getPath());
    }
    // LSP is mandatory (if there is none, parser will throw an exception)
    // this is to ensure a path will be created at any rate
    final Path1Builder p1Builder = new Path1Builder();
    p1Builder.setLsp(report.getLsp());
    final PathSetupType pst;
    if (srp != null && srp.getTlvs() != null && srp.getTlvs().getPathSetupType() != null) {
        pst = srp.getTlvs().getPathSetupType();
        p1Builder.setPathSetupType(pst);
    } else {
        pst = null;
    }
    pb.addAugmentation(p1Builder.build());
    final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.lsp.Tlvs tlvs = report.getLsp().getTlvs();
    if (tlvs != null) {
        if (tlvs.getLspIdentifiers() != null) {
            pb.setLspId(tlvs.getLspIdentifiers().getLspId());
        } else if (!PSTUtil.isDefaultPST(pst)) {
            pb.setLspId(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.LspId(lsp.getPlspId().getValue()));
        }
    }
    return pb.build();
}
Also used : LspId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.LspId) Collections(java.util.Collections) PathBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcupd.message.pcupd.message.updates.PathBuilder) PathSetupType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.path.setup.type.tlv.PathSetupType) Path1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Path1Builder)

Example 18 with Tlvs

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.Tlvs in project bgpcep by opendaylight.

the class PCEPTopologySessionListenerTest method testDelegatedLspsCountWithDelegation.

@Test
public void testDelegatedLspsCountWithDelegation() throws Exception {
    listener.onSessionUp(session);
    topologyRpcs.addLsp(createAddLspInput());
    assertEquals(1, receivedMsgs.size());
    assertTrue(receivedMsgs.get(0) instanceof Pcinitiate);
    final Pcinitiate pcinitiate = (Pcinitiate) receivedMsgs.get(0);
    final Requests req = pcinitiate.getPcinitiateMessage().getRequests().get(0);
    final Uint32 srpId = req.getSrp().getOperationId().getValue();
    final Tlvs tlvs = createLspTlvs(req.getLsp().getPlspId().getValue(), true, testAddress, testAddress, testAddress, Optional.empty());
    // delegate set to true
    final Pcrpt pcRpt = MsgBuilderUtil.createPcRtpMessage(new LspBuilder(req.getLsp()).setTlvs(tlvs).setPlspId(new PlspId(Uint32.ONE)).setSync(FALSE).setRemove(FALSE).setOperational(OperationalStatus.Active).setDelegate(TRUE).build(), Optional.of(MsgBuilderUtil.createSrp(srpId)), MsgBuilderUtil.createPath(req.getEro().getSubobject()));
    listener.onMessage(session, pcRpt);
    checkEquals(() -> assertEquals(1, listener.listenerState.getDelegatedLspsCount().intValue()));
}
Also used : Tlvs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.lsp.Tlvs) MsgBuilderUtil.createLspTlvs(org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.createLspTlvs) Pcrpt(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Pcrpt) LspBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.LspBuilder) Requests(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.pcinitiate.message.pcinitiate.message.Requests) Uint32(org.opendaylight.yangtools.yang.common.Uint32) Pcinitiate(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.Pcinitiate) PlspId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.PlspId) Test(org.junit.Test)

Example 19 with Tlvs

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.Tlvs in project bgpcep by opendaylight.

the class SyncOptimizationTest method testDoesLspDbMatchPositive.

@Test
public void testDoesLspDbMatchPositive() {
    final Tlvs tlvs = createTlvs(1L, false, false);
    Mockito.doReturn(tlvs).when(this.pcepSession).getLocalTlvs();
    Mockito.doReturn(tlvs).when(this.pcepSession).getRemoteTlvs();
    final SyncOptimization syncOpt = new SyncOptimization(this.pcepSession);
    assertTrue(syncOpt.doesLspDbMatch());
}
Also used : Tlvs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.Tlvs) Test(org.junit.Test)

Example 20 with Tlvs

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.Tlvs in project bgpcep by opendaylight.

the class SyncOptimizationTest method testIsDbVersionPresentNegative.

@Test
public void testIsDbVersionPresentNegative() {
    final Tlvs tlvs = createTlvs(null, true, false);
    Mockito.doReturn(tlvs).when(this.pcepSession).getLocalTlvs();
    Mockito.doReturn(tlvs).when(this.pcepSession).getRemoteTlvs();
    final SyncOptimization syncOpt = new SyncOptimization(this.pcepSession);
    assertFalse(syncOpt.isDbVersionPresent());
}
Also used : Tlvs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.Tlvs) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)27 MsgBuilderUtil.createLspTlvs (org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.createLspTlvs)21 Tlvs (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.lsp.Tlvs)13 Pcrpt (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Pcrpt)11 LspBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.LspBuilder)10 Tlvs (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.Tlvs)9 Uint32 (org.opendaylight.yangtools.yang.common.Uint32)9 Pcrpt (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcrpt)8 LspBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.LspBuilder)8 Tlvs (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.lsp.Tlvs)8 ArrayList (java.util.ArrayList)7 Pcinitiate (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Pcinitiate)7 Requests (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.pcinitiate.message.pcinitiate.message.Requests)7 Pcinitiate (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.Pcinitiate)7 Requests (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.pcinitiate.message.pcinitiate.message.Requests)7 PlspId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.PlspId)6 BgpParameters (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.open.message.BgpParameters)5 PlspId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PlspId)5 Collections (java.util.Collections)4 BGPSessionPreferences (org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences)4