module sal-bulk-flow {
    namespace "urn:opendaylight:bulk-flow:service";
    prefix bflow;

    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 bulk flow management.";

    revision "2015-06-08" {
        description "Initial revision of bulk flow service";
    }

    grouping bulk-flow-base-content-grouping {
        uses inv:node-context-ref;
        uses types:flow;
    }

    grouping bulk-flow-list-grouping {
        description "Suitable for rpc way";
        list bulk-flow-item {
            uses bulk-flow-base-content-grouping;
        }
    }

    grouping bulk-flow-ds-list-grouping {
        description "Suitable for dataStore way - includes flowId";
        list bulk-flow-ds-item {
            uses bulk-flow-base-content-grouping;
            leaf flow-id {
                mandatory true;
                type flow-inv:flow-id;
            }
        }
    }

    rpc register {
        description "register mbean etc. via rpc invocation.";
    }

    rpc add-flows-rpc {
        description "Adding multiple flows to openflow device via direct rpc invocation.";
        input {
            uses bulk-flow-list-grouping;
        }
    }

    rpc remove-flows-rpc {
        description "Removing multiple flows from openflow device via direct rpc invocation.";
        input {
            uses bulk-flow-list-grouping;
        }
    }

    rpc add-flows-ds {
        description "Adding multiple flows to openflow device via dataStore.";
        input {
            leaf always-create-parents {
                description "true if all items must take care of parent structure";
                type boolean;
                default false;
            }
            uses bulk-flow-ds-list-grouping;
        }
    }

    rpc remove-flows-ds {
        description "Removing multiple flows from openflow device via dataStore.";
        input {
            uses bulk-flow-ds-list-grouping;
        }
    }

    rpc flow-test {
        input {
            leaf create-parents {
                type boolean;
                mandatory true;
                default true;
                status current;
                description "Create parents if doesn't exist";
            }
            leaf is-add {
                type boolean;
                mandatory true;
                status current;
                description "Add or delete";
            }
            leaf dpn-count {
                type uint32;
                mandatory true;
                status current;
                description "No of DPNs";
            }
            leaf flows-per-dpn {
                type uint32;
                mandatory true;
                status current;
                description "Flows to be pushed per DPN";
            }
            leaf start-table-id {
                type uint32;
                mandatory true;
                status current;
                description "Start adding flows from this table id";
            }
            leaf end-table-id {
                type uint32;
                mandatory true;
                status current;
                description "The last table to add flows to and then wrap around";
            }
            leaf batch-size {
                type uint32;
                mandatory true;
                status current;
                description "batch size";
            }
            leaf seq {
                type boolean;
                mandatory true;
                status current;
                description "Whether to use sequential or concurrent writer";
            }
            leaf tx-chain {
                type boolean;
                mandatory true;
                status current;
                description "Whether to use PingPong Broker or not. seq is ignored.";
            }
            leaf sleep-for {
                type uint32;
                mandatory true;
                status current;
                description "sleep for the given milliseconds";
            }
            leaf sleep-after {
                type uint32;
                mandatory true;
                status current;
                description "Sleep after the given number of iterations. Will be used in the concurrent case only";
            }
        }
    }

    rpc read-flow-test {
	input {
	    leaf verbose {
		type boolean;
		mandatory true;
		status current;
		description "Add or delete";
	    }
	    leaf dpn-count {
		type uint32;
		mandatory true;
		status current;
		description "No of DPNs";
	    }
	    leaf is-config-ds {
		type boolean;
		mandatory true;
		status current;
		description "true for Config DS and false for Operational DS";
	    }
	    leaf flows-per-dpn {
		type uint32;
		mandatory true;
		status current;
		description "Flows to be pushed per DPN";
	    }
	    leaf start-table-id {
		type uint32;
		mandatory true;
		status current;
		description "Start reading from this table id";
	    }
	    leaf end-table-id {
		type uint32;
		mandatory true;
		status current;
		description "The last table id to read from and then wrap over";
	    }
	}
    }

    rpc flow-rpc-add-test {
	input {
	    leaf dpn-id {
		type string;
		mandatory true;
		status current;
		description "DPID to which flows are pushed";
	    }
	    leaf flow-count {
		type uint32;
		mandatory true;
		status current;
		description "Flows to be pushed per DPN";
	    }
	    leaf rpc-batch-size {
		type uint32;
		mandatory true;
		status current;
		description "Batch-size which would be sent continuously without any pause, If less than sal-bulk-flow:flow-count, a fixed pause of 40 ms would be introduced";
	    }
	}
    }

    rpc flow-rpc-add-multiple {
	input {
	    leaf flow-count {
		type uint32;
		mandatory true;
		status current;
		description "Flows to be pushed per DPN";
	    }
	    leaf rpc-batch-size {
		type uint32;
		mandatory true;
		status current;
		description "Batch-size which would be sent continuously without any pause, If less than sal-bulk-flow:flow-count, a fixed pause of 40 ms would be introduced";
	    }
	}
    }

    rpc table-test {
        input {
            leaf operation {
                type enumeration {
                    enum add;
                    enum delete;
                }
                status current;
                description "Type of operation, add or delete";
            }

            leaf dpn-count {
                type uint32;
                mandatory true;
                status current;
                description "Total number of dpns to add these tables";
            }

            leaf start-table-id {
                type uint32;
                mandatory true;
                status current;
                description "Starting table id";
            }

            leaf end-table-id {
                type uint32;
                mandatory true;
                status current;
                description "Last table id";
            }
        }
    }
}