blob: 4f064622ac87893f35e8f70af48704bcff5a0218 [file] [log] [blame]
Dan Talaycoc0e802e2013-05-18 23:52:39 -07001// Copyright 2013, Big Switch Networks, Inc.
2//
Dan Talaycof76f7112013-05-19 23:32:12 -07003// LoxiGen is licensed under the Eclipse Public License,
Dan Talaycoba506722013-05-21 14:33:33 -07004// version 1.0 (EPL), with the following special exception:
Dan Talaycoc0e802e2013-05-18 23:52:39 -07005//
6// LOXI Exception
7//
Dan Talaycof76f7112013-05-19 23:32:12 -07008// As a special exception to the terms of the EPL, you may
9// distribute libraries generated by LoxiGen (LoxiGen Libraries)
10// under the terms of your choice, provided that copyright and
11// licensing notices generated by LoxiGen are not altered or removed
12// from the LoxiGen Libraries and the notice provided below is (i)
13// included in the LoxiGen Libraries, if distributed in source code
14// form and (ii) included in any documentation for the LoxiGen
15// Libraries, if distributed in binary form.
Dan Talaycoc0e802e2013-05-18 23:52:39 -070016//
Dan Talaycof76f7112013-05-19 23:32:12 -070017// Notice: "Copyright 2013, Big Switch Networks, Inc.
18// This library was generated by the LoxiGen Compiler."
Dan Talaycoc0e802e2013-05-18 23:52:39 -070019//
Dan Talaycof76f7112013-05-19 23:32:12 -070020// You may not use this file except in compliance with the EPL or
21// LOXI Exception. You may obtain a copy of the EPL at:
Dan Talaycoc0e802e2013-05-18 23:52:39 -070022//
23// http://www.eclipse.org/legal/epl-v10.html
24//
Dan Talaycof76f7112013-05-19 23:32:12 -070025// Unless required by applicable law or agreed to in writing,
26// software distributed under the License is distributed on an "AS
27// IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
28// express or implied. See the EPL for the specific language
29// governing permissions and limitations under the EPL.
Dan Talaycoc0e802e2013-05-18 23:52:39 -070030
31#version any
32
Kiran Poola8ecd3f12013-07-09 17:58:12 -070033enum ofp_bsn_vport_status {
Kiran Poola747339a2013-07-09 17:45:22 -070034 OF_BSN_VPORT_STATUS_OK = 0,
35 OF_BSN_VPORT_STATUS_FAILED = 1,
36};
37
Dan Talayco78654ff2013-05-24 11:41:55 -070038// When the ingress or egress VID has this value, no outer tag should be used.
39// In this case, the corresponding TPID is ignored.
40
Andreas Wundsam4ee51462013-07-30 11:00:37 -070041enum ofp_bsn_vport_q_in_q_untagged(wire_type=uint16_t, complete=False) {
Dan Talayco78654ff2013-05-24 11:41:55 -070042 OF_BSN_VPORT_Q_IN_Q_UNTAGGED = 0xffff,
43};
44
Wilson Ng8c9d9572014-04-15 16:27:53 -070045enum ofp_bsn_vport_l2gre_flags(wire_type=uint32_t, bitmask=True) {
46 OF_BSN_VPORT_L2GRE_LOCAL_MAC_IS_VALID = 0x1,
Wilson Ngd6181882014-04-14 16:28:35 -070047
Wilson Ng8c9d9572014-04-15 16:27:53 -070048 /* DSCP flags are mutually exclusive */
49 OF_BSN_VPORT_L2GRE_DSCP_ASSIGN = 0x2,
50 OF_BSN_VPORT_L2GRE_DSCP_COPY = 0x4,
Wilson Ng8afae4c2014-06-16 14:37:35 -070051
52 OF_BSN_VPORT_L2GRE_LOOPBACK_IS_VALID = 0x8,
Wilson Ngd6181882014-04-14 16:28:35 -070053};
54
Dan Talaycoc0e802e2013-05-18 23:52:39 -070055// BSN Virtual port object header
56// FIXME For now, inheritance is not exercised. See below.
Rich Laned0714672013-05-29 14:22:35 -070057struct of_bsn_vport {
Andreas Wundsam70411bf2013-08-02 22:26:38 -070058 uint16_t type == ?; /* Discriminate virtual port type */
Dan Talaycoc0e802e2013-05-18 23:52:39 -070059 uint16_t length; /* Length in bytes of this structure with this header */
60 /* Remainder of data is specific to the port type */
61};
62
63
Dan Talaycoc0e802e2013-05-18 23:52:39 -070064// Q-in-Q virtual port specification
65
Rich Lanee9c37db2013-06-21 18:30:24 -070066struct of_bsn_vport_q_in_q : of_bsn_vport {
Rich Laned0714672013-05-29 14:22:35 -070067 uint16_t type == 0;
Wilson Ngd6181882014-04-14 16:28:35 -070068 uint16_t length;
Dan Talaycoc0e802e2013-05-18 23:52:39 -070069 uint32_t port_no; /* OF port number of parent; usually phys port */
70 uint16_t ingress_tpid;
71 uint16_t ingress_vlan_id;
72 uint16_t egress_tpid;
73 uint16_t egress_vlan_id;
Kiran Poola4d83d652013-09-20 13:28:31 -070074 of_port_name_t if_name; /* Name to use in create operation */
Dan Talaycoc0e802e2013-05-18 23:52:39 -070075};
76
Wilson Ngd6181882014-04-14 16:28:35 -070077
78// L2GRE tunnel virtual port specification
79
80struct of_bsn_vport_l2gre : of_bsn_vport {
81 uint16_t type == 1;
82 uint16_t length;
Wilson Ng8c9d9572014-04-15 16:27:53 -070083 enum ofp_bsn_vport_l2gre_flags flags;
Wilson Ng28fc85b2014-06-10 18:18:39 -070084 of_port_no_t port_no; /* OF port number of parent */
85 of_port_no_t loopback_port_no; /* OF port number of loopback */
86 of_mac_addr_t local_mac; /* Local MAC */
87 of_mac_addr_t nh_mac; /* Next Hop MAC */
88 of_ipv4_t src_ip; /* Source IP */
89 of_ipv4_t dst_ip; /* Destination IP */
Wilson Ngd6181882014-04-14 16:28:35 -070090 uint8_t dscp;
91 uint8_t ttl;
Wilson Ng8c9d9572014-04-15 16:27:53 -070092 pad(2);
Wilson Ng28fc85b2014-06-10 18:18:39 -070093 uint32_t vpn; /* VPN ID (for GRE Key) */
94 of_port_name_t if_name; /* Virtual Interface Name */
Wilson Ngd6181882014-04-14 16:28:35 -070095};
96
97
Dan Talaycoc0e802e2013-05-18 23:52:39 -070098// Request from controller to switch to create vport
Rich Lanee9c37db2013-06-21 18:30:24 -070099struct of_bsn_virtual_port_create_request : of_bsn_header {
Dan Talaycoc0e802e2013-05-18 23:52:39 -0700100 uint8_t version;
Rich Laned0714672013-05-29 14:22:35 -0700101 uint8_t type == 4;
Dan Talaycoc0e802e2013-05-18 23:52:39 -0700102 uint16_t length;
103 uint32_t xid;
Rich Laned0714672013-05-29 14:22:35 -0700104 uint32_t experimenter == 0x5c16c7;
105 uint32_t subtype == 15;
Wilson Nga5706e62014-04-09 04:11:20 -0700106 of_bsn_vport_t vport; // Description of vport to create
Dan Talaycoc0e802e2013-05-18 23:52:39 -0700107 // Additional data follows depending on header type
108};
109
110// Reply from switch to controller indicating port number created
111// vport_no must be 16 bits to be compatible with 1.0
Rich Lanee9c37db2013-06-21 18:30:24 -0700112struct of_bsn_virtual_port_create_reply : of_bsn_header {
Dan Talaycoc0e802e2013-05-18 23:52:39 -0700113 uint8_t version;
Rich Laned0714672013-05-29 14:22:35 -0700114 uint8_t type == 4;
Dan Talaycoc0e802e2013-05-18 23:52:39 -0700115 uint16_t length;
116 uint32_t xid; // Must match create_request
Rich Laned0714672013-05-29 14:22:35 -0700117 uint32_t experimenter == 0x5c16c7;
118 uint32_t subtype == 16;
Dan Talaycob392f6b2013-06-12 10:48:17 -0700119 uint32_t status; // 0 means success
Dan Talaycoc0e802e2013-05-18 23:52:39 -0700120 uint32_t vport_no; // The OF port number created. 16-bits for OF 1.0
121};
122
123// Request from controller to switch to remove a vport
Rich Lanee9c37db2013-06-21 18:30:24 -0700124struct of_bsn_virtual_port_remove_request : of_bsn_header {
Dan Talaycoc0e802e2013-05-18 23:52:39 -0700125 uint8_t version;
Rich Laned0714672013-05-29 14:22:35 -0700126 uint8_t type == 4;
Dan Talaycoc0e802e2013-05-18 23:52:39 -0700127 uint16_t length;
128 uint32_t xid;
Rich Laned0714672013-05-29 14:22:35 -0700129 uint32_t experimenter == 0x5c16c7;
130 uint32_t subtype == 17;
Dan Talaycoc0e802e2013-05-18 23:52:39 -0700131 uint32_t vport_no; // The OF port number to be removed
132};
Dan Talaycob392f6b2013-06-12 10:48:17 -0700133
134// Request from controller to switch to remove a vport
Rich Lanee9c37db2013-06-21 18:30:24 -0700135struct of_bsn_virtual_port_remove_reply : of_bsn_header {
Dan Talaycob392f6b2013-06-12 10:48:17 -0700136 uint8_t version;
137 uint8_t type == 4;
138 uint16_t length;
139 uint32_t xid; // Must match request xid
140 uint32_t experimenter == 0x5c16c7;
141 uint32_t subtype == 26;
142 uint32_t status; // 0 means success
143};