module opendaylight-queue-statistics {
    namespace "urn:opendaylight:queue:statistics";
    prefix queuestat;

    import flow-capable-transaction {prefix tr; revision-date "2015-03-04";}
    import yang-ext {prefix ext; revision-date "2013-07-09";}
    import opendaylight-inventory {prefix inv;revision-date "2013-08-19";}
    import flow-node-inventory {prefix flow-node;revision-date "2013-08-19";}
    import opendaylight-queue-types {prefix queue-types;revision-date "2013-09-25";}
    import opendaylight-statistics-types {prefix stat-types;revision-date "2013-09-25";}
    import opendaylight-multipart-types { prefix multipart; revision-date "2017-01-12"; }

    description "Openflowplugin queue statistics structures.";

    contact
        "Anilkumar Vishnoi
        Email: avishnoi@in.ibm.com";

    revision "2013-12-16" {
        description "Initial revision of queue statistics model";
    }

    //Augment queue statistics data to the flow-capable-node-connector
    augment "/inv:nodes/inv:node/inv:node-connector/flow-node:queue" {
        description "Openflow queue statistics data into the queue node.";
        ext:augment-identifier "flow-capable-node-connector-queue-statistics-data";
        uses flow-capable-node-connector-queue-statistics;
    }

    grouping flow-capable-node-connector-queue-statistics {
        description "TODO::simplify;";
        container flow-capable-node-connector-queue-statistics {
            uses stat-types:generic-queue-statistics;
        }
    }

    //RPC calls to fetch queue statistics
    grouping queue-id-and-statistics-map {
        list queue-id-and-statistics-map {
            key "queue-id node-connector-id";
            leaf queue-id {
                type queue-types:queue-id;
            }
            leaf node-connector-id {
                type inv:node-connector-id;
            }

            uses stat-types:generic-queue-statistics;
        }
    }

    rpc get-all-queues-statistics-from-all-ports {
        status deprecated;
        description "Get statistics for all the queues attached to all the ports from the node";

        input {
            uses inv:node-context-ref;
        }
        output {
            uses queue-id-and-statistics-map;
            uses tr:transaction-aware;
        }
    }

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

        input {
            uses inv:node-context-ref;
            leaf node-connector-id {
                type inv:node-connector-id;
            }
        }
        output {
            uses queue-id-and-statistics-map;
            uses tr:transaction-aware;
        }
    }

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

        input {
            uses inv:node-context-ref;
            leaf node-connector-id {
                type inv:node-connector-id;
            }
            leaf queue-id {
                type queue-types:queue-id;
            }
        }
        output {
            uses queue-id-and-statistics-map;
            uses tr:transaction-aware;
        }
    }

    //Notification for port statistics update

    notification queue-statistics-update {
        status deprecated;

        uses inv:node;
        uses queue-id-and-statistics-map;
        uses tr:multipart-transaction-aware;
    }

    augment "/multipart:multipart-reply/multipart:multipart-reply-body" {
        case multipart-reply-queue-stats {
            uses queue-id-and-statistics-map;
        }
    }

    augment "/multipart:multipart-request/multipart:multipart-request-body" {
        case multipart-request-queue-stats {
            leaf queue-id {
                type queue-types:queue-id;
            }

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