Skip to content

Instantly share code, notes, and snippets.

@tfukushima
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tfukushima/046ebc87fc942e2e2b66 to your computer and use it in GitHub Desktop.
Save tfukushima/046ebc87fc942e2e2b66 to your computer and use it in GitHub Desktop.
topology.proto migration to Protocol Buffers 3.0
diff --git a/cluster/src/main/proto/commons.proto b/cluster/src/main/proto/commons.proto
index fbd223e..74bb227 100644
--- a/cluster/src/main/proto/commons.proto
+++ b/cluster/src/main/proto/commons.proto
@@ -14,27 +14,29 @@
// limitations under the License.
//
+syntax = "proto3";
+
package org.midonet.cluster.models;
option java_package = "org.midonet.cluster.models";
option java_outer_classname = "Commons";
enum IPVersion {
- V4 = 1;
- V6 = 2;
+ V4 = 0;
+ V6 = 1;
}
message UUID {
- required uint64 msb = 1;
- required uint64 lsb = 2;
+ uint64 msb = 1;
+ uint64 lsb = 2;
}
message IPAddress {
- required IPVersion version = 1;
- required string address = 2;
+ IPVersion version = 1;
+ string address = 2;
}
message IPSubnet {
- required IPVersion version = 1;
+ IPVersion version = 1;
optional string address = 2;
optional uint32 prefix_length = 3;
}
@@ -50,14 +52,14 @@ enum RuleDirection {
}
enum EtherType {
- ARP = 2054; // 0x0806
- IPV4 = 2048; // 0x0800
- IPV6 = 34525; // 0x86dd
+ ARP = 0; // 0x0806
+ IPV4 = 1; // 0x0800
+ IPV6 = 2; // 0x86dd
}
enum Protocol {
- TCP = 6; // 0x6
- UDP = 17; // 0x11
- ICMP = 1; // 0x1
- ICMPV6 = 58; // 0x3a
+ TCP = 0; // 0x6
+ UDP = 1; // 0x11
+ ICMP = 2; // 0x1
+ ICMPV6 = 3; // 0x3a
}
diff --git a/cluster/src/main/proto/topology.proto b/cluster/src/main/proto/topology.proto
index 6192a00..8ebf564 100644
--- a/cluster/src/main/proto/topology.proto
+++ b/cluster/src/main/proto/topology.proto
@@ -14,6 +14,8 @@
// limitations under the License.
//
+syntax = "proto3";
+
import "commons.proto";
package org.midonet.cluster.models;
@@ -22,19 +24,19 @@ option java_outer_classname = "Topology";
// One per type
enum Type {
- CHAIN = 1;
- HOST = 2;
- IP_ADDR_GROUP = 3;
- NETWORK = 4;
- PORT = 5;
- PORT_GROUP = 6;
- ROUTE = 7;
- ROUTER = 8;
- RULE = 9;
- TUNNEL_ZONE = 10;
- VTEP = 11;
- VTEP_BINDING = 12;
- DHCP=13;
+ CHAIN = 0;
+ HOST = 1;
+ IP_ADDR_GROUP = 2;
+ NETWORK = 3;
+ PORT = 4;
+ PORT_GROUP = 5;
+ ROUTE = 6;
+ ROUTER = 7;
+ RULE = 8;
+ TUNNEL_ZONE = 9;
+ VTEP = 10;
+ VTEP_BINDING = 11;
+ DHCP=12;
}
message Network {
@@ -108,7 +110,7 @@ message Port {
optional UUID vif_id = 8;
optional UUID host_id = 9;
optional string interface_name = 10;
- optional bool admin_state_up = 11 [default = true];
+ optional bool admin_state_up = 11;
repeated UUID port_group_ids = 12;
@@ -188,21 +190,21 @@ message Rule {
optional UUID id = 1;
enum Type {
- LITERAL_RULE = 1;
- NAT_RULE = 2;
- JUMP_RULE = 3;
- TRACE_RULE = 4;
+ LITERAL_RULE = 0;
+ NAT_RULE = 1;
+ JUMP_RULE = 2;
+ TRACE_RULE = 3;
}
optional Type type = 2;
optional UUID chain_id = 3;
enum Action {
- ACCEPT = 1;
- CONTINUE = 2;
- DROP = 3;
- JUMP = 4;
- REJECT = 5;
- RETURN = 6;
+ ACCEPT = 0;
+ CONTINUE = 1;
+ DROP = 2;
+ JUMP = 3;
+ REJECT = 4;
+ RETURN = 5;
}
optional Action action = 4;
@@ -223,10 +225,10 @@ message Rule {
optional int32 dl_type = 18;
optional bool inv_dl_type = 19;
optional string dl_src = 20;
- optional int64 dl_src_mask = 21 [default = -1]; // Top 16 bits ignored.
+ optional int64 dl_src_mask = 21; // Top 16 bits ignored.
optional bool inv_dl_src = 22;
optional string dl_dst = 23;
- optional int64 dl_dst_mask = 24 [default = -1]; // Top 16 bits ignored.
+ optional int64 dl_dst_mask = 24; // Top 16 bits ignored.
optional bool inv_dl_dst = 25;
optional int32 nw_tos = 26;
optional bool nw_tos_inv = 27;
@@ -244,10 +246,10 @@ message Rule {
optional bool traversed_device_inv = 39;
enum FragmentPolicy {
- ANY = 1;
- NONHEADER = 2;
- HEADER = 3;
- UNFRAGMENTED = 4;
+ ANY = 0;
+ NONHEADER = 1;
+ HEADER = 2;
+ UNFRAGMENTED = 3;
}
optional FragmentPolicy fragment_policy = 40;
// end of condition fields
@@ -282,9 +284,9 @@ message TunnelZone {
optional UUID id = 1;
optional string name = 2;
enum Type {
- GRE = 1;
- VXLAN = 2;
- VTEP = 3;
+ GRE = 0;
+ VXLAN = 1;
+ VTEP = 2;
}
optional Type type = 3;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment