Skip to content

Commit c353cd4

Browse files
Merge pull request #89 from Telecominfraproject/WIFI-13542
Wifi 13542
2 parents 4031e50 + 3e1ee3b commit c353cd4

13 files changed

Lines changed: 151 additions & 111 deletions

BUILDING.md

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Building from source
2-
In order to build the OWFMS, you will need to install its dependencies, which includes the following:
2+
In order to build OWFMS, you will need to install its dependencies, which includes the following:
33
- cmake
44
- boost
55
- POCO 1.10.1 or later
@@ -12,111 +12,110 @@ In order to build the OWFMS, you will need to install its dependencies, which in
1212

1313
Building is a 2 part process. The first part is to build a local copy of the framework tailored to your environment. This
1414
framework is [Poco](https://github.com/pocoproject/poco). The version used in this project has a couple of fixes
15-
from the master copy needed for cmake. Please use the version of this [Poco fix](https://github.com/stephb9959/poco). Building
15+
from the master copy needed for cmake. Please use the version of this [Poco fix](https://github.com/Telecominfraproject/wlan-cloud-lib-poco). Building
1616
Poco may take several minutes depending on the platform you are building on.
1717

1818
## Ubuntu
1919
These instructions have proven to work on Ubuntu 20.4.
2020
```bash
21-
sudo apt install git cmake g++ libssl-dev libmariabd-dev unixodbc-dev
21+
sudo apt install git cmake g++ libssl-dev libmariabd-dev unixodbc-dev
2222
sudo apt install libpq-dev libaprutil1-dev apache2-dev libboost-all-dev
2323
sudo apt install librdkafka-dev liblua5.3-dev
2424

25-
git clone https://github.com/stephb9959/poco
25+
git clone https://github.com/Telecominfraproject/wlan-cloud-lib-poco --branch poco-tip-v1 poco
2626
cd poco
2727
mkdir cmake-build
2828
cd cmake-build
2929
cmake ..
3030
cmake --build . --config Release
3131
sudo cmake --build . --target install
32+
cd ../..
3233

33-
git clone https://github.com/stephb9959/cppkafka
34+
git clone https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka --branch tip-v1 cppkafka
3435
cd cppkafka
3536
mkdir cmake-build
3637
cd cmake-build
3738
cmake ..
3839
cmake --build . --config Release
3940
sudo cmake --build . --target install
41+
cd ../..
4042

41-
cd ~
4243
git clone https://github.com/Telecominfraproject/wlan-cloud-ucentralgw
4344
cd wlan-cloud-ucentralgw
4445
mkdir cmake-build
4546
cd cmake-build
4647
cmake ..
4748
make
49+
cd ../..
4850
```
4951

5052
## Fedora
5153
The following instructions have proven to work on Fedora 33
5254
```bash
5355
sudo yum install cmake g++ openssl-devel unixODBC-devel mysql-devel mysql apr-util-devel boost boost-devel
54-
sudo yum install yaml-cpp-devel lua-devel
56+
sudo yum install yaml-cpp-devel lua-devel
5557
sudo dnf install postgresql.x86_64 librdkafka-devel
5658
sudo dnf install postgresql-devel
5759

58-
git clone https://github.com/stephb9959/poco
60+
git clone https://github.com/Telecominfraproject/wlan-cloud-lib-poco --branch poco-tip-v1 poco
5961
cd poco
6062
mkdir cmake-build
6163
cd cmake-build
6264
cmake ..
6365
cmake --build . --config Release
6466
sudo cmake --build . --target install
67+
cd ../..
6568

66-
git clone https://github.com/stephb9959/cppkafka
69+
git clone https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka --branch tip-v1 cppkafka
6770
cd cppkafka
6871
mkdir cmake-build
6972
cd cmake-build
7073
cmake ..
7174
cmake --build . --config Release
7275
sudo cmake --build . --target install
76+
cd ../..
7377

74-
cd ~
7578
git clone https://github.com/Telecominfraproject/wlan-cloud-ucentralfms
7679
cd wlan-cloud-ucentralfms
7780
mkdir cmake-build
7881
cd cmake-build
7982
cmake ..
8083
make
84+
cd ../..
8185

8286
```
8387

84-
## OSX Build
88+
## Mac OSX Build
8589
The following instructions have proven to work on OSX Big Sur. You need to install [Homebrew](https://brew.sh/). You must also have installed [XCode for OS X](https://www.freecodecamp.org/news/how-to-download-and-install-xcode/).
8690
```bash
87-
brew install openssl
88-
brew install cmake
89-
brew install libpq
90-
brew install mysql-client
91-
brew install apr
92-
brew install apr-util
93-
brew install boost
94-
brew install yaml-cpp
95-
brew install postgresql
96-
brew install unixodbc
97-
brew install librdkafka
91+
brew install \
92+
openssl cmake libpq mysql-client \
93+
apr apr-util boost yaml-cpp postgresql \
94+
unixodbc librdkafka
9895

99-
git clone https://github.com/stephb9959/poco
96+
git clone https://github.com/Telecominfraproject/wlan-cloud-lib-poco --branch poco-tip-v1 poco
10097
cd poco
101-
mkdir cmake-build
98+
mkdir cmake-build
10299
cd cmake-build
103100
cmake ..
104101
cmake --build . --config Release -j
105102
sudo cmake --build . --target install
103+
cd ../..
106104

107-
git clone https://github.com/stephb9959/cppkafka
105+
git clone https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka --branch tip-v1 cppkafka
108106
cd cppkafka
109107
mkdir cmake-build
110108
cd cmake-build
111109
cmake ..
112110
cmake --build . --config Release
113111
sudo cmake --build . --target install
112+
cd ../..
114113

115-
cd ~
116114
git clone https://github.com/Telecominfraproject/wlan-cloud-ucentralfms
117115
cd wlan-cloud-ucentralfms
118116
mkdir cmake-build
119117
cd cmake-build
120118
cmake ..
121119
make -j
120+
cd ../..
122121
```

Dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
1616
FROM build-base AS poco-build
1717

1818
ARG POCO_VERSION
19-
20-
ADD https://api.github.com/repos/AriliaWireless/poco/git/refs/tags/${POCO_VERSION} version.json
21-
RUN git clone https://github.com/AriliaWireless/poco --branch ${POCO_VERSION} /poco
19+
ADD https://api.github.com/repos/Telecominfraproject/wlan-cloud-lib-poco/git/refs/tags/${POCO_VERSION} version.json
20+
RUN git clone https://github.com/Telecominfraproject/wlan-cloud-lib-poco --branch ${POCO_VERSION} /poco
2221

2322
WORKDIR /poco
2423
RUN mkdir cmake-build
@@ -31,8 +30,8 @@ FROM build-base AS cppkafka-build
3130

3231
ARG CPPKAFKA_VERSION
3332

34-
ADD https://api.github.com/repos/AriliaWireless/cppkafka/git/refs/tags/${CPPKAFKA_VERSION} version.json
35-
RUN git clone https://github.com/AriliaWireless/cppkafka --branch ${CPPKAFKA_VERSION} /cppkafka
33+
ADD https://api.github.com/repos/Telecominfraproject/wlan-cloud-lib-cppkafka/git/refs/tags/${CPPKAFKA_VERSION} version.json
34+
RUN git clone https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka --branch ${CPPKAFKA_VERSION} /cppkafka
3635

3736
WORKDIR /cppkafka
3837
RUN mkdir cmake-build

build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6
1+
7

src/RESTObjects/RESTAPI_ProvObjects.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,9 @@ namespace OpenWifi::ProvObjects {
587587
field_to_json(Obj, "locale", locale);
588588
field_to_json(Obj, "realMacAddress", realMacAddress);
589589
field_to_json(Obj, "doNotAllowOverrides", doNotAllowOverrides);
590+
field_to_json(Obj, "imported", imported);
591+
field_to_json(Obj, "connected", connected);
592+
field_to_json(Obj, "platform", platform);
590593
}
591594

592595
bool InventoryTag::from_json(const Poco::JSON::Object::Ptr &Obj) {
@@ -609,6 +612,9 @@ namespace OpenWifi::ProvObjects {
609612
field_from_json(Obj, "locale", locale);
610613
field_from_json(Obj, "realMacAddress", realMacAddress);
611614
field_from_json(Obj, "doNotAllowOverrides", doNotAllowOverrides);
615+
field_from_json(Obj, "imported", imported);
616+
field_from_json(Obj, "connected", connected);
617+
field_from_json(Obj, "platform", platform);
612618
return true;
613619
} catch (...) {
614620
}

src/RESTObjects/RESTAPI_ProvObjects.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,9 +490,11 @@ namespace OpenWifi::ProvObjects {
490490
std::string locale;
491491
std::string realMacAddress;
492492
bool doNotAllowOverrides = false;
493+
std::uint64_t imported=0;
494+
std::uint64_t connected=0;
495+
std::string platform{"AP"};
493496

494497
void to_json(Poco::JSON::Object &Obj) const;
495-
496498
bool from_json(const Poco::JSON::Object::Ptr &Obj);
497499
};
498500

src/framework/EventBusManager.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ namespace OpenWifi {
1616
KafkaManager()->PostMessage(KafkaTopics::SERVICE_EVENTS, MicroServicePrivateEndPoint(), Msg,
1717
false);
1818
while (Running_) {
19-
Poco::Thread::trySleep((unsigned long)MicroServiceDaemonBusTimer());
20-
if (!Running_)
21-
break;
19+
if(!Poco::Thread::trySleep((unsigned long)MicroServiceDaemonBusTimer())) {
20+
break;
21+
}
2222
Msg = (MicroServiceMakeSystemEventMessage(KafkaTopics::ServiceEvents::EVENT_KEEP_ALIVE));
2323
KafkaManager()->PostMessage(KafkaTopics::SERVICE_EVENTS, MicroServicePrivateEndPoint(),
2424
Msg, false);
@@ -29,19 +29,19 @@ namespace OpenWifi {
2929
};
3030

3131
void EventBusManager::Start() {
32-
poco_information(Logger(), "Starting...");
32+
poco_information(Logger_, "Starting...");
3333
if (KafkaManager()->Enabled()) {
3434
Thread_.start(*this);
3535
}
3636
}
3737

3838
void EventBusManager::Stop() {
3939
if (KafkaManager()->Enabled()) {
40-
poco_information(Logger(), "Stopping...");
40+
poco_information(Logger_, "Stopping...");
4141
Running_ = false;
4242
Thread_.wakeUp();
4343
Thread_.join();
44-
poco_information(Logger(), "Stopped...");
44+
poco_information(Logger_, "Stopped...");
4545
}
4646
}
4747

src/framework/EventBusManager.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ namespace OpenWifi {
2222
return instance_;
2323
}
2424

25-
explicit EventBusManager(Poco::Logger &L);
2625
void run() final;
2726
void Start();
2827
void Stop();

src/framework/KafkaManager.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,10 @@ namespace OpenWifi {
7979
Utils::SetThreadName("Kafka:Prod");
8080
cppkafka::Configuration Config(
8181
{{"client.id", MicroServiceConfigGetString("openwifi.kafka.client.id", "")},
82-
{"metadata.broker.list",
83-
MicroServiceConfigGetString("openwifi.kafka.brokerlist", "")}});
82+
{"metadata.broker.list",MicroServiceConfigGetString("openwifi.kafka.brokerlist", "")} // ,
83+
// {"send.buffer.bytes", KafkaManager()->KafkaManagerMaximumPayloadSize() }
84+
}
85+
);
8486

8587
AddKafkaSecurity(Config);
8688

@@ -275,6 +277,7 @@ namespace OpenWifi {
275277
int KafkaManager::Start() {
276278
if (!KafkaEnabled_)
277279
return 0;
280+
MaxPayloadSize_ = MicroServiceConfigGetInt("openwifi.kafka.max.payload", 250000);
278281
ConsumerThr_.Start();
279282
ProducerThr_.Start();
280283
return 0;

src/framework/KafkaManager.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,14 @@ namespace OpenWifi {
9494
return ConsumerThr_.UnregisterTopicWatcher(Topic,Id);
9595
}
9696

97+
std::uint64_t KafkaManagerMaximumPayloadSize() const { return MaxPayloadSize_; }
98+
9799
private:
98100
bool KafkaEnabled_ = false;
99101
std::string SystemInfoWrapper_;
100102
KafkaProducer ProducerThr_;
101103
KafkaConsumer ConsumerThr_;
104+
std::uint64_t MaxPayloadSize_ = 250000;
102105

103106
void PartitionAssignment(const cppkafka::TopicPartitionList &partitions);
104107
void PartitionRevocation(const cppkafka::TopicPartitionList &partitions);

0 commit comments

Comments
 (0)