cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
6945
Views
12
Helpful
25
Replies

Example for a simple stacked NSO Service

ks
Level 1
Level 1

Hello,

I am quite new to NSO Development. I am searching for a example for a simple stacked NSO Service. I went through the development guide but I am not quite sure how to accomplish this.

Thank you

Knut

1 Accepted Solution

Accepted Solutions

Here is a very crude example just to show the mechanics of mapping between the layer.

It is exactly like mapping to device-models, except the top-level service maps to bottom-level service[s].So it is possible to have N levels of mappings. The bottom most layer would then map to a device model.

https://communities.cisco.com/docs/DOC-77788

View solution in original post

25 Replies 25

kiran kotari
Cisco Employee
Cisco Employee

jump into you package directory and enter the following command in your project.

cisco@NCS:~$ cd $HOME/ncs-run/packages

cisco@NCS:~/ncs-run/packages$ ncs-make-package --service-skeleton template-based l2vpn

                                                                                                                                                       |-> your package name

These are the following options:-

  JAVA specific options:

    --java-package NAME

  PYTHON specific options:

    --component-class NAME (default main.Main)

    --action-example

    --subscriber-example


You will get to see the basic examples of NSO Service.

Hi Kiran,

I am searching for a example where one service instincates some other more basic services.

Kind regards

Knut

You can find the basic services in the Lab Guide and here are few links from github.

https://github.com/NSO-developer/nso-ospf-service

https://github.com/NSO-developer/nso-firewall-services

sspehar
Level 1
Level 1

Hi,

I'm not sure if there's an example of a simple stacked service in the installation dir, but there's an example of layered service architecture which is using service stacking (nso-dir/examples.ncs/getting-started/developing-with-ncs/22-layered-service-architecture). The difference is that it's not a monolithic nso but a different architecture because of LSA.

The idea is that you split your service into upper and lower layers. Upper layers usually don't touch devices directly, but are used to manage lower level service layers. So imagine that at your lower level services you're mapping input to the templates for pushing the config to the devices - so the normal service you usually create.

Input to the higher level services will be mapped using the templates which include configuration tree of particular lower level service - so they are mapping user input not directly to the device but rather to the other services which can then process the input and apply their templates.

Higher level service will then be the point for interaction with your services.

smadappa
Level 1
Level 1

Hi,

I believe Simon's reply should give you idea to create a stacked service yourself. Let me give an example from our project.

We have a service defined for our overall product which in turn will call other individual services such as mpls, internet etc.

How do you create a simple stacked service?  Create all these services individually first. Then when you want to configure one service from the other one, you populate xml template of other service from the first service and apply the template. Only the last service will apply device template. Rest of them will be applying the service template of the underlying service.

Regards,

Shameer

Hi Shameer,

this is something I would like to do to.

I have several more basic services which should be bundled together. These higher level servies should be available via REST to our OSS/BSS system.

Regards,

Knut

Hi Knut,

Here is a sample.

module lower1 {
augment /ncs:services {
list lower1 {
key name;
leaf name {
type string;
}
uses ncs:service-data;
ncs:servicepoint lower1-servicepoint;
leaf device {
mandatory true;
type string;
}}}}

----

module lower2 {
augment /ncs:services {
list lower2 {
key name;
leaf name {
type string;
}
uses ncs:service-data;
ncs:servicepoint lower2-servicepoint;
leaf device {
mandatory true;
type string;
}}}}

====

module higher {

augment /ncs:services {
list higher {

key name;
leaf name {
type string;
}
uses ncs:service-data;
ncs:servicepoint higher-servicepoint;

container lower1 {
presence "lower1";
uses lower1:lower1;
}
container lower2 {
presence "lower2";
uses lower2:lower2;
}}}}

Regards,

Shameer

Please note that generally, when using stacked services, the idea is to have layers of abstractions. Hide some parameters/complexity at the bottom layers and not expose everything all the way to the top layer. If the top service is just a sum total of all possible parameters from the bottom services, then we are not using stacked services to its full potential. So when it makes sense, auto-generate, infer, look-up, deduce some of the parameters of the bottom services while mapping out from the top service

Here is a very crude example just to show the mechanics of mapping between the layer.

It is exactly like mapping to device-models, except the top-level service maps to bottom-level service[s].So it is possible to have N levels of mappings. The bottom most layer would then map to a device model.

https://communities.cisco.com/docs/DOC-77788

Is it possible to show the dependancy between the services once it is applied.

Lets say service first uses the device facing service second. Is there a way to display that services second was instanciated from service first?

alam.bilal
Cisco Employee
Cisco Employee

So with your top level service instance, you can do "get-modifications shallow" which will show it mapping to the bottom-service-instance. There is also an option to do "get-modifications deep" which expands it out to show the entire device layer mappings.

I wonder if this is possible the other way around?

admin@ncs# show services KS-Loopback used-by-customer-service

              USED BY

              CUSTOMER

DEVICE  ID    SERVICE

------------------------

ips1    2012  -

admin@ncs#

There is a simple example but there is a Service KS-CE which uses KS-Loopback.

Hi Alam,

I downloaded your example "stacked_services", but in the service "service-first" I didn't find the java code to populate xml template of other service.

Can you help me?

 

Thanks  

That service is a pure template-service and has no Java-code.

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: