Shad Ansari | 7193ae2 | 2018-08-08 22:23:18 +0000 | [diff] [blame] | 1 | /* |
| 2 | Copyright (C) 2018 Open Networking Foundation |
| 3 | |
| 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 | #include <iostream> |
| 19 | #include <memory> |
| 20 | #include <string> |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 21 | #include <unistd.h> |
Shad Ansari | 7193ae2 | 2018-08-08 22:23:18 +0000 | [diff] [blame] | 22 | |
| 23 | #include "Queue.h" |
| 24 | #include <iostream> |
| 25 | #include <sstream> |
| 26 | |
| 27 | #include "core.h" |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 28 | #include "state.h" |
Shad Ansari | 7193ae2 | 2018-08-08 22:23:18 +0000 | [diff] [blame] | 29 | |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 30 | State state; |
| 31 | |
| 32 | void* RunSim(void *) { |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 33 | |
| 34 | state.activate(); |
| 35 | |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 36 | while (!state.is_connected()) { |
| 37 | sleep(5); |
| 38 | } |
| 39 | |
| 40 | // Send Olt up indication |
| 41 | { |
| 42 | openolt::Indication ind; |
| 43 | openolt::OltIndication* olt_ind = new openolt::OltIndication; |
| 44 | olt_ind->set_oper_state("up"); |
| 45 | ind.set_allocated_olt_ind(olt_ind); |
| 46 | std::cout << "olt indication, oper_state:" << ind.olt_ind().oper_state() << std::endl; |
| 47 | oltIndQ.push(ind); |
| 48 | } |
| 49 | |
| 50 | // TODO - Add interface and onu indication events |
| 51 | } |
| 52 | |
| 53 | Status Enable_(int argc, char *argv[]) { |
| 54 | pthread_t simThread; |
| 55 | |
| 56 | pthread_create(&simThread, NULL, RunSim, NULL); |
Shad Ansari | 7193ae2 | 2018-08-08 22:23:18 +0000 | [diff] [blame] | 57 | return Status::OK; |
| 58 | } |
| 59 | |
| 60 | Status Disable_() { |
| 61 | return Status::OK; |
| 62 | } |
| 63 | |
| 64 | Status Reenable_() { |
| 65 | return Status::OK; |
| 66 | } |
| 67 | |
| 68 | Status EnablePonIf_(uint32_t intf_id) { |
| 69 | return Status::OK; |
| 70 | } |
| 71 | |
| 72 | Status DisableUplinkIf_(uint32_t intf_id) { |
| 73 | return Status::OK; |
| 74 | } |
| 75 | |
| 76 | Status EnableUplinkIf_(uint32_t intf_id) { |
| 77 | return Status::OK; |
| 78 | } |
| 79 | |
| 80 | Status DisablePonIf_(uint32_t intf_id) { |
| 81 | return Status::OK; |
| 82 | } |
| 83 | |
| 84 | Status ActivateOnu_(uint32_t intf_id, uint32_t onu_id, |
| 85 | const char *vendor_id, const char *vendor_specific, uint32_t pir) { |
| 86 | return Status::OK; |
| 87 | } |
| 88 | |
| 89 | Status DeactivateOnu_(uint32_t intf_id, uint32_t onu_id, |
| 90 | const char *vendor_id, const char *vendor_specific) { |
| 91 | return Status::OK; |
| 92 | } |
| 93 | |
| 94 | Status DeleteOnu_(uint32_t intf_id, uint32_t onu_id, |
| 95 | const char *vendor_id, const char *vendor_specific) { |
| 96 | return Status::OK;; |
| 97 | } |
| 98 | |
| 99 | Status OmciMsgOut_(uint32_t intf_id, uint32_t onu_id, const std::string pkt) { |
| 100 | return Status::OK; |
| 101 | } |
| 102 | |
Craig Lutgen | 967a1d0 | 2018-11-27 10:41:51 -0600 | [diff] [blame^] | 103 | Status OnuPacketOut_(uint32_t intf_id, uint32_t onu_id, uint32_t port_no, const std::string pkt) { |
Shad Ansari | 7193ae2 | 2018-08-08 22:23:18 +0000 | [diff] [blame] | 104 | return Status::OK; |
| 105 | } |
| 106 | |
| 107 | Status UplinkPacketOut_(uint32_t intf_id, const std::string pkt) { |
| 108 | return Status::OK; |
| 109 | } |
| 110 | |
Craig Lutgen | 967a1d0 | 2018-11-27 10:41:51 -0600 | [diff] [blame^] | 111 | Status FlowAdd_(int32_t access_intf_id, int32_t onu_id, int32_t uni_id, uint32_t port_no, |
Shad Ansari | 7193ae2 | 2018-08-08 22:23:18 +0000 | [diff] [blame] | 112 | uint32_t flow_id, const std::string flow_type, |
Craig Lutgen | 967a1d0 | 2018-11-27 10:41:51 -0600 | [diff] [blame^] | 113 | int32_t alloc_id, int32_t network_intf_id, |
| 114 | int32_t gemport_id, const ::openolt::Classifier& classifier, |
| 115 | const ::openolt::Action& action, int32_t priority_value, uint64_t cookie) { |
Shad Ansari | 7193ae2 | 2018-08-08 22:23:18 +0000 | [diff] [blame] | 116 | return Status::OK; |
| 117 | } |
| 118 | |
| 119 | Status SchedAdd_(int intf_id, int onu_id, int agg_port_id) { |
| 120 | return Status::OK; |
| 121 | } |
| 122 | |
| 123 | Status SchedRemove_(int intf_id, int onu_id, int agg_port_id) { |
| 124 | return Status::OK; |
| 125 | } |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 126 | |
| 127 | Status FlowRemove_(uint32_t flow_id, const std::string flow_type) { |
| 128 | return Status::OK; |
| 129 | } |
| 130 | |
Nicolas Palpacuer | 6a63ea9 | 2018-09-05 17:21:37 -0400 | [diff] [blame] | 131 | void stats_collection() { |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 132 | } |
Nicolas Palpacuer | dff9679 | 2018-09-06 14:59:32 -0400 | [diff] [blame] | 133 | |
| 134 | Status GetDeviceInfo_(openolt::DeviceInfo* deviceInfo) { |
| 135 | return Status::OK; |
| 136 | } |