Initial commit of a simple OpenOLT simulator
make openoltsim
./build/openoltsim
Openoltsim is meant to simulate an OLT running the OpenOLT driver.
Currently, it only sends the the "olt up" indication allowing
voltha pre-provision/enable commands to connect to openoltsim.
Change-Id: I95910657d269e37f4e4943d2b91f2780ecd8fd08
diff --git a/openoltsim/main.cc b/openoltsim/main.cc
new file mode 100644
index 0000000..652378e
--- /dev/null
+++ b/openoltsim/main.cc
@@ -0,0 +1,50 @@
+/*
+ Copyright (C) 2018 Open Networking Foundation
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+#include <iostream>
+#include <unistd.h>
+#include <pthread.h>
+
+#include "server.h"
+#include "core.h"
+#include "state.h"
+
+void* RunSim(void *) {
+ while (!state::is_connected()) {
+ sleep(5);
+ }
+
+ // Send Olt up indication
+ {
+ openolt::Indication ind;
+ openolt::OltIndication* olt_ind = new openolt::OltIndication;
+ olt_ind->set_oper_state("up");
+ ind.set_allocated_olt_ind(olt_ind);
+ std::cout << "olt indication, oper_state:" << ind.olt_ind().oper_state() << std::endl;
+ oltIndQ.push(ind);
+ }
+
+ // TODO - Add interface and onu indication events
+}
+
+int main(int argc, char** argv) {
+ pthread_t simThread;
+
+ pthread_create(&simThread, NULL, RunSim, NULL);
+ RunServer();
+
+ return 0;
+}