module opendaylight-port-statistics {
    namespace "urn:opendaylight:port:statistics";
    prefix portstat;

    import flow-capable-transaction {prefix tr; revision-date "2015-03-04";}
    import yang-ext {prefix ext; revision-date "2013-07-09";}
    import opendaylight-inventory {prefix inv;revision-date "2013-08-19";}
    import opendaylight-statistics-types {prefix stat-types;revision-date "2013-09-25";}
    import opendaylight-multipart-types { prefix multipart; revision-date "2017-01-12"; }

    description "Openflow port statistics structures.";

    contact
        "Anilkumar Vishnoi
        Email: avishnoi@in.ibm.com";

    revision "2013-12-14" {
        description "Initial revision of port statistics model";
    }

    //Augment port statistics data to the flow-capable-node-connector
    augment "/inv:nodes/inv:node/inv:node-connector" {
        description "Openflow port statistics data into the node connector node.";
        ext:augment-identifier "flow-capable-node-connector-statistics-data";
        uses flow-capable-node-connector-statistics;
    }

    grouping flow-capable-node-connector-statistics {
        description "TODO:: simplify";
        container flow-capable-node-connector-statistics {
            uses stat-types:node-connector-statistics;
        }
    }

    // RPC calls
    rpc get-all-node-connectors-statistics {
        status deprecated;

        description "Get statistics for all node connectors from the node";
        input {
            uses inv:node-context-ref;
        }
        output {
            uses node-connector-statistics-and-port-number-map;
            uses tr:transaction-aware;
        }
    }

    rpc get-node-connector-statistics {
        status deprecated;

        description "Get statistics for given node connector from the node";
        input {
            uses inv:node-context-ref;
            leaf node-connector-id {
                type inv:node-connector-id;
            }
        }
        output {
            uses stat-types:node-connector-statistics;
            uses tr:transaction-aware;
        }
    }

    //Notification for node connector statistics update
    grouping node-connector-statistics-and-port-number-map {
        description "List of map - node connectors and their statistics";
        list node-connector-statistics-and-port-number-map {
            key "node-connector-id";
            leaf node-connector-id {
                type inv:node-connector-id;
            }
            uses stat-types:node-connector-statistics;
        }
    }

    notification node-connector-statistics-update {
        status deprecated;

        uses inv:node;
        uses node-connector-statistics-and-port-number-map;
        uses tr:multipart-transaction-aware;
    }

    augment "/multipart:multipart-reply/multipart:multipart-reply-body" {
        case multipart-reply-port-stats {
            uses node-connector-statistics-and-port-number-map;
        }
    }

    augment "/multipart:multipart-request/multipart:multipart-request-body" {
        case multipart-request-port-stats {
            leaf node-connector-id {
                type inv:node-connector-id;
            }
        }
    }
}