[ONOS-7035] Packet Protobuf model

Change-Id: I188fe329335e26095cc0b4fde5c6cded6fb87de4
diff --git a/incubator/protobuf/models/src/main/proto/net/flow/TrafficSelectorProto.proto b/incubator/protobuf/models/src/main/proto/net/flow/TrafficSelectorProto.proto
new file mode 100644
index 0000000..831f149
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/net/flow/TrafficSelectorProto.proto
@@ -0,0 +1,11 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.flow.models";
+
+package net.flow;
+
+import "net/flow/criteria/CriterionProto.proto";
+
+// Corresponds to org.onosproject.net.flow.TrafficSelector.
+message TrafficSelectorProto {
+    repeated net.flow.criteria.CriterionProto criterion = 1;
+}
\ No newline at end of file
diff --git a/incubator/protobuf/models/src/main/proto/net/flow/TrafficTreatmentProto.proto b/incubator/protobuf/models/src/main/proto/net/flow/TrafficTreatmentProto.proto
new file mode 100644
index 0000000..b2d6236
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/net/flow/TrafficTreatmentProto.proto
@@ -0,0 +1,18 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.flow.models";
+
+package net.flow;
+
+import "net/flow/instructions/InstructionsProto.proto";
+import "net/flow/instructions/InstructionProto.proto";
+
+// Corresponds to org.onosproject.net.flow.TrafficTreatment.
+message TrafficTreatmentProto {
+    repeated net.flow.instructions.InstructionProto deferred = 1;
+    repeated net.flow.instructions.InstructionProto immediate = 2;
+    repeated net.flow.instructions.InstructionProto all_instructions = 3;
+    net.flow.instructions.TableTypeTransitionProto table_transition = 4;
+    bool cleared_deferred = 5;
+    net.flow.instructions.MetadataInstructionProto write_metadata = 6;
+    net.flow.instructions.MetadataInstructionProto metered = 7;
+}
\ No newline at end of file
diff --git a/incubator/protobuf/models/src/main/proto/net/flow/criteria/CriterionProto.proto b/incubator/protobuf/models/src/main/proto/net/flow/criteria/CriterionProto.proto
new file mode 100644
index 0000000..cfbf896
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/net/flow/criteria/CriterionProto.proto
@@ -0,0 +1,73 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.flow.criteria.models";
+
+package net.flow.criteria;
+
+enum TypeProto {
+    IN_PORT = 0;
+    ETH_DST = 1;
+    ETH_SRC = 2;
+    ETH_TYPE = 3;
+    IPV4_SRC = 4;
+    IPV4_DST = 5;
+    UDP_SRC = 6;
+    UDP_DST = 7;
+    TCP_SRC = 8;
+    TCP_DST = 9;
+    VLAN_VID = 10;
+    ARP_OP = 11;
+    ARP_SPA = 12;
+    ARP_TPA = 13;
+    ARP_SHA = 14;
+    ARP_THA = 15;
+    IP_PROTO = 16;
+    ETH_DST_MASKED = 17;
+    ETH_SRC_MASKED = 18;
+    VLAN_PCP = 19;
+    INNER_VLAN_VID = 20;
+    INNER_VLAN_PCP = 21;
+    IP_DSCP = 22;
+    IP_ECN = 23;
+    IN_PHY_PORT = 24;
+    METADATA = 25;
+    TCP_SRC_MASKED = 26;
+    TCP_DST_MASKED = 27;
+    UDP_SRC_MASKED = 28;
+    UDP_DST_MASKED = 29;
+    SCTP_SRC = 30;
+    SCTP_SRC_MASKED = 31;
+    SCTP_DST = 32;
+    SCTP_DST_MASKED = 33;
+    ICMPV4_TYPE = 34;
+    ICMPV4_CODE = 35;
+    IPV6_SRC = 36;
+    IPV6_DST = 37;
+    IPV6_FLABEL = 38;
+    ICMPV6_TYPE = 39;
+    ICMPV6_CODE = 40;
+    IPV6_ND_TARGET = 41;
+    IPV6_ND_SLL = 42;
+    IPV6_ND_TLL = 43;
+    MPLS_LABEL = 44;
+    MPLS_TC = 45;
+    MPLS_BOS = 46;
+    PBB_ISID = 47;
+    TUNNEL_ID = 48;
+    IPV6_EXTHDR =49;
+    UNASSIGNED_40 = 50;
+    PBB_UCA = 51;
+    TCP_FLAGS = 52;
+    ACTSET_OUTPUT = 53;
+    PACKET_TYPE = 54;
+    OCH_SIGID = 55;
+    OCH_SIGTYPE = 56;
+    ODU_SIGID = 57;
+    ODU_SIGTYPE = 58;
+    PROTOCOL_INDEPENDENT = 59;
+    EXTENSION = 60;
+    DUMMY = 61;
+}
+
+message CriterionProto {
+    TypeProto type = 1;
+}
\ No newline at end of file
diff --git a/incubator/protobuf/models/src/main/proto/net/flow/instructions/InstructionProto.proto b/incubator/protobuf/models/src/main/proto/net/flow/instructions/InstructionProto.proto
new file mode 100644
index 0000000..095bd53
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/net/flow/instructions/InstructionProto.proto
@@ -0,0 +1,25 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.flow.instructions.models";
+
+package net.flow.instructions;
+
+enum TypeProto {
+    NOACTION = 0;
+    OUTPUT = 1;
+    GROUP = 2;
+    QUEUE = 3;
+    METER = 4;
+    L0MODIFICATION = 5;
+    L1MODIFICATION = 6;
+    L2MODIFICATION = 7;
+    L3MODIFICATION = 8;
+    L4MODIFICATION = 9;
+    TABLE = 10;
+    METADATA = 11;
+    PROTOCOL_INDEPENDENT = 12;
+    EXTENSION = 13;
+}
+
+message InstructionProto {
+    TypeProto type = 1;
+}
\ No newline at end of file
diff --git a/incubator/protobuf/models/src/main/proto/net/flow/instructions/InstructionsProto.proto b/incubator/protobuf/models/src/main/proto/net/flow/instructions/InstructionsProto.proto
new file mode 100644
index 0000000..93c4089
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/net/flow/instructions/InstructionsProto.proto
@@ -0,0 +1,13 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.flow.instructions.models";
+
+package net.flow.instructions;
+
+message TableTypeTransitionProto {
+    int32 table_id = 1;
+}
+
+message MetadataInstructionProto {
+    int64 meta_data = 1;
+    int64 meta_data_mask = 2;
+}
\ No newline at end of file
diff --git a/incubator/protobuf/models/src/main/proto/net/packet/OutboundPacketProto.proto b/incubator/protobuf/models/src/main/proto/net/packet/OutboundPacketProto.proto
new file mode 100644
index 0000000..00e0bb9
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/net/packet/OutboundPacketProto.proto
@@ -0,0 +1,13 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.packet.models";
+
+package net.packet;
+
+import "net/flow/TrafficTreatmentProto.proto";
+
+// Corresponds to org.onosproject.net.packet.OutboundPacket.
+message OutboundPacketProto {
+    string device_id = 1;
+    net.flow.TrafficTreatmentProto treatment = 2;
+    bytes data = 3;
+}
\ No newline at end of file
diff --git a/incubator/protobuf/models/src/main/proto/net/packet/PacketEnumsProto.proto b/incubator/protobuf/models/src/main/proto/net/packet/PacketEnumsProto.proto
new file mode 100644
index 0000000..ce8352f
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/net/packet/PacketEnumsProto.proto
@@ -0,0 +1,8 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.packet.models";
+
+package net.packet;
+
+enum PacketEventTypeProto {
+    EMIT = 0;
+}
\ No newline at end of file
diff --git a/incubator/protobuf/models/src/main/proto/net/packet/PacketEventProto.proto b/incubator/protobuf/models/src/main/proto/net/packet/PacketEventProto.proto
new file mode 100644
index 0000000..f482780
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/net/packet/PacketEventProto.proto
@@ -0,0 +1,13 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.packet.models";
+
+package net.packet;
+
+import "net/packet/OutboundPacketProto.proto";
+import "net/packet/PacketEnumsProto.proto";
+
+// Corresponds to org.onosproject.net.packet.PacketEvent.
+message PacketNotificationProto {
+    net.packet.OutboundPacketProto outbound_packet = 1;
+    net.packet.PacketEventTypeProto packet_event_type = 2;
+}
\ No newline at end of file
diff --git a/incubator/protobuf/models/src/main/proto/net/packet/PacketProcessorEntryProto.proto b/incubator/protobuf/models/src/main/proto/net/packet/PacketProcessorEntryProto.proto
new file mode 100644
index 0000000..918e750
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/net/packet/PacketProcessorEntryProto.proto
@@ -0,0 +1,15 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.packet.models";
+
+package net.packet;
+
+import "net/packet/PacketProcessorProto.proto";
+
+// Corresponds to org.onosproject.net.packet.PacketProcessorEntry.
+message PacketProcessorEntryProto {
+    net.packet.PacketProcessorProto packet_processor = 1;
+    int32 priority = 2;
+    int64 invocations = 3;
+    int64 total_nanos = 4;
+    int64 average_nanos = 5;
+}
\ No newline at end of file
diff --git a/incubator/protobuf/models/src/main/proto/net/packet/PacketProcessorProto.proto b/incubator/protobuf/models/src/main/proto/net/packet/PacketProcessorProto.proto
new file mode 100644
index 0000000..8cb4499
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/net/packet/PacketProcessorProto.proto
@@ -0,0 +1,9 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.packet.models";
+
+package net.packet;
+
+// Corresponds to org.onosproject.net.packet.PacketProcessor.
+message PacketProcessorProto {
+    int32 priority = 1;
+}
\ No newline at end of file
diff --git a/incubator/protobuf/models/src/main/proto/net/packet/PacketRequestProto.proto b/incubator/protobuf/models/src/main/proto/net/packet/PacketRequestProto.proto
new file mode 100644
index 0000000..9a0e491
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/net/packet/PacketRequestProto.proto
@@ -0,0 +1,17 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.packet.models";
+
+package net.packet;
+
+import "net/flow/TrafficSelectorProto.proto";
+import "cluster/NodeIdProto.proto";
+import "core/ApplicationIdProto.proto";
+
+// Corresponds to org.onosproject.net.packet.PacketRequest.
+message PacketRequestProto {
+    net.flow.TrafficSelectorProto traffic_selector = 1;
+    int32 priority = 2;
+    core.ApplicationIdProto application_id = 3;
+    cluster.NodeIdProto node_id = 4;
+    string device_id = 5;
+}
\ No newline at end of file
diff --git a/incubator/protobuf/services/nb/src/main/proto/net/packet/PacketServiceNb.proto b/incubator/protobuf/services/nb/src/main/proto/net/packet/PacketServiceNb.proto
new file mode 100644
index 0000000..26d6c90
--- /dev/null
+++ b/incubator/protobuf/services/nb/src/main/proto/net/packet/PacketServiceNb.proto
@@ -0,0 +1,76 @@
+syntax="proto3";
+option java_package = "org.onosproject.grpc.nb.net.packet";
+
+package nb.net.packet;
+
+import "net/packet/PacketRequestProto.proto";
+import "net/packet/PacketProcessorProto.proto";
+import "net/packet/PacketProcessorEntryProto.proto";
+import "net/packet/OutboundPacketProto.proto";
+import "core/ApplicationIdProto.proto";
+import "net/flow/TrafficSelectorProto.proto";
+import "net/flow/TrafficTreatmentProto.proto";
+
+message addProcessorRequest {
+    .net.packet.PacketProcessorProto packet_processor = 1;
+    int32 priority = 2;
+}
+
+message addProcessorReply {
+}
+
+message removeProcessorRequest {
+    .net.packet.PacketProcessorProto packet_processor = 1;
+}
+
+message removeProcessorReply {
+}
+
+message getProcessorsRequest {
+}
+
+message getProcessorsReply {
+    repeated .net.packet.PacketProcessorEntryProto packetProcessor_entry = 1;
+}
+
+message requestPacketsRequest {
+    .net.flow.TrafficSelectorProto traffic_selector = 1;
+    int32 priority = 2;
+    .core.ApplicationIdProto application_id = 3;
+}
+
+message requestPacketsReply {
+}
+
+message cancelPacketsRequest {
+    .net.flow.TrafficSelectorProto traffic_selector = 1;
+    int32 priority = 2;
+    .core.ApplicationIdProto application_id = 3;
+}
+
+message cancelPacketsReply {
+}
+
+message getRequestsRequest {
+}
+
+message getRequestsReply {
+    repeated .net.packet.PacketRequestProto packet_request = 1;
+}
+
+message emitRequest {
+    .net.packet.OutboundPacketProto outbound_packet = 1;
+}
+
+message emitReply {
+}
+
+service DeviceService {
+    rpc addProcessor(addProcessorRequest) returns (addProcessorReply) {}
+    rpc removeProcessor(removeProcessorRequest) returns (removeProcessorReply) {}
+    rpc getProcessors(getProcessorsRequest) returns (getProcessorsReply) {}
+    rpc requestPackets(requestPacketsRequest) returns (requestPacketsReply) {}
+    rpc cancelPackets(cancelPacketsRequest) returns (cancelPacketsReply) {}
+    rpc getRequests(getRequestsRequest) returns (getRequestsReply) {}
+    rpc emit(emitRequest) returns (emitReply) {}
+}
\ No newline at end of file