Detangling incubator: virtual nets, tunnels, resource labels, oh my
- virtual networking moved to /apps/virtual; with CLI & REST API
- tunnels and labels moved to /apps/tunnel; with CLI & REST API; UI disabled for now
- protobuf/models moved to /core/protobuf/models
- defunct grpc/rpc registry stuff left under /graveyard
- compile dependencies on /incubator moved to respective modules for compilation
- run-time dependencies will need to be re-tested for dependent apps
- /graveyard will be removed in not-too-distant future
Change-Id: I0a0b995c635487edcf95a352f50dd162186b0b39
diff --git a/core/protobuf/models/BUILD b/core/protobuf/models/BUILD
new file mode 100644
index 0000000..f04af82
--- /dev/null
+++ b/core/protobuf/models/BUILD
@@ -0,0 +1,7 @@
+COMPILE_DEPS = CORE_DEPS + [
+ "//core/protobuf/models/proto:onos-core-protobuf-models-proto",
+]
+
+osgi_jar_with_tests(
+ deps = COMPILE_DEPS,
+)
diff --git a/core/protobuf/models/proto/BUILD b/core/protobuf/models/proto/BUILD
new file mode 100644
index 0000000..7b426c5
--- /dev/null
+++ b/core/protobuf/models/proto/BUILD
@@ -0,0 +1,496 @@
+load("//tools/build/bazel:osgi_java_library.bzl", "osgi_proto_jar")
+
+PROTO_SOURCE_ROOT = "core/protobuf/models/proto"
+
+osgi_proto_jar(
+ name = "onos-core-protobuf-models-proto",
+ proto_libs = [
+ ":ApplicationsEnums_proto",
+ ":ConfigPropertyEnums_proto",
+ ":ConfigProperty_proto",
+ ":NodeId_proto",
+ ":RoleInfo_proto",
+ ":ApplicationId_proto",
+ ":ApplicationProto_proto",
+ ":Version_proto",
+ ":DeviceDescription_proto",
+ ":DeviceEnums_proto",
+ ":DeviceEvent_proto",
+ ":PortDescription_proto",
+ ":PortEnums_proto",
+ ":PortStatistics_proto",
+ ":Criterion_proto",
+ ":Instruction_proto",
+ ":Instructions_proto",
+ ":FlowEntryEnums_proto",
+ ":FlowEntry_proto",
+ ":FlowRuleEnums_proto",
+ ":FlowRule_proto",
+ ":TraficSelector_proto",
+ ":TrafficTreatment_proto",
+ ":HostDescription_proto",
+ ":HostEnums_proto",
+ ":HostEvent_proto",
+ ":LinkDescription_proto",
+ ":LinkEnums_proto",
+ ":LinkEvent_proto",
+ ":BandEnums_proto",
+ ":Band_proto",
+ ":MeterEnums_proto",
+ ":MeterEvent_proto",
+ ":Meter_proto",
+ ":MeterRequest_proto",
+ ":OutboundPacket_proto",
+ ":PacketEnums_proto",
+ ":PacketEvent_proto",
+ ":PacketProcessorEntry_proto",
+ ":PacketProcessor_proto",
+ ":PacketRequest_proto",
+ ":RegionEnums_proto",
+ ":ConnectPoint_proto",
+ ":Device_proto",
+ ":DisjointPath_proto",
+ ":HostId_proto",
+ ":HostLocation_proto",
+ ":Host_proto",
+ ":Link_proto",
+ ":MastershipRole_proto",
+ ":Path_proto",
+ ":Port_proto",
+ ":ProviderId_proto",
+ ":Region_proto",
+ ":Permission_proto",
+ ],
+)
+
+### app ###
+proto_library(
+ name = "ApplicationsEnums_proto",
+ srcs = ["app/ApplicationEnumsProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+)
+
+### cfg ###
+proto_library(
+ name = "ConfigPropertyEnums_proto",
+ srcs = ["cfg/ConfigPropertyEnumsProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+)
+
+proto_library(
+ name = "ConfigProperty_proto",
+ srcs = ["cfg/ConfigPropertyProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+ deps = [":ConfigPropertyEnums_proto"],
+)
+
+### cluster ###
+proto_library(
+ name = "NodeId_proto",
+ srcs = ["cluster/NodeIdProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+)
+
+proto_library(
+ name = "RoleInfo_proto",
+ srcs = ["cluster/RoleInfoProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+ deps = [":NodeId_proto"],
+)
+
+### core ###
+
+proto_library(
+ name = "ApplicationId_proto",
+ srcs = ["core/ApplicationIdProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+)
+
+proto_library(
+ name = "ApplicationProto_proto",
+ srcs = ["core/ApplicationProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+ deps = [
+ ":ApplicationId_proto",
+ ":ApplicationsEnums_proto",
+ ":Permission_proto",
+ ":Version_proto",
+ ],
+)
+
+proto_library(
+ name = "Version_proto",
+ srcs = ["core/VersionProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+)
+
+### net ###
+
+### device ###
+proto_library(
+ name = "DeviceDescription_proto",
+ srcs = ["net/device/DeviceDescriptionProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+ deps = [":DeviceEnums_proto"],
+)
+
+proto_library(
+ name = "DeviceEnums_proto",
+ srcs = ["net/device/DeviceEnumsProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+)
+
+proto_library(
+ name = "DeviceEvent_proto",
+ srcs = ["net/device/DeviceEventProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+ deps = [
+ ":DeviceEnums_proto",
+ ":Device_proto",
+ ":Port_proto",
+ ],
+)
+
+proto_library(
+ name = "PortDescription_proto",
+ srcs = ["net/device/PortDescriptionProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+ deps = [":PortEnums_proto"],
+)
+
+proto_library(
+ name = "PortEnums_proto",
+ srcs = ["net/device/PortEnumsProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+)
+
+proto_library(
+ name = "PortStatistics_proto",
+ srcs = ["net/device/PortStatisticsProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+)
+
+### flow ###
+## criteria ##
+proto_library(
+ name = "Criterion_proto",
+ srcs = ["net/flow/criteria/CriterionProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+)
+
+## instrcutions ##
+proto_library(
+ name = "Instruction_proto",
+ srcs = ["net/flow/instructions/InstructionProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+)
+
+proto_library(
+ name = "Instructions_proto",
+ srcs = ["net/flow/instructions/InstructionsProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+)
+
+proto_library(
+ name = "FlowEntryEnums_proto",
+ srcs = ["net/flow/FlowEntryEnumsProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+)
+
+proto_library(
+ name = "FlowEntry_proto",
+ srcs = ["net/flow/FlowEntryProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+ deps = ["FlowEntryEnums_proto"],
+)
+
+proto_library(
+ name = "FlowRuleEnums_proto",
+ srcs = ["net/flow/FlowRuleEnumsProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+)
+
+proto_library(
+ name = "FlowRule_proto",
+ srcs = ["net/flow/FlowRuleProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+ deps = [
+ ":FlowRuleEnums_proto",
+ ":TrafficTreatment_proto",
+ ":TraficSelector_proto",
+ ],
+)
+
+proto_library(
+ name = "TraficSelector_proto",
+ srcs = ["net/flow/TrafficSelectorProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+ deps = [":Criterion_proto"],
+)
+
+proto_library(
+ name = "TrafficTreatment_proto",
+ srcs = ["net/flow/TrafficTreatmentProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+ deps = [
+ "Instruction_proto",
+ ":Instructions_proto",
+ ],
+)
+
+#### host ####
+
+proto_library(
+ name = "HostDescription_proto",
+ srcs = ["net/host/HostDescriptionProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+ deps = [":HostLocation_proto"],
+)
+
+proto_library(
+ name = "HostEnums_proto",
+ srcs = ["net/host/HostEnumsProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+)
+
+proto_library(
+ name = "HostEvent_proto",
+ srcs = ["net/host/HostEventProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+ deps = [
+ ":HostEnums_proto",
+ ":Host_proto",
+ ],
+)
+
+#### link ####
+
+proto_library(
+ name = "LinkDescription_proto",
+ srcs = ["net/link/LinkDescriptionProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+ deps = [
+ ":ConnectPoint_proto",
+ ":LinkEnums_proto",
+ ],
+)
+
+proto_library(
+ name = "LinkEnums_proto",
+ srcs = ["net/link/LinkEnumsProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+)
+
+proto_library(
+ name = "LinkEvent_proto",
+ srcs = ["net/link/LinkEventProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+ deps = [
+ ":LinkEnums_proto",
+ ":Link_proto",
+ ],
+)
+
+### meter ####
+
+proto_library(
+ name = "BandEnums_proto",
+ srcs = ["net/meter/BandEnumsProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+)
+
+proto_library(
+ name = "Band_proto",
+ srcs = ["net/meter/BandProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+ deps = [":BandEnums_proto"],
+)
+
+proto_library(
+ name = "MeterEnums_proto",
+ srcs = ["net/meter/MeterEnumsProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+)
+
+proto_library(
+ name = "MeterEvent_proto",
+ srcs = ["net/meter/MeterEventProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+ deps = [
+ ":MeterEnums_proto",
+ ":Meter_proto",
+ ],
+)
+
+proto_library(
+ name = "Meter_proto",
+ srcs = ["net/meter/MeterProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+ deps = [
+ "MeterEnums_proto",
+ ":ApplicationId_proto",
+ ":Band_proto",
+ ],
+)
+
+proto_library(
+ name = "MeterRequest_proto",
+ srcs = ["net/meter/MeterRequestProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+ deps = [
+ ":ApplicationId_proto",
+ ":Band_proto",
+ ":MeterEnums_proto",
+ ],
+)
+
+### packet ####
+
+proto_library(
+ name = "OutboundPacket_proto",
+ srcs = ["net/packet/OutboundPacketProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+ deps = [":TrafficTreatment_proto"],
+)
+
+proto_library(
+ name = "PacketEnums_proto",
+ srcs = ["net/packet/PacketEnumsProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+)
+
+proto_library(
+ name = "PacketEvent_proto",
+ srcs = ["net/packet/PacketEventProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+ deps = [
+ ":OutboundPacket_proto",
+ ":PacketEnums_proto",
+ ],
+)
+
+proto_library(
+ name = "PacketProcessorEntry_proto",
+ srcs = ["net/packet/PacketProcessorEntryProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+ deps = [":PacketProcessor_proto"],
+)
+
+proto_library(
+ name = "PacketProcessor_proto",
+ srcs = ["net/packet/PacketProcessorProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+)
+
+proto_library(
+ name = "PacketRequest_proto",
+ srcs = ["net/packet/PacketRequestProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+ deps = [
+ ":ApplicationId_proto",
+ ":NodeId_proto",
+ ":TraficSelector_proto",
+ ],
+)
+
+#### region ####
+
+proto_library(
+ name = "RegionEnums_proto",
+ srcs = ["net/region/RegionEnumsProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+)
+
+proto_library(
+ name = "ConnectPoint_proto",
+ srcs = ["net/ConnectPointProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+)
+
+proto_library(
+ name = "Device_proto",
+ srcs = ["net/DeviceProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+ deps = [":DeviceEnums_proto"],
+)
+
+proto_library(
+ name = "DisjointPath_proto",
+ srcs = ["net/DisjointPathProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+ deps = [":Path_proto"],
+)
+
+proto_library(
+ name = "HostId_proto",
+ srcs = ["net/HostIdProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+)
+
+proto_library(
+ name = "HostLocation_proto",
+ srcs = ["net/HostLocationProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+ deps = [":ConnectPoint_proto"],
+)
+
+proto_library(
+ name = "Host_proto",
+ srcs = ["net/HostProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+ deps = [
+ ":HostId_proto",
+ ":HostLocation_proto",
+ ":ProviderId_proto",
+ ],
+)
+
+proto_library(
+ name = "Link_proto",
+ srcs = ["net/LinkProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+ deps = [
+ ":ConnectPoint_proto",
+ ":LinkEnums_proto",
+ ":ProviderId_proto",
+ ],
+)
+
+proto_library(
+ name = "MastershipRole_proto",
+ srcs = ["net/MastershipRoleProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+)
+
+proto_library(
+ name = "Path_proto",
+ srcs = ["net/PathProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+ deps = [":Link_proto"],
+)
+
+proto_library(
+ name = "Port_proto",
+ srcs = ["net/PortProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+ deps = [":PortEnums_proto"],
+)
+
+proto_library(
+ name = "ProviderId_proto",
+ srcs = ["net/ProviderIdProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+)
+
+proto_library(
+ name = "Region_proto",
+ srcs = ["net/RegionProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+ deps = [":RegionEnums_proto"],
+)
+
+proto_library(
+ name = "Permission_proto",
+ srcs = ["security/PermissionProto.proto"],
+ proto_source_root = PROTO_SOURCE_ROOT,
+)
diff --git a/core/protobuf/models/proto/app/ApplicationEnumsProto.proto b/core/protobuf/models/proto/app/ApplicationEnumsProto.proto
new file mode 100644
index 0000000..2a1a912
--- /dev/null
+++ b/core/protobuf/models/proto/app/ApplicationEnumsProto.proto
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.app.models";
+
+package app;
+
+enum ApplicationStateProto {
+ // Indicates that application has been installed, but is not running.
+ INSTALLED = 0;
+ // Indicates that application is active.
+ ACTIVE = 1;
+}
+
+enum ApplicationRoleProto {
+ // Indicates that an application has an ADMIN role.
+ ADMIN = 0;
+ // Indicates that an application has a USER role.
+ USER = 1;
+ // Indicates that an application role has not been specified.
+ UNSPECIFIED = 2;
+
+ // More useful roles may be defined...
+}
diff --git a/core/protobuf/models/proto/cfg/ConfigPropertyEnumsProto.proto b/core/protobuf/models/proto/cfg/ConfigPropertyEnumsProto.proto
new file mode 100644
index 0000000..00204e7
--- /dev/null
+++ b/core/protobuf/models/proto/cfg/ConfigPropertyEnumsProto.proto
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.cfg.models";
+
+package cfg;
+
+enum ConfigPropertyTypeProto {
+ STRING = 0;
+ BYTE = 1;
+ INTEGER = 2;
+ LONG = 3;
+ FLOAT = 4;
+ DOUBLE = 5;
+ BOOLEAN = 6;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/cfg/ConfigPropertyProto.proto b/core/protobuf/models/proto/cfg/ConfigPropertyProto.proto
new file mode 100644
index 0000000..d3ae6ac
--- /dev/null
+++ b/core/protobuf/models/proto/cfg/ConfigPropertyProto.proto
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.cfg.models";
+
+package cfg;
+
+import "cfg/ConfigPropertyEnumsProto.proto";
+
+// Corresponds to org.onosproject.cfg.ConfigProperty.
+message ConfigPropertyProto {
+ string name = 1;
+ cfg.ConfigPropertyTypeProto type = 2;
+ string value = 3;
+ string default_value = 4;
+ string description = 5;
+ bool is_set = 6;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/cluster/NodeIdProto.proto b/core/protobuf/models/proto/cluster/NodeIdProto.proto
new file mode 100644
index 0000000..48d4494
--- /dev/null
+++ b/core/protobuf/models/proto/cluster/NodeIdProto.proto
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.cluster.models";
+
+package cluster;
+
+message NodeIdProto {
+ string node_id = 1;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/cluster/RoleInfoProto.proto b/core/protobuf/models/proto/cluster/RoleInfoProto.proto
new file mode 100644
index 0000000..1ede9ae
--- /dev/null
+++ b/core/protobuf/models/proto/cluster/RoleInfoProto.proto
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.cluster.models";
+
+import "cluster/NodeIdProto.proto";
+
+package cluster;
+
+message RoleInfoProto {
+ cluster.NodeIdProto master = 1;
+ repeated cluster.NodeIdProto backups = 2;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/core/ApplicationIdProto.proto b/core/protobuf/models/proto/core/ApplicationIdProto.proto
new file mode 100644
index 0000000..59dacc8
--- /dev/null
+++ b/core/protobuf/models/proto/core/ApplicationIdProto.proto
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.core.models";
+
+package core;
+
+// Corresponds to org.onosproject.core.ApplicationId.
+message ApplicationIdProto {
+ uint32 id = 1;
+ string name = 2;
+}
diff --git a/core/protobuf/models/proto/core/ApplicationProto.proto b/core/protobuf/models/proto/core/ApplicationProto.proto
new file mode 100644
index 0000000..4601e3b
--- /dev/null
+++ b/core/protobuf/models/proto/core/ApplicationProto.proto
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.core.models";
+
+package core;
+
+import "core/ApplicationIdProto.proto";
+import "app/ApplicationEnumsProto.proto";
+import "security/PermissionProto.proto";
+import "core/VersionProto.proto";
+
+// Corresponds to org.onosproject.core.Application.
+message ApplicationProto {
+ core.ApplicationIdProto app_id = 1;
+ core.VersionProto version = 2;
+ string title = 3;
+ string description = 4;
+ string category = 5;
+ string url = 6;
+ string readme = 7;
+
+ // tag id 8 is reserved for app icon
+ reserved 8;
+
+ string origin = 9;
+ app.ApplicationRoleProto role = 10;
+ repeated security.PermissionProto permissions = 11;
+
+ // tag id 12 is reserved for features repo
+ // optional type will be added later
+ reserved 12;
+ repeated string features = 13;
+ repeated string required_apps = 14;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/core/VersionProto.proto b/core/protobuf/models/proto/core/VersionProto.proto
new file mode 100644
index 0000000..e1458a9
--- /dev/null
+++ b/core/protobuf/models/proto/core/VersionProto.proto
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.core.models";
+
+package core;
+
+// Corresponds to org.onosproject.core.
+message VersionProto {
+ int32 major = 1;
+ int32 minor = 2;
+ string patch = 3;
+ string build = 4;
+}
diff --git a/core/protobuf/models/proto/net/ConnectPointProto.proto b/core/protobuf/models/proto/net/ConnectPointProto.proto
new file mode 100644
index 0000000..9607b7e
--- /dev/null
+++ b/core/protobuf/models/proto/net/ConnectPointProto.proto
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.models";
+
+package net;
+
+message ConnectPointProto {
+ oneof element_id {
+ // DeviceID as String DeviceId#toString
+ string device_id = 1;
+ string host_id = 3;
+ string ip_element_id = 4;
+ }
+ // PortNumber as String PortNumber#toString
+ string port_number = 2;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/net/DeviceProto.proto b/core/protobuf/models/proto/net/DeviceProto.proto
new file mode 100644
index 0000000..9726d84
--- /dev/null
+++ b/core/protobuf/models/proto/net/DeviceProto.proto
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.models";
+
+package net;
+
+import "net/device/DeviceEnumsProto.proto";
+
+// Corresponds to org.onosproject.net.Device.
+message DeviceProto {
+ string device_id = 1;
+ net.device.DeviceTypeProto type = 2;
+ string manufacturer = 3;
+ string hw_version = 4;
+ string sw_version = 5;
+ string serial_number = 6;
+ string chassis_id = 7;
+ map<string, string> annotations = 8;
+}
diff --git a/core/protobuf/models/proto/net/DisjointPathProto.proto b/core/protobuf/models/proto/net/DisjointPathProto.proto
new file mode 100644
index 0000000..e80d4ec
--- /dev/null
+++ b/core/protobuf/models/proto/net/DisjointPathProto.proto
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.models";
+
+package net;
+
+import "net/PathProto.proto";
+
+// Corresponds to org.onosproject.net.DisjointPath.
+message DisjointPathProto {
+ net.PathProto primary = 1;
+ net.PathProto backup = 2;
+ map<string, string> annotations = 3;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/net/HostIdProto.proto b/core/protobuf/models/proto/net/HostIdProto.proto
new file mode 100644
index 0000000..a0aae4c
--- /dev/null
+++ b/core/protobuf/models/proto/net/HostIdProto.proto
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.models";
+
+package net;
+
+// Corresponds to org.onosproject.net.HostId.
+message HostIdProto {
+ string mac = 1;
+ uint32 vlan_id = 2;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/net/HostLocationProto.proto b/core/protobuf/models/proto/net/HostLocationProto.proto
new file mode 100644
index 0000000..9e44eba
--- /dev/null
+++ b/core/protobuf/models/proto/net/HostLocationProto.proto
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.models";
+
+import "net/ConnectPointProto.proto";
+
+package net;
+
+// Corresponds to org.onosproject.net.HostLocation.
+message HostLocationProto {
+ net.ConnectPointProto connect_point = 1;
+ uint64 time = 2;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/net/HostProto.proto b/core/protobuf/models/proto/net/HostProto.proto
new file mode 100644
index 0000000..ba38fab
--- /dev/null
+++ b/core/protobuf/models/proto/net/HostProto.proto
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.models";
+
+import "net/HostIdProto.proto";
+import "net/HostLocationProto.proto";
+import "net/ProviderIdProto.proto";
+
+package net;
+
+// Corresponds to org.onosproject.net.Host.
+message HostProto {
+ net.HostIdProto host_id = 1;
+ uint32 vlan = 2;
+ net.HostLocationProto location = 3;
+ repeated string ip_addresses = 4;
+ bool configured = 5;
+ net.ProviderIdProto provider_id = 6;
+ map<string, string> annotations = 7;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/net/LinkProto.proto b/core/protobuf/models/proto/net/LinkProto.proto
new file mode 100644
index 0000000..e5ce70a
--- /dev/null
+++ b/core/protobuf/models/proto/net/LinkProto.proto
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.models";
+
+package net;
+
+import "net/link/LinkEnumsProto.proto";
+import "net/ConnectPointProto.proto";
+import "net/ProviderIdProto.proto";
+
+// Corresponds to org.onosproject.net.Link.
+message LinkProto {
+ net.link.LinkStateProto state = 1;
+ net.ConnectPointProto src = 2;
+ net.ConnectPointProto dst = 3;
+ net.link.LinkTypeProto type = 4;
+ map<string, string> annotations = 5;
+ net.ProviderIdProto provider_id = 6;
+ bool isExpected = 7;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/net/MastershipRoleProto.proto b/core/protobuf/models/proto/net/MastershipRoleProto.proto
new file mode 100644
index 0000000..24508d5
--- /dev/null
+++ b/core/protobuf/models/proto/net/MastershipRoleProto.proto
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.models";
+
+package net;
+
+enum MastershipRoleProto {
+ NONE = 0;
+ MASTER = 1;
+ STANDBY = 2;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/net/PathProto.proto b/core/protobuf/models/proto/net/PathProto.proto
new file mode 100644
index 0000000..02343ae
--- /dev/null
+++ b/core/protobuf/models/proto/net/PathProto.proto
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.models";
+
+package net;
+
+import "net/LinkProto.proto";
+
+// Corresponds to org.onosproject.net.Path.
+message PathProto {
+ repeated net.LinkProto links = 1;
+ double weight = 2;
+ map<string, string> annotations = 3;
+}
diff --git a/core/protobuf/models/proto/net/PortProto.proto b/core/protobuf/models/proto/net/PortProto.proto
new file mode 100644
index 0000000..09282e3
--- /dev/null
+++ b/core/protobuf/models/proto/net/PortProto.proto
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.models";
+
+package net;
+
+import "net/device/PortEnumsProto.proto";
+
+// Corresponds to org.onosproject.net.Port.
+message PortProto {
+ string port_number = 1;
+ bool is_enabled = 2;
+ net.device.PortTypeProto type = 3;
+ int64 port_speed = 4;
+ map<string, string> annotations = 5;
+}
+
diff --git a/core/protobuf/models/proto/net/ProviderIdProto.proto b/core/protobuf/models/proto/net/ProviderIdProto.proto
new file mode 100644
index 0000000..9f4e4cf
--- /dev/null
+++ b/core/protobuf/models/proto/net/ProviderIdProto.proto
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.models";
+
+package net;
+
+// Corresponds to org.onosproject.net.provider.ProviderId
+message ProviderIdProto {
+ string scheme = 1;
+ string id = 2;
+ bool ancillary = 3;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/net/RegionProto.proto b/core/protobuf/models/proto/net/RegionProto.proto
new file mode 100644
index 0000000..b760b6e
--- /dev/null
+++ b/core/protobuf/models/proto/net/RegionProto.proto
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.models";
+
+package net;
+
+import "net/region/RegionEnumsProto.proto";
+
+// Corresponds to org.onosproject.net.Region.
+
+message RegionProto {
+ string region_id = 1;
+ net.region.RegionTypeProto type = 2;
+ string name = 3;
+
+ // List<Set<NodeId>> masters();
+ // Since masters is a list of set of NodeIds,
+ // the following message is required.
+ message NodeIdSet {
+ repeated string node_id = 1;
+ }
+
+ repeated NodeIdSet masters = 4;
+ map<string, string> annotations = 5;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/net/device/DeviceDescriptionProto.proto b/core/protobuf/models/proto/net/device/DeviceDescriptionProto.proto
new file mode 100644
index 0000000..d2eb2c7
--- /dev/null
+++ b/core/protobuf/models/proto/net/device/DeviceDescriptionProto.proto
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.device.models";
+
+package net.device;
+
+import "net/device/DeviceEnumsProto.proto";
+
+message DeviceDescriptionProto {
+ string device_uri = 1;
+ net.device.DeviceTypeProto type = 2;
+ string manufacturer = 3;
+ string hw_version = 4;
+ string sw_version = 5;
+ string serial_number = 6;
+ string chassis_id = 7;
+ map<string, string> annotations = 8;
+ bool is_default_available = 9;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/net/device/DeviceEnumsProto.proto b/core/protobuf/models/proto/net/device/DeviceEnumsProto.proto
new file mode 100644
index 0000000..e8713d3
--- /dev/null
+++ b/core/protobuf/models/proto/net/device/DeviceEnumsProto.proto
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.device.models";
+
+package net.device;
+
+enum DeviceTypeProto {
+ OTHER = 0;
+ SWITCH = 1;
+ ROUTER = 2;
+ ROADM = 3;
+ OTN = 4;
+ ROADM_OTN = 5;
+ FIREWALL = 6;
+ BALANCER = 7;
+ IPS = 8;
+ IDS = 9;
+ CONTROLLER = 10;
+ VIRTUAL_DEVICE = 11;
+ FIBER_SWITCH = 12;
+ MICROWAVE = 13;
+}
+
+enum DeviceEventTypeProto {
+ DEVICE_ADDED = 0;
+ DEVICE_UPDATED = 1;
+ DEVICE_REMOVED = 2;
+ DEVICE_SUSPENDED = 3;
+ DEVICE_AVAILABILITY_CHANGED = 4;
+ PORT_ADDED = 5;
+ PORT_UPDATED = 6;
+ PORT_REMOVED = 7;
+ PORT_STATS_UPDATED = 8;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/net/device/DeviceEventProto.proto b/core/protobuf/models/proto/net/device/DeviceEventProto.proto
new file mode 100644
index 0000000..f973bcc
--- /dev/null
+++ b/core/protobuf/models/proto/net/device/DeviceEventProto.proto
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.device.models";
+
+
+import "net/DeviceProto.proto";
+import "net/device/DeviceEnumsProto.proto";
+import "net/PortProto.proto";
+
+package net.device;
+
+// Corresponds to org.onosproject.net.device.DeviceEvent.
+message DeviceNotificationProto {
+ net.DeviceProto device = 1;
+ net.device.DeviceEventTypeProto device_event_type = 2;
+ net.PortProto port = 3;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/net/device/PortDescriptionProto.proto b/core/protobuf/models/proto/net/device/PortDescriptionProto.proto
new file mode 100644
index 0000000..52a6e23
--- /dev/null
+++ b/core/protobuf/models/proto/net/device/PortDescriptionProto.proto
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.device.models";
+
+package net.device;
+
+import "net/device/PortEnumsProto.proto";
+
+message PortDescriptionProto {
+ // PortNumber as String PortNumber#toString
+ string port_number = 1;
+ bool is_enabled = 2;
+ net.device.PortTypeProto type = 3;
+ int64 port_speed = 4;
+ map<string, string> annotations = 8;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/net/device/PortEnumsProto.proto b/core/protobuf/models/proto/net/device/PortEnumsProto.proto
new file mode 100644
index 0000000..28757fc
--- /dev/null
+++ b/core/protobuf/models/proto/net/device/PortEnumsProto.proto
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.device.models";
+
+package net.device;
+
+enum PortTypeProto {
+ // Signifies copper-based connectivity.
+ COPPER = 0;
+ // Signifies optical fiber-based connectivity.
+ FIBER = 1;
+ // Signifies optical fiber-based packet port.
+ PACKET = 2;
+ // Signifies optical fiber-based optical tributary port (called T-port).
+ //The signal from the client side will be formed into a ITU G.709 (OTN) frame.
+ ODUCLT = 3;
+ // Signifies optical fiber-based Line-side port (called L-port).
+ OCH = 4;
+ // Signifies optical fiber-based WDM port (called W-port).
+ //Optical Multiplexing Section (See ITU G.709).
+ OMS = 5;
+ // Signifies virtual port.
+ VIRTUAL_PORT = 6;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/net/device/PortStatisticsProto.proto b/core/protobuf/models/proto/net/device/PortStatisticsProto.proto
new file mode 100644
index 0000000..af0b039
--- /dev/null
+++ b/core/protobuf/models/proto/net/device/PortStatisticsProto.proto
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.device.models";
+
+package net.device;
+
+message PortStatisticsProto {
+ int32 port = 1;
+ int64 packets_received = 2;
+ int64 packets_sent = 3;
+ int64 bytes_received = 4;
+ int64 bytes_sent = 5;
+ int64 packets_rx_dropped = 6;
+ int64 packets_tx_dropped = 7;
+ int64 packets_rx_errors = 8;
+ int64 packets_tx_errors = 9;
+ int64 duration_sec = 10;
+ int64 duration_nano = 11;
+ bool is_zero = 12;
+ // TODO add all other fields
+}
diff --git a/core/protobuf/models/proto/net/flow/FlowEntryEnumsProto.proto b/core/protobuf/models/proto/net/flow/FlowEntryEnumsProto.proto
new file mode 100644
index 0000000..2bb6768
--- /dev/null
+++ b/core/protobuf/models/proto/net/flow/FlowEntryEnumsProto.proto
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.flow.models";
+
+package net.flow;
+
+// Corresponds to org.onosproject.net.flow.FlowEntry.
+enum FlowEntryStateProto {
+
+ // Indicates that this rule has been submitted for addition.
+ // Not necessarily in the flow table.
+ PENDING_ADD = 0;
+
+ // Rule has been added which means it is in the flow table.
+ ADDED = 1;
+
+ // Flow has been marked for removal, might still be in flow table.
+ PENDING_REMOVE = 2;
+
+ // Flow has been removed from flow table and can be purged.
+ REMOVED = 3;
+
+ // Indicates that the installation of this flow has failed.
+ FAILED = 4;
+}
+
+enum FlowLiveTypeProto {
+
+ // Indicates that this rule has been submitted for addition immediately.
+ // Not necessarily collecting flow stats.
+ IMMEDIATE = 0;
+
+ // Indicates that this rule has been submitted for a short time.
+ // Collecting flow stats every SHORT interval, defined by the implementation.
+ SHORT = 1;
+
+ // Indicates that this rule has been submitted for a mid time.
+ // Collecting flow stats every MID interval, defined by the implementation.
+ MID = 2;
+
+ // Indicates that this rule has been submitted for a long time.
+ // Collecting flow stats every LONG interval, defined by the implementation.
+ LONG = 3;
+
+ // Indicates that this rule has been submitted for UNKNOWN or ERROR.
+ // Not necessarily collecting flow stats.
+ UNKNOWN = 4;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/net/flow/FlowEntryProto.proto b/core/protobuf/models/proto/net/flow/FlowEntryProto.proto
new file mode 100644
index 0000000..c28a624
--- /dev/null
+++ b/core/protobuf/models/proto/net/flow/FlowEntryProto.proto
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.flow.models";
+
+package net.flow;
+
+import "net/flow/FlowEntryEnumsProto.proto";
+
+// Corresponds to org.onosproject.net.flow.DefaultFlowEntry.
+message FlowEntryProto {
+ int64 life = 1;
+ int64 packets = 2;
+ int64 bytes = 3;
+ int64 last_seen = 4;
+ int32 err_type = 5;
+ int32 err_code = 6;
+
+ net.flow.FlowEntryStateProto state = 7;
+ net.flow.FlowLiveTypeProto live_type = 8;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/net/flow/FlowRuleEnumsProto.proto b/core/protobuf/models/proto/net/flow/FlowRuleEnumsProto.proto
new file mode 100644
index 0000000..269f429
--- /dev/null
+++ b/core/protobuf/models/proto/net/flow/FlowRuleEnumsProto.proto
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.flow.models";
+
+package net.flow;
+
+// Corresponds to org.onosproject.net.flow.FlowRule enums.
+enum FlowRemoveReasonProto {
+ IDLE_TIMEOUT = 0;
+ HARD_TIMEOUT = 1;
+ DELETE = 2;
+ GROUP_DELETE = 3;
+ METER_DELETE = 4;
+ EVICTION = 5;
+ NO_REASON = 6;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/net/flow/FlowRuleProto.proto b/core/protobuf/models/proto/net/flow/FlowRuleProto.proto
new file mode 100644
index 0000000..9bf615d
--- /dev/null
+++ b/core/protobuf/models/proto/net/flow/FlowRuleProto.proto
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.flow.models";
+
+package net.flow;
+
+import "net/flow/TrafficSelectorProto.proto";
+import "net/flow/TrafficTreatmentProto.proto";
+import "net/flow/FlowRuleEnumsProto.proto";
+
+// Corresponds to org.onosproject.net.flow.DefaultFlowRule.
+message FlowRuleProto {
+ int32 priority = 1;
+ int32 app_id = 2;
+ string device_id = 3;
+ int64 flow_id = 4;
+ int32 timeout = 5;
+ bool permanent = 6;
+ int32 table_id = 7;
+ string table_name = 8;
+
+ net.flow.TrafficSelectorProto selector = 9;
+ net.flow.TrafficTreatmentProto treatment = 10;
+ net.flow.FlowRemoveReasonProto reason = 11;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/net/flow/TrafficSelectorProto.proto b/core/protobuf/models/proto/net/flow/TrafficSelectorProto.proto
new file mode 100644
index 0000000..74a5bce
--- /dev/null
+++ b/core/protobuf/models/proto/net/flow/TrafficSelectorProto.proto
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+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/core/protobuf/models/proto/net/flow/TrafficTreatmentProto.proto b/core/protobuf/models/proto/net/flow/TrafficTreatmentProto.proto
new file mode 100644
index 0000000..428e218
--- /dev/null
+++ b/core/protobuf/models/proto/net/flow/TrafficTreatmentProto.proto
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+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/core/protobuf/models/proto/net/flow/criteria/CriterionProto.proto b/core/protobuf/models/proto/net/flow/criteria/CriterionProto.proto
new file mode 100644
index 0000000..cc26526
--- /dev/null
+++ b/core/protobuf/models/proto/net/flow/criteria/CriterionProto.proto
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+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/core/protobuf/models/proto/net/flow/instructions/InstructionProto.proto b/core/protobuf/models/proto/net/flow/instructions/InstructionProto.proto
new file mode 100644
index 0000000..472899f
--- /dev/null
+++ b/core/protobuf/models/proto/net/flow/instructions/InstructionProto.proto
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+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/core/protobuf/models/proto/net/flow/instructions/InstructionsProto.proto b/core/protobuf/models/proto/net/flow/instructions/InstructionsProto.proto
new file mode 100644
index 0000000..7491623
--- /dev/null
+++ b/core/protobuf/models/proto/net/flow/instructions/InstructionsProto.proto
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+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/core/protobuf/models/proto/net/host/HostDescriptionProto.proto b/core/protobuf/models/proto/net/host/HostDescriptionProto.proto
new file mode 100644
index 0000000..733fd8c
--- /dev/null
+++ b/core/protobuf/models/proto/net/host/HostDescriptionProto.proto
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.host.models";
+
+package net.host;
+
+import "net/HostLocationProto.proto";
+
+// Corresponds to org.onosproject.net.host.HostDescription.
+message HostDescription {
+ string hw_address = 1;
+ uint32 vlan = 2;
+ net.HostLocationProto location = 3;
+ repeated string ip_addresses = 4;
+ bool configured = 5;
+ map<string, string> annotations = 6;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/net/host/HostEnumsProto.proto b/core/protobuf/models/proto/net/host/HostEnumsProto.proto
new file mode 100644
index 0000000..7d45f29
--- /dev/null
+++ b/core/protobuf/models/proto/net/host/HostEnumsProto.proto
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.host.models";
+
+package net.host;
+
+enum HostEventTypeProto {
+ HOST_ADDED = 0;
+ HOST_REMOVED = 1;
+ HOST_UPDATED = 2;
+ HOST_MOVED = 3;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/net/host/HostEventProto.proto b/core/protobuf/models/proto/net/host/HostEventProto.proto
new file mode 100644
index 0000000..c88dc20
--- /dev/null
+++ b/core/protobuf/models/proto/net/host/HostEventProto.proto
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.host.models";
+
+package net.host;
+
+import "net/HostProto.proto";
+import "net/host/HostEnumsProto.proto";
+
+
+// Corresponds to org.onosproject.net.device.HostEvent.
+message HostNotificationProto {
+ net.HostProto host = 1;
+ net.host.HostEventTypeProto hostEventType = 2;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/net/link/LinkDescriptionProto.proto b/core/protobuf/models/proto/net/link/LinkDescriptionProto.proto
new file mode 100644
index 0000000..9519f3c
--- /dev/null
+++ b/core/protobuf/models/proto/net/link/LinkDescriptionProto.proto
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.link.models";
+
+package net.link;
+
+import "net/ConnectPointProto.proto";
+import "net/link/LinkEnumsProto.proto";
+
+message LinkDescriptionProto {
+ net.ConnectPointProto src = 1;
+ net.ConnectPointProto dst = 2;
+ net.link.LinkTypeProto type = 3;
+ map<string, string> annotations = 4;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/net/link/LinkEnumsProto.proto b/core/protobuf/models/proto/net/link/LinkEnumsProto.proto
new file mode 100644
index 0000000..ea76f9e
--- /dev/null
+++ b/core/protobuf/models/proto/net/link/LinkEnumsProto.proto
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.link.models";
+
+package net.link;
+
+enum LinkTypeProto {
+ // Signifies that this is a direct single-segment link.
+ DIRECT = 0;
+
+ // Signifies that this link is potentially comprised from multiple
+ // underlying segments or hops, and as such should be used to tag
+ // links traversing optical paths, tunnels or intervening 'dark'
+ // switches.
+ INDIRECT = 1;
+
+ // Signifies that this link is an edge, i.e. host link.
+ EDGE = 2;
+
+ // Signifies that this link represents a logical link backed by
+ // some form of a tunnel, e.g., GRE, MPLS, ODUk, OCH.
+ TUNNEL = 3;
+
+ // Signifies that this link is realized by fiber (either single channel or WDM).
+ OPTICAL = 4;
+
+ // Signifies that this link is a virtual link or a pseudo-wire.
+ VIRTUAL = 5;
+}
+
+enum LinkStateProto {
+ ACTIVE = 0;
+ INACTIVE = 1;
+}
+
+// Link Event Types
+enum LinkEventTypeProto {
+ LINK_ADDED = 0;
+ LINK_UPDATED = 1;
+ LINK_REMOVED = 2;
+}
diff --git a/core/protobuf/models/proto/net/link/LinkEventProto.proto b/core/protobuf/models/proto/net/link/LinkEventProto.proto
new file mode 100644
index 0000000..3772109
--- /dev/null
+++ b/core/protobuf/models/proto/net/link/LinkEventProto.proto
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.link.models";
+
+package net.link;
+
+import "net/LinkProto.proto";
+import "net/link/LinkEnumsProto.proto";
+
+// Corresponds to org.onosproject.net.link.LinkEvent.
+message LinkNotificationProto {
+ net.link.LinkEventTypeProto link_event_type = 1;
+ net.LinkProto link = 2;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/net/meter/BandEnumsProto.proto b/core/protobuf/models/proto/net/meter/BandEnumsProto.proto
new file mode 100644
index 0000000..48dbe61
--- /dev/null
+++ b/core/protobuf/models/proto/net/meter/BandEnumsProto.proto
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.meter.models";
+
+package net.meter;
+
+/**
+* Specifies the type of band.
+*/
+enum BandTypeProto {
+ /**
+ * Simple rate limiter which drops packets
+ * when the rate is exceeded.
+ */
+ DROP = 0;
+
+ /**
+ * defines a simple DiffServ policer that remark
+ * the drop precedence of the DSCP field in the
+ * IP header of the packets that exceed the band
+ * rate value.
+ */
+ REMARK = 1;
+
+ /**
+ * defines an experimental meter band.
+ */
+ EXPERIMENTAL = 2;
+}
diff --git a/core/protobuf/models/proto/net/meter/BandProto.proto b/core/protobuf/models/proto/net/meter/BandProto.proto
new file mode 100644
index 0000000..4757c46
--- /dev/null
+++ b/core/protobuf/models/proto/net/meter/BandProto.proto
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.meter.models";
+
+package net.meter;
+
+import "net/meter/BandEnumsProto.proto";
+
+// Corresponds to org.onosproject.net.meter.Band.
+message BandProto {
+ uint64 rate = 1;
+ uint64 burst = 2;
+ uint32 drop_precedence = 3;
+ BandTypeProto type = 4;
+ uint64 packets = 5;
+ uint64 bytes = 6;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/net/meter/MeterEnumsProto.proto b/core/protobuf/models/proto/net/meter/MeterEnumsProto.proto
new file mode 100644
index 0000000..1b0bbf5
--- /dev/null
+++ b/core/protobuf/models/proto/net/meter/MeterEnumsProto.proto
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.meter.models";
+
+package net.meter;
+
+enum MeterUnitProto {
+ /**
+ * Packets per second.
+ */
+ PKTS_PER_SEC = 0;
+
+ /**
+ * Kilo bits per second.
+ */
+ KB_PER_SEC = 1;
+}
+
+enum MeterStateProto {
+ /**
+ * The meter is in the process of being added.
+ */
+ PENDING_ADD = 0;
+
+ /**
+ * THe meter has been added.
+ */
+ ADDED = 1;
+
+ /**
+ * The meter is in the process of being removed.
+ */
+ PENDING_REMOVE = 2;
+
+ /**
+ * The meter has been removed.
+ */
+ REMOVED = 3;
+}
+
+enum MeterRequestTypeProto {
+ ADD = 0;
+ MODIFY = 1;
+ REMOVE = 2;
+}
+
+enum MeterEventTypeProto {
+ /**
+ * A meter addition was requested.
+ */
+ METER_ADD_REQ = 0;
+
+ /**
+ * A meter removal was requested.
+ */
+ METER_REM_REQ = 1;
+
+ /**
+ * A meter was finally added to device.
+ */
+ METER_ADDED = 2;
+
+ /**
+ * A meter was finally removed from device.
+ */
+ METER_REMOVED = 3;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/net/meter/MeterEventProto.proto b/core/protobuf/models/proto/net/meter/MeterEventProto.proto
new file mode 100644
index 0000000..898692a
--- /dev/null
+++ b/core/protobuf/models/proto/net/meter/MeterEventProto.proto
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.meter.models";
+
+package net.meter;
+
+import "net/meter/MeterEnumsProto.proto";
+import "net/meter/MeterProto.proto";
+
+// Corresponds to org.onosproject.net.meter.MeterEvent.
+message MeterNotificationProto {
+ MeterEventTypeProto type = 1;
+ MeterProto meter = 2;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/net/meter/MeterProto.proto b/core/protobuf/models/proto/net/meter/MeterProto.proto
new file mode 100644
index 0000000..9478394
--- /dev/null
+++ b/core/protobuf/models/proto/net/meter/MeterProto.proto
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.meter.models";
+
+package net.meter;
+
+import "net/meter/BandProto.proto";
+import "net/meter/MeterEnumsProto.proto";
+import "core/ApplicationIdProto.proto";
+
+message MeterProto {
+ string device_id = 1;
+ uint64 meter_id = 2;
+ core.ApplicationIdProto application_id = 3;
+ MeterUnitProto unit = 4;
+ bool is_burst = 5;
+ repeated BandProto bands = 6;
+ MeterStateProto state = 7;
+ uint64 life = 8;
+ uint64 reference_count = 9;
+ uint64 packets_seen = 10;
+ uint64 bytes_seen = 11;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/net/meter/MeterRequestProto.proto b/core/protobuf/models/proto/net/meter/MeterRequestProto.proto
new file mode 100644
index 0000000..be60f11
--- /dev/null
+++ b/core/protobuf/models/proto/net/meter/MeterRequestProto.proto
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.meter.models";
+
+package net.meter;
+
+import "net/meter/BandProto.proto";
+import "net/meter/MeterEnumsProto.proto";
+import "core/ApplicationIdProto.proto";
+
+message MeterRequestProto {
+ string device_id = 1;
+ core.ApplicationIdProto application_id = 2;
+ MeterUnitProto unit = 3;
+ bool is_burst = 4;
+ repeated BandProto bands = 5;
+ MeterRequestTypeProto type = 6;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/net/packet/OutboundPacketProto.proto b/core/protobuf/models/proto/net/packet/OutboundPacketProto.proto
new file mode 100644
index 0000000..9d943e4
--- /dev/null
+++ b/core/protobuf/models/proto/net/packet/OutboundPacketProto.proto
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+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/core/protobuf/models/proto/net/packet/PacketEnumsProto.proto b/core/protobuf/models/proto/net/packet/PacketEnumsProto.proto
new file mode 100644
index 0000000..db6e5ca
--- /dev/null
+++ b/core/protobuf/models/proto/net/packet/PacketEnumsProto.proto
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+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/core/protobuf/models/proto/net/packet/PacketEventProto.proto b/core/protobuf/models/proto/net/packet/PacketEventProto.proto
new file mode 100644
index 0000000..07d9580
--- /dev/null
+++ b/core/protobuf/models/proto/net/packet/PacketEventProto.proto
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+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/core/protobuf/models/proto/net/packet/PacketProcessorEntryProto.proto b/core/protobuf/models/proto/net/packet/PacketProcessorEntryProto.proto
new file mode 100644
index 0000000..b0b90b2
--- /dev/null
+++ b/core/protobuf/models/proto/net/packet/PacketProcessorEntryProto.proto
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+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/core/protobuf/models/proto/net/packet/PacketProcessorProto.proto b/core/protobuf/models/proto/net/packet/PacketProcessorProto.proto
new file mode 100644
index 0000000..8a71674
--- /dev/null
+++ b/core/protobuf/models/proto/net/packet/PacketProcessorProto.proto
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+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/core/protobuf/models/proto/net/packet/PacketRequestProto.proto b/core/protobuf/models/proto/net/packet/PacketRequestProto.proto
new file mode 100644
index 0000000..0b61a66
--- /dev/null
+++ b/core/protobuf/models/proto/net/packet/PacketRequestProto.proto
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+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/core/protobuf/models/proto/net/region/RegionEnumsProto.proto b/core/protobuf/models/proto/net/region/RegionEnumsProto.proto
new file mode 100644
index 0000000..67bf53f
--- /dev/null
+++ b/core/protobuf/models/proto/net/region/RegionEnumsProto.proto
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.region.models";
+
+package net.region;
+
+enum RegionTypeProto {
+ /**
+ * Region represents an entire continent.
+ */
+ CONTINENT = 0;
+
+ /**
+ * Region represents an entire country.
+ */
+ COUNTRY = 1;
+
+ /**
+ * Region represents a metropolitan area.
+ */
+ METRO = 2;
+
+ /**
+ * Region represents a campus.
+ */
+ CAMPUS = 3;
+
+ /**
+ * Region represents a building.
+ */
+ BUILDING = 4;
+
+ /**
+ * Region represents a data center.
+ */
+ DATA_CENTER = 5;
+
+ /**
+ * Region represents a building floor.
+ */
+ FLOOR = 6;
+
+ /**
+ * Region represents a room.
+ */
+ ROOM = 7;
+
+ /**
+ * Region represents a rack.
+ */
+ RACK = 8;
+
+ /**
+ * Region represents a logical grouping.
+ */
+ LOGICAL_GROUP = 9;
+}
\ No newline at end of file
diff --git a/core/protobuf/models/proto/security/PermissionProto.proto b/core/protobuf/models/proto/security/PermissionProto.proto
new file mode 100644
index 0000000..e14af96
--- /dev/null
+++ b/core/protobuf/models/proto/security/PermissionProto.proto
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.security.models";
+
+package security;
+
+// Corresponds to org.onosproject.security.Permission.
+message PermissionProto {
+ string classname = 1;
+ string name = 2;
+ string actions = 3;
+}
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/cfg/ConfigPropertyEnumsProtoTranslator.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/cfg/ConfigPropertyEnumsProtoTranslator.java
new file mode 100644
index 0000000..d08e2fa
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/cfg/ConfigPropertyEnumsProtoTranslator.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.incubator.protobuf.models.cfg;
+
+import org.onosproject.cfg.ConfigProperty.Type;
+import org.onosproject.grpc.cfg.models.ConfigPropertyEnumsProto.ConfigPropertyTypeProto;
+
+/**
+ * gRPC ConfigProperty.Type message to equivalent ONOS enum conversion related utilities.
+ */
+public final class ConfigPropertyEnumsProtoTranslator {
+
+ /**
+ * Translates gRPC ConfigProperty type to {@link Type}.
+ *
+ * @param configPropertyTypeProto config Property proto type
+ * @return {@link Type}
+ */
+ public static Type translate(ConfigPropertyTypeProto configPropertyTypeProto) {
+
+ return Type.valueOf(configPropertyTypeProto.name());
+ }
+
+ /**
+ * Translates {@link Type} to gRPC ConfigProperty type.
+ *
+ * @param type config Property type
+ * @return gRPC ConfigProperty type
+ */
+ public static ConfigPropertyTypeProto translate(Type type) {
+
+ return ConfigPropertyTypeProto.valueOf(type.name());
+ }
+
+ // Utility class not intended for instantiation.
+ private ConfigPropertyEnumsProtoTranslator() {}
+}
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/cfg/ConfigPropertyProtoTranslator.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/cfg/ConfigPropertyProtoTranslator.java
new file mode 100644
index 0000000..ecf9baf
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/cfg/ConfigPropertyProtoTranslator.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.incubator.protobuf.models.cfg;
+
+import org.onosproject.cfg.ConfigProperty;
+import org.onosproject.grpc.cfg.models.ConfigPropertyProtoOuterClass.ConfigPropertyProto;
+
+/**
+ * gRPC ConfigPropertyProto message to equivalent ONOS ConfigProperty conversion related utilities.
+ */
+public final class ConfigPropertyProtoTranslator {
+
+ /**
+ * Translates gRPC ConfigProperty message to {@link ConfigProperty}.
+ *
+ * @param configPropertyProto gRPC message
+ * @return {@link ConfigProperty}
+ */
+ public static ConfigProperty translate(ConfigPropertyProto configPropertyProto) {
+
+ ConfigProperty configProperty = ConfigProperty.defineProperty(configPropertyProto.getName(),
+ ConfigPropertyEnumsProtoTranslator
+ .translate(configPropertyProto
+ .getType()),
+ configPropertyProto.getDefaultValue(),
+ configPropertyProto.getDescriptionBytes()
+ .toString());
+ return ConfigProperty.setProperty(configProperty, configPropertyProto.getValue());
+ }
+
+ /**
+ * Translates {@link ConfigProperty} to gRPC ConfigProperty message.
+ *
+ * @param configProperty config property
+ * @return gRPC ConfigProperty message
+ */
+ public static ConfigPropertyProto translate(ConfigProperty configProperty) {
+
+ if (configProperty != null) {
+ return ConfigPropertyProto.newBuilder()
+ .setName(configProperty.name())
+ .setType(ConfigPropertyEnumsProtoTranslator.translate(configProperty.type()))
+ .setDefaultValue(configProperty.defaultValue())
+ .setDescription(configProperty.description())
+ .setValue(configProperty.value())
+ .build();
+ }
+
+ return ConfigPropertyProto.getDefaultInstance();
+ }
+
+ // Utility class not intended for instantiation.
+ private ConfigPropertyProtoTranslator() {}
+}
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/cfg/package-info.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/cfg/package-info.java
new file mode 100644
index 0000000..b0ea47d
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/cfg/package-info.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Utilities to handle ProtoBuf version of ONOS network models.
+ */
+package org.onosproject.incubator.protobuf.models.cfg;
\ No newline at end of file
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/cluster/NodeIdProtoTranslator.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/cluster/NodeIdProtoTranslator.java
new file mode 100644
index 0000000..f41586d
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/cluster/NodeIdProtoTranslator.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.protobuf.models.cluster;
+
+import org.onosproject.cluster.NodeId;
+import org.onosproject.grpc.net.cluster.models.NodeIdProtoOuterClass;
+
+/**
+ * gRPC NodeIdProto message to equivalent ONOS NodeId conversion related utilities.
+ */
+public final class NodeIdProtoTranslator {
+
+ /**
+ * Translates gRPC NodeId to {@link NodeId}.
+ *
+ * @param nodeId gRPC message
+ * @return {@link NodeId}
+ */
+ public static NodeId translate(NodeIdProtoOuterClass.NodeIdProto nodeId) {
+ if (nodeId.equals(NodeIdProtoOuterClass.NodeIdProto.getDefaultInstance())) {
+ return null;
+ }
+
+ return NodeId.nodeId(nodeId.getNodeId());
+ }
+
+ /**
+ * Translates {@link NodeId} to gRPC NodeId message.
+ *
+ * @param nodeId {@link NodeId}
+ * @return gRPC NodeId message
+ */
+ public static NodeIdProtoOuterClass.NodeIdProto translate(NodeId nodeId) {
+
+ if (nodeId != null) {
+ return NodeIdProtoOuterClass.NodeIdProto.newBuilder()
+ .setNodeId(nodeId.id())
+ .build();
+ }
+
+ return NodeIdProtoOuterClass.NodeIdProto.getDefaultInstance();
+ }
+
+ // Utility class not intended for instantiation.
+ private NodeIdProtoTranslator() {}
+}
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/cluster/RoleInfoProtoTranslator.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/cluster/RoleInfoProtoTranslator.java
new file mode 100644
index 0000000..d879a08
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/cluster/RoleInfoProtoTranslator.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.protobuf.models.cluster;
+
+import com.google.common.collect.Lists;
+import org.onosproject.cluster.NodeId;
+import org.onosproject.cluster.RoleInfo;
+import org.onosproject.grpc.cluster.models.RoleInfoProtoOuterClass;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * gRPC RoleInfoProto message to equivalent ONOS RoleInfo conversion related utilities.
+ */
+public final class RoleInfoProtoTranslator {
+
+ /**
+ * Translates gRPC RoleInfo to {@link RoleInfo}.
+ *
+ * @param roleInfo gRPC message
+ * @return {@link RoleInfo}
+ */
+ public static RoleInfo translate(RoleInfoProtoOuterClass.RoleInfoProto roleInfo) {
+ NodeId master = NodeIdProtoTranslator.translate(roleInfo.getMaster());
+
+ List<NodeId> backups = Lists.newArrayList();
+ backups = roleInfo.getBackupsList().stream().map(r ->
+ NodeIdProtoTranslator.translate(r)).collect(Collectors.toList());
+ return new RoleInfo(master, backups);
+ }
+
+ /**
+ * Translates {@link RoleInfo} to gRPC RoleInfo message.
+ *
+ * @param roleInfo {@link RoleInfo}
+ * @return gRPC RoleInfo message
+ */
+ public static RoleInfoProtoOuterClass.RoleInfoProto translate(RoleInfo roleInfo) {
+
+ if (roleInfo != null) {
+ RoleInfoProtoOuterClass.RoleInfoProto.Builder builder =
+ RoleInfoProtoOuterClass.RoleInfoProto.newBuilder();
+ builder.setMaster(NodeIdProtoTranslator.translate(roleInfo.master()));
+ roleInfo.backups().forEach(b -> builder.addBackups(NodeIdProtoTranslator.translate(b)));
+ return builder.build();
+ }
+
+ return RoleInfoProtoOuterClass.RoleInfoProto.getDefaultInstance();
+ }
+
+ // Utility class not intended for instantiation.
+ private RoleInfoProtoTranslator() {}
+}
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/cluster/package-info.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/cluster/package-info.java
new file mode 100644
index 0000000..0f120f5
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/cluster/package-info.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Utilities to handle ProtoBuf version of ONOS cluster models.
+ */
+package org.onosproject.incubator.protobuf.models.cluster;
\ No newline at end of file
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/core/ApplicationEnumsProtoTranslator.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/core/ApplicationEnumsProtoTranslator.java
new file mode 100644
index 0000000..6fe0319
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/core/ApplicationEnumsProtoTranslator.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.protobuf.models.core;
+
+import org.onosproject.app.ApplicationState;
+import org.onosproject.core.ApplicationRole;
+import org.onosproject.grpc.app.models.ApplicationEnumsProto.ApplicationRoleProto;
+import org.onosproject.grpc.app.models.ApplicationEnumsProto.ApplicationStateProto;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Optional;
+
+/**
+ * gRPC ApplicationEnumsProto message to equivalent ONOS Application Enums conversion related utilities.
+ */
+public final class ApplicationEnumsProtoTranslator {
+
+ private static final Logger log = LoggerFactory.getLogger(ApplicationEnumsProtoTranslator.class);
+
+ /**
+ * Translates {@link ApplicationRole} to gRPC ApplicationRole.
+ *
+ * @param role {@link ApplicationRole}
+ * @return gRPC message
+ */
+ public static ApplicationRoleProto translate(ApplicationRole role) {
+
+ switch (role) {
+ case USER:
+ return ApplicationRoleProto.USER;
+ case ADMIN:
+ return ApplicationRoleProto.ADMIN;
+ case UNSPECIFIED:
+ return ApplicationRoleProto.UNSPECIFIED;
+
+ default:
+ log.warn("Unexpected application role: {}", role);
+ return ApplicationRoleProto.UNSPECIFIED;
+ }
+ }
+
+ /**
+ * Translates gRPC ApplicationRole to {@link ApplicationRole}.
+ *
+ * @param roleProto gRPC message
+ * @return {@link ApplicationRole}
+ */
+ public static Optional<ApplicationRole> translate(ApplicationRoleProto roleProto) {
+
+ switch (roleProto) {
+ case USER:
+ return Optional.of(ApplicationRole.USER);
+ case ADMIN:
+ return Optional.of(ApplicationRole.ADMIN);
+ case UNSPECIFIED:
+ return Optional.of(ApplicationRole.UNSPECIFIED);
+
+ default:
+ log.warn("Unexpected application role proto: {}", roleProto);
+ return Optional.empty();
+ }
+ }
+
+ /**
+ * Translate {@link ApplicationState} to gRPC ApplicationState.
+ *
+ * @param state {@link ApplicationState}
+ * @return gRPC message
+ */
+ public static ApplicationStateProto translate(ApplicationState state) {
+
+ switch (state) {
+ case ACTIVE:
+ return ApplicationStateProto.ACTIVE;
+ case INSTALLED:
+ return ApplicationStateProto.INSTALLED;
+
+ default:
+ log.warn("Unexpected application state: {}", state);
+ return ApplicationStateProto.INSTALLED;
+ }
+ }
+
+ /**
+ * Translate gRPC ApplicationState to {@link ApplicationState}.
+ *
+ * @param stateProto gRPC message
+ * @return {@link ApplicationState}
+ */
+ public static Optional<ApplicationState> translate(ApplicationStateProto stateProto) {
+
+ switch (stateProto) {
+ case ACTIVE:
+ return Optional.of(ApplicationState.ACTIVE);
+ case INSTALLED:
+ return Optional.of(ApplicationState.INSTALLED);
+
+ default:
+ log.warn("Unexpected application state proto: {}", stateProto);
+ return Optional.empty();
+ }
+ }
+
+ // Utility class not intended for instantiation.
+ private ApplicationEnumsProtoTranslator() {}
+}
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/core/ApplicationIdProtoTranslator.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/core/ApplicationIdProtoTranslator.java
new file mode 100644
index 0000000..e74ad7f
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/core/ApplicationIdProtoTranslator.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.protobuf.models.core;
+
+import org.onosproject.core.ApplicationId;
+import org.onosproject.core.DefaultApplicationId;
+import org.onosproject.grpc.core.models.ApplicationIdProtoOuterClass.ApplicationIdProto;
+
+import static org.onosproject.grpc.core.models.ApplicationIdProtoOuterClass.ApplicationIdProto.getDefaultInstance;
+
+/**
+ * gRPC ApplicationIdProto message to equivalent ONOS ApplicationId conversion related utilities.
+ */
+public final class ApplicationIdProtoTranslator {
+
+ /**
+ * Translates gRPC ApplicationId to {@link ApplicationId}.
+ *
+ * @param applicationId gRPC message
+ * @return {@link ApplicationId}
+ */
+ public static ApplicationId translate(ApplicationIdProto applicationId) {
+
+ return new DefaultApplicationId(applicationId.getId(), applicationId.getName());
+ }
+
+ /**
+ * Translates {@link ApplicationId} to gRPC ApplicationId message.
+ *
+ * @param applicationId {@link ApplicationId}
+ * @return gRPC ApplicationId message
+ */
+ public static ApplicationIdProto translate(ApplicationId applicationId) {
+
+ if (applicationId != null) {
+ return ApplicationIdProto.newBuilder()
+ .setId(applicationId.id())
+ .setName(applicationId.name())
+ .build();
+ }
+
+ return getDefaultInstance();
+ }
+
+ // utility class not intended for instantiation.
+ private ApplicationIdProtoTranslator() {}
+}
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/core/ApplicationProtoTranslator.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/core/ApplicationProtoTranslator.java
new file mode 100644
index 0000000..25a95e4
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/core/ApplicationProtoTranslator.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.protobuf.models.core;
+
+import com.google.common.collect.Sets;
+import org.onosproject.core.Application;
+import org.onosproject.core.DefaultApplication;
+import org.onosproject.grpc.core.models.ApplicationProtoOuterClass.ApplicationProto;
+import org.onosproject.incubator.protobuf.models.security.PermissionProtoTranslator;
+import org.onosproject.security.Permission;
+
+import java.util.Optional;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import static org.onosproject.grpc.core.models.ApplicationProtoOuterClass.ApplicationProto.getDefaultInstance;
+
+/**
+ * gRPC ApplicationProto message to equivalent ONOS Application conversion related utilities.
+ */
+public final class ApplicationProtoTranslator {
+
+ /**
+ * Translates gRPC Application to {@link Application}.
+ *
+ * @param app gRPC message
+ * @return {@link Application}
+ */
+ public static Application translate(ApplicationProto app) {
+
+ Set<Permission> permissions = Sets.newHashSet();
+
+ app.getPermissionsList().forEach(p ->
+ permissions.add(PermissionProtoTranslator.translate(p)));
+
+ return DefaultApplication.builder()
+ .withAppId(ApplicationIdProtoTranslator.translate(app.getAppId()))
+ .withVersion(VersionProtoTranslator.translate(app.getVersion()))
+ .withTitle(app.getTitle())
+ .withDescription(app.getDescription())
+ .withOrigin(app.getOrigin())
+ .withCategory(app.getCategory())
+ .withUrl(app.getUrl())
+ .withReadme(app.getReadme())
+ .withIcon(app.toByteArray())
+ .withRole(ApplicationEnumsProtoTranslator.translate(app.getRole()).get())
+ .withPermissions(permissions)
+ .withFeatures(app.getFeaturesList())
+ .withFeaturesRepo(Optional.empty()) // TODO: need to add features repo
+ .withRequiredApps(app.getRequiredAppsList())
+ .build();
+ }
+
+ /**
+ * Translates {@link Application} to gRPC Application message.
+ *
+ * @param application {@link Application}
+ * @return gRPC message
+ */
+ public static ApplicationProto translate(Application application) {
+
+ if (application != null) {
+ return ApplicationProto.newBuilder()
+ .setAppId(ApplicationIdProtoTranslator.translate(application.id()))
+ .setCategory(application.category())
+ .setDescription(application.description())
+ .setOrigin(application.origin())
+ .setReadme(application.readme())
+ .setTitle(application.title())
+ .setUrl(application.url())
+ .setVersion(VersionProtoTranslator.translate(application.version()))
+ .setRole(ApplicationEnumsProtoTranslator.translate(application.role()))
+ .addAllFeatures(application.features())
+ .addAllPermissions(application.permissions().stream().map(p ->
+ PermissionProtoTranslator.translate(p)).collect(Collectors.toList()))
+ .addAllRequiredApps(application.requiredApps())
+ .build();
+ }
+
+ return getDefaultInstance();
+ }
+
+ // Utility class not intended for instantiation.
+ private ApplicationProtoTranslator() {}
+}
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/core/VersionProtoTranslator.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/core/VersionProtoTranslator.java
new file mode 100644
index 0000000..6e0c243
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/core/VersionProtoTranslator.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.protobuf.models.core;
+
+import org.onosproject.core.Version;
+import org.onosproject.grpc.core.models.VersionProtoOuterClass.VersionProto;
+
+import static org.onosproject.grpc.core.models.VersionProtoOuterClass.VersionProto.getDefaultInstance;
+
+/**
+ * gRPC Version message to equivalent ONOS Version conversion related utilities.
+ */
+public final class VersionProtoTranslator {
+
+ /**
+ * Translates {@link Version} to gRPC version message.
+ *
+ * @param version {@link Version}
+ * @return gRPC message
+ */
+ public static VersionProto translate(Version version) {
+
+ if (version != null) {
+ return VersionProto.newBuilder()
+ .setMajor(version.major())
+ .setMinor(version.minor())
+ .setPatch(version.patch())
+ .setBuild(version.build())
+ .build();
+ }
+
+ return getDefaultInstance();
+ }
+
+ /**
+ * Translates gRPC version message to {@link Version}.
+ *
+ * @param version gRPC message
+ * @return {@link Version}
+ */
+ public static Version translate(VersionProto version) {
+
+ return Version.version(version.getMajor(), version.getMinor(),
+ version.getPatch(), version.getBuild());
+ }
+
+ // Utility class not intended for instantiation.
+ private VersionProtoTranslator() {}
+}
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/core/package-info.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/core/package-info.java
new file mode 100644
index 0000000..c1de17f
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/core/package-info.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Utilities to handle ProtoBuf version of ONOS core models.
+ */
+package org.onosproject.incubator.protobuf.models.core;
\ No newline at end of file
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/AnnotationsTranslator.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/AnnotationsTranslator.java
new file mode 100644
index 0000000..0b8cb03
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/AnnotationsTranslator.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.protobuf.models.net;
+
+import org.onosproject.net.Annotations;
+import org.onosproject.net.DefaultAnnotations;
+import org.onosproject.net.SparseAnnotations;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * gRPC message conversion related utilities for annotations service.
+ */
+public final class AnnotationsTranslator {
+
+ private static final Logger log = LoggerFactory.getLogger(AnnotationsTranslator.class);
+
+ /**
+ * Converts Annotations to Map of Strings.
+ *
+ * @param annotations {@link Annotations}
+ * @return Map of annotation key and values
+ */
+ public static Map<String, String> asMap(Annotations annotations) {
+ if (annotations instanceof DefaultAnnotations) {
+ return ((DefaultAnnotations) annotations).asMap();
+ }
+ Map<String, String> map = new HashMap<>();
+ annotations.keys()
+ .forEach(k -> map.put(k, annotations.value(k)));
+
+ return map;
+ }
+
+ /**
+ * Converts Map of Strings to {@link SparseAnnotations}.
+ *
+ * @param annotations Map of annotation key and values
+ * @return {@link SparseAnnotations}
+ */
+ public static SparseAnnotations asAnnotations(Map<String, String> annotations) {
+ DefaultAnnotations.Builder builder = DefaultAnnotations.builder();
+ annotations.entrySet().forEach(e -> {
+ if (e.getValue() != null) {
+ builder.set(e.getKey(), e.getValue());
+ } else {
+ builder.remove(e.getKey());
+ }
+ });
+ return builder.build();
+ }
+
+ // Utility class not intended for instantiation.
+ private AnnotationsTranslator() {}
+}
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/ConnectPointProtoTranslator.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/ConnectPointProtoTranslator.java
new file mode 100644
index 0000000..fd149b1
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/ConnectPointProtoTranslator.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.protobuf.models.net;
+
+import org.onlab.packet.IpAddress;
+import org.onosproject.grpc.net.models.ConnectPointProtoOuterClass.ConnectPointProto;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.HostId;
+import org.onosproject.net.IpElementId;
+import org.onosproject.net.PortNumber;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Optional;
+
+/**
+ * gRPC ConnectPoint message to org.onosproject.net.ConnectPoint conversion related utilities.
+ */
+public final class ConnectPointProtoTranslator {
+
+ private static final Logger log = LoggerFactory.getLogger(ConnectPointProtoTranslator.class);
+
+ /**
+ * Translates gRPC ConnectPoint message to Optional of {@link org.onosproject.net.ConnectPoint}.
+ *
+ * @param connectPoint gRPC message
+ * @return Optional of equivalent {@link org.onosproject.net.ConnectPoint} or empty if ElementId is not recognized
+ */
+ public static Optional<ConnectPoint> translate(ConnectPointProto connectPoint) {
+ switch (connectPoint.getElementIdCase()) {
+ case DEVICE_ID:
+ return Optional.of(new ConnectPoint(DeviceId.deviceId(connectPoint.getDeviceId()),
+ PortNumber.portNumber(connectPoint.getPortNumber())));
+ case HOST_ID:
+ return Optional.of(new ConnectPoint(HostId.hostId(connectPoint.getHostId()),
+ PortNumber.portNumber(connectPoint.getPortNumber())));
+ case IP_ELEMENT_ID:
+ return Optional.of(new ConnectPoint(IpElementId.ipElement(IpAddress
+ .valueOf(connectPoint
+ .getIpElementId()
+ )),
+ PortNumber.portNumber(connectPoint.getPortNumber())));
+ default:
+ return Optional.empty();
+ }
+ }
+
+ /**
+ * Translates {@link org.onosproject.net.ConnectPoint} to gRPC ConnectPoint message.
+ *
+ * @param connectPoint {@link org.onosproject.net.ConnectPoint}
+ * @return gRPC ConnectPoint message
+ */
+ public static ConnectPointProto translate(ConnectPoint connectPoint) {
+
+ if (connectPoint.elementId() instanceof DeviceId) {
+ return ConnectPointProto.newBuilder().setDeviceId(connectPoint.deviceId().toString())
+ .setPortNumber(connectPoint.port().toString())
+ .build();
+ } else if (connectPoint.elementId() instanceof HostId) {
+ return ConnectPointProto.newBuilder().setHostId(connectPoint.hostId().toString())
+ .setPortNumber(connectPoint.port().toString())
+ .build();
+ } else if (connectPoint.ipElementId() != null) {
+ return ConnectPointProto.newBuilder().setIpElementId(connectPoint.ipElementId().toString())
+ .setPortNumber(connectPoint.port().toString())
+ .build();
+ } else {
+ log.warn("Unrecognized ElementId", connectPoint);
+ throw new IllegalArgumentException("Unrecognized ElementId");
+ }
+ }
+
+ // Utility class not intended for instantiation.
+ private ConnectPointProtoTranslator() {}
+}
\ No newline at end of file
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/HostIdProtoTranslator.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/HostIdProtoTranslator.java
new file mode 100644
index 0000000..859cca4
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/HostIdProtoTranslator.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.incubator.protobuf.models.net;
+
+import org.onlab.packet.MacAddress;
+import org.onlab.packet.VlanId;
+import org.onosproject.grpc.net.models.HostIdProtoOuterClass.HostIdProto;
+import org.onosproject.net.HostId;
+
+/**
+ * gRPC HostIdProto message to equivalent ONOS HostId conversion related utilities.
+ */
+public final class HostIdProtoTranslator {
+
+ /**
+ * Translates gRPC HostId to {@link HostId}.
+ *
+ * @param hostId gRPC message
+ * @return {@link HostId}
+ */
+ public static HostId translate(HostIdProto hostId) {
+
+ if (hostId.equals(HostIdProto.getDefaultInstance())) {
+ return null;
+ }
+
+ return HostId.hostId(MacAddress.valueOf(hostId.getMac()), VlanId.vlanId((short) hostId.getVlanId()));
+ }
+
+ /**
+ * Translates {@link HostId} to gRPC HostId message.
+ *
+ * @param hostId {@link HostId}
+ * @return gRPC HostId message
+ */
+ public static HostIdProto translate(HostId hostId) {
+
+ if (hostId != null) {
+ return HostIdProto.newBuilder()
+ .setMac(hostId.mac().toString())
+ .setVlanId(hostId.vlanId().toShort())
+ .build();
+ }
+
+ return HostIdProto.getDefaultInstance();
+ }
+
+ // Utility class not intended for instantiation.
+ private HostIdProtoTranslator() {}
+}
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/HostLocationProtoTranslator.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/HostLocationProtoTranslator.java
new file mode 100644
index 0000000..098a276
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/HostLocationProtoTranslator.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.incubator.protobuf.models.net;
+
+import org.onosproject.grpc.net.models.ConnectPointProtoOuterClass.ConnectPointProto;
+import org.onosproject.grpc.net.models.HostLocationProtoOuterClass.HostLocationProto;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.HostLocation;
+import org.onosproject.net.PortNumber;
+
+/**
+ * gRPC HostLocationProto message to equivalent ONOS Host location conversion related utilities.
+ */
+public final class HostLocationProtoTranslator {
+
+ /**
+ * Translates gRPC HostLocation to {@link HostLocation}.
+ *
+ * @param hostLocation gRPC message
+ * @return {@link HostLocation}
+ */
+ public static HostLocation translate(HostLocationProto hostLocation) {
+
+ if (hostLocation.equals(HostLocationProto.getDefaultInstance())) {
+ return null;
+ }
+
+ return new HostLocation(DeviceId.deviceId(hostLocation.getConnectPoint().getDeviceId()),
+ PortNumber.portNumber(hostLocation.getConnectPoint().getPortNumber()), 0L);
+ }
+
+ /**
+ * Translates {@link HostLocation} to gRPC HostLocation message.
+ *
+ * @param hostLocation {@link HostLocation}
+ * @return gRPC HostLocation message
+ */
+ public static HostLocationProto translate(HostLocation hostLocation) {
+
+ if (hostLocation != null) {
+ return HostLocationProto.newBuilder()
+ .setConnectPoint(ConnectPointProto.newBuilder()
+ .setDeviceId(hostLocation.deviceId().toString())
+ .setPortNumber(hostLocation.port().toString()))
+ .setTime(hostLocation.time())
+ .build();
+ }
+
+ return HostLocationProto.getDefaultInstance();
+ }
+
+ // Utility class not intended for instantiation.
+ private HostLocationProtoTranslator() {}
+}
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/HostProtoTranslator.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/HostProtoTranslator.java
new file mode 100644
index 0000000..c12fd7f
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/HostProtoTranslator.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.incubator.protobuf.models.net;
+
+import org.onlab.packet.IpAddress;
+import org.onlab.packet.MacAddress;
+import org.onlab.packet.VlanId;
+import org.onosproject.grpc.net.models.HostProtoOuterClass.HostProto;
+import org.onosproject.net.DefaultAnnotations;
+import org.onosproject.net.DefaultHost;
+import org.onosproject.net.Host;
+
+import java.util.stream.Collectors;
+
+/**
+ * gRPC HostProto message to equivalent ONOS Host conversion related utilities.
+ */
+public final class HostProtoTranslator {
+
+
+ /**
+ * Translates {@link Host} to gRPC Host message.
+ *
+ * @param host {@link Host}
+ * @return gRPC HostProto message
+ */
+ public static HostProto translate(Host host) {
+
+ if (host != null) {
+ return HostProto.newBuilder()
+ .setHostId(HostIdProtoTranslator.translate(host.id()))
+ .setConfigured(host.configured())
+ .setVlan(host.vlan().toShort())
+ .addAllIpAddresses(host.ipAddresses().stream()
+ .map(IpAddress::toString)
+ .collect(Collectors.toList()))
+ .setLocation(HostLocationProtoTranslator.translate(host.location()))
+ .build();
+ }
+
+ return HostProto.getDefaultInstance();
+ }
+
+ /**
+ * Translates gRPC Host message to {@link Host}.
+ *
+ * @param host gRPC message
+ * @return {@link Host}
+ */
+ public static Host translate(HostProto host) {
+ if (host.equals(HostProto.getDefaultInstance())) {
+ return null;
+ }
+
+ return new DefaultHost(ProviderIdProtoTranslator.translate(host.getProviderId()),
+ HostIdProtoTranslator.translate(host.getHostId()),
+ MacAddress.valueOf(host.getHostId().getMac()),
+ VlanId.vlanId((short) host.getVlan()),
+ HostLocationProtoTranslator.translate(host.getLocation()),
+ host.getIpAddressesList().stream().map(x -> IpAddress.valueOf(x))
+ .collect(Collectors.toSet()),
+ DefaultAnnotations.builder().putAll(host.getAnnotationsMap()).build());
+ }
+
+ // Utility class not intended for instantiation.
+ private HostProtoTranslator() {}
+}
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/LinkProtoTranslator.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/LinkProtoTranslator.java
new file mode 100644
index 0000000..770d835
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/LinkProtoTranslator.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.protobuf.models.net;
+
+import org.onosproject.incubator.protobuf.models.net.link.LinkEnumsProtoTranslator;
+import org.onosproject.grpc.net.models.LinkProtoOuterClass;
+import org.onosproject.net.Annotations;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.DefaultAnnotations;
+import org.onosproject.net.DefaultLink;
+import org.onosproject.net.Link;
+import org.onosproject.net.SparseAnnotations;
+import org.onosproject.net.provider.ProviderId;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * gRPC LinkProto message to equivalent ONOS Link conversion related utilities.
+ */
+public final class LinkProtoTranslator {
+
+ /**
+ * Translates gRPC LinkCore message to {@link Link}.
+ *
+ * @param link gRPC message
+ * @return {@link Link} null if link is a default instance
+ */
+ public static Link translate(LinkProtoOuterClass.LinkProto link) {
+ if (link.equals(LinkProtoOuterClass.LinkProto.getDefaultInstance())) {
+ return null;
+ }
+ ProviderId providerId = ProviderIdProtoTranslator.translate(link.getProviderId());
+ Link.State state = LinkEnumsProtoTranslator.translate(link.getState()).get();
+ ConnectPoint src = ConnectPointProtoTranslator.translate(link.getSrc()).get();
+ ConnectPoint dst = ConnectPointProtoTranslator.translate(link.getDst()).get();
+ Link.Type type = LinkEnumsProtoTranslator.translate(link.getType()).get();
+ Annotations annots = asAnnotations(link.getAnnotations());
+ Boolean isExpected = link.getIsExpected();
+ return DefaultLink.builder().state(state)
+ .annotations(annots)
+ .providerId(providerId)
+ .src(src)
+ .dst(dst)
+ .type(type)
+ .isExpected(isExpected)
+ .build();
+ }
+
+ /**
+ * Translates {@link Link} to gRPC LinkCore message.
+ *
+ * @param link {@link Link}
+ * @return gRPC LinkCore message
+ */
+ public static LinkProtoOuterClass.LinkProto translate(Link link) {
+ if (link == null) {
+ return LinkProtoOuterClass.LinkProto.getDefaultInstance();
+ }
+ return LinkProtoOuterClass.LinkProto.newBuilder()
+ .setProviderId(ProviderIdProtoTranslator.translate(link.providerId()))
+ .setState(LinkEnumsProtoTranslator.translate(link.state()))
+ .setSrc(ConnectPointProtoTranslator.translate(link.src()))
+ .setDst(ConnectPointProtoTranslator.translate(link.dst()))
+ .setType(LinkEnumsProtoTranslator.translate(link.type()))
+ .setIsExpected(link.isExpected())
+ .build();
+ }
+
+ // may be this can be moved to Annotation itself or AnnotationsUtils
+
+ /**
+ * Converts Map of Strings to {@link SparseAnnotations}.
+ *
+ * @param annotations Map of annotation key and values
+ * @return {@link SparseAnnotations}
+ */
+ public static SparseAnnotations asAnnotations(Map<String, String> annotations) {
+ DefaultAnnotations.Builder builder = DefaultAnnotations.builder();
+ annotations.entrySet().forEach(e -> {
+ if (e.getValue() != null) {
+ builder.set(e.getKey(), e.getValue());
+ } else {
+ builder.remove(e.getKey());
+ }
+ });
+ return builder.build();
+ }
+
+ /**
+ * Converts Annotations to Map of Strings.
+ *
+ * @param annotations {@link Annotations}
+ * @return Map of annotation key and values
+ */
+ public static Map<String, String> asMap(Annotations annotations) {
+ if (annotations instanceof DefaultAnnotations) {
+ return ((DefaultAnnotations) annotations).asMap();
+ }
+ Map<String, String> map = new HashMap<>();
+ annotations.keys()
+ .forEach(k -> map.put(k, annotations.value(k)));
+
+ return map;
+ }
+
+ // Utility class not intended for instantiation.
+ private LinkProtoTranslator() {
+ }
+
+}
+
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/MastershipRoleProtoTranslator.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/MastershipRoleProtoTranslator.java
new file mode 100644
index 0000000..d10c621
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/MastershipRoleProtoTranslator.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.protobuf.models.net;
+
+import org.onosproject.grpc.net.models.MastershipRoleProtoOuterClass;
+import org.onosproject.net.MastershipRole;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Optional;
+
+/**
+ * gRPC MastershipRoleProto message to equivalent ONOS MastershipRole conversion related utilities.
+ */
+public final class MastershipRoleProtoTranslator {
+
+ private static final Logger log = LoggerFactory.getLogger(MastershipRoleProtoTranslator.class);
+
+ /**
+ * Translates {@link MastershipRole} to gRPC MastershipRole.
+ *
+ * @param mastershipRole {@link MastershipRole}
+ * @return gRPC message
+ */
+ public static MastershipRoleProtoOuterClass.MastershipRoleProto translate(MastershipRole mastershipRole) {
+
+ switch (mastershipRole) {
+ case MASTER:
+ return MastershipRoleProtoOuterClass.MastershipRoleProto.MASTER;
+ case STANDBY:
+ return MastershipRoleProtoOuterClass.MastershipRoleProto.STANDBY;
+ case NONE:
+ return MastershipRoleProtoOuterClass.MastershipRoleProto.NONE;
+
+ default:
+ log.warn("Unexpected mastership role: {}", mastershipRole);
+ return MastershipRoleProtoOuterClass.MastershipRoleProto.NONE;
+ }
+ }
+
+ /**
+ * Translate gRPC MastershipRole to {@link MastershipRole}.
+ *
+ * @param mastershipRole gRPC message
+ * @return {@link MastershipRole}
+ */
+ public static Optional<Object> translate(MastershipRoleProtoOuterClass.MastershipRoleProto mastershipRole) {
+
+ switch (mastershipRole) {
+ case MASTER:
+ return Optional.of(MastershipRole.MASTER);
+ case STANDBY:
+ return Optional.of(MastershipRole.STANDBY);
+ case UNRECOGNIZED:
+ return Optional.of(MastershipRole.NONE);
+
+ default:
+ log.warn("Unexpected mastership role: {}", mastershipRole);
+ return Optional.empty();
+ }
+ }
+
+ // Utility class not intended for instantiation.
+ private MastershipRoleProtoTranslator() {}
+}
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/ProviderIdProtoTranslator.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/ProviderIdProtoTranslator.java
new file mode 100644
index 0000000..8ee4fe5
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/ProviderIdProtoTranslator.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.protobuf.models.net;
+
+import org.onosproject.grpc.net.models.ProviderIdProtoOuterClass;
+import org.onosproject.net.provider.ProviderId;
+
+/**
+ * gRPC ProviderId message to org.onosproject.net.provider.ProviderId conversion related utilities.
+ */
+public final class ProviderIdProtoTranslator {
+
+ /**
+ * Translates gRPC ProviderId message to {@link org.onosproject.net.provider.ProviderId}.
+ *
+ * @param providerId gRPC ProviderId message
+ * @return {@link org.onosproject.net.provider.ProviderId} or null if providerId is a default instance
+ */
+ public static ProviderId translate(ProviderIdProtoOuterClass.ProviderIdProto providerId) {
+ if (providerId.equals(ProviderIdProtoOuterClass.ProviderIdProto.getDefaultInstance())) {
+ return null;
+ }
+ return new ProviderId(providerId.getScheme(), providerId.getId(), providerId.getAncillary());
+ }
+
+ /**
+ * Translates {@link org.onosproject.net.provider.ProviderId} to gRPC ProviderId message.
+ *
+ * @param providerId {@link org.onosproject.net.provider.ProviderId}
+ * @return gRPC ProviderId message
+ */
+ public static ProviderIdProtoOuterClass.ProviderIdProto translate(ProviderId providerId) {
+ if (providerId == null) {
+ return ProviderIdProtoOuterClass.ProviderIdProto.getDefaultInstance();
+ }
+ return ProviderIdProtoOuterClass.ProviderIdProto.newBuilder()
+ .setScheme(providerId.scheme())
+ .setId(providerId.id())
+ .setAncillary(providerId.isAncillary())
+ .build();
+ }
+
+
+ // Utility class not intended for instantiation.
+ private ProviderIdProtoTranslator() {}
+
+}
+
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/RegionProtoTranslator.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/RegionProtoTranslator.java
new file mode 100644
index 0000000..f426982
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/RegionProtoTranslator.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.protobuf.models.net;
+
+import com.google.common.base.Strings;
+import org.onosproject.incubator.protobuf.models.net.region.RegionEnumsProtoTranslator;
+import org.onosproject.cluster.NodeId;
+import org.onosproject.grpc.net.models.RegionProtoOuterClass;
+import org.onosproject.net.Annotations;
+import org.onosproject.net.region.DefaultRegion;
+import org.onosproject.net.region.Region;
+import org.onosproject.net.region.RegionId;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * gRPC Region message to @link org.onosproject.net.region.Region conversion related utilities for region service.
+ */
+public final class RegionProtoTranslator {
+
+ /**
+ * Translates gRPC RegionProto message to {@link org.onosproject.net.region.Region}.
+ *
+ * @param region gRPC message
+ * @return {@link org.onosproject.net.region.Region}
+ */
+ public static Region translate(RegionProtoOuterClass.RegionProto region) {
+ RegionId id = RegionId.regionId(region.getRegionId());
+ Region.Type type = RegionEnumsProtoTranslator.translate(region.getType()).get();
+ String name = Strings.nullToEmpty(region.getName());
+
+ List<Set<NodeId>> masters = new ArrayList<>();
+
+ region.getMastersList().forEach(s -> {
+ Set<NodeId> nodeIdSet = new HashSet<NodeId>();
+ s.getNodeIdList().forEach(n -> {
+ nodeIdSet.add(new NodeId(n));
+ });
+ masters.add(nodeIdSet);
+ });
+
+ Annotations annots = AnnotationsTranslator.asAnnotations(region.getAnnotations());
+
+ return new DefaultRegion(id, name, type, annots, masters);
+ }
+
+ /**
+ * Translates {@link org.onosproject.net.region.Region} to gRPC RegionProto message.
+ *
+ * @param region {@link org.onosproject.net.region.Region}
+ * @return gRPC RegionProto message
+ */
+ public static RegionProtoOuterClass.RegionProto translate(Region region) {
+ return RegionProtoOuterClass.RegionProto.newBuilder()
+ .setRegionId(region.id().toString())
+ .setType(RegionEnumsProtoTranslator.translate(region.type()))
+ .setName(region.name().isEmpty() ? null : region.name())
+ .addAllMasters(region.masters()
+ .stream()
+ .map(s -> RegionProtoOuterClass.RegionProto.NodeIdSet
+ .newBuilder()
+ .addAllNodeId(s.stream().map(id ->
+ id.toString()).collect(Collectors.toList()))
+ .build())
+ .collect(Collectors.toList()))
+ .build();
+ }
+
+ // Utility class not intended for instantiation.
+ private RegionProtoTranslator() {}
+
+}
+
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/device/DeviceProtoTranslator.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/device/DeviceProtoTranslator.java
new file mode 100644
index 0000000..90d10f5
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/device/DeviceProtoTranslator.java
@@ -0,0 +1,174 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.protobuf.models.net.device;
+
+import org.onlab.packet.ChassisId;
+import org.onosproject.grpc.net.device.models.DeviceDescriptionProtoOuterClass;
+import org.onosproject.grpc.net.device.models.DeviceDescriptionProtoOuterClass.DeviceDescriptionProto;
+import org.onosproject.grpc.net.device.models.DeviceEnumsProto.DeviceTypeProto;
+import org.onosproject.incubator.protobuf.models.net.AnnotationsTranslator;
+import org.onosproject.net.Device.Type;
+import org.onosproject.net.device.DefaultDeviceDescription;
+import org.onosproject.net.device.DeviceDescription;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.net.URI;
+
+/**
+ * gRPC message conversion related utilities for device service.
+ */
+public final class DeviceProtoTranslator {
+
+ private static final Logger log = LoggerFactory.getLogger(DeviceProtoTranslator.class);
+
+ /**
+ * Translates gRPC DeviceDescription to {@link DeviceDescriptionProtoOuterClass}.
+ *
+ * @param deviceDescription gRPC message
+ * @return {@link DeviceDescriptionProtoOuterClass}
+ */
+ public static DeviceDescription translate(
+ DeviceDescriptionProto deviceDescription) {
+ URI uri = URI.create(deviceDescription.getDeviceUri());
+ Type type = translate(deviceDescription.getType());
+ String manufacturer = deviceDescription.getManufacturer();
+ String hwVersion = deviceDescription.getHwVersion();
+ String swVersion = deviceDescription.getSwVersion();
+ String serialNumber = deviceDescription.getSerialNumber();
+ ChassisId chassis = new ChassisId(deviceDescription.getChassisId());
+ boolean defaultAvailable = deviceDescription.getIsDefaultAvailable();
+ return new DefaultDeviceDescription(uri, type, manufacturer,
+ hwVersion, swVersion, serialNumber,
+ chassis,
+ defaultAvailable,
+ AnnotationsTranslator.asAnnotations(deviceDescription.getAnnotationsMap()));
+ }
+
+ /**
+ * Translates {@link DeviceDescription} to gRPC DeviceDescription message.
+ *
+ * @param deviceDescription {@link DeviceDescription}
+ * @return gRPC DeviceDescription message
+ */
+ public static DeviceDescriptionProto translate(
+ DeviceDescription deviceDescription) {
+
+ return DeviceDescriptionProto.newBuilder()
+ .setDeviceUri(deviceDescription.deviceUri().toString())
+ .setType(translate(deviceDescription.type()))
+ .setManufacturer(deviceDescription.manufacturer())
+ .setHwVersion(deviceDescription.hwVersion())
+ .setSwVersion(deviceDescription.swVersion())
+ .setSerialNumber(deviceDescription.serialNumber())
+ .setChassisId(deviceDescription.chassisId().toString())
+ .setIsDefaultAvailable(deviceDescription.isDefaultAvailable())
+ .putAllAnnotations(AnnotationsTranslator.asMap(deviceDescription.annotations()))
+ .build();
+ }
+
+
+ /**
+ * Translates gRPC DeviceType to {@link Type}.
+ *
+ * @param type gRPC message
+ * @return {@link Type}
+ */
+ public static Type translate(DeviceTypeProto type) {
+ switch (type) {
+ case BALANCER:
+ return Type.BALANCER;
+ case CONTROLLER:
+ return Type.CONTROLLER;
+ case FIBER_SWITCH:
+ return Type.FIBER_SWITCH;
+ case FIREWALL:
+ return Type.FIREWALL;
+ case IDS:
+ return Type.IDS;
+ case IPS:
+ return Type.IPS;
+ case MICROWAVE:
+ return Type.MICROWAVE;
+ case OTHER:
+ return Type.OTHER;
+ case OTN:
+ return Type.OTN;
+ case ROADM:
+ return Type.ROADM;
+ case ROADM_OTN:
+ return Type.ROADM_OTN;
+ case ROUTER:
+ return Type.ROUTER;
+ case SWITCH:
+ return Type.SWITCH;
+ case VIRTUAL_DEVICE:
+ return Type.VIRTUAL;
+
+ case UNRECOGNIZED:
+ default:
+ log.warn("Unexpected DeviceType: {}", type);
+ return Type.OTHER;
+ }
+ }
+
+ /**
+ * Translates {@link Type} to gRPC DeviceType.
+ *
+ * @param type {@link Type}
+ * @return gRPC message
+ */
+ public static DeviceTypeProto translate(Type type) {
+ switch (type) {
+ case BALANCER:
+ return DeviceTypeProto.BALANCER;
+ case CONTROLLER:
+ return DeviceTypeProto.CONTROLLER;
+ case FIBER_SWITCH:
+ return DeviceTypeProto.FIBER_SWITCH;
+ case FIREWALL:
+ return DeviceTypeProto.FIREWALL;
+ case IDS:
+ return DeviceTypeProto.IDS;
+ case IPS:
+ return DeviceTypeProto.IPS;
+ case MICROWAVE:
+ return DeviceTypeProto.MICROWAVE;
+ case OTHER:
+ return DeviceTypeProto.OTHER;
+ case OTN:
+ return DeviceTypeProto.OTN;
+ case ROADM:
+ return DeviceTypeProto.ROADM;
+ case ROADM_OTN:
+ return DeviceTypeProto.ROADM_OTN;
+ case ROUTER:
+ return DeviceTypeProto.ROUTER;
+ case SWITCH:
+ return DeviceTypeProto.SWITCH;
+ case VIRTUAL:
+ return DeviceTypeProto.VIRTUAL_DEVICE;
+
+ default:
+ log.warn("Unexpected Device.Type: {}", type);
+ return DeviceTypeProto.OTHER;
+ }
+ }
+
+ // Utility class not intended for instantiation.
+ private DeviceProtoTranslator() {
+ }
+}
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/device/PortProtoTranslator.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/device/PortProtoTranslator.java
new file mode 100644
index 0000000..ff39987
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/device/PortProtoTranslator.java
@@ -0,0 +1,166 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.protobuf.models.net.device;
+
+import org.onosproject.grpc.net.device.models.PortDescriptionProtoOuterClass.PortDescriptionProto;
+import org.onosproject.grpc.net.device.models.PortEnumsProto;
+import org.onosproject.grpc.net.device.models.PortStatisticsProtoOuterClass;
+import org.onosproject.grpc.net.device.models.PortStatisticsProtoOuterClass.PortStatisticsProto;
+import org.onosproject.incubator.protobuf.models.net.AnnotationsTranslator;
+import org.onosproject.net.Port;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.SparseAnnotations;
+import org.onosproject.net.device.DefaultPortDescription;
+import org.onosproject.net.device.DefaultPortStatistics;
+import org.onosproject.net.device.PortDescription;
+import org.onosproject.net.device.PortStatistics;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Optional;
+
+/**
+ * gRPC message conversion related utilities for port service.
+ */
+public final class PortProtoTranslator {
+
+ private static final Logger log = LoggerFactory.getLogger(PortProtoTranslator.class);
+
+ /**
+ * Translates gRPC PortDescription message to {@link PortDescription}.
+ *
+ * @param portDescription gRPC message
+ * @return {@link PortDescription}
+ */
+ public static PortDescription translate(PortDescriptionProto portDescription) {
+ PortNumber number = PortNumber.fromString(portDescription.getPortNumber());
+ boolean isEnabled = portDescription.getIsEnabled();
+ Port.Type type = translate(portDescription.getType()).get();
+ long portSpeed = portDescription.getPortSpeed();
+ SparseAnnotations annotations = AnnotationsTranslator.asAnnotations(portDescription.getAnnotationsMap());
+ // TODO How to deal with more specific Port...
+ return DefaultPortDescription.builder().withPortNumber(number).isEnabled(isEnabled)
+ .type(type).portSpeed(portSpeed).annotations(annotations)
+ .build();
+ }
+
+ /**
+ * Translates {@link PortDescription} to gRPC PortDescription message.
+ *
+ * @param portDescription {@link PortDescription}
+ * @return gRPC PortDescription message
+ */
+ public static PortDescriptionProto translate(PortDescription portDescription) {
+ return PortDescriptionProto.newBuilder()
+ .setPortNumber(portDescription.portNumber().toString())
+ .setIsEnabled(portDescription.isEnabled())
+ .setType(translate(portDescription.type()))
+ .setPortSpeed(portDescription.portSpeed())
+ .putAllAnnotations(AnnotationsTranslator.asMap(portDescription.annotations()))
+ .build();
+ }
+
+ /**
+ * Translates gRPC PortType to {@link Port.Type}.
+ *
+ * @param type gRPC message
+ * @return {@link Port.Type}
+ */
+ public static Optional<Port.Type> translate(PortEnumsProto.PortTypeProto type) {
+ switch (type) {
+ case COPPER:
+ return Optional.of(Port.Type.COPPER);
+ case FIBER:
+ return Optional.of(Port.Type.FIBER);
+ case OCH:
+ return Optional.of(Port.Type.OCH);
+ case ODUCLT:
+ return Optional.of(Port.Type.ODUCLT);
+ case OMS:
+ return Optional.of(Port.Type.OMS);
+ case PACKET:
+ return Optional.of(Port.Type.PACKET);
+ case VIRTUAL_PORT:
+ return Optional.of(Port.Type.VIRTUAL);
+
+ default:
+ log.warn("Unexpected PortType: {}", type);
+ return Optional.empty();
+ }
+ }
+
+ /**
+ * Translates {@link Port.Type} to gRPC PortType.
+ *
+ * @param type {@link Port.Type}
+ * @return gRPC message
+ */
+ public static PortEnumsProto.PortTypeProto translate(Port.Type type) {
+ switch (type) {
+ case COPPER:
+ return PortEnumsProto.PortTypeProto.COPPER;
+ case FIBER:
+ return PortEnumsProto.PortTypeProto.FIBER;
+ case OCH:
+ return PortEnumsProto.PortTypeProto.OCH;
+ case ODUCLT:
+ return PortEnumsProto.PortTypeProto.ODUCLT;
+ case OMS:
+ return PortEnumsProto.PortTypeProto.OMS;
+ case PACKET:
+ return PortEnumsProto.PortTypeProto.PACKET;
+ case VIRTUAL:
+ return PortEnumsProto.PortTypeProto.VIRTUAL_PORT;
+
+ default:
+ log.warn("Unexpected Port.Type: {}", type);
+ return PortEnumsProto.PortTypeProto.UNRECOGNIZED;
+ }
+ }
+
+ /**
+ * Translates gRPC PortStatistics message to {@link PortStatisticsProtoOuterClass}.
+ *
+ * @param portStatistics gRPC PortStatistics message
+ * @return {@link PortStatisticsProtoOuterClass}
+ */
+ public static PortStatistics translate(PortStatisticsProto portStatistics) {
+ // TODO implement adding missing fields
+ return DefaultPortStatistics.builder()
+ .setPort(portStatistics.getPort())
+ .setPacketsReceived(portStatistics.getPacketsReceived())
+ .setPacketsSent(portStatistics.getPacketsSent())
+ .build();
+ }
+
+ /**
+ * Translates {@link PortStatistics} to gRPC PortStatistics message.
+ *
+ * @param portStatistics {@link PortStatistics}
+ * @return gRPC PortStatistics message
+ */
+ public static PortStatisticsProto translate(PortStatistics portStatistics) {
+ // TODO implement adding missing fields
+ return PortStatisticsProto.newBuilder()
+ .setPort(portStatistics.port())
+ .setPacketsReceived(portStatistics.packetsReceived())
+ .setPacketsSent(portStatistics.packetsSent())
+ .build();
+ }
+
+ // Utility class not intended for instantiation.
+ private PortProtoTranslator() {}
+}
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/device/package-info.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/device/package-info.java
new file mode 100644
index 0000000..5239102
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/device/package-info.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Utilities to handle ProtoBuf version of ONOS device models.
+ */
+package org.onosproject.incubator.protobuf.models.net.device;
\ No newline at end of file
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/flow/FlowEntryEnumsProtoTranslator.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/flow/FlowEntryEnumsProtoTranslator.java
new file mode 100644
index 0000000..f6c590b
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/flow/FlowEntryEnumsProtoTranslator.java
@@ -0,0 +1,140 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.protobuf.models.net.flow;
+
+import org.onosproject.grpc.net.flow.models.FlowEntryEnumsProto;
+import org.onosproject.net.flow.FlowEntry.FlowEntryState;
+import org.onosproject.net.flow.FlowEntry.FlowLiveType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Optional;
+
+
+/**
+ * gRPC FlowEntryEnumsProto message to equivalent ONOS FlowEntry enums conversion related utilities.
+ */
+public final class FlowEntryEnumsProtoTranslator {
+
+ private static final Logger log = LoggerFactory.getLogger(FlowEntryEnumsProtoTranslator.class);
+
+ /**
+ * Translates {@link FlowEntryState} to gRPC FlowEntryState.
+ *
+ * @param flowEntryState {@link FlowEntryState}
+ * @return gRPC message
+ */
+ public static FlowEntryEnumsProto.FlowEntryStateProto translate(FlowEntryState flowEntryState) {
+
+ switch (flowEntryState) {
+ case PENDING_ADD:
+ return FlowEntryEnumsProto.FlowEntryStateProto.PENDING_ADD;
+ case ADDED:
+ return FlowEntryEnumsProto.FlowEntryStateProto.ADDED;
+ case PENDING_REMOVE:
+ return FlowEntryEnumsProto.FlowEntryStateProto.PENDING_REMOVE;
+ case REMOVED:
+ return FlowEntryEnumsProto.FlowEntryStateProto.REMOVED;
+ case FAILED:
+ return FlowEntryEnumsProto.FlowEntryStateProto.FAILED;
+
+ default:
+ log.warn("Unexpected flow entry state: {}", flowEntryState);
+ return FlowEntryEnumsProto.FlowEntryStateProto.UNRECOGNIZED;
+ }
+ }
+
+ /**
+ * Translates gRPC FlowEntryState to {@link FlowEntryState}.
+ *
+ * @param flowEntryState gRPC message
+ * @return {@link FlowEntryState}
+ */
+ public static Optional<FlowEntryState> translate(FlowEntryEnumsProto.FlowEntryStateProto flowEntryState) {
+
+ switch (flowEntryState) {
+ case PENDING_ADD:
+ return Optional.of(FlowEntryState.PENDING_ADD);
+ case ADDED:
+ return Optional.of(FlowEntryState.ADDED);
+ case PENDING_REMOVE:
+ return Optional.of(FlowEntryState.PENDING_REMOVE);
+ case REMOVED:
+ return Optional.of(FlowEntryState.REMOVED);
+ case FAILED:
+ return Optional.of(FlowEntryState.FAILED);
+
+ default:
+ log.warn("Unexpected flow entry state: {}", flowEntryState);
+ return Optional.empty();
+ }
+ }
+
+ /**
+ * Translates {@link FlowLiveType} to gRPC FlowLiveType.
+ *
+ * @param flowLiveType {@link FlowLiveType}
+ * @return gRPC message
+ */
+ public static FlowEntryEnumsProto.FlowLiveTypeProto translate(FlowLiveType flowLiveType) {
+
+ switch (flowLiveType) {
+ case IMMEDIATE:
+ return FlowEntryEnumsProto.FlowLiveTypeProto.IMMEDIATE;
+ case SHORT:
+ return FlowEntryEnumsProto.FlowLiveTypeProto.SHORT;
+ case MID:
+ return FlowEntryEnumsProto.FlowLiveTypeProto.MID;
+ case LONG:
+ return FlowEntryEnumsProto.FlowLiveTypeProto.LONG;
+ case UNKNOWN:
+ return FlowEntryEnumsProto.FlowLiveTypeProto.UNKNOWN;
+
+ default:
+ log.warn("Unexpected flow live type : {}", flowLiveType);
+ return FlowEntryEnumsProto.FlowLiveTypeProto.UNRECOGNIZED;
+ }
+ }
+
+ /**
+ * Translates gRPC FlowLiveType to {@link FlowLiveType}.
+ *
+ * @param flowLiveType gRPC message
+ * @return {@link FlowLiveType}
+ */
+ public static Optional<FlowLiveType> translate(FlowEntryEnumsProto.FlowLiveTypeProto flowLiveType) {
+
+ switch (flowLiveType) {
+ case IMMEDIATE:
+ return Optional.of(FlowLiveType.IMMEDIATE);
+ case SHORT:
+ return Optional.of(FlowLiveType.SHORT);
+ case MID:
+ return Optional.of(FlowLiveType.MID);
+ case LONG:
+ return Optional.of(FlowLiveType.LONG);
+ case UNKNOWN:
+ return Optional.of(FlowLiveType.UNKNOWN);
+
+ default:
+ log.warn("Unexpected flow live type : {}", flowLiveType);
+ return Optional.empty();
+ }
+ }
+
+ // Utility class not intended for instantiation.
+ private FlowEntryEnumsProtoTranslator() {}
+}
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/flow/FlowEntryProtoTranslator.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/flow/FlowEntryProtoTranslator.java
new file mode 100644
index 0000000..80ec629
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/flow/FlowEntryProtoTranslator.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.protobuf.models.net.flow;
+
+import org.onosproject.grpc.net.flow.models.FlowEntryProtoOuterClass.FlowEntryProto;
+import org.onosproject.net.flow.DefaultFlowEntry;
+import org.onosproject.net.flow.FlowEntry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * gRPC FlowEntryProto message to equivalent ONOS FlowEntry conversion related utilities.
+ */
+public final class FlowEntryProtoTranslator {
+
+ private static final Logger log = LoggerFactory.getLogger(FlowEntryProtoTranslator.class);
+
+ /**
+ * Translates {@link FlowEntry} to gRPC FlowEntryProto.
+ *
+ * @param flowEntry {@link FlowEntry}
+ * @return gRPC message
+ */
+ public static FlowEntryProto translate(FlowEntry flowEntry) {
+
+ if (flowEntry != null) {
+ FlowEntryProto.Builder builder = FlowEntryProto.newBuilder();
+ builder.setLife(flowEntry.life())
+ .setPackets(flowEntry.packets())
+ .setBytes(flowEntry.bytes())
+ .setLastSeen(flowEntry.lastSeen())
+ .setErrType(flowEntry.errType())
+ .setErrCode(flowEntry.errCode())
+ .setState(FlowEntryEnumsProtoTranslator.translate(flowEntry.state()))
+ .setLiveType(FlowEntryEnumsProtoTranslator.translate(flowEntry.liveType()));
+ return builder.build();
+ }
+
+ return FlowEntryProto.getDefaultInstance();
+ }
+
+ /**
+ * Translates gRPC FlowEntry to {@link FlowEntry}.
+ *
+ * @param flowEntry gRPC message
+ * @return {@link FlowEntry}
+ */
+ public static FlowEntry translate(FlowEntryProto flowEntry) {
+ if (flowEntry.equals(FlowEntryProto.getDefaultInstance())) {
+ return null;
+ }
+
+ FlowEntry.FlowEntryState state =
+ FlowEntryEnumsProtoTranslator.translate(flowEntry.getState()).get();
+ FlowEntry.FlowLiveType liveType =
+ FlowEntryEnumsProtoTranslator.translate(flowEntry.getLiveType()).get();
+
+ // TODO: need to instantiate FlowRule later
+ return new DefaultFlowEntry(null, state, flowEntry.getLife(), liveType,
+ flowEntry.getPackets(), flowEntry.getBytes());
+ }
+
+ // Utility class not intended for instantiation.
+ private FlowEntryProtoTranslator() {}
+}
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/flow/FlowRuleEnumsProtoTranslator.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/flow/FlowRuleEnumsProtoTranslator.java
new file mode 100644
index 0000000..12ddf29
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/flow/FlowRuleEnumsProtoTranslator.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.protobuf.models.net.flow;
+
+import org.onosproject.grpc.net.flow.models.FlowRuleEnumsProto;
+import org.onosproject.net.flow.FlowRule.FlowRemoveReason;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Optional;
+
+/**
+ * gRPC FlowRuleEnumsProto message to equivalent ONOS FlowRule enums conversion related utilities.
+ */
+public final class FlowRuleEnumsProtoTranslator {
+
+ private static final Logger log = LoggerFactory.getLogger(FlowRuleEnumsProtoTranslator.class);
+
+ /**
+ * Translates {@link FlowRemoveReason} to gRPC FlowRemoveReason.
+ *
+ * @param flowRemoveReason {@link FlowRemoveReason}
+ * @return gRPC message
+ */
+ public static FlowRuleEnumsProto.FlowRemoveReasonProto translate(FlowRemoveReason flowRemoveReason) {
+
+ switch (flowRemoveReason) {
+ case DELETE:
+ return FlowRuleEnumsProto.FlowRemoveReasonProto.DELETE;
+ case EVICTION:
+ return FlowRuleEnumsProto.FlowRemoveReasonProto.EVICTION;
+ case GROUP_DELETE:
+ return FlowRuleEnumsProto.FlowRemoveReasonProto.GROUP_DELETE;
+ case METER_DELETE:
+ return FlowRuleEnumsProto.FlowRemoveReasonProto.METER_DELETE;
+ case HARD_TIMEOUT:
+ return FlowRuleEnumsProto.FlowRemoveReasonProto.HARD_TIMEOUT;
+ case IDLE_TIMEOUT:
+ return FlowRuleEnumsProto.FlowRemoveReasonProto.IDLE_TIMEOUT;
+ case NO_REASON:
+ return FlowRuleEnumsProto.FlowRemoveReasonProto.NO_REASON;
+ default:
+ log.warn("Unexpected flow remove reason: {}", flowRemoveReason);
+ return FlowRuleEnumsProto.FlowRemoveReasonProto.UNRECOGNIZED;
+ }
+ }
+
+ /**
+ * Translates gRPC FlowRemoveReason to {@link FlowRemoveReason}.
+ *
+ * @param flowRemoveReason gRPC message
+ * @return {@link FlowRemoveReason}
+ */
+ public static Optional<FlowRemoveReason> translate(FlowRuleEnumsProto.FlowRemoveReasonProto flowRemoveReason) {
+
+ switch (flowRemoveReason) {
+ case DELETE:
+ return Optional.of(FlowRemoveReason.DELETE);
+ case EVICTION:
+ return Optional.of(FlowRemoveReason.EVICTION);
+ case GROUP_DELETE:
+ return Optional.of(FlowRemoveReason.GROUP_DELETE);
+ case METER_DELETE:
+ return Optional.of(FlowRemoveReason.METER_DELETE);
+ case HARD_TIMEOUT:
+ return Optional.of(FlowRemoveReason.HARD_TIMEOUT);
+ case IDLE_TIMEOUT:
+ return Optional.of(FlowRemoveReason.IDLE_TIMEOUT);
+ case NO_REASON:
+ return Optional.of(FlowRemoveReason.NO_REASON);
+ default:
+ log.warn("Unexpected flow remove reason: {}", flowRemoveReason);
+ return Optional.empty();
+ }
+ }
+
+ // Utility class not intended for instantiation.
+ private FlowRuleEnumsProtoTranslator() {}
+}
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/flow/FlowRuleProtoTranslator.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/flow/FlowRuleProtoTranslator.java
new file mode 100644
index 0000000..76046e7
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/flow/FlowRuleProtoTranslator.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.protobuf.models.net.flow;
+
+import org.onosproject.grpc.net.flow.models.FlowRuleProtoOuterClass.FlowRuleProto;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.flow.DefaultFlowRule;
+import org.onosproject.net.flow.FlowRule;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * gRPC FlowRuleProto message to equivalent ONOS FlowRule conversion related utilities.
+ */
+public final class FlowRuleProtoTranslator {
+
+ private static final Logger log = LoggerFactory.getLogger(FlowRuleProtoTranslator.class);
+
+ /**
+ * Translates {@link FlowRule} to gRPC FlowRuleProto.
+ *
+ * @param flowRule {@link FlowRule}
+ * @return gRPC message
+ */
+ public static FlowRuleProto translate(FlowRule flowRule) {
+
+ if (flowRule != null) {
+ FlowRuleProto.Builder builder = FlowRuleProto.newBuilder();
+ builder.setAppId(flowRule.appId())
+ .setDeviceId(flowRule.deviceId().toString())
+ .setFlowId(flowRule.id().value())
+ .setPermanent(flowRule.isPermanent())
+ .setPriority(flowRule.priority())
+ .setReason(FlowRuleEnumsProtoTranslator.translate(flowRule.reason()))
+ .setTableId(flowRule.tableId())
+ .setTableName(flowRule.table().toString());
+
+ // TODO: need to set TrafficTreatment and TrafficSelector
+
+ return builder.build();
+ }
+ return FlowRuleProto.getDefaultInstance();
+ }
+
+ /**
+ * Translates gRPC FlowRule to {@link FlowRule}.
+ *
+ * @param flowRule gRPC message
+ * @return {@link FlowRule}
+ */
+ public static FlowRule translate(FlowRuleProto flowRule) {
+
+ if (flowRule.equals(FlowRuleProto.getDefaultInstance())) {
+ return null;
+ }
+
+ DeviceId deviceId = DeviceId.deviceId(flowRule.getDeviceId());
+
+ // TODO: to register AppId need to find a way to get CoreService
+
+ FlowRule.FlowRemoveReason reason =
+ FlowRuleEnumsProtoTranslator.translate(flowRule.getReason()).get();
+
+ FlowRule.Builder resultBuilder = new DefaultFlowRule.Builder();
+ resultBuilder.forDevice(deviceId);
+ resultBuilder.forTable(flowRule.getTableId());
+ resultBuilder.withPriority(flowRule.getPriority());
+ resultBuilder.withCookie(flowRule.getFlowId());
+ resultBuilder.withReason(reason);
+
+ if (flowRule.getPermanent()) {
+ resultBuilder.makePermanent();
+ } else {
+ resultBuilder.makeTemporary(flowRule.getTimeout());
+ }
+
+ // TODO: need to deal with TrafficTreatment and TrafficSelector
+
+ return resultBuilder.build();
+ }
+
+ // Utility class not intended for instantiation.
+ private FlowRuleProtoTranslator() {}
+}
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/flow/package-info.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/flow/package-info.java
new file mode 100644
index 0000000..08d0df9
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/flow/package-info.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Utilities to handle ProtoBuf version of ONOS flow models.
+ */
+package org.onosproject.incubator.protobuf.models.net.flow;
\ No newline at end of file
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/link/LinkEnumsProtoTranslator.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/link/LinkEnumsProtoTranslator.java
new file mode 100644
index 0000000..bc87984
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/link/LinkEnumsProtoTranslator.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.protobuf.models.net.link;
+
+import org.onosproject.grpc.net.link.models.LinkEnumsProto;
+import org.onosproject.net.Link;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Optional;
+
+/**
+ * gRPC LinkType and LinkState message to equivalent ONOS enum conversion related utilities.
+ */
+public final class LinkEnumsProtoTranslator {
+
+ private static final Logger log = LoggerFactory.getLogger(LinkEnumsProtoTranslator.class);
+
+ /**
+ * Translates gRPC enum LinkType to Optional of ONOS enum.
+ *
+ * @param type linktype type in gRPC enum
+ * @return Optional of equivalent ONOS enum or empty if not recognized
+ */
+ public static Optional<Link.Type> translate(LinkEnumsProto.LinkTypeProto type) {
+ switch (type) {
+ case DIRECT:
+ return Optional.of(Link.Type.DIRECT);
+ case INDIRECT:
+ return Optional.of(Link.Type.INDIRECT);
+ case EDGE:
+ return Optional.of(Link.Type.EDGE);
+ case TUNNEL:
+ return Optional.of(Link.Type.TUNNEL);
+ case OPTICAL:
+ return Optional.of(Link.Type.OPTICAL);
+ case VIRTUAL:
+ return Optional.of(Link.Type.VIRTUAL);
+ default:
+ log.warn("Unrecognized Type gRPC message: {}", type);
+ return Optional.empty();
+ }
+ }
+
+ /**
+ * Translates ONOS enum Type to gRPC enum.
+ *
+ * @param type ONOS' Type type
+ * @return equivalent gRPC message enum
+ */
+ public static LinkEnumsProto.LinkTypeProto translate(Link.Type type) {
+ switch (type) {
+ case DIRECT:
+ return LinkEnumsProto.LinkTypeProto.DIRECT;
+ case INDIRECT:
+ return LinkEnumsProto.LinkTypeProto.INDIRECT;
+ case EDGE:
+ return LinkEnumsProto.LinkTypeProto.EDGE;
+ case TUNNEL:
+ return LinkEnumsProto.LinkTypeProto.TUNNEL;
+ case OPTICAL:
+ return LinkEnumsProto.LinkTypeProto.OPTICAL;
+ case VIRTUAL:
+ return LinkEnumsProto.LinkTypeProto.VIRTUAL;
+ default:
+ log.warn("Unrecognized type", type);
+ throw new IllegalArgumentException("Unrecognized Type");
+ }
+ }
+
+ /**
+ * Translates gRPC enum LinkState to Optional of ONOS enum.
+ *
+ * @param state linkstate state in gRPC enum
+ * @return Optional of equivalent ONOS enum or empty if not recognized
+ */
+ public static Optional<Link.State> translate(LinkEnumsProto.LinkStateProto state) {
+ switch (state) {
+ case ACTIVE:
+ return Optional.of(Link.State.ACTIVE);
+ case INACTIVE:
+ return Optional.of(Link.State.INACTIVE);
+ default:
+ log.warn("Unrecognized State gRPC message: {}", state);
+ return Optional.empty();
+ }
+ }
+
+ /**
+ * Translates ONOS enum State to gRPC enum.
+ *
+ * @param state ONOS' state state
+ * @return equivalent gRPC message enum
+ */
+ public static LinkEnumsProto.LinkStateProto translate(Link.State state) {
+ switch (state) {
+ case ACTIVE:
+ return LinkEnumsProto.LinkStateProto.ACTIVE;
+ case INACTIVE:
+ return LinkEnumsProto.LinkStateProto.INACTIVE;
+ default:
+ log.warn("Unrecognized State", state);
+ throw new IllegalArgumentException("Unrecognized State");
+ }
+ }
+
+
+ // Utility class not intended for instantiation.
+ private LinkEnumsProtoTranslator() {}
+
+}
+
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/link/package-info.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/link/package-info.java
new file mode 100644
index 0000000..1392669
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/link/package-info.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Utilities to handle ProtoBuf version of ONOS link models.
+ */
+package org.onosproject.incubator.protobuf.models.net.link;
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/meter/BandEnumsProtoTranslator.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/meter/BandEnumsProtoTranslator.java
new file mode 100644
index 0000000..f0825fb
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/meter/BandEnumsProtoTranslator.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.protobuf.models.net.meter;
+
+import org.onosproject.grpc.net.meter.models.BandEnumsProto;
+import org.onosproject.net.meter.Band;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Optional;
+
+/**
+ * gRPC message conversion related utilities for band enums.
+ */
+public final class BandEnumsProtoTranslator {
+
+ private static final Logger log = LoggerFactory.getLogger(BandEnumsProtoTranslator.class);
+
+ /**
+ * Translates gRPC enum Band Type to ONOS enum.
+ *
+ * @param bandType BandType in gRPC enum
+ * @return equivalent in ONOS enum
+ */
+ public static Optional<Band.Type> translate(BandEnumsProto.BandTypeProto bandType) {
+ switch (bandType) {
+ case DROP:
+ return Optional.of(Band.Type.DROP);
+ case REMARK:
+ return Optional.of(Band.Type.REMARK);
+ case EXPERIMENTAL:
+ return Optional.of(Band.Type.EXPERIMENTAL);
+ default:
+ log.warn("Unrecognized BandType gRPC message: {}", bandType);
+ return Optional.empty();
+ }
+ }
+
+ // Utility class not intended for instantiation.
+ private BandEnumsProtoTranslator() {}
+}
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/meter/BandProtoTranslator.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/meter/BandProtoTranslator.java
new file mode 100644
index 0000000..ba4460d
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/meter/BandProtoTranslator.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.protobuf.models.net.meter;
+
+import org.onosproject.grpc.net.meter.models.BandEnumsProto;
+import org.onosproject.grpc.net.meter.models.BandProtoOuterClass.BandProto;
+import org.onosproject.net.meter.Band;
+import org.onosproject.net.meter.DefaultBand;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * gRPC message conversion related utilities for band service.
+ */
+public final class BandProtoTranslator {
+
+ private static final Logger log = LoggerFactory.getLogger(BandProtoTranslator.class);
+
+ /**
+ * Translates gRPC Band to {@link Band}.
+ *
+ * @param gBand gRPC message
+ * @return {@link Band}
+ */
+ public static Band translate(BandProto gBand) {
+ Band.Type type = BandEnumsProtoTranslator.translate(gBand.getType()).get();
+ long rate = gBand.getRate();
+ long burstSize = gBand.getBurst();
+ short prec = (short) gBand.getDropPrecedence();
+ Band band = new DefaultBand(type, rate, burstSize, prec);
+ return band;
+ }
+
+ /**
+ * Translates gRPC List Bands to Collection Band.
+ *
+ * @param listBands gRPC message
+ * @return Collection Band
+ */
+ public static Collection<Band> translate(List<BandProto> listBands) {
+ Collection<Band> bands = new ArrayList<>();
+ listBands.forEach(d -> bands.add(translate(d)));
+ return bands;
+ }
+
+ /**
+ * Translates ONOS enum Band Type to gRPC enum.
+ *
+ * @param bandType BandType in ONOS enum
+ * @return equivalent in gRPC enum
+ */
+ public static BandEnumsProto.BandTypeProto translate(Band.Type bandType) {
+ switch (bandType) {
+ case DROP:
+ return BandEnumsProto.BandTypeProto.DROP;
+ case REMARK:
+ return BandEnumsProto.BandTypeProto.REMARK;
+ case EXPERIMENTAL:
+ return BandEnumsProto.BandTypeProto.EXPERIMENTAL;
+ default:
+ log.warn("Unrecognized BandType ONOS message: {}", bandType);
+ return BandEnumsProto.BandTypeProto.UNRECOGNIZED;
+ }
+ }
+
+ // Utility class not intended for instantiation.
+ private BandProtoTranslator() {}
+}
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/meter/MeterEnumsProtoTranslator.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/meter/MeterEnumsProtoTranslator.java
new file mode 100644
index 0000000..b73117c
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/meter/MeterEnumsProtoTranslator.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.protobuf.models.net.meter;
+
+import org.onosproject.grpc.net.meter.models.MeterEnumsProto;
+import org.onosproject.net.meter.Meter;
+import org.onosproject.net.meter.MeterState;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Optional;
+
+/**
+ * gRPC message conversion related utilities for meter enums.
+ */
+public final class MeterEnumsProtoTranslator {
+
+ private static final Logger log = LoggerFactory.getLogger(MeterEnumsProtoTranslator.class);
+
+ /**
+ * Translates gRPC enum MeterUnit to ONOS enum.
+ *
+ * @param unit meterUnit in gRPC enum
+ * @return equivalent in ONOS enum
+ */
+ public static Optional<Meter.Unit> translate(MeterEnumsProto.MeterUnitProto unit) {
+ switch (unit) {
+ case PKTS_PER_SEC:
+ return Optional.of(Meter.Unit.PKTS_PER_SEC);
+ case KB_PER_SEC:
+ return Optional.of(Meter.Unit.KB_PER_SEC);
+ default:
+ log.warn("Unrecognized MeterUnit gRPC message: {}", unit);
+ return Optional.empty();
+ }
+ }
+
+ /**
+ * Translates ONOS enum Meter.Unit Type to gRPC enum.
+ *
+ * @param unit Meter.Unit in ONOS enum
+ * @return equivalent in gRPC enum
+ */
+ public static MeterEnumsProto.MeterUnitProto translate(Meter.Unit unit) {
+ switch (unit) {
+ case PKTS_PER_SEC:
+ return MeterEnumsProto.MeterUnitProto.PKTS_PER_SEC;
+ case KB_PER_SEC:
+ return MeterEnumsProto.MeterUnitProto.KB_PER_SEC;
+ default:
+ log.warn("Unrecognized MeterUnit ONOS message: {}", unit);
+ return MeterEnumsProto.MeterUnitProto.UNRECOGNIZED;
+ }
+ }
+
+ /**
+ * Translates ONOS enum MeterState Type to gRPC enum.
+ *
+ * @param meterState MeterState in ONOS enum
+ * @return equivalent in gRPC enum
+ */
+ public static MeterEnumsProto.MeterStateProto translate(MeterState meterState) {
+ switch (meterState) {
+ case PENDING_ADD:
+ return MeterEnumsProto.MeterStateProto.PENDING_ADD;
+ case ADDED:
+ return MeterEnumsProto.MeterStateProto.ADDED;
+ case PENDING_REMOVE:
+ return MeterEnumsProto.MeterStateProto.PENDING_REMOVE;
+ case REMOVED:
+ return MeterEnumsProto.MeterStateProto.REMOVED;
+ default:
+ log.warn("Unrecognized MeterState ONOS message: {}", meterState);
+ return MeterEnumsProto.MeterStateProto.UNRECOGNIZED;
+ }
+ }
+
+ // Utility class not intended for instantiation.
+ private MeterEnumsProtoTranslator() {}
+}
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/meter/MeterProtoTranslator.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/meter/MeterProtoTranslator.java
new file mode 100644
index 0000000..1044664
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/meter/MeterProtoTranslator.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.protobuf.models.net.meter;
+
+import com.google.common.annotations.Beta;
+import org.onosproject.grpc.net.meter.models.BandProtoOuterClass.BandProto;
+import org.onosproject.grpc.net.meter.models.MeterProtoOuterClass.MeterProto;
+import org.onosproject.incubator.protobuf.models.core.ApplicationIdProtoTranslator;
+import org.onosproject.net.meter.Meter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.stream.Collectors;
+
+/**
+ * gRPC message conversion related utilities for meter service.
+ */
+@Beta
+public final class MeterProtoTranslator {
+ private static final Logger log = LoggerFactory.getLogger(MeterProtoTranslator.class);
+
+ /**
+ * Translates {@link Meter} to gRPC MeterCore message.
+ *
+ * @param meter {@link Meter}
+ * @return gRPC MeterCore message
+ */
+ public static MeterProto translate(Meter meter) {
+ return MeterProto.newBuilder()
+ .setDeviceId(meter.deviceId().toString())
+ .setApplicationId(ApplicationIdProtoTranslator.translate(meter.appId()))
+ .setUnit(MeterEnumsProtoTranslator.translate(meter.unit()))
+ .setIsBurst(meter.isBurst())
+ .addAllBands(meter.bands().stream()
+ .map(b -> BandProto.newBuilder()
+ .setRate(b.rate())
+ .setBurst(b.burst())
+ .setDropPrecedence(b.dropPrecedence())
+ .setType(BandProtoTranslator.translate(b.type()))
+ .setPackets(b.packets())
+ .setBytes(b.bytes())
+ .build())
+ .collect(Collectors.toList()))
+ .setState(MeterEnumsProtoTranslator.translate(meter.state()))
+ .setLife(meter.life())
+ .setReferenceCount(meter.referenceCount())
+ .setPacketsSeen(meter.packetsSeen())
+ .setBytesSeen(meter.bytesSeen())
+ .build();
+ }
+
+ // Utility class not intended for instantiation.
+ private MeterProtoTranslator() {}
+}
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/meter/MeterRequestProtoTranslator.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/meter/MeterRequestProtoTranslator.java
new file mode 100644
index 0000000..dd6c5fb
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/meter/MeterRequestProtoTranslator.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.protobuf.models.net.meter;
+
+import org.onosproject.core.ApplicationId;
+import org.onosproject.grpc.net.meter.models.MeterEnumsProto;
+import org.onosproject.grpc.net.meter.models.MeterRequestProtoOuterClass;
+import org.onosproject.incubator.protobuf.models.core.ApplicationIdProtoTranslator;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.meter.Band;
+import org.onosproject.net.meter.DefaultMeterRequest;
+import org.onosproject.net.meter.Meter;
+import org.onosproject.net.meter.MeterRequest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Collection;
+import java.util.Optional;
+
+/**
+ * gRPC message conversion related utilities for meter request service.
+ */
+public final class MeterRequestProtoTranslator {
+
+ private static final Logger log = LoggerFactory.getLogger(MeterRequestProtoTranslator.class);
+
+ /**
+ * Translates gRPC MeterRequestType to {@link MeterRequest.Type}.
+ *
+ * @param type gRPC message
+ * @return {@link MeterRequest.Type}
+ */
+ public static Optional<Object> translate(MeterEnumsProto.MeterRequestTypeProto type) {
+ switch (type) {
+ case ADD:
+ return Optional.of(MeterRequest.Type.ADD);
+ case MODIFY:
+ return Optional.of(MeterRequest.Type.MODIFY);
+ case REMOVE:
+ return Optional.of(MeterRequest.Type.REMOVE);
+ default:
+ log.warn("Unrecognized MeterRequest type gRPC message: {}", type);
+ return Optional.empty();
+ }
+ }
+
+ /**
+ * Translates gRPC MeterRequest to {@link MeterRequest}.
+ *
+ * @param meterRequest gRPC message
+ * @return {@link MeterRequest}
+ */
+ public static MeterRequest translate(MeterRequestProtoOuterClass.MeterRequestProto meterRequest) {
+
+ DeviceId deviceid = DeviceId.deviceId(meterRequest.getDeviceId());
+ ApplicationId appId = ApplicationIdProtoTranslator.translate(meterRequest.getApplicationId());
+ Meter.Unit unit = MeterEnumsProtoTranslator.translate(meterRequest.getUnit()).get();
+ boolean burst = meterRequest.getIsBurst();
+ Collection<Band> bands = BandProtoTranslator.translate(meterRequest.getBandsList());
+ MeterRequest.Type type = (MeterRequest.Type) translate(meterRequest.getType()).get();
+ if (type == MeterRequest.Type.ADD) {
+ return DefaultMeterRequest.builder()
+ .forDevice(deviceid)
+ .fromApp(appId)
+ .withUnit(unit)
+ .withBands(bands)
+ .add();
+ } else {
+ return DefaultMeterRequest.builder()
+ .forDevice(deviceid)
+ .fromApp(appId)
+ .withUnit(unit)
+ .withBands(bands)
+ .remove();
+ }
+ }
+
+ // Utility class not intended for instantiation.
+ private MeterRequestProtoTranslator() {}
+}
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/meter/package-info.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/meter/package-info.java
new file mode 100644
index 0000000..a90c429
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/meter/package-info.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Utilities to handle ProtoBuf version of ONOS meter models.
+ */
+package org.onosproject.incubator.protobuf.models.net.meter;
\ No newline at end of file
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/package-info.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/package-info.java
new file mode 100644
index 0000000..e393681
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/package-info.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Utilities to handle ProtoBuf version of ONOS network models.
+ */
+package org.onosproject.incubator.protobuf.models.net;
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/region/RegionEnumsProtoTranslator.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/region/RegionEnumsProtoTranslator.java
new file mode 100644
index 0000000..6f3130f
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/region/RegionEnumsProtoTranslator.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.protobuf.models.net.region;
+
+import org.onosproject.grpc.net.region.models.RegionEnumsProto;
+import org.onosproject.net.region.Region;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Optional;
+
+/**
+ * gRPC RegionType message to equivalent ONOS enum conversion related utilities.
+ */
+public final class RegionEnumsProtoTranslator {
+
+ private static final Logger log = LoggerFactory.getLogger(RegionEnumsProtoTranslator.class);
+
+ /**
+ * Translates gRPC enum RegionType to Optional of ONOS enum.
+ *
+ * @param type regiontype type in gRPC enum
+ * @return Optional of equivalent ONOS enum or empty if not recognized
+ */
+ public static Optional<Region.Type> translate(RegionEnumsProto.RegionTypeProto type) {
+ switch (type) {
+ case CONTINENT:
+ return Optional.of(Region.Type.CONTINENT);
+ case COUNTRY:
+ return Optional.of(Region.Type.COUNTRY);
+ case METRO:
+ return Optional.of(Region.Type.METRO);
+ case CAMPUS:
+ return Optional.of(Region.Type.CAMPUS);
+ case BUILDING:
+ return Optional.of(Region.Type.BUILDING);
+ case DATA_CENTER:
+ return Optional.of(Region.Type.DATA_CENTER);
+ case FLOOR:
+ return Optional.of(Region.Type.FLOOR);
+ case ROOM:
+ return Optional.of(Region.Type.ROOM);
+ case RACK:
+ return Optional.of(Region.Type.RACK);
+ case LOGICAL_GROUP:
+ return Optional.of(Region.Type.LOGICAL_GROUP);
+ default:
+ log.warn("Unrecognized Type gRPC message: {}", type);
+ return Optional.empty();
+ }
+ }
+
+
+ /**
+ * Translates ONOS enum regionType to gRPC enum regionType.
+ *
+ * @param type ONOS' Type type
+ * @return equivalent gRPC message enum
+ */
+ public static RegionEnumsProto.RegionTypeProto translate(Region.Type type) {
+ switch (type) {
+ case CONTINENT:
+ return RegionEnumsProto.RegionTypeProto.CONTINENT;
+ case COUNTRY:
+ return RegionEnumsProto.RegionTypeProto.COUNTRY;
+ case METRO:
+ return RegionEnumsProto.RegionTypeProto.METRO;
+ case CAMPUS:
+ return RegionEnumsProto.RegionTypeProto.CAMPUS;
+ case BUILDING:
+ return RegionEnumsProto.RegionTypeProto.BUILDING;
+ case DATA_CENTER:
+ return RegionEnumsProto.RegionTypeProto.DATA_CENTER;
+ case FLOOR:
+ return RegionEnumsProto.RegionTypeProto.FLOOR;
+ case ROOM:
+ return RegionEnumsProto.RegionTypeProto.ROOM;
+ case RACK:
+ return RegionEnumsProto.RegionTypeProto.RACK;
+ case LOGICAL_GROUP:
+ return RegionEnumsProto.RegionTypeProto.LOGICAL_GROUP;
+ default:
+ log.warn("Unrecognized type", type);
+ throw new IllegalArgumentException("Unrecognized Type");
+ }
+ }
+
+ // Utility class not intended for instantiation.
+ private RegionEnumsProtoTranslator() {}
+}
+
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/region/package-info.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/region/package-info.java
new file mode 100644
index 0000000..459ad32
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/net/region/package-info.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Utilities to handle ProtoBuf version of ONOS region models.
+ */
+package org.onosproject.incubator.protobuf.models.net.region;
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/security/PermissionProtoTranslator.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/security/PermissionProtoTranslator.java
new file mode 100644
index 0000000..d3cdc7d
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/security/PermissionProtoTranslator.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.protobuf.models.security;
+
+import org.onosproject.grpc.security.models.PermissionProtoOuterClass.PermissionProto;
+import org.onosproject.security.Permission;
+
+import static org.onosproject.grpc.security.models.PermissionProtoOuterClass.PermissionProto.getDefaultInstance;
+
+/**
+ * gRPC Permission message to equivalent ONOS Permission conversion related utilities.
+ */
+public final class PermissionProtoTranslator {
+
+ /**
+ * Translate {@link Permission} to gRPC permission message.
+ *
+ * @param permission {@link Permission}
+ * @return gRPC message
+ */
+ public static PermissionProto translate(Permission permission) {
+
+ if (permission != null) {
+ return PermissionProto.newBuilder()
+ .setActions(permission.getActions())
+ .setClassname(permission.getClassName())
+ .setName(permission.getName())
+ .build();
+ }
+
+ return getDefaultInstance();
+ }
+
+ /**
+ * Translate gRPC permission message to {@link Permission}.
+ *
+ * @param permission gRPC message
+ * @return {@link Permission}
+ */
+ public static Permission translate(PermissionProto permission) {
+
+ return new Permission(permission.getClassname(),
+ permission.getName(), permission.getActions());
+ }
+
+ // Utility class not intended for instantiation.
+ private PermissionProtoTranslator() {}
+}
diff --git a/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/security/package-info.java b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/security/package-info.java
new file mode 100644
index 0000000..5ee50f4
--- /dev/null
+++ b/core/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/security/package-info.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Utilities to handle ProtoBuf version of ONOS security models.
+ */
+package org.onosproject.incubator.protobuf.models.security;
\ No newline at end of file