Search in sources :

Example 1 with IpNodeId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.nai.IpNodeId in project bgpcep by opendaylight.

the class AbstractSrSubobjectParser method serializeNai.

private static void serializeNai(final Nai nai, final SidType sidType, final ByteBuf buffer) {
    switch(sidType) {
        case Ipv4NodeId:
            writeIpv4Address(((IpNodeId) nai).getIpAddress().getIpv4Address(), buffer);
            break;
        case Ipv6NodeId:
            writeIpv6Address(((IpNodeId) nai).getIpAddress().getIpv6Address(), buffer);
            break;
        case Ipv4Adjacency:
            writeIpv4Address(((IpAdjacency) nai).getLocalIpAddress().getIpv4Address(), buffer);
            writeIpv4Address(((IpAdjacency) nai).getRemoteIpAddress().getIpv4Address(), buffer);
            break;
        case Ipv6Adjacency:
            writeIpv6Address(((IpAdjacency) nai).getLocalIpAddress().getIpv6Address(), buffer);
            writeIpv6Address(((IpAdjacency) nai).getRemoteIpAddress().getIpv6Address(), buffer);
            break;
        case Unnumbered:
            final UnnumberedAdjacency unnumbered = (UnnumberedAdjacency) nai;
            ByteBufWriteUtil.writeUnsignedInt(unnumbered.getLocalNodeId(), buffer);
            ByteBufWriteUtil.writeUnsignedInt(unnumbered.getLocalInterfaceId(), buffer);
            ByteBufWriteUtil.writeUnsignedInt(unnumbered.getRemoteNodeId(), buffer);
            ByteBufWriteUtil.writeUnsignedInt(unnumbered.getRemoteInterfaceId(), buffer);
            break;
        default:
            break;
    }
}
Also used : IpNodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.sr.subobject.nai.IpNodeId) UnnumberedAdjacency(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.sr.subobject.nai.UnnumberedAdjacency) IpAdjacency(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.sr.subobject.nai.IpAdjacency)

Example 2 with IpNodeId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.nai.IpNodeId in project bgpcep by opendaylight.

the class TopologyProviderTest method testOnReportMessage.

@Test
public void testOnReportMessage() throws ExecutionException, InterruptedException {
    listener.onSessionUp(session);
    Pcrpt pcRptMsg = createSrPcRpt("1.1.1.1", "sr-path1", Uint32.ONE, true);
    listener.onMessage(session, pcRptMsg);
    readDataOperational(getDataBroker(), pathComputationClientIId, pcc -> {
        // check sr-path
        final Map<ReportedLspKey, ReportedLsp> reportedLsps = pcc.getReportedLsp();
        assertNotNull(reportedLsps);
        assertEquals(1, reportedLsps.size());
        final ReportedLsp lsp = reportedLsps.values().iterator().next();
        assertEquals("sr-path1", lsp.getName());
        final Map<PathKey, Path> paths = lsp.getPath();
        assertNotNull(paths);
        final Path path = paths.values().iterator().next();
        assertEquals(1, path.augmentation(Path1.class).getPathSetupType().getPst().intValue());
        final List<Subobject> subobjects = path.getEro().nonnullSubobject();
        assertEquals(1, subobjects.size());
        assertEquals("1.1.1.1", ((IpNodeId) ((SrEroType) subobjects.get(0).getSubobjectType()).getNai()).getIpAddress().getIpv4AddressNoZone().getValue());
        return pcc;
    });
    pcRptMsg = createSrPcRpt("1.1.1.3", "sr-path2", Uint32.TWO, false);
    listener.onMessage(session, pcRptMsg);
    readDataOperational(getDataBroker(), pathComputationClientIId, pcc -> {
        // check second lsp sr-path
        final Map<ReportedLspKey, ReportedLsp> reportedLsps = pcc.getReportedLsp();
        assertNotNull(reportedLsps);
        assertEquals(2, reportedLsps.size());
        return pcc;
    });
    pcRptMsg = createSrPcRpt("1.1.1.2", "sr-path1", Uint32.ONE, true);
    listener.onMessage(session, pcRptMsg);
    readDataOperational(getDataBroker(), pathComputationClientIId, pcc -> {
        // check updated sr-path
        final Map<ReportedLspKey, ReportedLsp> reportedLsps = pcc.getReportedLsp();
        assertNotNull(reportedLsps);
        assertEquals(2, reportedLsps.size());
        for (final ReportedLsp rlsp : reportedLsps.values()) {
            if (rlsp.getName().equals("sr-path1")) {
                final List<Subobject> subobjects = rlsp.nonnullPath().values().iterator().next().getEro().nonnullSubobject();
                assertEquals(1, subobjects.size());
                assertEquals("1.1.1.2", ((IpNodeId) ((SrEroType) subobjects.get(0).getSubobjectType()).getNai()).getIpAddress().getIpv4AddressNoZone().getValue());
            }
        }
        return pcc;
    });
}
Also used : Path(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.reported.lsp.Path) PathKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.reported.lsp.PathKey) ReportedLsp(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.ReportedLsp) Subobject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.Subobject) Pcrpt(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Pcrpt) ReportedLspKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.ReportedLspKey) SrEroType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.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)

