module opendaylight-group-statistics {
    namespace "urn:opendaylight:group:statistics";
    prefix groupstat;

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

    description "Openflow group statistics structures.";

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

    revision "2013-11-11" {
        description "Initial revision of group statistics service";
    }

    grouping group-statistics {
        description "TODO:: simplify";
        container group-statistics {
            uses group-types:group-statistics;
        }
    }

    augment "/inv:nodes/inv:node/fni:group" {
        description "Openflow group statistics into group node.";
        ext:augment-identifier "node-group-statistics";
        uses group-statistics;
    }

    grouping group-desc {
        description "TODO:: simplify";
        container group-desc {
            uses group-types:group;
        }
    }

    augment "/inv:nodes/inv:node/fni:group" {
        description "Openflow group description into group node.";
        ext:augment-identifier "node-group-desc-stats";
        uses group-desc;
    }

    grouping group-features {
        description "TODO:: simplify";
        container group-features {
            uses group-types:group-features-reply;
        }
    }

    augment "/inv:nodes/inv:node" {
        description "Openflow group features into group node.";
        ext:augment-identifier "node-group-features";
        uses group-features;
    }

    // RPC calls
    rpc get-all-group-statistics {
        status deprecated;
        input {
            uses inv:node-context-ref;
        }
        output {
            uses group-types:group-statistics-reply;
            uses tr:transaction-aware;
        }
    }

    rpc get-group-statistics {
        status deprecated;
        input {
            uses inv:node-context-ref;
            leaf group-id{
                type group-types:group-id;
            }
        }
        output {
            uses group-types:group-statistics-reply;
            uses tr:transaction-aware;
        }
    }

    rpc get-group-description {
        status deprecated;
        input {
            uses inv:node-context-ref;
        }
        output {
            uses group-types:group-desc-stats-reply;
            uses tr:transaction-aware;
        }
    }

    rpc get-group-features {
        status deprecated;
        input {
            uses inv:node-context-ref;
        }
        output {
            uses group-types:group-features-reply;
            uses tr:transaction-aware;
        }
    }


    //Notification calls

    notification group-statistics-updated {
        status deprecated;

        uses inv:node;
        uses group-types:group-statistics-reply;
        uses tr:multipart-transaction-aware;
    }

    notification group-desc-stats-updated {
        status deprecated;

        uses inv:node;
        uses group-types:group-desc-stats-reply;
        uses tr:multipart-transaction-aware;
    }

    notification group-features-updated {
        status deprecated;

        uses inv:node;
        uses group-types:group-features-reply;
        uses tr:multipart-transaction-aware;
    }

    augment "/multipart:multipart-reply/multipart:multipart-reply-body" {
        case multipart-reply-group-stats {
            uses group-types:group-statistics-reply;
        }

        case multipart-reply-group-desc {
            uses group-types:group-desc-stats-reply;
        }

        case multipart-reply-group-features {
            uses group-types:group-features-reply;
        }
    }

    augment "/multipart:multipart-request/multipart:multipart-request-body" {
        case multipart-request-group-desc {
            // Empty request case
        }
        case multipart-request-group-features {
            // Empty request case
        }
        case multipart-request-group-stats {
            leaf group-id {
                type group-types:group-id;
            }
        }
    }
}