Getting Error:Unknown type in namespace

Hi ,
I have installed confd-7.6 on x86.
when i am trying to run confd using the command like: confd -c confd.conf --foreground --verbose
I am getting error like:
Failed to load file /etc/confd/o-ran-interfaces.fxs: interface-ref: Unknown type in namespace ‘urn:ietf:params:xml:ns:yang:ietf-interfaces’
“Failed to load file /etc/confd/o-ran-interfaces.fxs: interface-ref: Unknown type in namespace ‘urn:ietf:params:xml:ns:yang:ietf-interfaces’\n”
Strange part is:ietf-interfaces.yang already being loaded.Which can be verified from below log:
Console Log:

9-Dec-2021::15:54:27.085 rimpcie-4 confd[23897]: - Daemon logging started
9-Dec-2021::15:54:27.094 rimpcie-4 confd[23897]: confd embedded apps in early_phase0:
[]
9-Dec-2021::15:54:27.107 rimpcie-4 confd[23897]: - Loading file /etc/confd/o-ran-wg4-features.fxs
9-Dec-2021::15:54:27.107 rimpcie-4 confd[23897]: - Loading file /etc/confd/ietf-crypto-types.fxs
9-Dec-2021::15:54:27.109 rimpcie-4 confd[23897]: - Loading file /etc/confd/o-ran-compression-factors.fxs
9-Dec-2021::15:54:27.109 rimpcie-4 confd[23897]: - Loading file /etc/confd/o-ran-ald-port.fxs
9-Dec-2021::15:54:27.110 rimpcie-4 confd[23897]: - Loading file /etc/confd/ietf-subscribed-notifications.fxs
9-Dec-2021::15:54:27.113 rimpcie-4 confd[23897]: - Loading file /etc/confd/ietf-origin.fxs
9-Dec-2021::15:54:27.113 rimpcie-4 confd[23897]: - Loading file /etc/confd/iana-hardware.fxs
9-Dec-2021::15:54:27.114 rimpcie-4 confd[23897]: - Loading file /etc/confd/ietf-interfaces.fxs
9-Dec-2021::15:54:27.114 rimpcie-4 confd[23897]: - Loading file /etc/confd/ietf-netconf-monitoring.fxs
9-Dec-2021::15:54:27.116 rimpcie-4 confd[23897]: - Loading file /etc/confd/tailf-common-monitoring.fxs
9-Dec-2021::15:54:27.116 rimpcie-4 confd[23897]: - Loading file /etc/confd/ietf-netconf-acm.fxs
9-Dec-2021::15:54:27.117 rimpcie-4 confd[23897]: - Loading file /etc/confd/tailf-rollback.fxs
9-Dec-2021::15:54:27.118 rimpcie-4 confd[23897]: - Loading file /etc/confd/tailf-common-query.fxs
9-Dec-2021::15:54:27.119 rimpcie-4 confd[23897]: - Loading file /etc/confd/tailf-netconf-transactions.fxs
9-Dec-2021::15:54:27.119 rimpcie-4 confd[23897]: - Loading file /etc/confd/tailf-common.fxs
9-Dec-2021::15:54:27.120 rimpcie-4 confd[23897]: - Loading file /etc/confd/tailf-progress.fxs
9-Dec-2021::15:54:27.121 rimpcie-4 confd[23897]: - Loading file /etc/confd/iana-crypt-hash.fxs
9-Dec-2021::15:54:27.122 rimpcie-4 confd[23897]: - Loading file /etc/confd/o-ran-file-management.fxs
9-Dec-2021::15:54:27.123 rimpcie-4 confd[23897]: - Loading file /etc/confd/ietf-hardware.fxs
9-Dec-2021::15:54:27.125 rimpcie-4 confd[23897]: - Loading file /etc/confd/o-ran-module-cap.fxs
9-Dec-2021::15:54:27.127 rimpcie-4 confd[23897]: - Loading file /etc/confd/o-ran-supervision.fxs
9-Dec-2021::15:54:27.128 rimpcie-4 confd[23897]: - Loading file /etc/confd/ietf-ip.fxs
9-Dec-2021::15:54:27.128 rimpcie-4 confd[23897]: - Loading file /etc/confd/o-ran-hardware.fxs
9-Dec-2021::15:54:27.130 rimpcie-4 confd[23897]: - Loading file /etc/confd/o-ran-interfaces.fxs
9-Dec-2021::15:54:27.130 rimpcie-4 confd[23897]: - Failed to load file /etc/confd/o-ran-interfaces.fxs: interface-ref: Unknown type in namespace ‘urn:ietf:params:xml:ns:yang:ietf-interfaces’
“Failed to load file /etc/confd/o-ran-interfaces.fxs: interface-ref: Unknown type in namespace ‘urn:ietf:params:xml:ns:yang:ietf-interfaces’\n”

