Nokia recommends using the pySROS API when interacting with SR OS using model-driven interfaces. However, some cases may require an unmodeled MD-CLI command, which the developer can get by manipulating the resulting string output.
The cli() API method allows developers to pass a single line string containing a single MD-CLI command (including output modifiers, if required) to an existing SR OS connection object. This command is executed immediately and the output is returned as a string. See NETCONF operations using the md-cli-raw-command request for more information about supported commands.
The following example executes an MD-CLI command from the pySROS API.
output_string = connection_object.cli('show system time')
print(output_string)
===============================================================================
Date & Time
===============================================================================
Current Date & Time : 2021/09/15 20:27:27 DST Active : no
Current Zone : UTC Offset from UTC : 00:00
-------------------------------------------------------------------------------
Non-DST Zone : UTC Offset from UTC : 00:00
Zone type : standard
-------------------------------------------------------------------------------
No DST zone configured.
-------------------------------------------------------------------------------
Prefer Local Time : NO
===============================================================================