Search in sources :

Example 1 with TriggerSyncInputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.TriggerSyncInputBuilder in project bgpcep by opendaylight.

the class PCEPTriggeredReSynchronizationProcedureTest method testTriggeredResynchronization.

@Test
public void testTriggeredResynchronization() throws Exception {
    // session up - sync skipped (LSP-DBs match)
    this.session = getPCEPSession(getOpen(), getOpen());
    this.listener.onSessionUp(this.session);
    // report LSP + LSP-DB version number
    final Pcrpt pcRpt = getPcrt();
    this.listener.onMessage(this.session, pcRpt);
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        assertEquals(PccSyncState.Synchronized, pcc.getStateSync());
        assertFalse(pcc.getReportedLsp().isEmpty());
        return pcc;
    });
    // PCEP Trigger Full Resync
    this.listener.triggerSync(new TriggerSyncInputBuilder().setNode(this.nodeId).build());
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        assertEquals(PccSyncState.PcepTriggeredResync, pcc.getStateSync());
        return pcc;
    });
    // end of sync
    final Pcrpt syncMsg = getSyncMsg();
    this.listener.onMessage(this.session, syncMsg);
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        // check node - synchronized
        assertEquals(PccSyncState.Synchronized, pcc.getStateSync());
        return pcc;
    });
    this.listener.onMessage(this.session, pcRpt);
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        assertEquals(1, pcc.getReportedLsp().size());
        return pcc;
    });
    // Trigger Full Resync
    this.listener.triggerSync(new TriggerSyncInputBuilder().setNode(this.nodeId).build());
    this.listener.onMessage(this.session, pcRpt);
    // end of sync
    this.listener.onMessage(this.session, syncMsg);
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        // check node - synchronized
        assertEquals(PccSyncState.Synchronized, pcc.getStateSync());
        // check reported LSP is not empty, Stale LSP state were purged
        assertEquals(1, pcc.getReportedLsp().size());
        return pcc;
    });
}
Also used : TriggerSyncInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.TriggerSyncInputBuilder) Pcrpt(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcrpt) Test(org.junit.Test)

Example 2 with TriggerSyncInputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.TriggerSyncInputBuilder in project bgpcep by opendaylight.

the class PCEPTriggeredReSynchronizationProcedureTest method testTriggeredResynchronizationLsp.

@Test
public void testTriggeredResynchronizationLsp() throws Exception {
    // session up - sync skipped (LSP-DBs match)
    this.session = getPCEPSession(getOpen(), getOpen());
    this.listener.onSessionUp(this.session);
    // report LSP + LSP-DB version number
    final Pcrpt pcRpt = getPcrt();
    this.listener.onMessage(this.session, pcRpt);
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        assertEquals(PccSyncState.Synchronized, pcc.getStateSync());
        final List<ReportedLsp> reportedLspPcc = pcc.getReportedLsp();
        assertFalse(reportedLspPcc.isEmpty());
        return pcc;
    });
    // Trigger Full Resync
    this.listener.triggerSync(new TriggerSyncInputBuilder().setNode(this.nodeId).setName("test").build());
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        assertEquals(PccSyncState.PcepTriggeredResync, pcc.getStateSync());
        assertFalse(pcc.getReportedLsp().isEmpty());
        return pcc;
    });
    this.listener.onMessage(this.session, pcRpt);
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        assertFalse(pcc.getReportedLsp().isEmpty());
        return pcc;
    });
    // sync rpt + LSP-DB
    final Pcrpt syncMsg = getSyncMsg();
    this.listener.onMessage(this.session, syncMsg);
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        // check node - synchronized
        assertEquals(PccSyncState.Synchronized, pcc.getStateSync());
        // check reported LSP
        assertEquals(1, pcc.getReportedLsp().size());
        return pcc;
    });
    // Trigger Full Resync
    this.listener.triggerSync(new TriggerSyncInputBuilder().setNode(this.nodeId).setName("test").build());
    this.listener.onMessage(this.session, syncMsg);
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        // check node - synchronized
        assertEquals(PccSyncState.Synchronized, pcc.getStateSync());
        // check reported LSP
        assertEquals(0, pcc.getReportedLsp().size());
        return pcc;
    });
}
Also used : ReportedLsp(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.path.computation.client.ReportedLsp) TriggerSyncInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.TriggerSyncInputBuilder) Pcrpt(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcrpt) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 Pcrpt (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcrpt)2 TriggerSyncInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.TriggerSyncInputBuilder)2 ReportedLsp (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.path.computation.client.ReportedLsp)1