module sal-bundle {
    namespace "urn:opendaylight:openflowplugin:extension:onf:bundle:service";
    prefix bundle-ext;

    import onf-extensions {prefix onf-ext; revision-date "2017-01-24";}
    import opendaylight-inventory {prefix inv; revision-date "2013-08-19";}
    import sal-experimenter-message {prefix exp-msg; revision-date "2015-10-20";}
    import opendaylight-flow-types {prefix flow-types; revision-date "2013-10-26";}
    import opendaylight-group-types {prefix group-types; revision-date "2013-10-18";}
    import opendaylight-port-types {prefix port-types; revision-date "2013-09-25";}

    revision "2017-01-24" {
        description "Initial revision of extension bundle service";
    }

    augment "/exp-msg:send-experimenter/exp-msg:input/exp-msg:experimenter-message-of-choice" {
        case bundle-control-sal {
            container sal-control-data {
                uses onf-ext:bundle-control-grouping;
            }
        }
        case bundle-add-message-sal {
            container sal-add-message-data {
                uses onf-ext:bundle-common-grouping;
                uses bundle-inner-message-grouping;
            }
        }
    }

    grouping bundle-inner-message-grouping {
        uses inv:node-context-ref;
        choice bundle-inner-message {
            case bundle-add-flow-case {
                container add-flow-case-data {
                    uses flow-types:flow;
                }
            }
            case bundle-update-flow-case {
                container update-flow-case-data {
                    uses flow-types:flow;
                }
            }
            case bundle-remove-flow-case {
                container remove-flow-case-data {
                    uses flow-types:flow;
                }
            }
            case bundle-add-group-case {
                container add-group-case-data {
                    uses group-types:group;
                }
            }
            case bundle-update-group-case {
                container update-group-case-data {
                    uses group-types:group;
                }
            }
            case bundle-remove-group-case {
                container remove-group-case-data {
                    uses group-types:group;
                }
            }
            case bundle-update-port-case {
                container update-port-case-data {
                    uses port-types:port-mod;
                }
            }
        }
    }

    rpc control-bundle {
        description "Control bundles on openflow device.";
        input {
            uses inv:node-context-ref;
            uses onf-ext:bundle-control-grouping;
        }
    }

    rpc add-bundle-messages {
        description "Add messages into bundle on openflow device.";
        input {
            uses inv:node-context-ref;
            uses onf-ext:bundle-common-grouping;
            container messages {
                list message {
                    uses bundle-inner-message-grouping;
                }
            }
        }
    }
}