03-21-2024 11:15 AM
Hello,
I am using the "ncs-make-package --netconf-ned" method of NED generation with the vendor specific YANG models. When we use this mechanism we have noticed that the platform information is not populated as it is with the purchased NEDs.
admin@ncs% run show devices device netdev1 platform
Possible completions:
model - The name of the product model.
name - The name of the system platform, for example, 'ios', 'ios-xr', or 'open-wrt'.
serial-number - Serial number of the device.
smart-license - Smart licensing state information.
version - The current version of the system platform.
admin@ncs% run show devices device netdev1 platform
% No entries found.
[ok][2024-03-21 14:11:09]
[edit]
admin@ncs%
I assume that code or some sort of xpath configuration would be needed to locate each of the values in the vendor specific models? Is there a pointer to how I could do this for the NETCONF NED?
Thank you!
03-21-2024 12:33 PM
Hello,
From $NCS_DIR/src/ncs/yang/tailf-ncs-devices.yang:
container platform {
config false;
tailf:cdb-oper {
tailf:persistent true;
}
description
"Contains vendor-specific information for
identifying the system platform.
NEDs MAY augment this container with more device-specific
nodes.";
leaf name {
type string;
description
"The name of the system platform, for example,
'ios', 'ios-xr', or 'open-wrt'.";
}
leaf version {
type string;
description
"The current version of the system platform. The format
of this string is vendor-specific.";
}
leaf model {
type string;
description
"The name of the product model. For example: if the device
comes in different types of hardware it may refer to the
hardware model or if the NED supports several different
platforms the model may refer to a product family.";
}
leaf serial-number {
type string;
description
"Serial number of the device.";
}
}
So you can use MAAPI or the CDB API to set this CDB operational datastore state data. An example below using MAAPI from the ncs_cmd tool to set the data and ncs_load to read it (remove the -dd flags to skip the debug info):
$ ncs_cmd -dd -o -c 'mset /devices/device{asa0}/platform/model "my model name"; mset /devices/device{asa0}/platform/name "my name"; mset /devices/device{asa0}/platform/serial-number "1234";mset /devices/device{asa0}/platform/version "1.0"'
TRACE Connected (maapi) to ConfD
TRACE MAAPI_START_USER_SESSION --> CONFD_OK
TRACE MAAPI_START_TRANS --> CONFD_OK
TRACE MAAPI_SET_ELEM2 /devices/device{asa0}/platform/model --> CONFD_OK
TRACE MAAPI_SET_ELEM2 /devices/device{asa0}/platform/name --> CONFD_OK
TRACE MAAPI_SET_ELEM2 /devices/device{asa0}/platform/serial-number --> CONFD_OK
TRACE MAAPI_SET_ELEM2 /devices/device{asa0}/platform/version --> CONFD_OK
TRACE MAAPI_APPLY_TRANS --> CONFD_OK
TRACE MAAPI_STOP_TRANS --> CONFD_OK
TRACE MAAPI_END_USER_SESSION --> CONFD_OK
$ ncs_load -dd -Fp -o -p /devices/device{asa0}/platform
TRACE Connected (maapi) to ConfD
starting user session ctxt=system user=system groups=[system]
TRACE MAAPI_START_USER_SESSION --> CONFD_OK
TRACE MAAPI_START_TRANS --> CONFD_OK
TRACE MAAPI_SAVE_CONFIG --> CONFD_OK
TRACE Connected (stream) to ConfD
<config xmlns="http://tail-f.com/ns/config/1.0">
<devices xmlns="http://tail-f.com/ns/ncs">
<device>
<name>asa0</name>
<platform>
<name>my name</name>
<version>1.0</version>
<model>my model name</model>
<serial-number>1234</serial-number>
</platform>
</device>
</devices>
TRACE MAAPI_SAVE_CONFIG_RESULT --> CONFD_OK
</config>
TRACE MAAPI_END_USER_SESSION --> CONFD_OK
Best regards
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide