Search in sources :

Example 11 with Tlvs

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.initiation.Tlvs in project bgpcep by opendaylight.

the class Stateful07TopologySessionListenerTest method testDelegatedLspsCountWithoutDelegation.

@Test
public void testDelegatedLspsCountWithoutDelegation() throws Exception {
    this.listener.onSessionUp(this.session);
    this.topologyRpcs.addLsp(createAddLspInput());
    assertEquals(1, this.receivedMsgs.size());
    assertTrue(this.receivedMsgs.get(0) instanceof Pcinitiate);
    final Pcinitiate pcinitiate = (Pcinitiate) this.receivedMsgs.get(0);
    final Requests req = pcinitiate.getPcinitiateMessage().getRequests().get(0);
    final long srpId = req.getSrp().getOperationId().getValue();
    final Tlvs tlvs = createLspTlvs(req.getLsp().getPlspId().getValue(), true, this.testAddress, this.testAddress, this.testAddress, Optional.absent());
    // delegate set to false
    final Pcrpt pcRpt = MsgBuilderUtil.createPcRtpMessage(new LspBuilder(req.getLsp()).setTlvs(tlvs).setPlspId(new PlspId(1L)).setSync(false).setRemove(false).setOperational(OperationalStatus.Active).setDelegate(false).build(), Optional.of(MsgBuilderUtil.createSrp(srpId)), MsgBuilderUtil.createPath(req.getEro().getSubobject()));
    this.listener.onMessage(this.session, pcRpt);
    checkEquals(() -> assertEquals(0, this.listener.listenerState.getDelegatedLspsCount().intValue()));
}
Also used : Tlvs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.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.rev171025.Pcrpt) LspBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.LspBuilder) Requests(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.pcinitiate.message.pcinitiate.message.Requests) Pcinitiate(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Pcinitiate) PlspId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PlspId) Test(org.junit.Test)

Example 12 with Tlvs

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.initiation.Tlvs in project bgpcep by opendaylight.

the class SyncOptimizationTest method testIsDeltaSyncEnabledPositive.

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

Example 13 with Tlvs

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.initiation.Tlvs in project bgpcep by opendaylight.

the class SyncOptimizationTest method testIsDeltaSyncEnabledNegative.

@Test
public void testIsDeltaSyncEnabledNegative() {
    final Tlvs localTlvs = createTlvs(1L, true, true);
    final Tlvs remoteTlvs = createTlvs(2L, false, false);
    Mockito.doReturn(localTlvs).when(this.pcepSession).getLocalTlvs();
    Mockito.doReturn(remoteTlvs).when(this.pcepSession).getRemoteTlvs();
    final SyncOptimization syncOpt = new SyncOptimization(this.pcepSession);
    assertFalse(syncOpt.isDeltaSyncEnabled());
}
Also used : Tlvs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.open.Tlvs) Test(org.junit.Test)

Example 14 with Tlvs

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.initiation.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.rev131005.open.object.open.Tlvs) Test(org.junit.Test)

Example 15 with Tlvs

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.initiation.Tlvs in project bgpcep by opendaylight.

the class SyncOptimizationTest method testIsSyncAvoidanceEnabledPositive.

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

Aggregations

Test (org.junit.Test)21 MsgBuilderUtil.createLspTlvs (org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.createLspTlvs)13 Tlvs (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.lsp.Tlvs)13 Pcrpt (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcrpt)11 LspBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.LspBuilder)11 BgpParameters (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.BgpParameters)9 Tlvs (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.open.Tlvs)9 BgpParametersBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.BgpParametersBuilder)8 OptionalCapabilities (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.bgp.parameters.OptionalCapabilities)8 OptionalCapabilitiesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.bgp.parameters.OptionalCapabilitiesBuilder)8 CParametersBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.bgp.parameters.optional.capabilities.CParametersBuilder)8 CParameters1Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.CParameters1Builder)8 OpenBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.OpenBuilder)7 As4BytesCapabilityBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.bgp.parameters.optional.capabilities.c.parameters.As4BytesCapabilityBuilder)7 MultiprotocolCapabilityBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.MultiprotocolCapabilityBuilder)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 PlspId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PlspId)7 ProtocolVersion (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.ProtocolVersion)6 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)5