Search in sources :

Example 1 with OspfNodeCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.OspfNodeCase 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 2 with OspfNodeCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.OspfNodeCase 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 3 with OspfNodeCase

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

the class NodeNlriParser method serializeOspfNode.

private static OspfNodeCase serializeOspfNode(final ContainerNode ospf) {
    final OspfNodeCaseBuilder builder = new OspfNodeCaseBuilder();
    if (ospf.getChild(OSPF_ROUTER_NID).isPresent()) {
        final OspfNodeBuilder nodeBuilder = new OspfNodeBuilder();
        nodeBuilder.setOspfRouterId((Long) ospf.getChild(OSPF_ROUTER_NID).get().getValue());
        builder.setOspfNode(nodeBuilder.build());
    }
    return builder.build();
}
Also used : OspfNodeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.ospf.node._case.OspfNodeBuilder) OspfNodeCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.OspfNodeCaseBuilder)

Aggregations

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 IsisPseudonode (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.isis.pseudonode._case.IsisPseudonode)2 OspfPseudonode (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.ospf.pseudonode._case.OspfPseudonode)2 NodeFlagBits (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.NodeFlagBits)1 CRouterIdentifier (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.CRouterIdentifier)1 IsisNodeCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.IsisNodeCase)1 IsisPseudonodeCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.IsisPseudonodeCase)1 OspfNodeCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.OspfNodeCaseBuilder)1 IsisNode (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.isis.node._case.IsisNode)1 OspfNodeBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.c.router.identifier.ospf.node._case.OspfNodeBuilder)1 OspfNodeAttributesBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.ospf.node.attributes.OspfNodeAttributesBuilder)1 AbrBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.ospf.node.attributes.ospf.node.attributes.router.type.AbrBuilder)1 InternalBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.ospf.node.attributes.ospf.node.attributes.router.type.InternalBuilder)1 PseudonodeBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.ospf.node.attributes.ospf.node.attributes.router.type.PseudonodeBuilder)1