SEBA-758 send periodic port stats to voltha
SEBA-790 get flow, gemport, and tcont information through API
fix lint errors

Change-Id: I10909e1992eba71d8e54c976ccbcea8778e35539
diff --git a/api/bbsim.proto b/api/bbsim.proto
index 494f947..1b35541 100644
--- a/api/bbsim.proto
+++ b/api/bbsim.proto
@@ -17,35 +17,40 @@
 
 import "google/api/annotations.proto";
 import "protoc-gen-swagger/options/annotations.proto";
+import "voltha_protos/openolt.proto";
+import "voltha_protos/tech_profile.proto";
 
 option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = {
-    info: {
+	info: {
 	title: "BBSim API";
 	version: "1.0";
-    };
-    schemes: HTTP;
-    consumes: "application/json";
-    produces: "application/json";
-    responses: {
+	contact: {
+		url: "http://opencord.org";
+		};
+	};
+	schemes: HTTP;
+	consumes: "application/json";
+	produces: "application/json";
+	responses: {
 	key: "404";
 	value: {
-	    description: "Returned when the resource does not exist.";
-	    schema: {
-		    json_schema: {
-		      type: STRING;
+		description: "Returned when the resource does not exist.";
+		schema: {
+			json_schema: {
+			  type: STRING;
 		}
-	    }
+		}
 	}
-    }
+	}
 };
 
 // OLT information
 message OLTInfo {
-    int64   olt_id = 1;
-    string  olt_serial = 2;
-    string  olt_ip = 3;
-    string  olt_state = 4;
-    string  olt_vendor = 5;
+	int64   olt_id = 1;
+	string  olt_serial = 2;
+	string  olt_ip = 3;
+	string  olt_state = 4;
+	string  olt_vendor = 5;
 }
 
 // ONU information
@@ -58,139 +63,159 @@
     string oper_state = 4;
     // ONU internal state
     string onu_state = 5;
+    repeated uint32 gemports = 6;
+    Tconts tconts = 7;
 }
 
 // Bulk ONU operations
 message ONUs {
-    repeated ONUInfo onus = 1;
+	repeated ONUInfo onus = 1;
 }
 
 message ONURequest {
-    ONUInfo onu = 1;
-    ONUs onus_batch = 2;
+	ONUInfo onu = 1;
+	ONUs onus_batch = 2;
 }
 
 // Port information
 message PortInfo {
-    string port_type = 1;
-    uint32 port_id = 2;
-    int32  pon_port_max_onus = 3;
-    uint32 pon_port_active_onus = 4;
-    string port_state = 5;
-    string alarm_state = 6;
+	string port_type = 1;
+	uint32 port_id = 2;
+	uint32 pon_port_max_onus = 3;
+	uint32 pon_port_active_onus = 4;
+	string port_state = 5;
+	string alarm_state = 6;
 }
 
 // Bulk port information
 message Ports {
-    repeated PortInfo ports = 1;
+	repeated PortInfo ports = 1;
 }
 
 // BBSim status
 message OLTStatusResponse {
-    OLTInfo olt = 1;
-    repeated PortInfo ports = 2;
+	OLTInfo olt = 1;
+	repeated PortInfo ports = 2;
 }
 
 // BBSim response message
 message BBSimResponse {
-    string status_msg = 1;
+	string status_msg = 1;
 }
 
 // ONU alarm request
 message ONUAlarmRequest {
-    // ONU serial number
-    string onu_serial = 1; 
-    // Alarm types are:
-    //   "signaldegrade"
-    //   "lossofomcichannel"
-    //   "lossofploam"
-    string alarm_type = 2;
-    // "on"/"off" indicates raised or cleared alarm 
-    string status = 3;                 }
+	// ONU serial number
+	string onu_serial = 1;
+	// Alarm types are:
+	//   "signaldegrade"
+	//   "lossofomcichannel"
+	//   "lossofploam"
+	string alarm_type = 2;
+	// "on"/"off" indicates raised or cleared alarm
+	string status = 3;                 }
 
 // OLT alarm request
 message OLTAlarmRequest {
-    uint32 port_id = 1;
-    string port_type = 2;
-    string status = 3;
+	uint32 port_id = 1;
+	string port_type = 2;
+	string status = 3;
 }
 
 // Device action
 message DeviceAction {
-    string device_type = 1;             // ONU or OLT
-    string device_serial_number = 2;    // Device serial number
-    string device_action = 3;           // soft or hard reboot
+	string device_type = 1;             // ONU or OLT
+	string serial_number = 2;    // Device serial number
+	string action = 3;           // soft or hard reboot
+}
+
+message Tconts {
+    fixed32 uni_id = 4;
+	fixed32 port_no = 5;
+	repeated tech_profile.TrafficScheduler tconts = 3;
+}
+
+message Flows {
+    repeated openolt.Flow flows = 1;
 }
 
 message Empty {}
 
 service BBSimService {
 
-    // Get current status of OLT
-    rpc OLTStatus(Empty) returns (OLTStatusResponse) {
-        option (google.api.http) = {
-            get : "/v1/olt"
-            additional_bindings {get : "/v1/olt/status"}
-        };
-    }
+	// Get current status of OLT
+	rpc OLTStatus(Empty) returns (OLTStatusResponse) {
+		option (google.api.http) = {
+			get : "/v1/olt"
+			additional_bindings {get : "/v1/olt/status"}
+		};
+	}
 
-    // Get status of a PON/NNI port
-    rpc PortStatus(PortInfo) returns (Ports) {
-        option (google.api.http) = {
-            get : "/v1/olt/ports/{port_type}"
-        };
-    }
+	// Get status of a PON/NNI port
+	rpc PortStatus(PortInfo) returns (Ports) {
+		option (google.api.http) = {
+			get : "/v1/olt/ports/{port_type}/{port_id}/status"
+		};
+	}
 
-    // Get status of all or specific ONUs
-    rpc ONUStatus(ONURequest) returns (ONUs) {
-        option (google.api.http) = {
-            get : "/v1/olt/onus"
-            additional_bindings { get : "/v1/olt/ports/{onu.pon_port_id}/onus" }
-            additional_bindings { get : "/v1/olt/onus/{onu.onu_serial}" }
-        };
-    }
+	// Get status of all or specific ONUs
+	rpc ONUStatus(ONURequest) returns (ONUs) {
+		option (google.api.http) = {
+			get : "/v1/olt/onus"
+			additional_bindings { get : "/v1/olt/ports/{onu.pon_port_id}/onus" }
+			additional_bindings { get : "/v1/olt/onus/{onu.onu_serial}" }
+		};
+	}
 
-    // Single/bulk activate ONU(s) for specific PON port(s)
-    rpc ONUActivate(ONURequest) returns (BBSimResponse) {
-        option (google.api.http) = {
-            post : "/v1/olt/onus"
-            body: "onus_batch"
-            additional_bindings { post : "/v1/olt/ports/{onu.pon_port_id}/onus" }
-            additional_bindings { post : "/v1/olt/ports/{onu.pon_port_id}/onus/{onu.onu_serial}" }
-        };
-    }
-    
-    // Deactivate ONU(s) for specific PON port(s) specified by  
-    // a given onu_serial, onu_id, or pon_port_id
-    rpc ONUDeactivate(ONURequest) returns (BBSimResponse) {
-        option (google.api.http) = {
-            delete : "/v1/olt/onus"
-            body: "onus_batch"
-            additional_bindings { delete: "/v1/olt/onus/{onu.onu_serial}" }
-            additional_bindings { delete: "/v1/olt/ports/{onu.pon_port_id}/onus" }
-            additional_bindings { delete: "/v1/olt/ports/{onu.pon_port_id}/onus/{onu.onu_id}" }
-        };
-    }
+	// Single/bulk activate ONU(s) for specific PON port(s)
+	rpc ONUActivate(ONURequest) returns (BBSimResponse) {
+		option (google.api.http) = {
+			post : "/v1/olt/onus"
+			body: "onus_batch"
+			additional_bindings { post : "/v1/olt/ports/{onu.pon_port_id}/onus" }
+			additional_bindings { post : "/v1/olt/ports/{onu.pon_port_id}/onus/{onu.onu_serial}" }
+		};
+	}
 
-    // Generate ONU related alarms
-    rpc GenerateONUAlarm(ONUAlarmRequest) returns (BBSimResponse) {
-        option (google.api.http) = {
-            post : "/v1/olt/onus/{onu_serial}/alarms/{alarm_type}/{status}"
-        };
-    }
+	// Deactivate ONU(s) for specific PON port(s) specified by
+	// a given onu_serial, onu_id, or pon_port_id
+	rpc ONUDeactivate(ONURequest) returns (BBSimResponse) {
+		option (google.api.http) = {
+			delete : "/v1/olt/onus"
+			body: "onus_batch"
+			additional_bindings { delete: "/v1/olt/onus/{onu.onu_serial}" }
+			additional_bindings { delete: "/v1/olt/ports/{onu.pon_port_id}/onus" }
+			additional_bindings { delete: "/v1/olt/ports/{onu.pon_port_id}/onus/{onu.onu_id}" }
+		};
+	}
 
-    // Generate OLT related alarms
-    rpc GenerateOLTAlarm(OLTAlarmRequest) returns (BBSimResponse) {
-        option (google.api.http) = {
-            post : "/v1/olt/ports/{port_type}/{port_id}/alarms/los/{status}"
-        };
-    }
+	// Generate ONU related alarms
+	rpc GenerateONUAlarm(ONUAlarmRequest) returns (BBSimResponse) {
+		option (google.api.http) = {
+			post : "/v1/olt/onus/{onu_serial}/alarms/{alarm_type}/{status}"
+		};
+	}
 
-    // Perform actions on OLT/ONU devices (e.g. reboot)
-    rpc PerformDeviceAction(DeviceAction) returns (BBSimResponse) {
-        option (google.api.http) = {
-            patch: "/v1/{device_type}/reboot"
-            additional_bindings { patch : "/v1/olt/{device_type}/{device_serial_number}/reboot/{device_action}"}
-        };
-    }
+	// Generate OLT related alarms
+	rpc GenerateOLTAlarm(OLTAlarmRequest) returns (BBSimResponse) {
+		option (google.api.http) = {
+			post : "/v1/olt/ports/{port_type}/{port_id}/alarms/los/{status}"
+		};
+	}
+
+	// Perform actions on OLT/ONU devices (e.g. reboot)
+	rpc PerformDeviceAction(DeviceAction) returns (BBSimResponse) {
+		option (google.api.http) = {
+			patch: "/v1/{device_type}/action/{action}"
+			additional_bindings { patch : "/v1/olt/{device_type}/{serial_number}/action/{action}"}
+		};
+	}
+
+	// Get flows
+	rpc GetFlows(ONUInfo) returns(Flows) {
+	    option (google.api.http) = {
+	        get: "/v1/olt/flows"
+	        additional_bindings {get: "/v1/olt/onu/{onu_serial}/flows"}
+	    };
+	}
 }