osaf/services/saf/amf/amfd/comp.cc | 32 +++++++++++++++++++++++++++++++ osaf/services/saf/amf/amfd/ctcstype.cc | 10 +++++++++ osaf/services/saf/amf/amfd/include/comp.h | 1 + osaf/services/saf/amf/amfd/util.cc | 1 - 4 files changed, 43 insertions(+), 1 deletions(-)
Before modifying compType attribute in a comp, one more check on the validity of SaAmfCtCsType is still required which means association (object of SaAmfCtCsType) between this new comptype and cstype in SaAmfCompCsType (in case such an object exists for this component) must also exists in the system. If ctcstype does not exist then there will be problem in deciding components capability for a given cstype. So reject the modify ccb if ctstype does not exist with any cstypes supported by this component via compcstype. Thus assert can be removed as patch 1 and patch 2 will not allow any invalid configuration in the syste. diff --git a/osaf/services/saf/amf/amfd/comp.cc b/osaf/services/saf/amf/amfd/comp.cc --- a/osaf/services/saf/amf/amfd/comp.cc +++ b/osaf/services/saf/amf/amfd/comp.cc @@ -846,7 +846,39 @@ static SaAisErrorT ccb_completed_modify_ report_ccb_validation_error(opdata, "saAmfCompType '%s' not found", dn.value); goto done; } + /* + This new compType exists in the AMF. Before modifying compType attribute in a comp, + one more check on the validity of SaAmfCtCsType is still required which means + association object (object of SaAmfCtCsType) between this new comptype and cstype + in SaAmfCompCsType (in case such an object exists for this component) must also + exists in the system. If ctcstype does not exist then there will be problem in + deciding components capability for a given cstype. So reject the modify ccb if + ctcstype does not exist with any cstypes supported by this component via compcstype. + */ + for (std::map<std::string, AVD_COMPCS_TYPE*>::const_iterator it = compcstype_db->begin(); + it != compcstype_db->end(); it++) { + AVD_COMPCS_TYPE *compcstype = it->second; + if (compcstype->comp == comp) { + SaNameT cstype_name; + AVD_CTCS_TYPE *ctcstype = NULL; + avd_cstype_t *cst = NULL; + get_child_dn_from_ass_dn(&compcstype->name, &cstype_name); + //First check if this cstype exists in the sustem. + if ((cst = cstype_db->find(Amf::to_string(&cstype_name))) == NULL) { + LOG_WA("cstype of '%s' is not preseint in AMF database", + compcstype->name.value); + continue; + } + //ctcstype relationship should exists with all the cstypes. + if ((ctcstype = get_ctcstype(&dn, &cstype_name)) == NULL) { + report_ccb_validation_error(opdata, "ctcstype relationship " + "between new comptype and cstype from" + "component's compcstype(s) does not exist"); + goto done; + } + } + } } else if (!strcmp(attribute->attrName, "saAmfCompInstantiateCmdArgv")) { char *param_val = *((char **)value); if (NULL == param_val) { diff --git a/osaf/services/saf/amf/amfd/ctcstype.cc b/osaf/services/saf/amf/amfd/ctcstype.cc --- a/osaf/services/saf/amf/amfd/ctcstype.cc +++ b/osaf/services/saf/amf/amfd/ctcstype.cc @@ -217,6 +217,16 @@ static void ctcstype_ccb_apply_cb(CcbUti TRACE_LEAVE(); } +AVD_CTCS_TYPE *get_ctcstype(const SaNameT *comptype_name, const SaNameT *cstype_name) +{ + SaNameT dn; + AVD_CTCS_TYPE *ctcs_type = NULL; + avsv_create_association_class_dn(cstype_name, comptype_name, + "safSupportedCsType", &dn); + ctcs_type = ctcstype_db->find(Amf::to_string(&dn)); + return ctcs_type; +} + void avd_ctcstype_constructor(void) { ctcstype_db = new AmfDb<std::string, AVD_CTCS_TYPE>; diff --git a/osaf/services/saf/amf/amfd/include/comp.h b/osaf/services/saf/amf/amfd/include/comp.h --- a/osaf/services/saf/amf/amfd/include/comp.h +++ b/osaf/services/saf/amf/amfd/include/comp.h @@ -239,4 +239,5 @@ extern AVD_COMP *avd_comp_get_or_create( bool comp_is_preinstantiable(const AVD_COMP *comp); extern bool is_comp_assigned_any_csi(AVD_COMP *comp); extern SaAisErrorT check_comp_stability(const AVD_COMP*); +extern AVD_CTCS_TYPE *get_ctcstype(const SaNameT *comptype_name, const SaNameT *cstype_name); #endif diff --git a/osaf/services/saf/amf/amfd/util.cc b/osaf/services/saf/amf/amfd/util.cc --- a/osaf/services/saf/amf/amfd/util.cc +++ b/osaf/services/saf/amf/amfd/util.cc @@ -680,7 +680,6 @@ static SaAmfCompCapabilityModelT get_com avsv_create_association_class_dn(&csi->cstype->name, &comp->comp_type->name, "safSupportedCsType", &dn); AVD_CTCS_TYPE *ctcs_type = ctcstype_db->find(Amf::to_string(&dn)); - osafassert(ctcs_type); return ctcs_type->saAmfCtCompCapability; } ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel