Problem:


You get a YANG compiler error because the "action" keyword is not accepted.


The "action" keyword is not available in YANG 1.0.  It was added in YANG 1.1.


Error: 'action' token not allowed here
Error:  Got 'action', Expected: anyxml, container, leaf, leaf-list, list, choice, uses,or augment keyword
codetest.yang:30.7: error(246): wrong token value




Solution:


The "yang-version 1.1" statement is probably missing from your module.


Check the very top of the module.


It should be the first statement found inside the module.


module codetest {
    yang-version 1.1;
    namespace "http://netconfcentral.org/ns/codetest";
    prefix "ct";

    // rest of module

}




Example YANG:


    list top2A {
      key a;
      config false;

      leaf a {
        type int32;
      }
      action top-action {
        input {
          leaf a {
            type int32;
          }
        }
        output {
          leaf b {
            type int8;
          }
        }
      }
    }