Shad Ansari | 7193ae2 | 2018-08-08 22:23:18 +0000 | [diff] [blame] | 1 | /* |
Girish Gowdra | a707e7c | 2019-11-07 11:36:13 +0530 | [diff] [blame] | 2 | * Copyright 2018-present Open Networking Foundation |
Shad Ansari | 7193ae2 | 2018-08-08 22:23:18 +0000 | [diff] [blame] | 3 | |
Girish Gowdra | a707e7c | 2019-11-07 11:36:13 +0530 | [diff] [blame] | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
Shad Ansari | 7193ae2 | 2018-08-08 22:23:18 +0000 | [diff] [blame] | 7 | |
Girish Gowdra | a707e7c | 2019-11-07 11:36:13 +0530 | [diff] [blame] | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
Shad Ansari | 7193ae2 | 2018-08-08 22:23:18 +0000 | [diff] [blame] | 9 | |
Girish Gowdra | a707e7c | 2019-11-07 11:36:13 +0530 | [diff] [blame] | 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
Shad Ansari | 7193ae2 | 2018-08-08 22:23:18 +0000 | [diff] [blame] | 16 | |
| 17 | #include <iostream> |
| 18 | #include <memory> |
| 19 | #include <string> |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 20 | #include <unistd.h> |
Shad Ansari | 7193ae2 | 2018-08-08 22:23:18 +0000 | [diff] [blame] | 21 | |
| 22 | #include "Queue.h" |
| 23 | #include <iostream> |
| 24 | #include <sstream> |
| 25 | |
| 26 | #include "core.h" |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 27 | #include "state.h" |
Shad Ansari | 7193ae2 | 2018-08-08 22:23:18 +0000 | [diff] [blame] | 28 | |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 29 | State state; |
| 30 | |
| 31 | void* RunSim(void *) { |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 32 | |
| 33 | state.activate(); |
| 34 | |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 35 | while (!state.is_connected()) { |
| 36 | sleep(5); |
| 37 | } |
| 38 | |
| 39 | // Send Olt up indication |
| 40 | { |
| 41 | openolt::Indication ind; |
| 42 | openolt::OltIndication* olt_ind = new openolt::OltIndication; |
| 43 | olt_ind->set_oper_state("up"); |
| 44 | ind.set_allocated_olt_ind(olt_ind); |
| 45 | std::cout << "olt indication, oper_state:" << ind.olt_ind().oper_state() << std::endl; |
| 46 | oltIndQ.push(ind); |
| 47 | } |
| 48 | |
| 49 | // TODO - Add interface and onu indication events |
| 50 | } |
| 51 | |
| 52 | Status Enable_(int argc, char *argv[]) { |
| 53 | pthread_t simThread; |
| 54 | |
| 55 | pthread_create(&simThread, NULL, RunSim, NULL); |
Shad Ansari | 7193ae2 | 2018-08-08 22:23:18 +0000 | [diff] [blame] | 56 | return Status::OK; |
| 57 | } |
| 58 | |
| 59 | Status Disable_() { |
| 60 | return Status::OK; |
| 61 | } |
| 62 | |
| 63 | Status Reenable_() { |
| 64 | return Status::OK; |
| 65 | } |
| 66 | |
| 67 | Status EnablePonIf_(uint32_t intf_id) { |
| 68 | return Status::OK; |
| 69 | } |
| 70 | |
| 71 | Status DisableUplinkIf_(uint32_t intf_id) { |
| 72 | return Status::OK; |
| 73 | } |
| 74 | |
| 75 | Status EnableUplinkIf_(uint32_t intf_id) { |
| 76 | return Status::OK; |
| 77 | } |
| 78 | |
| 79 | Status DisablePonIf_(uint32_t intf_id) { |
| 80 | return Status::OK; |
| 81 | } |
| 82 | |
| 83 | Status ActivateOnu_(uint32_t intf_id, uint32_t onu_id, |
| 84 | const char *vendor_id, const char *vendor_specific, uint32_t pir) { |
| 85 | return Status::OK; |
| 86 | } |
| 87 | |
| 88 | Status DeactivateOnu_(uint32_t intf_id, uint32_t onu_id, |
| 89 | const char *vendor_id, const char *vendor_specific) { |
| 90 | return Status::OK; |
| 91 | } |
| 92 | |
| 93 | Status DeleteOnu_(uint32_t intf_id, uint32_t onu_id, |
| 94 | const char *vendor_id, const char *vendor_specific) { |
| 95 | return Status::OK;; |
| 96 | } |
| 97 | |
| 98 | Status OmciMsgOut_(uint32_t intf_id, uint32_t onu_id, const std::string pkt) { |
| 99 | return Status::OK; |
| 100 | } |
| 101 | |
Craig Lutgen | 967a1d0 | 2018-11-27 10:41:51 -0600 | [diff] [blame] | 102 | 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] | 103 | return Status::OK; |
| 104 | } |
| 105 | |
| 106 | Status UplinkPacketOut_(uint32_t intf_id, const std::string pkt) { |
| 107 | return Status::OK; |
| 108 | } |
| 109 | |
Craig Lutgen | 967a1d0 | 2018-11-27 10:41:51 -0600 | [diff] [blame] | 110 | 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] | 111 | uint32_t flow_id, const std::string flow_type, |
Craig Lutgen | 967a1d0 | 2018-11-27 10:41:51 -0600 | [diff] [blame] | 112 | int32_t alloc_id, int32_t network_intf_id, |
| 113 | int32_t gemport_id, const ::openolt::Classifier& classifier, |
| 114 | const ::openolt::Action& action, int32_t priority_value, uint64_t cookie) { |
Shad Ansari | 7193ae2 | 2018-08-08 22:23:18 +0000 | [diff] [blame] | 115 | return Status::OK; |
| 116 | } |
| 117 | |
| 118 | Status SchedAdd_(int intf_id, int onu_id, int agg_port_id) { |
| 119 | return Status::OK; |
| 120 | } |
| 121 | |
| 122 | Status SchedRemove_(int intf_id, int onu_id, int agg_port_id) { |
| 123 | return Status::OK; |
| 124 | } |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 125 | |
| 126 | Status FlowRemove_(uint32_t flow_id, const std::string flow_type) { |
| 127 | return Status::OK; |
| 128 | } |
| 129 | |
Nicolas Palpacuer | 6a63ea9 | 2018-09-05 17:21:37 -0400 | [diff] [blame] | 130 | void stats_collection() { |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 131 | } |
Nicolas Palpacuer | dff9679 | 2018-09-06 14:59:32 -0400 | [diff] [blame] | 132 | |
| 133 | Status GetDeviceInfo_(openolt::DeviceInfo* deviceInfo) { |
| 134 | return Status::OK; |
| 135 | } |