osaf/services/saf/amf/amfd/sirankedsu.cc |  17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)


Amf is allowing to create sirankedsu object even if su
mentioned in that object doesn't exist.
Ideally Amf should throw error for such cases.
For creation of association object, both the associated objects
should exists

diff --git a/osaf/services/saf/amf/amfd/sirankedsu.cc 
b/osaf/services/saf/amf/amfd/sirankedsu.cc
--- a/osaf/services/saf/amf/amfd/sirankedsu.cc
+++ b/osaf/services/saf/amf/amfd/sirankedsu.cc
@@ -244,6 +244,7 @@ static int is_config_valid(const SaNameT
        SaNameT si_name;
         uint32_t rank = 0;
        AVD_SUS_PER_SI_RANK_INDX indx;
+       AVD_SU *avd_su = NULL;
 
         memset(&su_name, 0, sizeof(SaNameT));
         memset(&si_name, 0, sizeof(SaNameT));
@@ -266,6 +267,22 @@ static int is_config_valid(const SaNameT
                 }
         }
 
+       /* Find the su name. */
+       avd_su = su_db->find(Amf::to_string(&su_name));
+       if (avd_su == NULL) {
+               /* SU does not exist in current model, check CCB */
+               if (opdata == NULL) {
+                       report_ccb_validation_error(opdata, "'%s' does not 
exist in model", su_name.value);
+                       return 0;
+               }
+
+               if (ccbutil_getCcbOpDataByDN(opdata->ccbId, &su_name) == NULL) {
+                       report_ccb_validation_error(opdata, "'%s' does not 
exist in existing model or in CCB",
+                                       su_name.value);
+                       return 0;
+               }
+       }
+
        if (immutil_getAttr(const_cast<SaImmAttrNameT>("saAmfRank"), 
attributes, 0, &rank) != SA_AIS_OK) {
                report_ccb_validation_error(opdata, "saAmfRank not found for 
%s", dn->value);
                return 0;  

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to