Added more openflow models 25/925/2
authorAdam Brcek <adam.brcek@pantheon.sk>
Tue, 20 Aug 2013 13:28:25 +0000 (15:28 +0200)
committerAdam Brcek <adam.brcek@pantheon.sk>
Tue, 3 Sep 2013 22:14:36 +0000 (15:14 -0700)
  - openflow-action defines Openflow Actions
  - openflow-instruction defines Openflow Instructions
  - openflow-extensible-match defines Openflow Extensible Match
  - openflow-protocol defines Openflow Protocol messages and structures

Change-Id: Ifcaa196a673e83525a6a14d2c46603263cedbdd7
Signed-off-by: Adam Brcek <adam.brcek@pantheon.sk>
openflow-protocol-api/pom.xml
openflow-protocol-api/src/main/yang/openflow-action.yang [new file with mode: 0644]
openflow-protocol-api/src/main/yang/openflow-extensible-match.yang [new file with mode: 0644]
openflow-protocol-api/src/main/yang/openflow-instruction.yang [new file with mode: 0644]
openflow-protocol-api/src/main/yang/openflow-protocol.yang [new file with mode: 0644]
openflow-protocol-api/src/main/yang/openflow-types.yang

index aa0f63432ac0f4fa51bd9a3b25329c967e512baa..fa3e58840814141d4c5c01182e63613e1e25472c 100644 (file)
@@ -1,4 +1,4 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">\r
        <modelVersion>4.0.0</modelVersion>\r
        <parent>\r
@@ -32,7 +32,7 @@
                                     </outputBaseDir>\r
                                 </generator>\r
                             </codeGenerators >\r
-                            <inspectDependencies>false</inspectDependencies>\r
+                            <inspectDependencies>true</inspectDependencies>\r
                         </configuration>\r
                     </execution>\r
                 </executions>\r
             <artifactId>yang-common</artifactId>\r
             <version>0.5.7-SNAPSHOT</version>\r
         </dependency>\r
+        <dependency>\r
+            <groupId>org.opendaylight.yangtools.model</groupId>\r
+            <artifactId>ietf-inet-types</artifactId>\r
+            <version>2010.09.24-SNAPSHOT</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.opendaylight.yangtools.model</groupId>\r
+            <artifactId>ietf-yang-types</artifactId>\r
+            <version>2010.09.24-SNAPSHOT</version>\r
+        </dependency>\r
+        \r
     </dependencies>\r
 </project>
