module opendaylight-direct-statistics {
    namespace "urn:opendaylight:direct:statistics";
    prefix directstat;

    import yang-ext { prefix ext; revision-date "2013-07-09"; }
    import ietf-inet-types { prefix inet; revision-date "2013-07-15"; }
    import opendaylight-inventory { prefix inv; revision-date "2013-08-19"; }
    import opendaylight-statistics-types { prefix stat-types; revision-date "2013-09-25"; }

    import opendaylight-flow-types  { prefix flow-types;  revision-date "2013-10-26"; }
    import opendaylight-group-types { prefix group-types; revision-date "2013-10-18"; }
    import opendaylight-meter-types { prefix meter-types; revision-date "2013-09-18"; }
    import opendaylight-queue-types { prefix queue-types; revision-date "2013-09-25"; }
    import opendaylight-table-types { prefix table-types; revision-date "2013-10-26"; }

    import opendaylight-flow-statistics { prefix flowstat; revision-date "2013-08-19"; }
    import opendaylight-port-statistics { prefix portstat; revision-date "2013-12-14"; }
    import opendaylight-queue-statistics { prefix queuestat; revision-date "2013-12-16"; }

    description "Openflow direct statistics polling.";

    revision "2016-05-11" {
        description "Initial revision of direct statistics service";
    }

    grouping store-stats-grouping {
        description "Store collected statistics to DS/operational";

        leaf store-stats {
            type boolean;
            default false;
        }
    }

    grouping stats-input-common-grouping {
        description "Shared input parameters for all rpc statistics (routing context and datastore flag)";

        uses inv:node-context-ref;
        uses store-stats-grouping;
    }

    rpc get-flow-statistics {
        description "Get statistics for given flow";

        input {
            uses stats-input-common-grouping;
            uses flow-types:flow;
        }

        output {
            uses flowstat:flow-and-statistics-map-list;
        }
    }

    rpc get-group-statistics {
        description "Get statistics for given group";

        input {
            uses stats-input-common-grouping;

            leaf group-id {
                type group-types:group-id;
            }
        }

        output {
            uses group-types:group-statistics-reply;
        }
    }

    rpc get-meter-statistics {
        description "Get statistics for given meter";

        input {
            uses stats-input-common-grouping;

            leaf meter-id {
                type meter-types:meter-id;
            }
        }

        output {
            uses meter-types:meter-statistics-reply;
        }
    }

    rpc get-node-connector-statistics {
        description "Get statistics for given node connector from the node";

        input {
            uses stats-input-common-grouping;

            leaf node-connector-id {
                description "Optional, if omitted, returns statistics for all ports";
                type inv:node-connector-id;
            }
        }

        output {
            uses portstat:node-connector-statistics-and-port-number-map;
        }
    }

    rpc get-queue-statistics {
        description "Get statistics for given queues from given port of the node";

        input {
            uses stats-input-common-grouping;

            leaf node-connector-id {
                type inv:node-connector-id;
            }

            leaf queue-id {
                type queue-types:queue-id;
            }
        }

        output {
            uses queuestat:queue-id-and-statistics-map;
        }
    }
}