Service Handling of Ambiguous Device Models
As stated above, efforts have been made to keep APIs etc
backward compatible. A major concern has been to keep
old service code functional without change. However this
only works as long as there are no XML namespace ambiguities
between different devices in the system.
In other words, after an initial NSO CDM migration with the same NEDs
as before the migration, the service should work as before. Later,
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 that 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 basically 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
retrieving 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