\ No newline at end of file
diff --git a/openflow-protocol-api/src/main/yang/openflow-action.yang b/openflow-protocol-api/src/main/yang/openflow-action.yang
new file mode 100644 (file)
index 0000000..c665a8a
--- /dev/null
@@ -0,0 +1,158 @@
+module openflow-action {
+       namespace "urn:opendaylight:openflow:common:action";
+       prefix "ofaction";
+
+    import openflow-types { prefix oft; }
+
+       revision "2013-07-31" {
+               description "Initial model";
+       }
+
+    /*
+       identity output {
+               description " Output to switch port. ";
+               base oft:action;
+       }
+       identity copy_ttl_out {
+               description " Copy TTL "outwards" -- from next-to-outermost to outermost ";
+               base oft:action;
+       }
+       identity copy_ttl_in {
+               description " Copy TTL "inwards" -- from outermost to next-to-outermost ";
+               base oft:action;
+       }
+       identity set_mpls_ttl {
+               description " MPLS TTL ";
+               base oft:action;
+       }
+       identity dec_mpls_ttl {
+               description " Decrement MPLS TTL ";
+               base oft:action;
+       }
+       identity push_vlan {
+               description " Push a new VLAN tag ";
+               base oft:action;
+       }
+       identity pop_vlan {
+               description " Pop the outer VLAN tag ";
+               base oft:action;
+       }
+       identity push_mpls {
+               description " Push a new MPLS tag ";
+               base oft:action;
+       }
+       identity pop_mpls {
+               description " Pop the outer MPLS tag ";
+               base oft:action;
+       }
+       identity set_queue {
+               description " Set queue id when outputting to a port ";
+               base oft:action;
+       }
+       identity group {
+               description " Apply group. ";
+               base oft:action;
+       }
+       identity set_nw_ttl {
+               description " IP TTL. ";
+               base oft:action;
+       }
+       identity dec_nw_ttl {
+               description " Decrement IP TTL. ";
+               base oft:action;
+       }
+       identity set_field {
+               description " Set a header field using OXM TLV format. ";
+               base oft:action;
+       }
+       identity push_pbb {
+               description " Push a new PBB service tag (I-TAG) ";
+               base oft:action;
+       }
+       identity pop_pbb {
+               description " Pop the outer PBB service tag (I-TAG) ";
+               base oft:action;
+       }
+       identity experimenter {
+               description "";
+               base oft:action;
+       }
+    */
+       grouping output {
+               description 
+                       "Action structure for OFPAT_OUTPUT, which sends packets out 'port'.
+                       When the 'port' is the OFPP_CONTROLLER, 'max_len' indicates the max
+                       number of bytes to send. A 'max_len' of zero means no bytes of the
+                       packet should be sent. A 'max_len' of OFPCML_NO_BUFFER means that
+                       the packet is not buffered and the complete packet is to be sent to
+                       the controller.";
+               leaf port {
+                       type oft:any-port-number;
+               }
+               leaf max-length {
+                       description "Maximum packet length to be send to controller.";
+                       type union {
+                               type uint16 {
+                                       range "0..65294"; // 0..0xff0e
+                               }
+                               type enumeration {
+                                       enum no-buffer {
+                                               description 
+                                                       "indicates that no buffering should be
+                                                        applied and the whole packet is to be
+                                                        sent to the controller";
+                                               value 65535; //0xffff
+                                       }
+                               }
+                       }
+               }
+       }
+
+       grouping group {
+               leaf group {
+                       type oft:group-id; // define action group-id type;
+               }
+       }
+
+       grouping set_queue {
+               leaf queue {
+                       type oft:queue-id;
+               }
+       }
+
+       grouping set_mpls_ttl {
+               leaf mpls_ttl {
+                       type uint8;
+               }
+       }
+
+       grouping set_nw_ttl {
+               leaf nw_ttl {
+                       type uint8;
+               }
+       }
+
+       grouping push_pbb {
+
+       }
+
+       grouping push_mpls {
+
+       }
+
+       grouping push_vlan {
+
+       }
+
+       grouping pop_mpls {
+               leaf ethertype {
+                       type uint16; // TODO: define ethertype type
+               }
+       }
+
+       grouping set_field {
+               container field {
+                       // TODO: figure definition
+               }
+       }
+}
\ No newline at end of file
diff --git a/openflow-protocol-api/src/main/yang/openflow-extensible-match.yang b/openflow-protocol-api/src/main/yang/openflow-extensible-match.yang
new file mode 100644 (file)
index 0000000..c82c93d
--- /dev/null
@@ -0,0 +1,741 @@
+module openflow-extensible-match {
+       namespace "urn:openflowopenflow:oxm";
+       prefix "oxm";
+
+
+       
+       import ietf-yang-types {prefix yang;}
+       import ietf-inet-types {prefix inet;}
+       import openflow-types {prefix oft;}
+
+
+    revision "2013-07-31" {
+        description "Initial model";
+    }
+
+       identity oxm-match-type {
+               description 
+                  "The OpenFlow Extensible Match type must be supported by all OpenFlow
+                       switches.";
+               base oft:match-type;
+       }
+
+       // oxm classes
+               identity class {
+                       description "Base identity for OXM classes";
+               }
+
+
+               identity nxm-0-class {
+                       description "Backward compatibility with NXM";
+                       base class;
+               }
+               identity nxm-1-class {
+                       description "Backward compatibility with NXM";
+                       base class;
+               }
+               identity openflow-basic-class {
+                       description "Basic class for OpenFlow";
+                       base class;
+               }
+               identity experimenter-class {
+                       description 
+                               "Marks Experimenter match type class.
+                               All experimenter match classes MUST use this class as a base.";
+                       base class;
+               }
+
+
+
+       // field types
+           /*
+               identity match-field {
+                       description "Base identity for OXM Fields";
+               }
+
+           identity in_port {
+               base match-field;
+               description "Match for Switch input port.";
+           }
+           identity in_phy_port {
+               base match-field;
+               description "Match for Switch physical input port.";
+           }
+           identity metadata {
+               base match-field;
+               description "Match for Metadata passed between tables.";
+           }
+           identity eth_dst {
+               base match-field;
+               description "Match for Ethernet destination address.";
+           }
+           identity eth_src {
+               base match-field;
+               description "Match for Ethernet source address.";
+           }
+           identity eth_type {
+               base match-field;
+               description "Match for Ethernet frame type.";
+           }
+           identity vlan_vid {
+               base match-field;
+               description "Match for VLAN id.";
+           }
+           identity vlan_pcp {
+               base match-field;
+               description "Match for VLAN priority.";
+           }
+           identity ip_dscp {
+               base match-field;
+               description "Match for IP DSCP (6 bits in ToS field).";
+           }
+           identity ip_ecn {
+               base match-field;
+               description "Match for IP ECN (2 bits in ToS field).";
+           }
+           identity ip_proto {
+               base match-field;
+               description "Match for IP protocol.";
+           }
+           identity ipv4_src {
+               base match-field;
+               description "Match for IPv4 source address.";
+           }
+           identity ipv4_dst {
+               base match-field;
+               description "Match for IPv4 destination address.";
+           }
+           identity tcp_src {
+               base match-field;
+               description "Match for TCP source port.";
+           }
+           identity tcp_dst {
+               base match-field;
+               description "Match for TCP destination port.";
+           }
+           identity udp_src {
+               base match-field;
+               description "Match for UDP source port.";
+           }
+           identity udp_dst {
+               base match-field;
+               description "Match for UDP destination port.";
+           }
+           identity sctp_src {
+               base match-field;
+               description "Match for SCTP source port.";
+           }
+           identity sctp_dst {
+               base match-field;
+               description "Match for SCTP destination port.";
+           }
+           identity icmpv4_type {
+               base match-field;
+               description "Match for ICMP type.";
+           }
+           identity icmpv4_code {
+               base match-field;
+               description "Match for ICMP code.";
+           }
+           identity arp_op {
+               base match-field;
+               description "Match for ARP opcode.";
+           }
+           identity arp_spa {
+               base match-field;
+               description "Match for ARP source IPv4 address.";
+           }
+           identity arp_tpa {
+               base match-field;
+               description "Match for ARP target IPv4 address.";
+           }
+           identity arp_sha {
+               base match-field;
+               description "Match for ARP source hardware address.";
+           }
+           identity arp_tha {
+               base match-field;
+               description "Match for ARP target hardware address.";
+           }
+           identity ipv6_src {
+               base match-field;
+               description "Match for IPv6 source address.";
+           }
+           identity ipv6_dst {
+               base match-field;
+               description "Match for IPv6 destination address.";
+           }
+           identity ipv6_flabel {
+               base match-field;
+               description "Match for IPv6 Flow Label";
+           }
+           identity icmpv6_type {
+               base match-field;
+               description "Match for ICMPv6 type.";
+           }
+           identity icmpv6_code {
+               base match-field;
+               description "Match for ICMPv6 code.";
+           }
+           identity ipv6_nd_target {
+               base match-field;
+               description "Match for Target address for ND.";
+           }
+           identity ipv6_nd_sll {
+               base match-field;
+               description "Match for Source link-layer for ND.";
+           }
+           identity ipv6_nd_tll {
+               base match-field;
+               description "Match for Target link-layer for ND.";
+           }
+           identity mpls_label {
+               base match-field;
+               description "Match for MPLS label.";
+           }
+           identity mpls_tc {
+               base match-field;
+               description "Match for MPLS TC.";
+           }
+           identity mpls_bos {
+               base match-field;
+               description "Match for MPLS BoS bit.";
+           }
+           identity pbb_isid {
+               base match-field;
+               description "Match for PBB I-SID.";
+           }
+           identity tunnel_id {
+               base match-field;
+               description "Match for Logical Port Metadata";
+           }
+           identity ipv6_exthdr {
+               base match-field;
+               description "Match for IPv6 Extension Header pseudo-field";
+           }
+        */
+       // Abstract definitions of fields structure
+
+               grouping in_port {
+                       description 
+                               "Ingress port. Numerical representation of incoming port, starting at 1. This may be a physical or switch-defined logical port.";
+                       leaf port-number {
+                               type oft:port-number;
+                       }
+               }
+               grouping in_phy_port {
+                       description "Physical port. In ofp_packet_in messages, underlying physical port when packet received on a logical port.";
+                       leaf port-number {
+                               type oft:port-number;
+                       }
+               }
+               grouping metadata {
+                       description "Metadata passed between tables.";
+                       leaf value {
+                               type oft:metadata;
+                       }
+                       leaf mask {
+                               type oft:metadata;
+                       }
+               }
+               grouping eth_dst {
+                       description "Ethernet destination address.";
+                       leaf address {
+                               type yang:mac-address;
+                       }
+               }
+               grouping eth_src {
+                       description "Ethernet source address.";
+                       leaf address {
+                               type yang:mac-address;
+                       }
+                       leaf mask {
+                               type binary;
+                       }
+               }
+               grouping eth_type {
+                       description "Ethernet frame type.";
+                       leaf type {
+                               type oft:ether-type; // Needs to define that as general model
+                       }
+                       leaf mask {
+                               type binary;
+                       }
+               }
+               grouping vlan_vid {
+                       description "VLAN id.";
+                       leaf vlan-id {
+                               type uint16; // TODO: Define proper vlan id type.
+                       }
+                       leaf mask {
+                               type binary;
+                       }
+               }
+               grouping vlan_pcp {
+                       description "VLAN priority.";
+                       leaf vlan-pcp {
+                               type uint8; // TODO: Define PCP type
+                       }
+               }
+               grouping ip_dscp {
+                       description "IP DSCP (6 bits in ToS field).";
+
+                       leaf dscp {
+                               type inet:dscp; // TODO: Define DSCP type
+                       }
+               }
+               grouping ip_ecn {
+                       description "IP ECN (2 bits in ToS field).";
+                       leaf ecn {
+                               type uint8; // TODO define ECN
+                       }
+               }
+               grouping ip_proto {
+                       description "IP protocol.";
+                       leaf protocol-number {
+                               type uint8; // TODO define IP protocol number
+                       }
+               }
+               grouping ipv4_src {
+                       description "IPv4 source address.";
+                       leaf prefix {
+                               type inet:ipv4-prefix;
+                       }
+               }
+               grouping ipv4_dst {
+                       description "IPv4 destination address.";
+                       leaf prefix {
+                               type inet:ipv4-prefix;
+                       }
+               }
+               grouping tcp_src {
+                       description "TCP source port.";
+                       leaf port {
+                               type inet:port-number;
+                       }
+               }
+               grouping tcp_dst {
+                       description "TCP destination port.";
+                                       leaf port {
+                               type inet:port-number;
+                       }
+               }
+               grouping udp_src {
+                       description "UDP source port.";
+                       leaf port {
+                               type inet:port-number;
+                       }
+               }
+               grouping udp_dst {
+                       description "UDP destination port.";
+                       leaf port {
+                               type inet:port-number;
+                       }
+               }
+               grouping sctp_src {
+                       description "SCTP source port.";
+                       leaf port {
+                               type inet:port-number;
+                       }
+               }
+               grouping sctp_dst {
+                       description "SCTP destination port.";
+                       leaf port {
+                               type inet:port-number;
+                       }
+               }
+               grouping icmpv4_type {
+                       description "ICMP type.";
+                       leaf type {
+                               type uint8; // Define ICMP Type
+                       }
+               }
+               grouping icmpv4_code {
+                       description "ICMP code.";
+                       leaf code {
+                               type uint8; // Define ICMP Code
+                       }
+               }
+               grouping arp_op {
+                       description "ARP opcode.";
+                       leaf op-code {
+                               type uint16;
+                       }
+               }
+               grouping arp_spa {
+                       description "ARP source IPv4 address.";
+                       leaf prefix {
+                               type inet:ipv4-prefix;
+                       }
+               }
+               grouping arp_tpa {
+                       description "ARP target IPv4 address.";
+                       leaf prefix {
+                               type inet:ipv4-prefix;
+                       }
+               }
+               grouping arp_sha {
+                       description "ARP source hardware address.";
+                       leaf address {
+                               type yang:mac-address;
+                       }
+                       leaf mask {
+                               type binary;
+                       }
+               }
+               grouping arp_tha {
+                       description "ARP target hardware address.";
+                       leaf address {
+                               type yang:mac-address;
+                       }
+                       leaf mask {
+                               type binary;
+                       }
+               }
+               grouping ipv6_src {
+                       description "IPv6 source address.";
+                       leaf prefix {
+                               type inet:ipv6-prefix;
+                       }
+               }
+               grouping ipv6_dst {
+                       description "IPv6 destination address.";
+                       leaf prefix {
+                               type inet:ipv6-prefix;
+                       }
+               }
+               grouping ipv6_flabel {
+                       description "IPv6 Flow Label";
+                       leaf label {
+                               type inet:ipv6-flow-label;
+                       }
+               }
+               grouping icmpv6_type {
+                       description "ICMPv6 type.";
+                       leaf type {
+                               type uint8;
+                       }
+               }
+               grouping icmpv6_code {
+                       description "ICMPv6 code.";
+                       leaf code {
+                               type uint8;
+                       }
+               }
+               grouping ipv6_nd_target {
+                       description "Target address for ND.";
+                       leaf address {
+                               type inet:ipv6-address;
+                       }
+               }
+               grouping ipv6_nd_sll {
+                       description "Source link-layer for ND.";
+                       leaf address {
+                               type yang:mac-address;
+                       }
+               }
+               grouping ipv6_nd_tll {
+                       description "Target link-layer for ND.";
+                       leaf address {
+                               type yang:mac-address;
+                       }
+               }
+               grouping mpls_label {
+                       description "MPLS label.";
+                       leaf label {
+                               type uint32; // TODO define type
+                       }
+               }
+               grouping mpls_tc {
+                       description "MPLS TC.";
+                       leaf tc {
+                               type uint8;
+                       }
+               }
+               grouping mpls_bos {
+                       description "MPLS BoS bit.";
+                       leaf bos {
+                               type boolean;
+                       }
+               }
+               grouping pbb_isid {
+                       description "PBB I-SID.";
+                       leaf isid {
+                               type uint32;
+                       }
+                       leaf mask {
+                               type binary;
+                       }
+               }
+               grouping tunnel_id {
+                       description "Logical Port Metadata.";
+                       leaf value {
+                               type oft:metadata; 
+                       }
+                       leaf mask {
+                               type oft:metadata;
+                       }
+               }
+               grouping ipv6_exthdr {
+                       description "IPv6 Extension Header pseudo-field";
+                       leaf pseudo-field {
+                               type bits {
+                                       bit nonext {
+                                               description "<No next header> encountered.";
+                                               position 0;
+                                       }
+                                       bit esp {
+                                               description "Encrypted Sec Payload header present.";
+                                               position 1;
+                                       }
+                                       bit auth {
+                                               description "Authentication header present.";
+                                               position 2;
+                                       }
+                                       bit dest {
+                                               description "1 or 2 dest headers present.";
+                                               position 3;
+                                       }
+                                       bit frag {
+                                               description "Fragment header present.";
+                                               position 4;
+                                       }
+                                       bit router {
+                                               description "Router header present.";
+                                               position 5;
+                                       }
+                                       bit hop {
+                                               description "Hop-by-hop header present.";
+                                               position 6;
+                                       }
+                                       bit unrep {
+                                               description "Unexpected repeats encountered.";
+                                               position 7;
+                                       }
+                                       bit unseq {
+                                               description "Unexpected sequencing encountered.";
+                                               position 8;
+                                               }                                       
+                               }
+                       }
+                       leaf mask {
+                               type binary;
+                       }
+               }
+
+       /* Basic Match Fields : 
+          - Maybe it will be better to split into several groupings
+            based on protocol types:
+               - L2 match
+               - L3 match
+                  - IPv4 match
+                  - IPv6 match
+               - L4 match
+               - ARP match
+               etc...
+           Maybe this works belongs to other module.
+       */
+
+               grouping basic-match-fields {
+                       container in_port {
+                               presence;
+                               uses in_port; 
+               
+                       }
+                       container in_phy_port {
+                               presence;
+                               uses in_phy_port; 
+                               
+                       }
+                       container metadata {
+                               presence;
+                               uses metadata; 
+                               
+                       }
+                       container eth_dst {
+                               presence;
+                               uses eth_dst; 
+                               
+                       }
+                       container eth_src {
+                               presence;
+                               uses eth_src; 
+                               
+                       }
+                       container eth_type {
+                               presence;
+                               uses eth_type; 
+                               
+                       }
+                       container vlan_vid {
+                               presence;
+                               uses vlan_vid; 
+                               
+                       }
+                       container vlan_pcp {
+                               presence;
+                               uses vlan_pcp; 
+                               
+                       }
+                       container ip_dscp {
+                               presence;
+                               uses ip_dscp; 
+                               
+                       }
+                       container ip_ecn {
+                               presence;
+                               uses ip_ecn; 
+                               
+                       }
+                       container ip_proto {
+                               presence;
+                               uses ip_proto; 
+                               
+                       }
+                       container ipv4_src {
+                               presence;
+                               uses ipv4_src; 
+                               
+                       }
+                       container ipv4_dst {
+                               presence;
+                               uses ipv4_dst; 
+                               
+                       }
+                       container tcp_src {
+                               presence;
+                               uses tcp_src; 
+                               
+                       }
+                       container tcp_dst {
+                               presence;
+                               uses tcp_dst; 
+                               
+                       }
+                       container udp_src {
+                               presence;
+                               uses udp_src; 
+                               
+                       }
+                       container udp_dst {
+                               presence;
+                               uses udp_dst; 
+                               
+                       }
+                       container sctp_src {
+                               presence;
+                               uses sctp_src; 
+                               
+                       }
+                       container sctp_dst {
+                               presence;
+                               uses sctp_dst; 
+                               
+                       }
+                       container icmpv4_type {
+                               presence;
+                               uses icmpv4_type; 
+                               
+                       }
+                       container icmpv4_code {
+                               presence;
+                               uses icmpv4_code; 
+                               
+                       }
+                       container arp_op {
+                               presence;
+                               uses arp_op; 
+                               
+                       }
+                       container arp_spa {
+                               presence;
+                               uses arp_spa; 
+                               
+                       }
+                       container arp_tpa {
+                               presence;
+                               uses arp_tpa; 
+                               
+                       }
+                       container arp_sha {
+                               presence;
+                               uses arp_sha; 
+                               
+                       }
+                       container arp_tha {
+                               presence;
+                               uses arp_tha; 
+                               
+                       }
+                       container ipv6_src {
+                               presence;
+                               uses ipv6_src; 
+                               
+                       }
+                       container ipv6_dst {
+                               presence;
+                               uses ipv6_dst; 
+                               
+                       }
+                       container ipv6_flabel {
+                               presence;
+                               uses ipv6_flabel; 
+                               
+                       }
+                       container icmpv6_type {
+                               presence;
+                               uses icmpv6_type; 
+                               
+                       }
+                       container icmpv6_code {
+                               presence;
+                               uses icmpv6_code; 
+                               
+                       }
+                       container ipv6_nd_target {
+                               presence;
+                               uses ipv6_nd_target; 
+                               
+                       }
+                       container ipv6_nd_sll {
+                               presence;
+                               uses ipv6_nd_sll; 
+                               
+                       }
+                       container ipv6_nd_tll {
+                               presence;
+                               uses ipv6_nd_tll; 
+                               
+                       }
+                       container mpls_label {
+                               presence;
+                               uses mpls_label; 
+                               
+                       }
+                       container mpls_tc {
+                               presence;
+                               uses mpls_tc; 
+                               
+                       }
+                       container mpls_bos {
+                               presence;
+                               uses mpls_bos; 
+                               
+                       }
+                       container pbb_isid {
+                               presence;
+                               uses pbb_isid; 
+                               
+                       }
+                       container tunnel_id {
+                               presence;
+                               uses tunnel_id; 
+                               
+                       }
+                       container ipv6_exthdr {
+                               presence;
+                               uses ipv6_exthdr; 
+                               
+                       }
+               }
+}
\ No newline at end of file
diff --git a/openflow-protocol-api/src/main/yang/openflow-instruction.yang b/openflow-protocol-api/src/main/yang/openflow-instruction.yang
new file mode 100644 (file)
index 0000000..cb575a8
--- /dev/null
@@ -0,0 +1,83 @@
+module openflow-instruction {
+    namespace "urn:opendaylight:openflow:common:instruction";
+    prefix "ofinstruction";
+
+    import openflow-types { prefix oft; }
+
+    revision "2013-07-31" {
+       // description "Initial model";
+    }
+    /*
+    identity goto_table {
+        //description " Setup the next table in the lookup pipeline";
+        base oft:instruction;
+    }
+    identity write_metadata {
+        //description " Setup the metadata field for use later in     pipeline";
+        base oft:instruction;
+    }
+    identity write_actions {
+        description " Write the action(s) onto the datapath action set";
+        base oft:instruction;
+    }
+    identity apply_actions {
+        description " Applies the action(s) immediately";
+        base oft:instruction;
+    }
+    identity clear_actions {
+        description " Clears all actions from the datapath action set";
+        base oft:instruction;
+    }
+    identity meter {
+        description " Apply meter (rate limiter)";
+        base oft:instruction;
+    }
+    identity experimenter {
+        description "Experimenter instruction";
+        base oft:instruction;
+    }
+    */
+    // Structures
+
+    grouping goto_table {
+        description " Setup the next table in the lookup pipeline";
+        leaf table {
+            type oft:table-id; // 
+        }
+    }
+    grouping write_metadata {
+        description " Setup the metadata field for use later in     pipeline";
+        leaf metadata {
+            type oft:metadata;
+        }
+        leaf mask {
+            type oft:metadata;
+        }
+    }
+    grouping actions {
+        leaf type {
+            type enumeration {
+                enum write {
+                    description " Write the action(s) onto the datapath action set";            
+                }
+                enum apply {
+                    description " Applies the action(s) immediately";
+                }
+                enum clear {
+                    description " Clears all actions from the datapath action set";
+                }
+            }
+        }
+        list action {
+            // TBD
+        }
+    }
+    
+    grouping meter {
+        description " Apply meter (rate limiter)";
+        leaf meter-id {
+            type oft:meter-id;
+        }
+    }
+
+}
\ No newline at end of file
diff --git a/openflow-protocol-api/src/main/yang/openflow-protocol.yang b/openflow-protocol-api/src/main/yang/openflow-protocol.yang
new file mode 100644 (file)
index 0000000..cf6c4e5
--- /dev/null
@@ -0,0 +1,453 @@
+module openflow-protocol {
+    namespace "urn:opendaylight:openflow:protocol";
+    prefix "ofproto";
+
+
+    import ietf-inet-types {prefix inet;}
+    import ietf-yang-types {prefix yang;}
+    
+    import openflow-types {prefix oft;}
+    import openflow-extensible-match { prefix oxm;}
+    import openflow-instruction { prefix ofinstruction;}
+    import openflow-action {prefix ofaction;}
+
+
+
+    revision "2013-07-31" {
+        description "Initial model";
+    }
+
+    // Generic Structures
+
+        grouping port {
+            reference "ofp_port";
+            leaf port_no { 
+                reference "ofp_port.port_no"; 
+                type uint32;
+            }
+            leaf hw_addr { 
+                reference "ofp_port.hw_addr"; 
+                type yang:mac-address;
+            }
+            leaf name { 
+                reference "ofp_port.name"; 
+                type string;
+            }
+            leaf config { 
+                reference "ofp_port.config"; 
+                type oft:port-config;
+            }
+            leaf state { 
+                reference "ofp_port.state"; 
+                type oft:port-state;
+            }
+            leaf current-features { 
+                description "Current features.";
+                reference "ofp_port.curr"; 
+                type oft:port-features; 
+            }
+            leaf advertised-features { 
+                description "Features being advertised by the port.";
+                reference "ofp_port.advertised"; 
+                type oft:port-features; 
+            }
+            leaf supported-features { 
+                description "Features supported by the port.";
+                reference "ofp_port.supported"; 
+                type oft:port-features; 
+            }
+            leaf peer-features { 
+                description "Features advertised by peer.";
+                reference "ofp_port.peer"; 
+                type oft:port-features; 
+            }
+            leaf curr_speed { 
+                description "Current port bitrate in kbps.";
+                reference "ofp_port.curr_speed"; 
+                type uint32; 
+                units "kbps";
+            }
+            leaf max_speed { 
+                description "Max port bitrate in kbps";
+                reference "ofp_port.max_speed"; 
+                type uint32;
+                units "kbps"; 
+            }
+        }
+
+    // TODO: ofp_packat_queue
+
+    // # MESSAGE Structures
+        /* Immutable messages. */
+            grouping hello {
+                reference "OFPT_HELLO message in Openflow Switch 1.3 Spec"
+                
+                /* Symmetric message */
+            }
+            grouping error {
+                reference "OFPT_ERROR message in Openflow Switch 1.3 Spec"
+                
+                /* Symmetric message */
+            }
+            grouping echo_request {
+                reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec"
+                
+                /* Symmetric message */
+            }
+            grouping echo_reply {
+                reference "OFPT_ECHO_REPLY message in Openflow Switch 1.3 Spec"
+                
+                /* Symmetric message */
+            }
+            grouping experimenter {
+                reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec"
+                
+                /* Symmetric message */
+            }
+        /* Switch configuration messages. */
+            grouping features_request {
+                reference "OFPT_FEATURES_REQUEST message in Openflow Switch 1.3 Spec"
+                
+                /* Controller/switch message */
+            }
+            grouping features_reply {
+                reference "OFPT_FEATURES_REPLY message in Openflow Switch 1.3 Spec"
+                
+                /* Controller/switch message */
+            }
+            grouping get_config_request {
+                reference "OFPT_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec"
+                
+                /* Controller/switch message */
+            }
+            grouping get_config_reply {
+                reference "OFPT_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec"
+                
+                /* Controller/switch message */
+            }
+            grouping set_config {
+                reference "OFPT_SET_CONFIG message in Openflow Switch 1.3 Spec"
+                
+                /* Controller/switch message */
+            }
+        /* Asynchronous messages. */
+            grouping packet_in {
+                reference "OFPT_PACKET_IN message in Openflow Switch 1.3 Spec"
+                
+             /* Async message */
+            }
+            grouping flow_removed {
+                reference "OFPT_FLOW_REMOVED message in Openflow Switch 1.3 Spec"
+                
+                /* Async message */
+            } 
+            grouping port_status {
+                reference "OFPT_PORT_STATUS message in Openflow Switch 1.3 Spec"
+                
+            } /* Async message */
+        /* Controller command messages. */
+            grouping packet_out {
+                reference "OFPT_PACKET_OUT message in Openflow Switch 1.3 Spec"
+                
+                /* Controller/switch message */
+            } 
+            grouping flow_mod {
+                reference "OFPT_FLOW_MOD message in Openflow Switch 1.3 Spec"
+                
+                /* Controller/switch message */
+            } 
+            grouping group_mod {
+                reference "OFPT_GROUP_MOD message in Openflow Switch 1.3 Spec"
+                
+                /* Controller/switch message */
+            } 
+            grouping port_mod {
+                reference "OFPT_PORT_MOD message in Openflow Switch 1.3 Spec"
+                
+            } /* Controller/switch message */
+            grouping table_mod {
+                reference "OFPT_TABLE_MOD message in Openflow Switch 1.3 Spec"
+                
+            } /* Controller/switch message */
+        /* Multipart messages. */
+            grouping multipart_request {
+                reference "OFPT_MULTIPART_REQUEST message in Openflow Switch 1.3 Spec"
+                
+            } /* Controller/switch message */
+            grouping multipart_reply {
+                reference "OFPT_MULTIPART_REPLY message in Openflow Switch 1.3 Spec"
+                
+            } /* Controller/switch message */
+            /* Barrier messages. */
+            grouping barrier_request {
+                reference "OFPT_BARRIER_REQUEST message in Openflow Switch 1.3 Spec"
+                
+            } /* Controller/switch message */
+            grouping barrier_reply {
+                reference "OFPT_BARRIER_REPLY message in Openflow Switch 1.3 Spec"
+                
+            } /* Controller/switch message */
+        /* Queue Configuration messages. */
+            grouping queue_get_config_request {
+                reference "OFPT_QUEUE_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec"
+                
+            } /* Controller/switch message */
+            grouping queue_get_config_reply {
+                reference "OFPT_QUEUE_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec"
+                
+            } /* Controller/switch message */
+            /* Controller role change request messages. */
+            grouping role_request {
+                reference "OFPT_ROLE_REQUEST message in Openflow Switch 1.3 Spec"
+                
+            } /* Controller/switch message */
+            grouping role_reply {
+                reference "OFPT_ROLE_REPLY message in Openflow Switch 1.3 Spec"
+                
+            } /* Controller/switch message */
+            /* Asynchronous message configuration. */
+            grouping get_async_request {
+                reference "OFPT_GET_ASYNC_REQUEST message in Openflow Switch 1.3 Spec"
+                
+            } /* Controller/switch message */
+            grouping get_async_reply {
+                reference "OFPT_GET_ASYNC_REPLY message in Openflow Switch 1.3 Spec"
+                
+            } /* Controller/switch message */
+            grouping set_async {
+                reference "OFPT_SET_ASYNC message in Openflow Switch 1.3 Spec"
+                
+            } /* Controller/switch message */
+            /* Meters and rate limiters configuration messages. */
+            grouping meter_mod {
+                reference "OFPT_METER_MOD message in Openflow Switch 1.3 Spec"
+                
+            } /* Controller/switch message */
+
+
+
+                /* Immutable messages. */
+            notification hello {
+                uses hello;
+                reference "OFPT_HELLO message in Openflow Switch 1.3 Spec"
+                
+                /* Symmetric message */
+            }
+            notification error {
+                uses error;
+                reference "OFPT_ERROR message in Openflow Switch 1.3 Spec"
+                
+                /* Symmetric message */
+            }
+            notification echo_request {
+                uses echo_request;
+                reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec"
+                
+                /* Symmetric message */
+            }
+            notification echo_reply {
+                uses echo_reply;
+                reference "OFPT_ECHO_REPLY message in Openflow Switch 1.3 Spec"
+                
+                /* Symmetric message */
+            }
+            notification experimenter {
+                uses experimenter;
+                reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec"
+                
+                /* Symmetric message */
+            }
+            /* Switch configuration messages. */
+            rpc get_features {
+                input {
+                    uses features_request;
+                    reference "OFPT_FEATURES_REQUEST message in Openflow Switch 1.3 Spec"
+                }
+                output {
+                    uses features_reply;
+                    reference "OFPT_FEATURES_REPLY message in Openflow Switch 1.3 Spec"
+                }
+            }
+
+
+            notification get_config {
+                input {
+                    uses get_config_request;
+                    reference "OFPT_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec"
+                }
+                output {
+                    uses get_config_reply;
+                    reference "OFPT_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec"
+                }
+            }
+
+            notification set_config {
+                input {
+                    uses set_config;
+                    reference "OFPT_SET_CONFIG message in Openflow Switch 1.3 Spec"
+                }
+                /* Controller/switch message */
+            }
+
+    // # Notification and RPCs
+        
+
+        /* Switch configuration messages. */
+            rpc get_features {
+                reference "OFPT_FEATURES_REQUEST message in Openflow Switch 1.3 Spec"
+                input {
+                    uses features_request;
+                }
+                /* Controller/switch message */
+                output {
+                    uses features_reply;
+                }
+            }
+            
+            rpc get_config {
+                reference "OFPT_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec"
+                input {
+                    uses get_config_request;
+                }
+                output {
+                    uses get_config_reply;
+                }
+                /* Controller/switch message */
+            }
+            
+            grouping set_config {
+                reference "OFPT_SET_CONFIG message in Openflow Switch 1.3 Spec"
+                input {
+                    uses set_config;
+                }   
+                /* Controller/switch message */
+            }
+        /* Asynchronous messages. */
+            notification packet_in {
+                uses packet_in;
+                reference "OFPT_PACKET_IN message in Openflow Switch 1.3 Spec"
+                
+             /* Async message */
+            }
+            notification flow_removed {
+                uses flow_removed;
+                reference "OFPT_FLOW_REMOVED message in Openflow Switch 1.3 Spec"
+                
+                /* Async message */
+            } 
+            notification port_status {
+                uses port_status;
+                reference "OFPT_PORT_STATUS message in Openflow Switch 1.3 Spec"
+                
+            } /* Async message */
+
+        /* Controller command messages. */
+            rpc packet_out {
+                input {
+                    uses packet_out;
+                    reference "OFPT_PACKET_OUT message in Openflow Switch 1.3 Spec"
+                }
+                /* Controller/switch message */
+            } 
+            rpc flow_mod {
+                input {
+                    uses flow_mod;
+                    reference "OFPT_FLOW_MOD message in Openflow Switch 1.3 Spec"
+                }
+                /* Controller/switch message */
+            } 
+            rpc group_mod {
+                input {
+                    uses group_mod;
+                    reference "OFPT_GROUP_MOD message in Openflow Switch 1.3 Spec"
+                }
+                /* Controller/switch message */
+            } 
+            rpc port_mod {
+                input {
+                    uses port_mod;
+                    reference "OFPT_PORT_MOD message in Openflow Switch 1.3 Spec"
+                }
+            } /* Controller/switch message */
+            
+            rpc table_mod {
+                input {
+                    uses table_mod;
+                    reference "OFPT_TABLE_MOD message in Openflow Switch 1.3 Spec"
+                }
+            } /* Controller/switch message */
+
+        /* Multipart messages. */
+            //FIXME: Arent this wire protocol specific?
+
+            notification multipart_request {
+                uses multipart_request;
+                reference "OFPT_MULTIPART_REQUEST message in Openflow Switch 1.3 Spec"
+                
+            } /* Controller/switch message */
+            notification multipart_reply {
+                uses multipart_reply;
+                reference "OFPT_MULTIPART_REPLY message in Openflow Switch 1.3 Spec"
+                
+            } /* Controller/switch message */
+            
+
+            /* Barrier messages. */
+            rpc barrier {
+                input {
+                    uses barrier_request;
+                    reference "OFPT_BARRIER_REQUEST message in Openflow Switch 1.3 Spec"
+                }
+                output {
+                    uses barrier_reply;
+                    reference "OFPT_BARRIER_REPLY message in Openflow Switch 1.3 Spec"
+                }
+            }
+        /* Queue Configuration messages. */
+            rpc get_queue_config {
+                input {
+                    uses queue_get_config_request;
+                    reference "OFPT_QUEUE_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec"
+                }
+                output {
+                    uses queue_get_config_reply;
+                    reference "OFPT_QUEUE_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec"
+                }
+            } 
+
+        /* Controller role change request messages. */
+            rpc role_request {
+                input {
+                    uses role_request;
+                    reference "OFPT_ROLE_REQUEST message in Openflow Switch 1.3 Spec"
+                }
+                output {
+                    uses role_reply;
+                    reference "OFPT_ROLE_REPLY message in Openflow Switch 1.3 Spec"
+                }
+            } /* Controller/switch message */
+            
+        /* Asynchronous message configuration. */
+            notification get_async_request {
+                uses get_async_request;
+                reference "OFPT_GET_ASYNC_REQUEST message in Openflow Switch 1.3 Spec"
+                
+            } /* Controller/switch message */
+            notification get_async_reply {
+                uses get_async_reply;
+                reference "OFPT_GET_ASYNC_REPLY message in Openflow Switch 1.3 Spec"
+                
+            } /* Controller/switch message */
+            notification set_async {
+                uses set_async;
+                reference "OFPT_SET_ASYNC message in Openflow Switch 1.3 Spec"
+                
+            } /* Controller/switch message */
+        /* Meters and rate limiters configuration messages. */
+            rpc meter_mod {
+                input {
+                    uses meter_mod;
+                    reference "OFPT_METER_MOD message in Openflow Switch 1.3 Spec"
+                }
+            } /* Controller/switch message */
+}
\ No newline at end of file
index 3791f565ef49ca4f9827705b4b5da90b110895ae..740496dd525719738f7d31ae9e68112de68f8412 100644 (file)
@@ -14,7 +14,7 @@ module openflow-types {
 
     typedef special-port-number {
         type enumeration {
-            enum in_port { 
+            enum in-port { 
                 //value "4294967288";
                 //description "Send the packet out the input port. This virtual port must be explicitly used in order to send back out of the input port."
             }
@@ -65,39 +65,39 @@ module openflow-types {
                 position 0;
                 //description "10 Mb half-duplex rate support.";
             }
-            bit 10mb_fd { 
+            bit 10mb-fd { 
                 position 1;
                 //description "10 Mb full-duplex rate support.";
             }
-            bit 100mb_hd { 
+            bit 100mb-hd { 
                 position 2;
                 //description "100 Mb half-duplex rate support.";
             }
-            bit 100mb_fd { 
+            bit 100mb-fd { 
                 position 3;
                 //description "100 Mb full-duplex rate support.";
             }
-            bit 1gb_hd { 
+            bit 1gb-hd { 
                 position 4;
                 //description "1 Gb half-duplex rate support.";
             }
-            bit 1gb_fd { 
+            bit 1gb-fd { 
                 position 5;
                 //description "1 Gb full-duplex rate support.";
             }
-            bit 10gb_fd { 
+            bit 10gb-fd { 
                 position 6;
                 //description "10 Gb full-duplex rate support.";
             }
-            bit 40gb_fd { 
+            bit 40gb-fd { 
                 position 7;
                 //description "40 Gb full-duplex rate support.";
             }
-            bit 100gb_fd { 
+            bit 100gb-fd { 
                 position 8;
                 //description "100 Gb full-duplex rate support.";
             }
-            bit 1tb_fd { 
+            bit 1tb-fd { 
                 position 9;
                 //description "1 Tb full-duplex rate support.";
             }
@@ -121,39 +121,39 @@ module openflow-types {
                 position 14;
                 //description "Pause.";
             }
-            bit pause_asym { 
+            bit pause-asym { 
                 position 15;
                 //description "Asymmetric pause.";
             }
         }
     }
 
-    typedef port_config {
+    typedef port-config {
         description 
            "Flags to indicate behavior of the physical port. These flags are
             describe the current configuration and used port_mod message 
             to configure the port's behavior.";
         type bits {
-            bit port_down { 
+            bit port-down { 
                 //description " Port is administratively down.";
                 position 0;
             }
-            bit no_recv { 
+            bit no-recv { 
                 //description " Drop all packets received by port.";
                 position 2;
             }
-            bit no_fwd { 
+            bit no-fwd { 
                 //description " Drop packets forwarded to port.";
                 position 5;
             }
-            bit no_packet_in { 
+            bit no-packet-in { 
                 //description "Do not send packet-in msgs for port.";
                 position 6;
             }
         }
     }
 
-    typedef ofp_port_state {
+    typedef port-state {
         description 
             "Current state of the physical port. These are not configurable from
             the controller.";
@@ -204,6 +204,21 @@ module openflow-types {
     typedef metadata {
         type binary;
     }
-
-
+    
+    typedef table-id {
+        type uint32;
+    }
+    typedef meter-id {
+        type uint32;
+    }
+    typedef queue-id {
+        type uint32;
+    }
+    typedef group-id {
+        type uint32;
+    }
+    
+    typedef ether-type {
+        type uint16;
+    }
 }
\ No newline at end of file