10-08-2019 02:29 AM
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?
Solved! Go to Solution.
10-09-2019 01:57 PM
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
10-10-2019 02:45 AM
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,
10-09-2019 01:57 PM
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
10-10-2019 01:34 AM
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?
10-10-2019 02:45 AM
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,
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