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

    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-flow-types {prefix types;revision-date "2013-10-26";}
    import flow-node-inventory {prefix flow-inv; revision-date "2013-08-19";}

    description "Openflow batch flow management.";

    revision "2016-03-14" {
        description "Initial revision of batch flow service";
    }

    grouping batch-flow-id-grouping {
        description "General flow-id leaf.";

        leaf flow-id {
            type flow-inv:flow-id;
        }
    }

    grouping batch-flow-input-grouping {
        description "Openflow flow structure suitable for batch rpc input.";

        uses batch-flow-id-grouping;
        uses types:flow;
    }

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

        uses batch-flow-id-grouping;
        container original-batched-flow {
            uses types:flow;
        }
        container updated-batched-flow {
            uses types:flow;
        }
    }

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

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

            uses batch:batch-order-grouping;
            uses batch-flow-id-grouping;
         }
    }


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

            list batch-add-flows {
                key flow-id;
                uses batch-flow-input-grouping;
            }
            uses bc:barrier-suffix;
        }
        output {
            uses batch-flow-output-list-grouping;
        }
    }

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

            list batch-remove-flows {
                key flow-id;
                uses batch-flow-input-grouping;
            }
            uses bc:barrier-suffix;
        }
        output {
            uses batch-flow-output-list-grouping;
        }
    }

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

            list batch-update-flows {
                key flow-id;
                uses batch-flow-input-update-grouping;
            }
            uses bc:barrier-suffix;
        }
        output {
            uses batch-flow-output-list-grouping;
        }
    }
}