use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.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());
ByteBufUtils.writeOrZero(body, isis.getPsn());
} else if (tlv instanceof OspfNodeCase) {
ByteBufUtils.writeOrZero(body, ((OspfNodeCase) tlv).getOspfNode().getOspfRouterId());
} else if (tlv instanceof OspfPseudonodeCase) {
final OspfPseudonode node = ((OspfPseudonodeCase) tlv).getOspfPseudonode();
ByteBufUtils.writeOrZero(body, node.getOspfRouterId());
ByteBufUtils.write(body, node.getLanInterface().getValue());
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.node.identifier.c.router.identifier.OspfNodeCase in project bgpcep by opendaylight.
the class LinkstateGraphBuilder method getVertexId.
/**
* Get Vertex in the Graph by the OSPF Router ID or IS-IS-System ID.
*
* @param routerID The Router Identifier entry
*
* @return Vertex in the Connected Graph that corresponds to this Router ID. Vertex is created if not found.
*/
private static Uint64 getVertexId(final CRouterIdentifier routerID) {
Uint64 rid = Uint64.ZERO;
if (routerID instanceof IsisNodeCase) {
final byte[] isoId = ((IsisNodeCase) routerID).getIsisNode().getIsoSystemId().getValue();
final byte[] convert = { 0, 0, isoId[0], isoId[1], isoId[2], isoId[3], isoId[4], isoId[5] };
rid = Uint64.fromLongBits(ByteBuffer.wrap(convert).getLong());
}
if (routerID instanceof OspfNodeCase) {
rid = ((OspfNodeCase) routerID).getOspfNode().getOspfRouterId().toUint64();
}
LOG.debug("Get Vertex Identifier {}", rid);
return rid;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.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();
ospf.findChildByArg(OSPF_ROUTER_NID).map(routerId -> new OspfNodeBuilder().setOspfRouterId((Uint32) routerId.body()).build()).ifPresent(builder::setOspfNode);
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.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(Empty.getInstance()).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.getAbr() != null) {
ab.setRouterType(new AbrBuilder().setAbr(nf.getAbr() ? Empty.getInstance() : null).build());
} else if (nf.getExternal() != null) {
ab.setRouterType(new InternalBuilder().setInternal(nf.getExternal() ? null : Empty.getInstance()).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();
}
Aggregations