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

Service dependency

SCadilhac1
Level 1
Level 1

Hello,

 

I'm trying to implement the following simplified model (currently with NSO 4.7):

 

list endpoint {
uses ncs:service-data;
ncs:service-point "endpoint";
  key reference;
  leaf reference { ... }
  leaf device { ... }
  leaf port { ... }
leaf description { ... }
}

list vlan {
uses ncs:service-data;
ncs:service-point "vlan";
  key id;
  leaf id { ... }
  leaf name { ... }
  list attached-endpoint {
    type leafref {
      path /endpoint/reference;
    }
  }
}

The endpoint service configures the physical port as a trunk, with the description, etc.

Based on the attached endpoints, the VLAN service will configure the VLAN globally on the required switches and allow the VLAN on the endpoint ports.

When the endpoint is changed (e.g. migrated to another switch or port), I need the VLAN to re-deploy, and I would like this to be performed automatically within the same commit (and to be able to see the whole change in dry-run).

How to perform this?

 

  • A unique service could be attached at the upper level, but it would trigger for any change on any endpoint or VLAN, and would re-deploy everything each time (won't be efficient with a growing number of items).
  • Stacked services might be a solution (VLAN and endpoint services would push to a common service) but it gets over-complicated or even non functional when the model becomes more complex (trigger order of the intermediate service callbacks?).
  • I tried to call the VLAN "touch" action from the endpoint create callback, or from a SET_ELEM callback, but it either doesn't do anything or blocks everything (like a deadlock somewhere):
@DataCallback(callPoint="endpoint-change", callType=DataCBType.SET_ELEM)
public int setElem(DpTrans trans, ConfObject[] c, ConfValue v) {
try {
int tid = trans.getTransaction();
maapi.attach(tid, 0, trans.getUserInfo().getUserId());
int vlan = 100; /* use xpath or a loop to find out the real VLANs which use this endpoint */
maapi.requestActionTh(tid, new ConfXMLParam[0], "/vlan{%d}/touch", vlan);
maapi.detach(tid);
}
catch (Exception e) {
LOGGER.warn("endpoint-change callback error", e);
}
return Conf.REPLY_ACCUMULATE;
}

Any suggestion will be welcome :-)

 

Thanks

Sylvain

 

 

0 Replies 0