Search in sources :

Example 1 with CRouterIdentifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.CRouterIdentifier in project bgpcep by opendaylight.

the class NodeNlriParser method serializeOspfPseudoNode.

private static CRouterIdentifier serializeOspfPseudoNode(final ContainerNode ospfPseudonode) {
    final OspfPseudonodeCaseBuilder builder = new OspfPseudonodeCaseBuilder();
    final OspfPseudonodeBuilder nodeBuilder = new OspfPseudonodeBuilder();
    if (ospfPseudonode.getChild(LAN_IFACE_NID).isPresent()) {
        nodeBuilder.setLanInterface(new OspfInterfaceIdentifier((Long) ospfPseudonode.getChild(LAN_IFACE_NID).get().getValue()));
    }
    if (ospfPseudonode.getChild(OSPF_ROUTER_NID).isPresent()) {
        nodeBuilder.setOspfRouterId((Long) ospfPseudonode.getChild(OSPF_ROUTER_NID).get().getValue());
    }
    builder.setOspfPseudonode(nodeBuilder.build());
    return builder.build();
}
Also used : OspfPseudonodeCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.OspfPseudonodeCaseBuilder) OspfInterfaceIdentifier(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.OspfInterfaceIdentifier) OspfPseudonodeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.ospf.pseudonode._case.OspfPseudonodeBuilder)

Example 2 with CRouterIdentifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.CRouterIdentifier in project bgpcep by opendaylight.

the class RouterIdTlvParser method serializeTlvBody.

@Override
public void serializeTlvBody(final CRouterIdentifier tlv, final ByteBuf body) {
    if (tlv instanceof IsisNodeCase) {
        final IsisNode isis = ((IsisNodeCase) tlv).getIsisNode();
        body.writeBytes(isis.getIsoSystemId().getValue());
    } else if (tlv instanceof IsisPseudonodeCase) {
        final IsisPseudonode isis = ((IsisPseudonodeCase) tlv).getIsisPseudonode();
        body.writeBytes(isis.getIsIsRouterIdentifier().getIsoSystemId().getValue());
        ByteBufWriteUtil.writeUnsignedByte(isis.getPsn(), body);
    } else if (tlv instanceof OspfNodeCase) {
        ByteBufWriteUtil.writeUnsignedInt(((OspfNodeCase) tlv).getOspfNode().getOspfRouterId(), body);
    } else if (tlv instanceof OspfPseudonodeCase) {
        final OspfPseudonode node = ((OspfPseudonodeCase) tlv).getOspfPseudonode();
        ByteBufWriteUtil.writeUnsignedInt(node.getOspfRouterId(), body);
        ByteBufWriteUtil.writeUnsignedInt(node.getLanInterface().getValue(), body);
    }
}
Also used : OspfPseudonode(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.ospf.pseudonode._case.OspfPseudonode) IsisNodeCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.IsisNodeCase) OspfPseudonodeCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.OspfPseudonodeCase) OspfNodeCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.OspfNodeCase) IsisPseudonodeCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.IsisPseudonodeCase) IsisPseudonode(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.isis.pseudonode._case.IsisPseudonode) IsisNode(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.isis.node._case.IsisNode)

Example 3 with CRouterIdentifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.CRouterIdentifier in project bgpcep by opendaylight.

the class ProtocolUtil method ospfNodeAttributes.

