cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1373
Views
0
Helpful
0
Replies

In YANG, how do I check if a presence container exists or not?

In YANG, I'm trying to do a "tailf:display-when" statement for displaying a container called `default`. I'm checking the existence for one of three variables (if one of the three variables being checked exists, display the container, else don't). The check of the variable works fine for the `type string`, but it does not work for the `presence container`. Is there a specific way/method I should check if the presence container exists?

container default {
  tailf:info "This will default the interface(s) prior to applying template configuration";
  presence default;
  // 'interface-range' which is `type string` works fine
  // the presence containers 'dry-run' and 'l2-access-interfaces' check does not work, it always shows this container, whether the presence container is there or not
  tailf:display-when "(../interface-variable/interface-range or ../interface-variable/l2-access-interfaces='l2-access-interfaces') or not(../dry-run)";
}

choice commit-type {
  mandatory true;
  case dry-run {
    container dry-run {
      tailf:info "Instead of attempting to commit the transaction, it will show the dry-run";
      presence dry-run;
      leaf outformat {
        type outformat3;
      }
    }
  }
... } container interface-variable { choice int-var { case no-shut { container no-shutdown-interfaces { presence no-shutdown-interfaces; } } //end case case mgmt-int { container management-interface { presence management-interface; } } // end case case l3 { container l3-interfaces { presence l3-interfaces; tailf:info "An interface with an ipv4 or ipv6 address configured on it"; } } // end case case l2-access { container l2-access-interfaces { presence l2-access-interfaces; } } //end case case l2-trunk { container l2-trunk-interfaces { presence l2-trunk-interfaces; } } //end case case int-rng { leaf interface-range { type string; tailf:info "Interface number ranges such as `1/0/4`, `1/0/4-7`, `1-2/0/1-48`, etc. are viable."; } } //end case } // end choice }
0 Replies 0