blob: 8537eeb3281e9f831413c021d732509da91d2f61 [file] [log] [blame]
Shad Ansari7193ae22018-08-08 22:23:18 +00001/*
Girish Gowdraa707e7c2019-11-07 11:36:13 +05302 * Copyright 2018-present Open Networking Foundation
Shad Ansari7193ae22018-08-08 22:23:18 +00003
Girish Gowdraa707e7c2019-11-07 11:36:13 +05304 * 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 Ansari7193ae22018-08-08 22:23:18 +00007
Girish Gowdraa707e7c2019-11-07 11:36:13 +05308 * http://www.apache.org/licenses/LICENSE-2.0
Shad Ansari7193ae22018-08-08 22:23:18 +00009
Girish Gowdraa707e7c2019-11-07 11:36:13 +053010 * 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 Ansari7193ae22018-08-08 22:23:18 +000016
17#include <iostream>
18#include <memory>
19#include <string>
Shad Ansari627b5782018-08-13 22:49:32 +000020#include <unistd.h>
Shad Ansari7193ae22018-08-08 22:23:18 +000021
22#include "Queue.h"
23#include <iostream>
24#include <sstream>
25
26#include "core.h"
Shad Ansari627b5782018-08-13 22:49:32 +000027#include "state.h"
Shad Ansari7193ae22018-08-08 22:23:18 +000028
Shad Ansari627b5782018-08-13 22:49:32 +000029State state;
30
31void* RunSim(void *) {
Craig Lutgen88a22ad2018-10-04 12:30:46 -050032
33 state.activate();
34
Shad Ansari627b5782018-08-13 22:49:32 +000035 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
52Status Enable_(int argc, char *argv[]) {
53 pthread_t simThread;
54
55 pthread_create(&simThread, NULL, RunSim, NULL);
Shad Ansari7193ae22018-08-08 22:23:18 +000056 return Status::OK;
57}
58
59Status Disable_() {
60 return Status::OK;
61}
62
63Status Reenable_() {
64 return Status::OK;
65}
66
67Status EnablePonIf_(uint32_t intf_id) {
68 return Status::OK;
69}
70
71Status DisableUplinkIf_(uint32_t intf_id) {
72 return Status::OK;
73}
74
75Status EnableUplinkIf_(uint32_t intf_id) {
76 return Status::OK;
77}
78
79Status DisablePonIf_(uint32_t intf_id) {
80 return Status::OK;
81}
82
83Status 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
88Status DeactivateOnu_(uint32_t intf_id, uint32_t onu_id,
89 const char *vendor_id, const char *vendor_specific) {
90 return Status::OK;
91}
92
93Status DeleteOnu_(uint32_t intf_id, uint32_t onu_id,
94 const char *vendor_id, const char *vendor_specific) {
95 return Status::OK;;
96}
97
98Status OmciMsgOut_(uint32_t intf_id, uint32_t onu_id, const std::string pkt) {
99 return Status::OK;
100}
101
Craig Lutgen967a1d02018-11-27 10:41:51 -0600102Status OnuPacketOut_(uint32_t intf_id, uint32_t onu_id, uint32_t port_no, const std::string pkt) {
Shad Ansari7193ae22018-08-08 22:23:18 +0000103 return Status::OK;
104}
105
106Status UplinkPacketOut_(uint32_t intf_id, const std::string pkt) {
107 return Status::OK;
108}
109
Craig Lutgen967a1d02018-11-27 10:41:51 -0600110Status FlowAdd_(int32_t access_intf_id, int32_t onu_id, int32_t uni_id, uint32_t port_no,
Shad Ansari7193ae22018-08-08 22:23:18 +0000111 uint32_t flow_id, const std::string flow_type,
Craig Lutgen967a1d02018-11-27 10:41:51 -0600112 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 Ansari7193ae22018-08-08 22:23:18 +0000115 return Status::OK;
116}
117
118Status SchedAdd_(int intf_id, int onu_id, int agg_port_id) {
119 return Status::OK;
120}
121
122Status SchedRemove_(int intf_id, int onu_id, int agg_port_id) {
123 return Status::OK;
124}
Shad Ansari627b5782018-08-13 22:49:32 +0000125
126Status FlowRemove_(uint32_t flow_id, const std::string flow_type) {
127 return Status::OK;
128}
129
Nicolas Palpacuer6a63ea92018-09-05 17:21:37 -0400130void stats_collection() {
Shad Ansari627b5782018-08-13 22:49:32 +0000131}
Nicolas Palpacuerdff96792018-09-06 14:59:32 -0400132
133Status GetDeviceInfo_(openolt::DeviceInfo* deviceInfo) {
134 return Status::OK;
135}