private static org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.IgpNodeAttributes1 ospfNodeAttributes(final NodeIdentifier node, final NodeAttributes na) {
    final org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.ospf.node.attributes.ospf.node.attributes.TedBuilder tb = new org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.ospf.node.attributes.ospf.node.attributes.TedBuilder();
    final OspfNodeAttributesBuilder ab = new OspfNodeAttributesBuilder();
    if (na != null) {
        if (na.getIpv4RouterId() != null) {
            tb.setTeRouterIdIpv4(na.getIpv4RouterId());
        }
        if (na.getIpv6RouterId() != null) {
            tb.setTeRouterIdIpv6(na.getIpv6RouterId());
        }
        if (na.getTopologyIdentifier() != null) {
            ab.setMultiTopologyId(nodeMultiTopology(na.getTopologyIdentifier()));
        }
        final CRouterIdentifier ri = node.getCRouterIdentifier();
        if (ri instanceof OspfPseudonodeCase) {
            final OspfPseudonode pn = ((OspfPseudonodeCase) ri).getOspfPseudonode();
            ab.setRouterType(new PseudonodeBuilder().setPseudonode(Boolean.TRUE).build());
            ab.setDrInterfaceId(pn.getLanInterface().getValue());
        } else if (ri instanceof OspfNodeCase && na.getNodeFlags() != null) {
            // TODO: what should we do with in.getOspfRouterId()?
            final NodeFlagBits nf = na.getNodeFlags();
            if (nf.isAbr() != null) {
                ab.setRouterType(new AbrBuilder().setAbr(nf.isAbr()).build());
            } else if (nf.isExternal() != null) {
                ab.setRouterType(new InternalBuilder().setInternal(!nf.isExternal()).build());
            }
        }
    }
    ab.setTed(tb.build());
    return new org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.IgpNodeAttributes1Builder().setOspfNodeAttributes(ab.build()).build();
}
Also used : OspfPseudonode(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.ospf.pseudonode._case.OspfPseudonode) AbrBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.ospf.node.attributes.ospf.node.attributes.router.type.AbrBuilder) OspfNodeAttributesBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.ospf.node.attributes.OspfNodeAttributesBuilder) OspfNodeCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.OspfNodeCase) InternalBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.ospf.node.attributes.ospf.node.attributes.router.type.InternalBuilder) CRouterIdentifier(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.CRouterIdentifier) NodeFlagBits(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.NodeFlagBits) IsisPseudonode(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.isis.pseudonode._case.IsisPseudonode) OspfPseudonode(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.ospf.pseudonode._case.OspfPseudonode) PseudonodeBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.ospf.node.attributes.ospf.node.attributes.router.type.PseudonodeBuilder) OspfPseudonodeCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.OspfPseudonodeCase)

Example 4 with CRouterIdentifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.CRouterIdentifier in project bgpcep by opendaylight.

the class ProtocolUtil method isisNodeAttributes.

private static org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.isis.topology.rev131021.IgpNodeAttributes1 isisNodeAttributes(final NodeIdentifier node, final NodeAttributes na) {
    final org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.isis.topology.rev131021.isis.node.attributes.isis.node.attributes.TedBuilder tb = new org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.isis.topology.rev131021.isis.node.attributes.isis.node.attributes.TedBuilder();
    final IsisNodeAttributesBuilder ab = new IsisNodeAttributesBuilder();
    if (na != null) {
        if (na.getIpv4RouterId() != null) {
            tb.setTeRouterIdIpv4(na.getIpv4RouterId());
        }
        if (na.getIpv6RouterId() != null) {
            tb.setTeRouterIdIpv6(na.getIpv6RouterId());
        }
        if (na.getTopologyIdentifier() != null) {
            ab.setMultiTopologyId(nodeMultiTopology(na.getTopologyIdentifier()));
        }
    }
    final CRouterIdentifier ri = node.getCRouterIdentifier();
    if (ri instanceof IsisPseudonodeCase) {
        final IsisPseudonode pn = ((IsisPseudonodeCase) ri).getIsisPseudonode();
        final IsoBuilder b = new IsoBuilder();
        final String systemId = UriBuilder.isoId(pn.getIsIsRouterIdentifier().getIsoSystemId());
        b.setIsoSystemId(new IsoSystemId(systemId));
        b.setIsoPseudonodeId(new IsoPseudonodeId(BaseEncoding.base16().encode(new byte[] { pn.getPsn().byteValue() })));
        ab.setIso(b.build());
        if (na != null) {
            ab.setNet(toIsoNetIds(na.getIsisAreaId(), systemId));
        }
    } else if (ri instanceof IsisNodeCase) {
        final IsisNode in = ((IsisNodeCase) ri).getIsisNode();
        final String systemId = UriBuilder.isoId(in.getIsoSystemId());
        ab.setIso(new IsoBuilder().setIsoSystemId(new IsoSystemId(systemId)).build());
        if (na != null) {
            ab.setNet(toIsoNetIds(na.getIsisAreaId(), systemId));
        }
    }
    ab.setTed(tb.build());
    return new org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.isis.topology.rev131021.IgpNodeAttributes1Builder().setIsisNodeAttributes(ab.build()).build();
}
Also used : IsoPseudonodeId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.isis.topology.rev131021.IsoPseudonodeId) IsisNode(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.isis.node._case.IsisNode) CRouterIdentifier(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.CRouterIdentifier) IsisNodeCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.IsisNodeCase) IsoSystemId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.isis.topology.rev131021.IsoSystemId) IsisNodeAttributesBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.isis.topology.rev131021.isis.node.attributes.IsisNodeAttributesBuilder) IsisPseudonode(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.isis.pseudonode._case.IsisPseudonode) OspfPseudonode(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.ospf.pseudonode._case.OspfPseudonode) IsoBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.isis.topology.rev131021.isis.node.attributes.isis.node.attributes.IsoBuilder) IsisPseudonodeCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.IsisPseudonodeCase) IsisPseudonode(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.isis.pseudonode._case.IsisPseudonode)

