cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1175
Views
0
Helpful
3
Replies

show service output in a table format in NSO cli

Customer asked me to create a service in NSO with java in order to  show in a table format some data in the cli either in the webUi. These data in table format should be the input to another service.

I don'think this is possible in NSO: as for me it'is only possible to write data in a file and read it as input in another service, but I'm new in NSO programming. Besides I have no idea how I can show table formatted data in the cli with a service. Could anyone help me to find a solution?

2 Accepted Solutions

Accepted Solutions

allenc
Level 1
Level 1

I don't think it is possible for a service to have output.  As you say, you could write it to a file.  But perhaps a better possibility is to write it to the CDB itself so that other services could read it directly.  If you really want to return output to the CLI, you could use an action instead of a service.

 

-Allen

 

View solution in original post

Hello,

 

Regarding the "using service output as input to another service" - as it was suggested to you the second service can have access to the stored values of the initial service in the CDB so there is no real need for an output.

If the second service will always be created after the initial one you can have a look at stacked services (not saying it matches your use case but it is possible).

 

Regarding the "seeing the values of a service as a table" - in CLI you have the option after the show command to add tab after a pipe - of course if your service has many leaves it may become unreadable but you can filter on the leaves using select:

admin@ncs# show running-config test
test 42
 dummy 1.1.1.1
!
test 43
 dummy 2.2.2.2
!
admin@ncs# show running-config test | tab
NAME  DEVICE  DUMMY
-----------------------
42    -       1.1.1.1
43    -       2.2.2.2

admin@ncs# show running-config test | select dummy | tab
NAME  DUMMY
---------------
42    1.1.1.1
43    2.2.2.2

Regards,

 

 

View solution in original post

3 Replies 3

allenc
Level 1
Level 1

I don't think it is possible for a service to have output.  As you say, you could write it to a file.  But perhaps a better possibility is to write it to the CDB itself so that other services could read it directly.  If you really want to return output to the CLI, you could use an action instead of a service.

 

-Allen

 

Thank you for reply, it's very helpful for me.

Can you suggest  any example or best practice in the web to implement the action?

Hello,

 

Regarding the "using service output as input to another service" - as it was suggested to you the second service can have access to the stored values of the initial service in the CDB so there is no real need for an output.

If the second service will always be created after the initial one you can have a look at stacked services (not saying it matches your use case but it is possible).

 

Regarding the "seeing the values of a service as a table" - in CLI you have the option after the show command to add tab after a pipe - of course if your service has many leaves it may become unreadable but you can filter on the leaves using select:

admin@ncs# show running-config test
test 42
 dummy 1.1.1.1
!
test 43
 dummy 2.2.2.2
!
admin@ncs# show running-config test | tab
NAME  DEVICE  DUMMY
-----------------------
42    -       1.1.1.1
43    -       2.2.2.2

admin@ncs# show running-config test | select dummy | tab
NAME  DUMMY
---------------
42    1.1.1.1
43    2.2.2.2

Regards,

 

 

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: