Search in sources :

Example 26 with Pcrpt

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcrpt in project bgpcep by opendaylight.

the class TopologyProviderTest method testOnReportMessage.

@Test
public void testOnReportMessage() throws ReadFailedException {
    this.listener.onSessionUp(this.session);
    Pcrpt pcRptMsg = createSrPcRpt("1.1.1.1", "sr-path1", 1L, true);
    this.listener.onMessage(this.session, pcRptMsg);
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        // check sr-path
        final List<ReportedLsp> reportedLsps = pcc.getReportedLsp();
        assertNotNull(reportedLsps);
        assertEquals(1, reportedLsps.size());
        final ReportedLsp lsp = reportedLsps.get(0);
        assertEquals("sr-path1", lsp.getName());
        assertEquals(1, lsp.getPath().get(0).getAugmentation(Path1.class).getPathSetupType().getPst().intValue());
        final List<Subobject> subobjects = lsp.getPath().get(0).getEro().getSubobject();
        assertEquals(1, subobjects.size());
        assertEquals("1.1.1.1", ((IpNodeId) ((SrEroType) subobjects.get(0).getSubobjectType()).getNai()).getIpAddress().getIpv4Address().getValue());
        return pcc;
    });
    pcRptMsg = createSrPcRpt("1.1.1.3", "sr-path2", 2L, false);
    this.listener.onMessage(this.session, pcRptMsg);
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        // check second lsp sr-path
        final List<ReportedLsp> reportedLsps = pcc.getReportedLsp();
        assertNotNull(reportedLsps);
        assertEquals(2, reportedLsps.size());
        return pcc;
    });
    pcRptMsg = createSrPcRpt("1.1.1.2", "sr-path1", 1L, true);
    this.listener.onMessage(this.session, pcRptMsg);
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        // check updated sr-path
        final List<ReportedLsp> reportedLsps = pcc.getReportedLsp();
        assertNotNull(reportedLsps);
        assertEquals(2, reportedLsps.size());
        for (final ReportedLsp rlsp : reportedLsps) {
            if (rlsp.getName().equals("sr-path1")) {
                final List<Subobject> subobjects = rlsp.getPath().get(0).getEro().getSubobject();
                assertEquals(1, subobjects.size());
                assertEquals("1.1.1.2", ((IpNodeId) ((SrEroType) subobjects.get(0).getSubobjectType()).getNai()).getIpAddress().getIpv4Address().getValue());
            }
        }
        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) Subobject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.Subobject) Pcrpt(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcrpt) SrEroType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.network.topology.topology.node.path.computation.client.reported.lsp.path.ero.subobject.subobject.type.SrEroType) AbstractPCEPSessionTest(org.opendaylight.bgpcep.pcep.topology.provider.AbstractPCEPSessionTest) Test(org.junit.Test)

Aggregations

Pcrpt (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcrpt)21 Test (org.junit.Test)17 LspBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.LspBuilder)12 MsgBuilderUtil.createLspTlvs (org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.createLspTlvs)11 Tlvs (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.lsp.Tlvs)11 PlspId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PlspId)8 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 Collections (java.util.Collections)5 LspDbVersionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.lsp.db.version.tlv.LspDbVersionBuilder)5 Reports (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcrpt.message.pcrpt.message.Reports)5 PCEPSession (org.opendaylight.protocol.pcep.PCEPSession)4 PcrptBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PcrptBuilder)4 PcrptMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcrpt.message.PcrptMessageBuilder)4 LspDbVersion (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.lsp.db.version.tlv.LspDbVersion)3 ReportsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcrpt.message.pcrpt.message.ReportsBuilder)3 ReportedLsp (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.path.computation.client.ReportedLsp)3 ByteBuf (io.netty.buffer.ByteBuf)2 SymbolicPathName (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.SymbolicPathName)2 LspIdentifiersBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.LspIdentifiersBuilder)2