Example 5 with CRouterIdentifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.CRouterIdentifier in project bgpcep by opendaylight.

the class NodeNlriParser method serializeRouterId.

private static CRouterIdentifier serializeRouterId(final ContainerNode descriptorsData) {
    CRouterIdentifier cRouterId = null;
    final Optional<DataContainerChild<? extends PathArgument, ?>> maybeRouterId = descriptorsData.getChild(ROUTER_NID);
    if (maybeRouterId.isPresent()) {
        final ChoiceNode routerId = (ChoiceNode) maybeRouterId.get();
        if (routerId.getChild(ISIS_NODE_NID).isPresent()) {
            cRouterId = serializeIsisNode((ContainerNode) routerId.getChild(ISIS_NODE_NID).get());
        } else if (routerId.getChild(ISIS_PSEUDONODE_NID).isPresent()) {
            cRouterId = serializeIsisPseudoNode((ContainerNode) routerId.getChild(ISIS_PSEUDONODE_NID).get());
        } else if (routerId.getChild(OSPF_NODE_NID).isPresent()) {
            cRouterId = serializeOspfNode((ContainerNode) routerId.getChild(OSPF_NODE_NID).get());
        } else if (routerId.getChild(OSPF_PSEUDONODE_NID).isPresent()) {
            cRouterId = serializeOspfPseudoNode((ContainerNode) routerId.getChild(OSPF_PSEUDONODE_NID).get());
        }
    }
    return cRouterId;
}
Also used : CRouterIdentifier(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.CRouterIdentifier) DataContainerChild(org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild) ChoiceNode(org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode) ContainerNode(org.opendaylight.yangtools.yang.data.api.schema.ContainerNode) PathArgument(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument)

Aggregations

CRouterIdentifier (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.CRouterIdentifier)4 IsisPseudonode (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.isis.pseudonode._case.IsisPseudonode)3 OspfPseudonode (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.ospf.pseudonode._case.OspfPseudonode)3 IsisNodeCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.IsisNodeCase)2 IsisPseudonodeCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.IsisPseudonodeCase)2 OspfNodeCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.OspfNodeCase)2 OspfPseudonodeCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.OspfPseudonodeCase)2 IsisNode (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.isis.node._case.IsisNode)2 AsNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber)1 AreaIdentifier (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.AreaIdentifier)1 DomainIdentifier (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.DomainIdentifier)1 NodeFlagBits (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.NodeFlagBits)1 NodeIdentifier (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.NodeIdentifier)1 OspfInterfaceIdentifier (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.OspfInterfaceIdentifier)1 OspfPseudonodeCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.OspfPseudonodeCaseBuilder)1 OspfPseudonodeBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.ospf.pseudonode._case.OspfPseudonodeBuilder)1 IsoPseudonodeId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.isis.topology.rev131021.IsoPseudonodeId)1 IsoSystemId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.isis.topology.rev131021.IsoSystemId)1 IsisNodeAttributesBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.isis.topology.rev131021.isis.node.attributes.IsisNodeAttributesBuilder)1 IsoBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.isis.topology.rev131021.isis.node.attributes.isis.node.attributes.IsoBuilder)1