module finite-state-machine {

  namespace "http://sssup.it/fsm";

  prefix fsm;

  import transitions {

    prefix ev;

  }

  organization

    "Scuola Superiore Sant'Anna Network and Services Laboratory";

  contact

    " Editor: Matteo Dallaglio

              <mailto:m.dallaglio@sssup.it>

    ";

  description

    "This module contains a YANG definitions of a generic finite state
    machine.";

  revision 2016-03-15 {

    description "Initial Revision.";

    reference

      "RFC xxxx:";

  }

  // identity statements

  // typedef statements

  typedef state-id-type {

    type uint32;

  }
  // grouping statements

  grouping state-top {

    leaf id {

      type state-id-type;

    }

    leaf description {

      type string;

    }

    grouping next-state-top {

      leaf next-state {

          type leafref {

            path "../../../../../../../../../states/state/id";

          }

          description "Id of the next state";

        }

    }

   uses ev:transitions-top {

    augment "transitions/transition/actions/action/conditional/true" {

        uses next-state-top;

      }

    augment "transitions/transition/actions/action/conditional/false" {

        uses next-state-top;

      }

    augment "transitions/transition/actions/action/simple" {

        //uses next-state-top;

        leaf next-state {

          type leafref {

            path "../../../../../../../../states/state/id";

          }

          description "Id of the next state";

        }

      }

   }

  }

  grouping states-top {

    leaf current-state {

      type leafref {

        path "../states/state/id";

      }

    }

    container states {

      list state {

        key "id";

        uses state-top;

      }

    }

  }

  // data definition statements

  uses states-top;

  // extension statements

  // feature statements

  // augment statements.

  // rpc statements

  // notification statements

}//module fsm
