First commit
This commit is contained in:
44
setup/e2/RIC-E2-TERMINATION/TEST/ASN_LOG/LogTest.cpp
Normal file
44
setup/e2/RIC-E2-TERMINATION/TEST/ASN_LOG/LogTest.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2019 AT&T Intellectual Property
|
||||
* Copyright 2019 Nokia
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// Created by adi ENZEL on 11/26/19.
|
||||
//
|
||||
|
||||
#include "LogTest.h"
|
||||
|
||||
string LogTest::getLine() {
|
||||
std::string line;
|
||||
|
||||
if (std::getline(file, line)) {
|
||||
return line;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
void LogTest::getJsonDoc(string json) {
|
||||
if (json.length() != 0) {
|
||||
document.Parse(json.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
string LogTest::getBase64(Document &document) {
|
||||
if (document.HasMember("asnBase64")) {
|
||||
return document["asnBase64"].GetString();
|
||||
}
|
||||
return "";
|
||||
}
|
81
setup/e2/RIC-E2-TERMINATION/TEST/ASN_LOG/LogTest.h
Normal file
81
setup/e2/RIC-E2-TERMINATION/TEST/ASN_LOG/LogTest.h
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright 2019 AT&T Intellectual Property
|
||||
* Copyright 2019 Nokia
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// Created by adi ENZEL on 11/26/19.
|
||||
//
|
||||
|
||||
#ifndef E2_LOGTEST_H
|
||||
#define E2_LOGTEST_H
|
||||
#include <algorithm>
|
||||
|
||||
#include <cstdio>
|
||||
#include <cerrno>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <random>
|
||||
#include <sys/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_icmp.h>
|
||||
#include <netinet/sctp.h>
|
||||
#include <thread>
|
||||
#include <atomic>
|
||||
#include <sys/param.h>
|
||||
#include <sys/file.h>
|
||||
#include <ctime>
|
||||
#include <netdb.h>
|
||||
#include <sys/epoll.h>
|
||||
#include <mutex>
|
||||
#include <shared_mutex>
|
||||
#include <iterator>
|
||||
#include <map>
|
||||
#include <fstream>
|
||||
|
||||
#include "rapidjson/document.h"
|
||||
#include "rapidjson/writer.h"
|
||||
#include "rapidjson/stringbuffer.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace rapidjson;
|
||||
|
||||
class LogTest {
|
||||
public:
|
||||
LogTest() = default;
|
||||
|
||||
int openFile(string const& configFile) {
|
||||
file.open(configFile.c_str());
|
||||
if (!file) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
string getLine();
|
||||
void getJsonDoc(string json);
|
||||
|
||||
string getBase64(Document &document);
|
||||
|
||||
private:
|
||||
std::ifstream file;
|
||||
Document document;
|
||||
};
|
||||
|
||||
|
||||
#endif //E2_LOGTEST_H
|
Reference in New Issue
Block a user