cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
118
Views
0
Helpful
2
Replies
Highlighted
Beginner

Nested service-point

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
Cisco Employee

Re: Nested service-point

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.

2 REPLIES 2
Cisco Employee

Re: Nested service-point

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.

Cisco Employee

Re: Nested service-point

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.