use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.adj.flags.flags.isis.adj.flags._case.IsisAdjFlags in project bgpcep by opendaylight.
the class SrLinkAttributesParser method serializeAdjFlags.
private static BitArray serializeAdjFlags(final Flags flags, final SidLabelIndex sidLabelIndex) {
final BitArray bitFlags = new BitArray(FLAGS_BITS_SIZE);
if (flags instanceof OspfAdjFlagsCase) {
final OspfAdjFlags ospfFlags = ((OspfAdjFlagsCase) flags).getOspfAdjFlags();
bitFlags.set(BACKUP_OSPF, ospfFlags.getBackup());
bitFlags.set(SET_OSPF, ospfFlags.getSet());
SidLabelIndexParser.setFlags(sidLabelIndex, bitFlags, VALUE_OSPF, LOCAL_OSPF);
} else if (flags instanceof IsisAdjFlagsCase) {
final IsisAdjFlags isisFlags = ((IsisAdjFlagsCase) flags).getIsisAdjFlags();
bitFlags.set(ADDRESS_FAMILY_FLAG, isisFlags.getAddressFamily());
bitFlags.set(BACKUP_ISIS, isisFlags.getBackup());
bitFlags.set(SET_ISIS, isisFlags.getSet());
SidLabelIndexParser.setFlags(sidLabelIndex, bitFlags, VALUE_ISIS, LOCAL_ISIS);
} else if (flags == null) {
SidLabelIndexParser.setFlags(sidLabelIndex, bitFlags, VALUE_EPE, LOCAL_EPE);
}
return bitFlags;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.adj.flags.flags.isis.adj.flags._case.IsisAdjFlags in project bgpcep by opendaylight.
the class LinkstateGraphBuilder method createEdgeAttributes.
/**
* Create Edge Attributes from Link attributes.
*
* @param la Linkstate Attributes
* @param linkDesc Linkstate Descriptors
*
* @return EdgeAttributes
*/
private static EdgeAttributes createEdgeAttributes(final LinkAttributes la, final LinkDescriptors linkDesc) {
EdgeAttributesBuilder builder = new EdgeAttributesBuilder();
if (linkDesc.getIpv4InterfaceAddress() != null) {
builder.setLocalAddress(new IpAddress(linkDesc.getIpv4InterfaceAddress()));
}
if (linkDesc.getIpv6InterfaceAddress() != null) {
builder.setLocalAddress(new IpAddress(linkDesc.getIpv6InterfaceAddress()));
}
if (linkDesc.getIpv4NeighborAddress() != null) {
builder.setRemoteAddress(new IpAddress(linkDesc.getIpv4NeighborAddress()));
}
if (linkDesc.getIpv6NeighborAddress() != null) {
builder.setRemoteAddress(new IpAddress(linkDesc.getIpv6NeighborAddress()));
}
if (linkDesc.getLinkLocalIdentifier() != null) {
builder.setLocalIdentifier(linkDesc.getLinkLocalIdentifier());
}
if (linkDesc.getLinkRemoteIdentifier() != null) {
builder.setRemoteIdentifier(linkDesc.getLinkRemoteIdentifier());
}
if (la.getMetric() != null) {
builder.setMetric(la.getMetric().getValue());
}
if (la.getTeMetric() != null) {
builder.setTeMetric(la.getTeMetric().getValue());
}
if (la.getMaxLinkBandwidth() != null) {
builder.setMaxLinkBandwidth(bandwithToDecimalBandwidth(la.getMaxLinkBandwidth()));
}
if (la.getMaxReservableBandwidth() != null) {
builder.setMaxResvLinkBandwidth(bandwithToDecimalBandwidth(la.getMaxReservableBandwidth()));
}
if (la.getUnreservedBandwidth() != null) {
int upperBound = Math.min(la.getUnreservedBandwidth().size(), MAX_PRIORITY);
final List<UnreservedBandwidth> unRsvBw = new ArrayList<>(upperBound);
for (final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.UnreservedBandwidth bandwidth : la.nonnullUnreservedBandwidth().values()) {
unRsvBw.add(new UnreservedBandwidthBuilder().setBandwidth(bandwithToDecimalBandwidth(bandwidth.getBandwidth())).withKey(new UnreservedBandwidthKey(bandwidth.getPriority())).build());
}
builder.setUnreservedBandwidth(unRsvBw);
}
if (la.getAdminGroup() != null) {
builder.setAdminGroup(la.getAdminGroup().getValue());
}
if (la.getLinkDelay() != null) {
builder.setDelay(new Delay(la.getLinkDelay().getValue()));
}
if (la.getLinkMinMaxDelay() != null && la.getLinkMinMaxDelay() != null) {
MinMaxDelay mmDelay = new MinMaxDelayBuilder().setMaxDelay(new Delay(la.getLinkMinMaxDelay().getMaxDelay().getValue())).setMinDelay(new Delay(la.getLinkMinMaxDelay().getMinDelay().getValue())).build();
builder.setMinMaxDelay(mmDelay);
}
if (la.getDelayVariation() != null) {
builder.setJitter(new Delay(la.getDelayVariation().getValue()));
}
if (la.getLinkLoss() != null) {
builder.setLoss(new Loss(la.getLinkLoss().getValue()));
}
if (la.getAvailableBandwidth() != null) {
builder.setAvailableBandwidth(bandwithToDecimalBandwidth(la.getAvailableBandwidth()));
}
if (la.getResidualBandwidth() != null) {
builder.setResidualBandwidth(bandwithToDecimalBandwidth(la.getResidualBandwidth()));
}
if (la.getUtilizedBandwidth() != null) {
builder.setUtilizedBandwidth(bandwithToDecimalBandwidth(la.getUtilizedBandwidth()));
}
if (la.getSharedRiskLinkGroups() != null) {
List<Uint32> srlgs = new ArrayList<>();
for (SrlgId srlg : la.getSharedRiskLinkGroups()) {
srlgs.add(srlg.getValue());
}
builder.setSrlgs(srlgs);
}
for (SrAdjIds adj : la.nonnullSrAdjIds()) {
if (adj.getSidLabelIndex() instanceof LocalLabelCase) {
boolean backup = false;
if (adj.getFlags() instanceof OspfAdjFlags) {
backup = ((OspfAdjFlags) adj.getFlags()).getBackup();
}
if (adj.getFlags() instanceof IsisAdjFlags) {
backup = ((IsisAdjFlags) adj.getFlags()).getBackup();
}
if (!backup) {
builder.setAdjSid(((LocalLabelCase) adj.getSidLabelIndex()).getLocalLabel().getValue());
} else {
builder.setBackupAdjSid(((LocalLabelCase) adj.getSidLabelIndex()).getLocalLabel().getValue());
}
}
}
return builder.build();
}
Aggregations