o-ran-interfaces.yang

module o-ran-interfaces {
yang-version 1.1;
namespace "urn:o-ran:interfaces:1.0";
prefix "o-ran-int";


import ietf-inet-types {
prefix "inet";
}

 import iana-if-type {
 prefix "ianaift";
}

import ietf-interfaces {
prefix "if";
}

import ietf-ip {
prefix "IP";
}
 }

    augment "/if:interfaces/if:interface" {
      when "if:type = 'ianaift:l2vlan'";
description "augments for VLAN definition";
leaf base-interface {
  type if:interface-ref;
  must "/if:interfaces/if:interface[if:name = current()]"
        + "/o-ran-int:vlan-tagging = 'true'" {
    description
      "The base interface must have VLAN tagging enabled.";
  }
  description
    "The base interface for the VLAN sub-interafce.";
}
leaf vlan-id {
  type uint16 {
    range "1..4094";
  }
  description
    "The VLAN-ID.";
}
}

ietf-interfaces.yang:

   typedef interface-ref {
     type leafref {
      path "/if:interfaces/if:interface/if:name";
     }
description
  "This type is used by data models that need to reference
   interfaces.";
 }

I am not able to proceed futher.Please if can figure out the root cause,then really helpful.

Regards,
Biswajit

How did you compile the module ietf-interfaces? The type interface-ref is there and in my environment I can refer it from other modules without any problems.

Hi ,
Sorry for late reply.

$(if $(wildcard $(patsubst ietf-hardware.yang,o-ran-hardware-ann.yang,$(<F))),\
           --annotate $(patsubst ietf-hardware.yang,o-ran-hardware-ann.yang,$(<F)), \
           $(if $(wildcard $(patsubst ietf-interfaces.yang,o-ran-interfaces-ann.yang,$(<F))), \
           --annotate $(patsubst ietf-interfaces.yang,o-ran-interfaces-ann.yang,$(<F))) \
           $(if $(wildcard $(patsubst %.yang,%-ann.yang,$(<F))), --annotate $(patsubst %.yang,%-ann.yang,$(<F))) \
           ) -c $< -o $@

Above i am doing in Makefile

Let me know if you found a mistake obove.

Regards,
Biswajit

This does not help much, I would have to know what files are present at your hard drive when you run this Makefile rule; the actual command line that was run as a result of this rule would be more useful. But even then, without seeing what the annotation files contain we still might be unable to tell what’s wrong in your setup.

I suggest you compile all the YANG files without any annotation files at all and try to start that. If it works, it is obvious that the problem is in your annotation files and you can start looking at them, possibly adding them one by one to check when the problem appears again.

By the way, the long Makefile expression you pasted indicates that you are using e.g. o-ran-interfaces-ann.yang for annotating ietf-interfaces.yang. This is a bit suspicious, the common scenario is that you have (at most) one annotation file for one module; and though it might be possible to keep annotations for more YANG modules in one annotation file (and use it with --annotate ... when compiling any of them), it is not the best practice and the compiler will likely throw warnings or even fail. I’m not saying this is what causes the “unknown interface-ref type” problem, but you may want to take a look at that.