# Error while trying to annotate "must" statement

**URL:** https://dmap-community.ductus.global/t/error-while-trying-to-annotate-must-statement/3800
**Category:** YANG
**Created:** [September 3, 2021, 10:27am UTC](https://dmap-community.ductus.global/t/error-while-trying-to-annotate-must-statement/3800 "2021-09-03T10:27:49Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![harminder](https://avatars.discourse-cdn.com/v4/letter/h/8e7dd6/32.png) [@harminder](https://dmap-community.ductus.global/u/harminder)
#### Post date: [September 3, 2021, 10:27am UTC](https://dmap-community.ductus.global/t/error-while-trying-to-annotate-must-statement/3800/1 "2021-09-03T10:27:49Z")

</div>

I am trying to annotate below “must” statement under leaf “port-name” in container port-reference

augment “/if:interfaces/if:interface” {  
when “(if:type = ‘ianaift:ethernetCsmacd’) or  
(if:type = ‘ianaift:l2vlan’)” {  
description “Applies to ethernetCsmacd and l2vlan interfaces”;  
}  
description  
“Augment the interface model with parameters for all  
both ethernetCsmacd and l2vlan interfaces.”;  
leaf mac-address {  
type yang:mac-address;

```
  description
    "The MAC address of the interface.";
}

container port-reference {
  description
    "a port reference used by other O-RAN modules";
  leaf port-name {
    type leafref {
      path '/hw:hardware/hw:component/hw:name';
    }

    **must "derived-from-or-self(deref(current())/../hw:class, 'ianahw:port')";**

```

}  
}  
]

Using the below annotate model

o-ran-interfaces-ann.yang  
module o-ran-interfaces-ann {  
namespace “urn:o-ran-interfaces-ann:1.0”;  
prefix ointa;  
import tailf-common {  
prefix tailf;  
}  
import o-ran-interfaces {  
prefix oint;  
}  
import iana-hardware {  
prefix “ianahw”;  
}  
import ietf-interfaces {  
prefix “if”;  
}  
import ietf-hardware {  
prefix “hw”;  
}  
description  
“Annotate model for o-ran-interfaces adds the callpoints necessary for using this module with ConfD.”;

```
 tailf:annotate-module 'oint'{
   tailf:annotate-statement augment[7]{
   tailf:annotate-statement container[name=‘port-reference’]{
    tailf:annotate-statement leaf[name=‘port-name’] {
      tailf:annotate-statement must {
       tailf:dependency 'hw:hardware/hw:component/hw:class';

            } } } } }

```

}

now facing below **error** when trying to build fxs using below command

/root/confd/bin/confdc --fail-on-warnings -a o-ran-interfaces-ann.yang -c o-ran-interfaces.yang -o o-ran-interfaces.fxs --yangpath …/…/imported\_models/ --verbose  
Generating .fxs file “o-ran-interfaces.fxs”  
**o-ran-interfaces.yang:399: error: The ‘must’ expression should have a tailf:dependency. If is doesn’t, it will be checked for every commit.**

when I add the tailf:dependency into the main yang itself, it is working fine.  
what am i missing?

---

<div class="post-metadata">

### Author: ![mvf](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/mvf/32/182_2.png) [@mvf](https://dmap-community.ductus.global/u/mvf)
#### Post date: [September 3, 2021, 2:49pm UTC](https://dmap-community.ductus.global/t/error-while-trying-to-annotate-must-statement/3800/2 "2021-09-03T14:49:24Z")

</div>

There are two issues in your annotate statements:

- The module name is most likely not `oint`, I assume it should be `o-ran-interfaces`. This should be reported by the compiler, but the ConfD compiler prior to the release 7.5 does not report this kind of mistake. As a result, it appears as if the annotation was accepted, but it is actually silently ignored.

- The dependency should be `/hw:hardware/...`, note that you are using a relative path. The compile would complain about that if the `annotate-module` was correct.

---

<div class="post-metadata">

### Author: ![harminder](https://avatars.discourse-cdn.com/v4/letter/h/8e7dd6/32.png) [@harminder](https://dmap-community.ductus.global/u/harminder)
#### Post date: [September 6, 2021, 5:08am UTC](https://dmap-community.ductus.global/t/error-while-trying-to-annotate-must-statement/3800/3 "2021-09-06T05:08:02Z")

</div>

> [@mvf](#):
>
> note that you are using a relative path.

module o-ran-interfaces-ann {  
namespace “urn:o-ran-interfaces-ann:1.0”;  
prefix ointa;  
import tailf-common {  
prefix tailf;  
}  
//import o-ran-interfaces {  
// prefix oint;  
// }  
import iana-hardware {  
prefix “ianahw”;  
}  
import ietf-interfaces {  
prefix “if”;  
}  
import ietf-hardware {  
prefix “hw”;  
}

```
description
    "Annotate model for o-ran-interfaces adds the callpoints necessary for using this module with ConfD.";

 tailf:annotate-module "o-ran-interface"{
   tailf:annotate-statement augment[7]{
   tailf:annotate-statement container[name=‘port-reference’]{
    tailf:annotate-statement leaf[name=‘port-name’] {
      tailf:annotate-statement must {
       tailf:dependency '/hw:hardware/hw:component/hw:class';

            }
    }
  }
}

```

}  
}

tried with the suggested “o-ran-interface” but still the same ERROR

[root@C7LabMachine interfaces]# /root/confd/bin/confdc --fail-on-warnings -a o-ran-interfaces-ann.yang -c o-ran-interfaces.yang -o o-ran-interfaces.fxs --yangpath …/…/imported\_models/  
o-ran-interfaces.yang:399: error: The ‘must’ expression should have a tailf:dependency. If is doesn’t, it will be checked for every commit.

NOte: using 7.3 version

---

<div class="post-metadata">

### Author: ![cohult](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/cohult/32/221_2.png) [@cohult](https://dmap-community.ductus.global/u/cohult)
#### Post date: [September 6, 2021, 8:41am UTC](https://dmap-community.ductus.global/t/error-while-trying-to-annotate-must-statement/3800/4 "2021-09-06T08:41:11Z")

</div>

> [@harminder](#):
>
> `must "derived-from-or-self(deref(current())/../hw:class, 'ianahw:port')";`

> [@harminder](#):
>
> ```auto
> tailf:annotate-statement must {
> tailf:dependency '/hw:hardware/hw:component/hw:class';
> 
> }
> 
> ```

should be

```auto
tailf:annotate-statement "must[condition=\"derived-from-or-self(deref(current())/../hw:class, 'ianahw:port')\"]" {
  tailf:dependency "/hw:hardware/hw:component/hw:class";
}

```

---

<div class="post-metadata">

### Author: ![harminder](https://avatars.discourse-cdn.com/v4/letter/h/8e7dd6/32.png) [@harminder](https://dmap-community.ductus.global/u/harminder)
#### Post date: [September 8, 2021, 4:55am UTC](https://dmap-community.ductus.global/t/error-while-trying-to-annotate-must-statement/3800/5 "2021-09-08T04:55:39Z")

</div>

thanks @cohult , working fine now.
