cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1579
Views
0
Helpful
5
Replies

Nested service-point

Fantolino
Level 1
Level 1

I’ve created two packages using “ncs-make-package service-skeleton python-and-template”. The first is intended to be augmented by the second.

I want to have code associated to the latter package, so that when the branch defined in the second yang model is populated that code runs.

I see the data model is augmented but the code associated to secondo packages does not run.

 

FIRST PACKAGE YANG MODEL (excerpt)

  list LF-Host {

    description "This is an RFS skeleton service";

 

    key Nome;

   

    leaf Nome {

      tailf:info "Identificativo Istanza di servizio";

      tailf:cli-allow-range;

      type tsc:idalfanum;

    }

 

    uses ncs:service-data;

    ncs:servicepoint LF-Host-servicepoint;

   

    uses tsc:ANNOTAZIONI;

   

    leaf Nodo {

      type leafref {

        path "/ncs:devices/ncs:device/ncs:name";

      }

    }

 

    list Ramo {

      key Interfaccia;

      leaf Interfaccia {

        tailf:info "interfaccia";

        type string;

      }

      leaf Testo {

        tailf:info "description";

        type string;

      }

      leaf Intervallo {

        tailf:info "minimo..massimo";

        type string {

          pattern '[1-9][0-9]*\.\.[1-9][0-9]*' +

                  '[a..b]+';

        }

      }

    }

  }

}

 

SECOND PACKAGE YANG MODEL (excerpt)

  augment /lfh:LF-Host/lfh:Ramo {

 

    container Guest {

      presence "Prova";

      uses ncs:service-data;

      ncs:servicepoint LF-Guest-servicepoint;   ß- This servicepoint does not run!

     

      leaf Vlanid {

        type uint16;

      }

 

    }

 

    leaf gigi {

      type string;

    }

  }

}

1 Accepted Solution

Accepted Solutions

gmuloche
Cisco Employee
Cisco Employee

In the python code of the first package you could check for the presence of the container Guest from the augmenter module and run some code only if it is present (example using Python) in the cb_create function

 

if service.augmenter_container.exists():
  service.have_i_been_augmented = True

Note that this code assume that there is a module "augmenter" augmenting the module with a presence container "augmenter_container". So the code would fail if the augmenter package is not loaded.

View solution in original post

5 Replies 5

gmuloche
Cisco Employee
Cisco Employee

In the python code of the first package you could check for the presence of the container Guest from the augmenter module and run some code only if it is present (example using Python) in the cb_create function

 

if service.augmenter_container.exists():
  service.have_i_been_augmented = True

Note that this code assume that there is a module "augmenter" augmenting the module with a presence container "augmenter_container". So the code would fail if the augmenter package is not loaded.

I'm trying to do something similar (augment a service but the augmented service template isn't being invoked).  My issue with this solution is that it requires the parent service (first package) to have knowledge of the augmenting child services.  In my opinion, that doesn't fit with the concept of service augmentation.  The augmented services should be instantiated without knowledge by parent services.

 

I can get this to work if I don't have the following in my parent service (for now, the parent service is simply a container).

uses ncs:service-data;
ncs:servicepoint nodes-servicepoint;
 
 
However, I believe this implies that I won't be able to further augment those child services.
 
Is there a way to instantiate augmenting child services without having to edit the parents?

I am not sure I quite understand what you want to accomplish. But, there is a yang extension tailf:annotate (in the tailf_yang_extensions man page).

Thanks for your quick reply (sorry mine isn't so much)!

 

Mostly I was trying to see what I could do with NSO (just getting started).

 

I'm interested in creating a logical hierarchy of services within NSO and I want to build each of those services as a separate package.  I was using augment to do this but maybe there's a different/preferable way?  e.g., can I create the following hierarchy and build each of those paths as a separate package?  What I found is that I can build Service1 and Service2 as packages that augment My-Services.  But, if I try to create the package Augmenting-Child-Service that augments Service2 it doesn't work (I don't think the servicepoint for Augmenting-Child-Service gets registered)

/My-Services

/My-Services/Service1

/My-Services/Service2

/My-Services/Service2/Augmenting-Child-Service

lmanor
Cisco Employee
Cisco Employee

You could achieve what I think you want to do by using a stacked service.

Having your initial service created code determine if the subordinate service needs to be deployed and if so issue a service instance request to that service.