use of org.onosproject.bgpio.types.OspfNonPseudonode in project onos by opennetworkinglab.
the class BgpDpid method add.
/**
* Obtains instance of this class by appending stringBuilder with node descriptor value.
*
* @param value node descriptor
* @return instance of this class
*/
public BgpDpid add(final NodeDescriptors value) {
log.debug("BgpDpid :: add function");
if (value != null) {
List<BgpValueType> subTlvs = value.getSubTlvs();
ListIterator<BgpValueType> listIterator = subTlvs.listIterator();
while (listIterator.hasNext()) {
BgpValueType tlv = listIterator.next();
if (tlv.getType() == AutonomousSystemTlv.TYPE) {
this.stringBuilder.append(":ASN=").append(((AutonomousSystemTlv) tlv).getAsNum());
} else if (tlv.getType() == BgpLSIdentifierTlv.TYPE) {
this.stringBuilder.append(":DOMAINID=").append(((BgpLSIdentifierTlv) tlv).getBgpLsIdentifier());
} else if (tlv.getType() == NodeDescriptors.IGP_ROUTERID_TYPE) {
if (tlv instanceof IsIsNonPseudonode) {
this.stringBuilder.append(":ISOID=").append(isoNodeIdString(((IsIsNonPseudonode) tlv).getIsoNodeId()));
} else if (tlv instanceof IsIsPseudonode) {
IsIsPseudonode isisPseudonode = ((IsIsPseudonode) tlv);
this.stringBuilder.append(":ISOID=").append(isoNodeIdString(((IsIsPseudonode) tlv).getIsoNodeId()));
this.stringBuilder.append(":PSN=").append(isisPseudonode.getPsnIdentifier());
} else if (tlv instanceof OspfNonPseudonode) {
this.stringBuilder.append(":RID=").append(((OspfNonPseudonode) tlv).getrouterID());
} else if (tlv instanceof OspfPseudonode) {
this.stringBuilder.append(":RID=").append(((OspfPseudonode) tlv).getrouterID());
}
}
}
}
return this;
}
use of org.onosproject.bgpio.types.OspfNonPseudonode in project onos by opennetworkinglab.
the class NodeDescriptors method compareTo.
/**
* Compares this and o object.
*
* @param o object to be compared with this object
* @return which object is greater
*/
public int compareTo(Object o) {
if (this.equals(o)) {
return 0;
}
ListIterator<BgpValueType> listIterator = subTlvs.listIterator();
int countOtherSubTlv = ((NodeDescriptors) o).subTlvs.size();
int countObjSubTlv = subTlvs.size();
boolean tlvFound = false;
if (countOtherSubTlv != countObjSubTlv) {
if (countOtherSubTlv > countObjSubTlv) {
return 1;
} else {
return -1;
}
} else {
while (listIterator.hasNext()) {
BgpValueType tlv1 = listIterator.next();
log.debug("NodeDescriptor compare subtlv's");
for (BgpValueType tlv : ((NodeDescriptors) o).subTlvs) {
if (tlv.getType() == tlv1.getType()) {
if (tlv.getType() == IGP_ROUTERID_TYPE) {
if ((tlv1 instanceof IsIsNonPseudonode && tlv instanceof IsIsPseudonode) || (tlv1 instanceof IsIsPseudonode && tlv instanceof IsIsNonPseudonode) || (tlv1 instanceof OspfNonPseudonode && tlv instanceof OspfPseudonode) || (tlv1 instanceof OspfPseudonode && tlv instanceof OspfNonPseudonode)) {
continue;
}
}
int result = subTlvs.get(subTlvs.indexOf(tlv1)).compareTo(((NodeDescriptors) o).subTlvs.get(((NodeDescriptors) o).subTlvs.indexOf(tlv)));
if (result != 0) {
return result;
}
tlvFound = true;
break;
}
}
if (!tlvFound) {
return 1;
}
}
}
return 0;
}
Aggregations