Skip to content

How to resolve namespace collisions in YANG models #2197

@tokarenko

Description

@tokarenko

Question
Please advise how to handle gNMI Get response parsing error caused by java.lang.IllegalStateException:

Choose suitable module name for element interfaces:
ietf-interfaces
openconfig-interfaces
     at org.opendaylight.yangtools.yang.data.codec.gson.JsonParserStream.resolveNamespace(JsonParserStream.java:395) ~[yang-data-codec-gson-14.0.11.jar:14.0.11]

The root cause is that the namespace is missing from the JSON reponse:

{
    ...
    val {
      json_val: "{\n  \"interfaces\": {\n    \"interface\": [\n ...
  }
}

json_val should start with json_val: "{\n "openconfig-interfaces:interfaces": ...

HTTP GET request is http://localhost:8888/restconf/data/network-topology:network-topology/topology=gnmi-topology/node=gnmi-simulator/yang-ext:mount/openconfig-interfaces:interfaces?content=config.

From this ODL Jira issue I realized that possible workaround is to disable/unload ietf-interfaces model from the controller.

I removed all the references to the ietf-interfaces model from the configuration but the error persisted. Then I noticed that ietf-interfaces is loaded by openconfig-interfaces and iana-if-type used by the controller: { "usedBy": "CONTROLLER", "name": "iana-if-type","revision": "2023-01-26", "nameSpace": "urn:ietf:params:xml:ns:yang:iana-if-type"}.

So, ietf-interfaces model can't be removed. Is there a way to prefer openconfig if namespaces clash?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions