module base-packet { yang-version 1; namespace "urn:opendaylight:packet:basepacket"; prefix bpacket; import opendaylight-inventory { prefix inv; revision-date "2013-08-19"; } import packet-processing { prefix pprocessing; revision-date 2013-07-09; } import opendaylight-match-types { prefix match-type; revision-date "2013-10-26"; } import opendaylight-table-types { prefix table-type; revision-date "2013-10-26"; } import opendaylight-flow-types { prefix flow-type; revision-date "2013-10-26"; } revision 2014-05-28 { description "Base packet module draft."; } grouping packet-payload { leaf payload { type binary; } } grouping packet-fields { leaf payload-offset { type uint32; } leaf payload-length { type uint32; } } grouping packet-chain-grp { list packet-chain { // Note on the design here: // // We are inlining raw view of the packet, as these fields are being repeated // in other cases. YANG semantics requires that individual case statements within // a choice do not overlap on child QNames -- i.e. they differ in namespace or // or localname. Since this structure is defined as a grouping, there is no way // things like ipv4-packet-received can differentiate on namespace. We therefore // enclose this case in an explicit case (to keep consistency with users) and a // further container as the sole element. // // This guarantees the contents of packet-fields do not clash across cases, while // keeping things reasonable (to an extent). // // TODO: a much better design would look like this: // // container packet { // uses packet-fields; // // choice packet-type { // case raw-packet { // // .. the contents of raw-packet-fields .. // } // } // } // // which still has a potential problem with naming fields, but at least it is not // baked into the design. choice packet { case raw-packet { container raw-packet-fields { leaf ingress { type inv:node-connector-ref; } leaf connection-cookie { type pprocessing:connection-cookie; } leaf flow-cookie { type flow-type:flow-cookie; } leaf table-id { type table-type:table-id; } leaf packet-in-reason { type identityref { base pprocessing:packet-in-reason; } } container match { uses match-type:match; } uses packet-fields; } } } } } }