osaf/services/saf/amf/amfd/include/sg.h | 2 +-
osaf/services/saf/amf/amfd/sg.cc | 21 +++++++++++++++++++++
osaf/services/saf/amf/amfd/sg_nway_fsm.cc | 5 +++++
osaf/services/saf/amf/amfd/sg_nwayact_fsm.cc | 6 ++++++
4 files changed, 33 insertions(+), 1 deletions(-)
#
#Problem: The implementation has not respected the AMF spec
#according to the configuration of saAmfSGNumPrefAssignedSUs
#
#Analysis: In AMF spec, the 3.6.4.3 and 3.6.5.3 mention that the
#saAmfSGNumPrefAssignedSUs affected in assignment in nway and
#nway-active sg
#
#Change: Skip the SI assignment if the current number of assigned
#SU exceeding the saAmfSGNumPrefAssignedSUs
diff --git a/osaf/services/saf/amf/amfd/include/sg.h
b/osaf/services/saf/amf/amfd/include/sg.h
--- a/osaf/services/saf/amf/amfd/include/sg.h
+++ b/osaf/services/saf/amf/amfd/include/sg.h
@@ -356,6 +356,6 @@ extern void avd_su_role_failover(struct
extern bool sg_is_tolerance_timer_running_for_any_si(AVD_SG *sg);
extern void avd_sg_adjust_config(AVD_SG *sg);
extern uint32_t sg_instantiated_su_count(const AVD_SG *sg);
-
+extern uint32_t sg_assigned_su_count(const AVD_SG *sg);
#endif
diff --git a/osaf/services/saf/amf/amfd/sg.cc b/osaf/services/saf/amf/amfd/sg.cc
--- a/osaf/services/saf/amf/amfd/sg.cc
+++ b/osaf/services/saf/amf/amfd/sg.cc
@@ -1612,3 +1612,24 @@ uint32_t sg_instantiated_su_count(const
return inst_su_count;
}
+
+/**
+ * @brief Counts number of assigned su in the sg.
+ * @param Service Group
+ *
+ * @return Number of assigned su in the sg.
+ */
+uint32_t sg_assigned_su_count(const AVD_SG *sg)
+{
+ uint32_t su_count;
+ const AVD_SU *su;
+
+ for (su = sg->list_of_su, su_count = 0; su != NULL; su =
su->sg_list_su_next) {
+ TRACE_1("su'%s', current number of active SIs'%u'",
su->name.value, su->saAmfSUNumCurrActiveSIs);
+ if (su->saAmfSUNumCurrActiveSIs > 0 ||
su->saAmfSUNumCurrStandbySIs > 0) {
+ su_count++;
+ }
+ }
+
+ return su_count;
+}
diff --git a/osaf/services/saf/amf/amfd/sg_nway_fsm.cc
b/osaf/services/saf/amf/amfd/sg_nway_fsm.cc
--- a/osaf/services/saf/amf/amfd/sg_nway_fsm.cc
+++ b/osaf/services/saf/amf/amfd/sg_nway_fsm.cc
@@ -285,6 +285,11 @@ uint32_t avd_sg_nway_su_insvc_func(AVD_C
if ((cb->init_state != AVD_APP_STATE) && (su->sg_of_su->sg_ncs_spec ==
SA_FALSE))
goto done;
+ /* If current number of assigned su exceeds the
saAmfSGNumPrefAssignedSUs,
+ just skip the assignment. */
+ if (sg_assigned_su_count(su->sg_of_su) >=
su->sg_of_su->saAmfSGNumPrefAssignedSUs)
+ goto done;
+
/* a new su is available for assignments.. start assigning */
rc = avd_sg_nway_si_assign(cb, su->sg_of_su);
diff --git a/osaf/services/saf/amf/amfd/sg_nwayact_fsm.cc
b/osaf/services/saf/amf/amfd/sg_nwayact_fsm.cc
--- a/osaf/services/saf/amf/amfd/sg_nwayact_fsm.cc
+++ b/osaf/services/saf/amf/amfd/sg_nwayact_fsm.cc
@@ -575,6 +575,12 @@ uint32_t avd_sg_nacvred_su_insvc_func(AV
return NCSCC_RC_SUCCESS;
}
+ /* If current number of active assigned su exceeds the
saAmfSGNumPrefAssignedSUs,
+ just return success. */
+ if (sg_assigned_su_count(su->sg_of_su) >=
su->sg_of_su->saAmfSGNumPrefAssignedSUs) {
+ return NCSCC_RC_SUCCESS;
+ }
+
if (avd_sg_nacvred_su_chose_asgn(cb, su->sg_of_su) == NULL) {
avd_sg_app_su_inst_func(cb, su->sg_of_su);
if (AVD_SG_FSM_STABLE == su->sg_of_su->sg_fsm_state) {
------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works.
Faster operations. Version large binaries. Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel