blob: 1fd3767bcd775b9bc8e9b255499bf0cf78744582 [file] [log] [blame]
Shad Ansarib7b0ced2018-05-11 21:53:32 +00001/*
Nicolas Palpacuerb78def42018-06-07 12:55:26 -04002 Copyright (C) 2018 Open Networking Foundation
Shad Ansarib7b0ced2018-05-11 21:53:32 +00003
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef OPENOLT_CORE_H_
19#define OPENOLT_CORE_H_
20
21#include <grpc++/grpc++.h>
22using grpc::Status;
23#include <openolt.grpc.pb.h>
24
Shad Ansariedef2132018-08-10 22:14:50 +000025#include "state.h"
26
Shad Ansari627b5782018-08-13 22:49:32 +000027#define COLLECTION_PERIOD 15
28
Shad Ansariedef2132018-08-10 22:14:50 +000029extern State state;
30
Jason Huang439d24f2019-06-26 03:25:05 +080031enum FLOW_CFG {
32 INTF_TYPE = 0,
33 INTF_ID = 1,
34 SVC_PORT_ID = 2,
35 COOKIE = 3
36};
37
Shad Ansari627b5782018-08-13 22:49:32 +000038Status Enable_(int argc, char *argv[]);
Shad Ansarib7b0ced2018-05-11 21:53:32 +000039Status ActivateOnu_(uint32_t intf_id, uint32_t onu_id,
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -070040 const char *vendor_id, const char *vendor_specific, uint32_t pir);
Jonathan Davis70c21812018-07-19 15:32:10 -040041Status DeactivateOnu_(uint32_t intf_id, uint32_t onu_id,
42 const char *vendor_id, const char *vendor_specific);
43Status DeleteOnu_(uint32_t intf_id, uint32_t onu_id,
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -070044 const char *vendor_id, const char *vendor_specific);
Shad Ansarib7b0ced2018-05-11 21:53:32 +000045Status EnablePonIf_(uint32_t intf_id);
Nicolas Palpacuer05ea0ea2018-07-06 11:47:21 -040046Status DisablePonIf_(uint32_t intf_id);
Nicolas Palpacuere3fc0d22018-08-02 16:51:05 -040047Status EnableUplinkIf_(uint32_t intf_id);
48Status DisableUplinkIf_(uint32_t intf_id);
Craig Lutgen88a22ad2018-10-04 12:30:46 -050049unsigned NumNniIf_();
50unsigned NumPonIf_();
Shad Ansarib7b0ced2018-05-11 21:53:32 +000051Status OmciMsgOut_(uint32_t intf_id, uint32_t onu_id, const std::string pkt);
Girish Gowdruc8ed2ef2019-02-13 08:18:44 -080052Status OnuPacketOut_(uint32_t intf_id, uint32_t onu_id, uint32_t port_no, uint32_t gemport_id, const std::string pkt);
Craig Lutgen88a22ad2018-10-04 12:30:46 -050053Status ProbeDeviceCapabilities_();
54Status ProbePonIfTechnology_();
Jason Huangd33b4d82019-05-15 18:22:57 +080055Status UplinkPacketOut_(uint32_t intf_id, const std::string pkt, uint16_t flow_id);
Craig Lutgen967a1d02018-11-27 10:41:51 -060056Status FlowAdd_(int32_t access_intf_id, int32_t onu_id, int32_t uni_id, uint32_t port_no,
Shad Ansarib7b0ced2018-05-11 21:53:32 +000057 uint32_t flow_id, const std::string flow_type,
Girish Gowdru7c4ec2d2018-10-25 00:29:54 -070058 int32_t alloc_id, int32_t network_intf_id,
59 int32_t gemport_id, const ::openolt::Classifier& classifier,
Craig Lutgen967a1d02018-11-27 10:41:51 -060060 const ::openolt::Action& action, int32_t priority_value, uint64_t cookie);
Nicolas Palpacueredfaa0c2018-07-05 15:05:27 -040061Status FlowRemove_(uint32_t flow_id, const std::string flow_type);
Nicolas Palpacuere3fc0d22018-08-02 16:51:05 -040062Status Disable_();
63Status Reenable_();
Nicolas Palpacuerdff96792018-09-06 14:59:32 -040064Status GetDeviceInfo_(openolt::DeviceInfo* device_info);
Thiyagarajan Subramani0695c982019-06-05 07:30:50 -070065Status CreateDefaultSchedQueue_(uint32_t intf_id, const std::string direction);
Girish Gowdruc8ed2ef2019-02-13 08:18:44 -080066Status CreateTrafficSchedulers_(const tech_profile::TrafficSchedulers *traffic_scheds);
67Status RemoveTrafficSchedulers_(const tech_profile::TrafficSchedulers *traffic_scheds);
68Status CreateTrafficQueues_(const tech_profile::TrafficQueues *traffic_queues);
69Status RemoveTrafficQueues_(const tech_profile::TrafficQueues *traffic_queues);
Craig Lutgen967a1d02018-11-27 10:41:51 -060070uint32_t GetPortNum_(uint32_t flow_id);
Jason Huangd33b4d82019-05-15 18:22:57 +080071int get_status_bcm_cli_quit(void);
72uint16_t get_dev_id(void);
Jason Huang88795222019-06-13 19:28:44 +080073Status pushOltOperInd(uint32_t intf_id, const char *type, const char *state);
Jason Huang439d24f2019-06-26 03:25:05 +080074uint64_t get_flow_status(uint16_t flow_id, uint16_t data_id);
Nicolas Palpacuere3fc0d22018-08-02 16:51:05 -040075
Nicolas Palpacuer6a63ea92018-09-05 17:21:37 -040076void stats_collection();
Shad Ansarib7b0ced2018-05-11 21:53:32 +000077#endif