Example 3 with IpNodeId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.nai.IpNodeId in project bgpcep by opendaylight.

the class AbstractSrSubobjectParser method serializeNai.

private static void serializeNai(final Nai nai, final NaiType naiType, final ByteBuf buffer) {
    switch(naiType) {
        case Ipv4NodeId:
            Ipv4Util.writeIpv4Address(((IpNodeId) nai).getIpAddress().getIpv4AddressNoZone(), buffer);
            break;
        case Ipv6NodeId:
            Ipv6Util.writeIpv6Address(((IpNodeId) nai).getIpAddress().getIpv6AddressNoZone(), buffer);
            break;
        case Ipv4Adjacency:
            Ipv4Util.writeIpv4Address(((IpAdjacency) nai).getLocalIpAddress().getIpv4AddressNoZone(), buffer);
            Ipv4Util.writeIpv4Address(((IpAdjacency) nai).getRemoteIpAddress().getIpv4AddressNoZone(), buffer);
            break;
        case Ipv6Adjacency:
            Ipv6Util.writeIpv6Address(((IpAdjacency) nai).getLocalIpAddress().getIpv6AddressNoZone(), buffer);
            Ipv6Util.writeIpv6Address(((IpAdjacency) nai).getRemoteIpAddress().getIpv6AddressNoZone(), buffer);
            break;
        case Unnumbered:
            final UnnumberedAdjacency unnumbered = (UnnumberedAdjacency) nai;
            ByteBufUtils.writeOrZero(buffer, unnumbered.getLocalNodeId());
            ByteBufUtils.writeOrZero(buffer, unnumbered.getLocalInterfaceId());
            ByteBufUtils.writeOrZero(buffer, unnumbered.getRemoteNodeId());
            ByteBufUtils.writeOrZero(buffer, unnumbered.getRemoteInterfaceId());
            break;
        case Ipv6Local:
            final Ipv6Local ipv6Local = (Ipv6Local) nai;
            Ipv6Util.writeIpv6Address(ipv6Local.getLocalIpv6Address(), buffer);
            ByteBufUtils.writeOrZero(buffer, ipv6Local.getLocalId());
            Ipv6Util.writeIpv6Address(ipv6Local.getRemoteIpv6Address(), buffer);
            ByteBufUtils.writeOrZero(buffer, ipv6Local.getRemoteId());
            break;
        default:
            break;
    }
}
Also used : IpNodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.nai.IpNodeId) UnnumberedAdjacency(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.nai.UnnumberedAdjacency) IpAdjacency(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.nai.IpAdjacency) Ipv6Local(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.nai.Ipv6Local)

Aggregations

Test (org.junit.Test)1 AbstractPCEPSessionTest (org.opendaylight.bgpcep.pcep.topology.provider.AbstractPCEPSessionTest)1 Pcrpt (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Pcrpt)1 IpAdjacency (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.sr.subobject.nai.IpAdjacency)1 IpNodeId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.sr.subobject.nai.IpNodeId)1 UnnumberedAdjacency (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.sr.subobject.nai.UnnumberedAdjacency)1 SrEroType (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.network.topology.topology.node.path.computation.client.reported.lsp.path.ero.subobject.subobject.type.SrEroType)1 IpAdjacency (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.nai.IpAdjacency)1 IpNodeId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.nai.IpNodeId)1 Ipv6Local (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.nai.Ipv6Local)1 UnnumberedAdjacency (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.nai.UnnumberedAdjacency)1 Subobject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.Subobject)1 ReportedLsp (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.ReportedLsp)1 ReportedLspKey (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.ReportedLspKey)1 Path (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.reported.lsp.Path)1 PathKey (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.reported.lsp.PathKey)1