Standby rank which is passed to CSI set and protection group callbacks may not be accurate.
If SIrankedSUs exist with non-unique ranks, AVD_SI::get_sisu_rank() is not traversing all the SUs at that rank to determine the standby rank. AVD_SI::get_sisu_rank() needs to traverse all the SUs at the particular rank. --- src/amf/amfd/si.cc | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/amf/amfd/si.cc b/src/amf/amfd/si.cc index cd8be9479..df9d511f3 100644 --- a/src/amf/amfd/si.cc +++ b/src/amf/amfd/si.cc @@ -339,7 +339,7 @@ void AVD_SI::update_sisu_rank(const std::string& suname, uint32_t newRank) { } uint32_t AVD_SI::get_sisu_rank(const std::string& suname) const { - uint32_t rank{}; + uint32_t rank{}, currentRank{}; TRACE_ENTER2("%s", suname.c_str()); @@ -348,11 +348,27 @@ uint32_t AVD_SI::get_sisu_rank(const std::string& suname) const { susi->su->name.c_str(), susi->si->name.c_str(), susi->state); - if (susi->state == SA_AMF_HA_STANDBY) + if (susi->state == SA_AMF_HA_STANDBY) { + // if there are SUs with the same rank we need to go through all of them + if (currentRank) { + const AVD_SIRANKEDSU *sirankedsu{get_si_ranked_su(susi->su->name)}; + if (!sirankedsu || + (sirankedsu && sirankedsu->get_sa_amf_rank() != currentRank)) { + break; + } + } + rank++; + } - if (suname == susi->su->name) - break; + if (suname == susi->su->name) { + // see if there are any other SUs at this same rank + const AVD_SIRANKEDSU *sirankedsu{get_si_ranked_su(susi->su->name)}; + if (sirankedsu) + currentRank = sirankedsu->get_sa_amf_rank(); + else + break; + } } TRACE_LEAVE(); -- 2.21.1 ----------------------------------------------------------------------------------------------------------------------- Notice: This e-mail together with any attachments may contain information of Ribbon Communications Inc. that is confidential and/or proprietary for the sole use of the intended recipient. Any review, disclosure, reliance or distribution by others or forwarding without express permission is strictly prohibited. If you are not the intended recipient, please notify the sender immediately and then delete all copies, including any attachments. ----------------------------------------------------------------------------------------------------------------------- _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel