Add support for SNMP "bits" data type (Feature Request #411)
@olofhagsand: May I ask you to take a look at this pull request and give me some hints on how to improve it? Currently there are no unit tests, I will write them later. So my intention is not to merge this request now, but to get feedback on whether I am "on the right track".
Note: I need to define the mapping between YANG data type "bits" and ASN_OCTET_STR, even if there is an ASN_BITS data type. The reason is that I get the error message "Expected type:4, got: 3" in https://github.com/clicon/clixon/blob/master/apps/snmp/snmp_handler.c#L747 when I use the ASN_BITS type. As far as I understand, the expected type is specified by the nets-snmp library in netsnmp_request_info, so maybe there is a bug? (I have not checked it.)
Note 2: In all functions (like type_xml2snmp_pre), the data read or written to/from snmp is treated as a string. This does not work for bits as there can be multiple 0x00 bytes. For this reason I use fixed lengths (uint32).
Add support for SNMP "bits" data type (Feature Request #411)
@olofhagsand: May I ask you to take a look at this pull request and give me some hints on how to improve it? Currently there are no unit tests, I will write them later. So my intention is not to merge this request now, but to get feedback on whether I am "on the right track".
Note: I need to define the mapping between YANG data type "bits" and ASN_OCTET_STR, even if there is an ASN_BITS data type. The reason is that I get the error message "Expected type:4, got: 3" in https://github.com/clicon/clixon/blob/master/apps/snmp/snmp_handler.c#L747 when I use the ASN_BITS type. As far as I understand, the expected type is specified by the nets-snmp library in
netsnmp_request_info
, so maybe there is a bug? (I have not checked it.)Note 2: In all functions (like
type_xml2snmp_pre
), the data read or written to/from snmp is treated as a string. This does not work for bits as there can be multiple 0x00 bytes. For this reason I use fixed lengths (uint32).Thanks, Mico