Perform handling of ambiguous device models.
When new NED versions with diverging XML namespaces are introduced, adaptations might be needed in the services for these new NEDs. But not necessarily; it depends on where in the specific NED models the ambiguities reside. Existing services might not refer to these parts of the model and in that case, they do not need any adaptations.
Finding out if and where services need adaptations can be non-trivial. An important exception is template services which check and point out ambiguities at load time (NSO startup). In Java or Python code this is harder and essentially falls back to code reviews and testing.
The changes in service code to handle ambiguities are straightforward but different for templates and code.
In templates, there are new processing instructions if-ned-id
and elif-ned-id
. When the template specifies a node in an XML namespace where an ambiguity exists, the if-ned-id
process instruction is used to resolve that ambiguity.
The processing instruction else
can be used in conjunction with if-ned-id
and elif-ned-id
to capture all other NED IDs.
For the nodes in the XML namespace where no ambiguities occur, this process instruction is not necessary.
In Java, the service code must handle the ambiguities by code where the devices' ned-id
is tested before setting the nodes and values for the diverging paths.
The ServiceContext
class has a new convenience method, getNEDIdByDeviceName
which helps retrieve the ned-id
from the device name string.
In the Python API, there is also a need to handle ambiguities by checking the ned-id
before setting the diverging paths. Use get_ned_id()
from ncs.application
to resolve NED IDs.