immdump intends to dump only non-empty value object's attributes, all empty-value attributes will not be written to dump file, otherwise the immxml-validate will raise following error:
Traceback (most recent call last): File "./immxml-validate", line 523, in <module> main(sys.argv[1:]) File "./immxml-validate", line 504, in main doc.post_process_validate() File "./immxml-validate", line 412, in post_process_validate self.post_validate_object_list() File "./immxml-validate", line 275, in post_validate_object_list node_value = element.firstChild.nodeValue AttributeError: 'NoneType' object has no attribute 'nodeValue
But in some cases, above intention is not guranteed. That is when the attribute has <default-value> tag with no value given and the attribute type is either SA_NAME_T or SA_STRING_T, then the dump file will look like, having empty-value attribute dump:
<object class="TestClass"> <dn>testClass=1</dn> <attr> <name>StringAttribute</name> <value></value> </attr> <attr> <name>SaNameTAttribute</name> <value></value> </attr> </object>
Steps to reproduce:
1) Import the attached file
2) Create an object immcfg -c TestClass testClass=1
3) Dump the test class immdump -c TestClass > dump.xml
4) Validate the dump file
In IMM SAF spec, at section 4.2.7 SaImmAttrDefinitionT_2, it states:
Must be set to NULL if there is no default value for this attribute , does it mean
attrDefaultValue
must be set to NULL if no value is given to <default-value> tags?If that understanding is right, we should fix the bug in imm_loader and imm_import?
https://sourceforge.net/p/opensaf/mailman/message/36379573/
commit 59cf8371a385b3dbfa7b73712cc1ebef3ebf95ad (HEAD -> develop, origin/develop, ticket-2901)
Author: Vu Minh Nguyen vu.m.nguyen@dektech.com.au
Date: Fri Aug 3 08:43:27 2018 +0700