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

    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-meter-types {prefix meter-type;revision-date "2013-09-18";}

    description "Openflow batch meter management.";

    revision "2016-03-16" {
        description "Initial revision of meter batch service";
    }

    grouping batch-meter-input-update-grouping {
        description "Update openflow meter structure suitable for batch rpc input.";

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

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

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

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

    rpc add-meters-batch {
        description "Adding batch meters to openflow device.";
        input {
            uses "inv:node-context-ref";

            list batch-add-meters {
                key meter-id;

                leaf meter-ref {
                    type meter-type:meter-ref;
                }
                uses meter-type:meter;
            }
            uses bc:barrier-suffix;
        }
        output {
            uses batch-meter-output-list-grouping;
        }
    }

    rpc remove-meters-batch {
        description "Removing batch meter from openflow device.";
        input {
            uses "inv:node-context-ref";

            list batch-remove-meters {
                key meter-id;

                leaf meter-ref {
                    type meter-type:meter-ref;
                }
                uses meter-type:meter;
            }
            uses bc:barrier-suffix;
        }
        output {
            uses batch-meter-output-list-grouping;
        }
    }

    rpc update-meters-batch {
        description "Updating batch meter on openflow device.";
        input {
            uses "inv:node-context-ref";
            list batch-update-meters {
                leaf meter-ref {
                    type meter-type:meter-ref;
                }
                uses batch-meter-input-update-grouping;
            }
            uses bc:barrier-suffix;
        }
        output {
            uses batch-meter-output-list-grouping;
        }
    }
}