cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1410
Views
0
Helpful
2
Replies

NSO service logging with ncs.service_log

Maksim12
Level 1
Level 1

Hello All,

I'm wondering if anyone was able to log directly to NSO service using Python API ncs.service_log  https://developer.cisco.com/docs/nso/api/#!ncs-service_log

It might be missing a bit of a description. I'm not clear if path is path to service or to service/log. As well as type variable is missing a description.

My code example: 

    servicelog = ncs.service_log.ServiceLog(node)
    servicelog.error("""test""ncs:service-modified")

The last line gives me error:
File "/home/dev/.local/lib/python3.8/site-packages/ncs/maapi.py", line 711, in write_service_log_entry
_tm.maapi.write_service_log_entry(self.msock, path, msg, type, level)
TypeError: argument 3 must be confd.Value

 

Setup:

Ubuntu

NSO v5.5.2

 

Thank you !

 

2 Accepted Solutions

Accepted Solutions

gutizar
Level 1
Level 1

The third parameter should be an instance of ncs.Value, so:

    servicelog = ncs.service_log.ServiceLog(node)
    servicelog.error("", "test", ncs.Value("ncs:service-modified", ncs.C_BUF))

View solution in original post

2 Replies 2

gutizar
Level 1
Level 1

The third parameter should be an instance of ncs.Value, so:

    servicelog = ncs.service_log.ServiceLog(node)
    servicelog.error("", "test", ncs.Value("ncs:service-modified", ncs.C_BUF))

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the NSO Developer community: