module sal-groups-batch {
    namespace "urn:opendaylight:groups:service";
    prefix groups;

    import barrier-common {prefix bc;revision-date "2016-03-15";}
    import batch-common {prefix batch;revision-date "2016-03-22";}
    import opendaylight-inventory {prefix inv;revision-date "2013-08-19";}
    import opendaylight-group-types {prefix group-type;revision-date "2013-10-18";}

    description "Openflow batch group management.";

    revision "2016-03-15" {
        description "Initial revision of batch group service";
    }

    grouping batch-group-input-update-grouping {
        description "Openflow group structure for group batch update rpc.";

        // group-id is included in group-type:group
        container original-batched-group {
            uses group-type:group;
        }
        container updated-batched-group {
            uses group-type:group;
        }
    }

    grouping batch-group-output-list-grouping {
        description "Openflow group list suitable for batch rpc output.";

         list batch-failed-groups-output {
            key batch-order;

            uses batch:batch-order-grouping;
            leaf group-id {
                type group-type:group-id;
            }
         }
    }


    rpc add-groups-batch {
        description "Batch adding groups to openflow device.";
        input {
            uses "inv:node-context-ref";

            list batch-add-groups {
                key group-id;
                uses group-type:group;
            }
            uses bc:barrier-suffix;
        }
        output {
            uses batch-group-output-list-grouping;
        }
    }

    rpc remove-groups-batch {
        description "Batch removing groups from openflow device.";
        input {
            uses "inv:node-context-ref";

            list batch-remove-groups {
                key group-id;
                uses group-type:group;
            }
            uses bc:barrier-suffix;
        }
        output {
            uses batch-group-output-list-grouping;
        }
    }

    rpc update-groups-batch {
        description "Batch updating groups on openflow device.";
        input {
            uses "inv:node-context-ref";

            list batch-update-groups {
                // key group-id;
                uses batch-group-input-update-grouping;
            }
            uses bc:barrier-suffix;
        }
        output {
            uses batch-group-output-list-grouping;
        }
    }
}