netopeer2 icon indicating copy to clipboard operation
netopeer2 copied to clipboard

Created XML fields are not displayed

Open SumitPhutrapahl opened this issue 3 years ago • 5 comments

Hello Michal Vasko!

I'm trying to implement features of o-ran-performance-management.yang but getting as issue I cannot even investigate. Need some help.

There is one big container "performance-measurement-objects" in o-ran-performance-management model. It contains fields enable-SFTP-upload enable-random-file-upload transceiver-measurement-interval epe-measurement-interval rx-window-measurement-interval tx-measurement-interval notification-interval file-upload-interval max-bin-count and few anothers in the root of the container.

They all writable and not mandatory except the last one (max-bin-count). And when I create these fiels inside GET-request callback in Sysrepo daemon I see only one field created - 'max-bin-count' in netopeer2-cli as on the picture below. I didn't face such issues for another YANG models.

изображение

The actual code block:

#define XPATH_CONFIG_STR_BASE "/o-ran-performance-management:performance-measurement-objects"

ret = lyd_new_path(NULL, ctx, XPATH_CONFIG_STR_BASE "/enable-SFTP-upload", "false", 0, parent);
if (ret != LY_SUCCESS) {
	syslog(LOG_ERR, "Failed to add 'enable-SFTP-upload' field; error %d", ret);
	return SR_ERR_LY;
}

ret = lyd_new_path(*parent, NULL, XPATH_CONFIG_STR_BASE "/enable-random-file-upload", "false", 0, parent);
if (ret != LY_SUCCESS) {
	syslog(LOG_ERR, "Failed to add 'enable-random-file-upload' field; error %d", ret);
	return SR_ERR_LY;
}

ret = lyd_new_path(*parent, NULL, XPATH_CONFIG_STR_BASE "/transceiver-measurement-interval", "1", 0, parent);
if (ret != LY_SUCCESS) {
	syslog(LOG_ERR, "Failed to add 'transceiver-measurement-interval' field; error %d", ret);
	return SR_ERR_LY;
}

ret = lyd_new_path(*parent, NULL, XPATH_CONFIG_STR_BASE "/rx-window-measurement-interval", "1", 0, parent);
if (ret != LY_SUCCESS) {
	syslog(LOG_ERR, "Failed to add 'rx-window-measurement-interval' field; error %d", ret);
	return SR_ERR_LY;
}

ret = lyd_new_path(*parent, NULL, XPATH_CONFIG_STR_BASE "/tx-measurement-interval", "1", 0, parent);
if (ret != LY_SUCCESS) {
	syslog(LOG_ERR, "Failed to add 'tx-measurement-interval' field; error %d", ret);
	return SR_ERR_LY;
}

ret = lyd_new_path(*parent, NULL, XPATH_CONFIG_STR_BASE "/notification-interval", "1", 0, parent);
if (ret != LY_SUCCESS) {
	syslog(LOG_ERR, "Failed to add 'notification-interval' field; error %d", ret);
	return SR_ERR_LY;
}

ret = lyd_new_path(*parent, NULL, XPATH_CONFIG_STR_BASE "/file-upload-interval", "1", 0, parent);
if (ret != LY_SUCCESS) {
	syslog(LOG_ERR, "Failed to add 'file-upload-interval' field; error %d", ret);
	return SR_ERR_LY;
}

ret = lyd_new_path(*parent, NULL, XPATH_CONFIG_STR_BASE "/max-bin-count", "1024", 0, parent);
if (ret != LY_SUCCESS) {
	syslog(LOG_ERR, "Failed to add 'max-bin-count' field; error %d", ret);
	return SR_ERR_LY;
}

So the fileds are created successfully but due to some unknown reason they are not displayed. Do you have an idea why?

FYI... The versions I'm using: Netopeer2 of version 2.0.30 from master branch (8ec6d81d2a4991535c448e011e13380134d2bcfe). Sysrepo of version 2.0.47 from master branch (https://github.com/sysrepo/sysrepo/commit/aec5ddc8be13c6e8cd7262024a57eac562487d8f). Libyang of version 2.0.97 from master branch (320f34305dd9c7d14af5f13bec18e477b37f5db8). Libnetconf of version 2.0.19 latest from master branch (37380c9f895b08c5e57092ea2fbead1b769a0711).

SumitPhutrapahl avatar Mar 04 '22 11:03 SumitPhutrapahl

I found out it works if I previously set these RW fields with edit-config and XML:

<performance-measurement-objects xmlns="urn:o-ran:performance-management:1.0">
	<enable-SFTP-upload>false</enable-SFTP-upload>
	<enable-random-file-upload>false</enable-random-file-upload>
	<transceiver-measurement-interval>1</transceiver-measurement-interval>
	<epe-measurement-interval>1</epe-measurement-interval>
	<rx-window-measurement-interval>1</rx-window-measurement-interval>
	<tx-measurement-interval>1</tx-measurement-interval>
	<notification-interval>1</notification-interval>
	<file-upload-interval>1</file-upload-interval>
</performance-measurement-objects>

изображение

It seems like callback for GET request should cover only RO nodes. @michalvasko , can you confirm that?

SumitPhutrapahl avatar Mar 04 '22 13:03 SumitPhutrapahl

callback for GET request

What is that? Post the code snippet you use for subscribing this callback.

michalvasko avatar Mar 04 '22 13:03 michalvasko

I'm constructing the XML output inside my callback mru_pfm_get_measurement_config_cb which is subscribed with the code below.


int error = sr_oper_get_items_subscribe(session, "o-ran-performance-management",
                                        "/o-ran-performance-management:performance-measurement-objects",
                                        mru_pfm_get_measurement_config_cb, NULL, SR_SUBSCR_CTX_REUSE, &subscription);
if (error) {
    syslog(LOG_ERR, "sr_oper_get_items_subscribe error (%d): %s", error, sr_strerror(error));
    sr_unsubscribe(subscription);
    return error;
}

SumitPhutrapahl avatar Mar 04 '22 18:03 SumitPhutrapahl

I found the way to set RW nodes from plugin if needed. Sysrepo API should be used for that. Particularly method sr_set_item_str with sr_apply_changes. As a hint for somebody in future...

SumitPhutrapahl avatar Mar 05 '22 13:03 SumitPhutrapahl

It seems like callback for GET request should cover only RO nodes.

The callback in sr_oper_get_items_subscribe() can return both RO and RW data. You must creating them incorrectly, not sure why else would it not work.

I found the way to set RW nodes from plugin if needed. Sysrepo API should be used for that.

Yes, that should work, too.

michalvasko avatar Mar 09 '22 09:03 michalvasko