mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-31 14:05:33 +00:00
[trac3664] Cleanup
Cleanup spaces and such to meet coding specs Remove testing artifacts Update man page documenation
This commit is contained in:
@@ -44,18 +44,18 @@
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>kea-lfc</command>
|
||||
<arg><option>-4|-6</option></arg>
|
||||
<arg><option>-c <replaceable class="parameter">config-file</replaceable></option></arg>
|
||||
<arg><option>-p <replaceable class="parameter">previous-file</replaceable></option></arg>
|
||||
<arg><option>-i <replaceable class="parameter">copy-file</replaceable></option></arg>
|
||||
<arg><option>-o <replaceable class="parameter">output-file</replaceable></option></arg>
|
||||
<arg><option>-f <replaceable class="parameter">finish-file</replaceable></option></arg>
|
||||
<arg><option>-v</option></arg>
|
||||
<arg><option>-V</option></arg>
|
||||
<arg><option>-d</option></arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>kea-lfc</command>
|
||||
<arg><option>-s</option></arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
|
||||
<refsect1>
|
||||
<title>DESCRIPTION</title>
|
||||
<para>
|
||||
@@ -76,13 +76,34 @@
|
||||
<variablelist>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-v</option></term>
|
||||
<term><option>-d</option></term>
|
||||
<listitem><para>
|
||||
Verbose mode sets the logging level to debug. This is primarily
|
||||
for development purposes in stand-alone mode.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-v</option></term>
|
||||
<listitem><para>
|
||||
version causes the version stamp to be printed.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-V</option></term>
|
||||
<listitem><para>
|
||||
Version causes a longer form of the version stamp to be printed.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-4 | -6</option></term>
|
||||
<listitem><para>
|
||||
The protocol version of the lease files, must be one of 4 or 6.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-c</option></term>
|
||||
<listitem><para>
|
||||
@@ -91,6 +112,47 @@
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-p</option></term>
|
||||
<listitem><para>
|
||||
Previous lease file - When LFC starts this is the result of any previous
|
||||
run of LFC.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-i</option></term>
|
||||
<listitem><para>
|
||||
Input or copy of lease file - Before the DHCP serves invokes LFC it will move
|
||||
the current lease file to this file and then call LFC with the new file.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-o</option></term>
|
||||
<listitem><para>
|
||||
Output lease file - The temporary file LFC should use to write the leases.
|
||||
Upon completion this file will be moved to the finish file (see below).
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-f</option></term>
|
||||
<listitem><para>
|
||||
Finish or completion file - Another temporary file LFC uses for bookkeeping.
|
||||
When LFC completes writing the output file it moves it to this file name.
|
||||
After LFC finishes deleting the other files (previous and input) it moves
|
||||
this file to previous lease file.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-c</option></term>
|
||||
<listitem><para>
|
||||
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
|
@@ -12,11 +12,11 @@
|
||||
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
// PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
#include <config.h>
|
||||
#include <lfc/lfc.h>
|
||||
#include <exceptions/exceptions.h>
|
||||
#include <log/logger_support.h>
|
||||
#include <log/logger_manager.h>
|
||||
#include <config.h>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
@@ -33,12 +33,10 @@ const char* lfcController::lfc_bin_name_ = "kea-lfc";
|
||||
|
||||
lfcController::lfcController()
|
||||
: protocol_version_(0), verbose_(false), config_file_(""), previous_file_(""),
|
||||
copy_file_(""), output_file_(""), finish_file_(""), pid_file_("./test_pid") {
|
||||
std::cerr << "created lfc" << std::endl;
|
||||
copy_file_(""), output_file_(""), finish_file_(""), pid_file_("") {
|
||||
}
|
||||
|
||||
lfcController::~lfcController() {
|
||||
std::cerr << "destroyed lfc" << std::endl;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -49,13 +47,10 @@ lfcController::launch(int argc, char* argv[], const bool test_mode) {
|
||||
usage(ex.what());
|
||||
throw; // rethrow it
|
||||
}
|
||||
|
||||
std::cerr << "launched lfc" << std::endl;
|
||||
}
|
||||
|
||||
void
|
||||
lfcController::parseArgs(int argc, char* argv[])
|
||||
{
|
||||
lfcController::parseArgs(int argc, char* argv[]) {
|
||||
int ch;
|
||||
|
||||
while ((ch = getopt(argc, argv, "46dvVp:i:o:c:f:")) != -1) {
|
||||
@@ -171,26 +166,8 @@ lfcController::parseArgs(int argc, char* argv[])
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
lfcController::pidCheck(const std::string & pid_file)
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
bool
|
||||
lfcController::pidWrite(const std::string & pid_file)
|
||||
{
|
||||
return (true);
|
||||
}
|
||||
|
||||
void
|
||||
lfcController::pidDelete(const std::string & pid_file)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
lfcController::usage(const std::string & text)
|
||||
{
|
||||
lfcController::usage(const std::string& text) {
|
||||
if (text != "") {
|
||||
std::cerr << "Usage error: " << text << std::endl;
|
||||
}
|
||||
|
@@ -16,7 +16,6 @@
|
||||
#define LFC_H
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <exceptions/exceptions.h>
|
||||
|
||||
namespace isc {
|
||||
@@ -53,9 +52,9 @@ public:
|
||||
///
|
||||
/// 1. parse command line arguments
|
||||
/// 2. verifies that it is the only instance
|
||||
/// 3. creates pid file
|
||||
/// 3. creates pid file (TBD)
|
||||
/// .... TBD
|
||||
/// 4. remove pid file
|
||||
/// 4. remove pid file (TBD)
|
||||
/// 5. exit to the caller
|
||||
void launch(int argc, char* argv[], const bool test_mode);
|
||||
|
||||
@@ -63,21 +62,6 @@ public:
|
||||
/// step taken after the process has been launched.
|
||||
void parseArgs(int argc, char* argv[]);
|
||||
|
||||
/// @brief Use the pid file to determine if there is another instance
|
||||
///
|
||||
/// @param pid_file is the name of the file which holds the pid to check
|
||||
/// returns true if there is a process with that pid
|
||||
bool pidCheck(const std::string & pid_file);
|
||||
|
||||
/// @brief Extract the pid and Write it out to the pid file
|
||||
///
|
||||
/// @param pid_file is the name of the file in which to write the pid
|
||||
/// returns true if the write was successful
|
||||
bool pidWrite(const std::string & pid_file);
|
||||
|
||||
/// @brief Get rid of the pid file we created earlier
|
||||
void pidDelete(const std::string & pid_file);
|
||||
|
||||
/// @brief Prints the program usage text to std error.
|
||||
///
|
||||
/// @param text is a string message which will preceded the usage text.
|
||||
@@ -157,4 +141,3 @@ private:
|
||||
}; // namespace isc
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -12,12 +12,11 @@
|
||||
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
// PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
#include <config.h>
|
||||
#include <lfc/lfc.h>
|
||||
#include <exceptions/exceptions.h>
|
||||
#include <log/logger_support.h>
|
||||
#include <log/logger_manager.h>
|
||||
|
||||
#include <config.h>
|
||||
#include <iostream>
|
||||
|
||||
using namespace isc::lfc;
|
||||
|
@@ -12,9 +12,9 @@
|
||||
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
// PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
#include <lfc/lfc.h>
|
||||
#include <log/logger_support.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <lfc/lfc.h>
|
||||
|
||||
using namespace isc::lfc;
|
||||
using namespace std;
|
||||
@@ -23,14 +23,13 @@ TEST(lfcControllerTest, initialValues) {
|
||||
lfcController lfcController;
|
||||
|
||||
// Verify that we start with everything empty
|
||||
EXPECT_TRUE(lfcController.getProtocolVersion() == 0);
|
||||
EXPECT_TRUE(lfcController.getConfigFile() == "");
|
||||
EXPECT_TRUE(lfcController.getPreviousFile() == "");
|
||||
EXPECT_TRUE(lfcController.getCopyFile() == "");
|
||||
EXPECT_TRUE(lfcController.getOutputFile() == "");
|
||||
EXPECT_TRUE(lfcController.getFinishFile() == "");
|
||||
// Currently defaulting pid file for testing
|
||||
// EXPECT_TRUE(lfcController.getPidFile() == "");
|
||||
EXPECT_EQ(lfcController.getProtocolVersion(), 0);
|
||||
EXPECT_EQ(lfcController.getConfigFile(), "");
|
||||
EXPECT_EQ(lfcController.getPreviousFile(), "");
|
||||
EXPECT_EQ(lfcController.getCopyFile(), "");
|
||||
EXPECT_EQ(lfcController.getOutputFile(), "");
|
||||
EXPECT_EQ(lfcController.getFinishFile(), "");
|
||||
EXPECT_EQ(lfcController.getPidFile(), "");
|
||||
}
|
||||
|
||||
TEST(lfcControllerTest, fullCommandLine) {
|
||||
@@ -54,12 +53,12 @@ TEST(lfcControllerTest, fullCommandLine) {
|
||||
EXPECT_NO_THROW(lfcController.parseArgs(argc, argv));
|
||||
|
||||
// The parsed data
|
||||
EXPECT_TRUE(lfcController.getProtocolVersion() == 4);
|
||||
EXPECT_TRUE(lfcController.getConfigFile() == "config");
|
||||
EXPECT_TRUE(lfcController.getPreviousFile() == "previous");
|
||||
EXPECT_TRUE(lfcController.getCopyFile() == "copy");
|
||||
EXPECT_TRUE(lfcController.getOutputFile() == "output");
|
||||
EXPECT_TRUE(lfcController.getFinishFile() == "finish");
|
||||
EXPECT_EQ(lfcController.getProtocolVersion(), 4);
|
||||
EXPECT_EQ(lfcController.getConfigFile(), "config");
|
||||
EXPECT_EQ(lfcController.getPreviousFile(), "previous");
|
||||
EXPECT_EQ(lfcController.getCopyFile(), "copy");
|
||||
EXPECT_EQ(lfcController.getOutputFile(), "output");
|
||||
EXPECT_EQ(lfcController.getFinishFile(), "finish");
|
||||
}
|
||||
|
||||
TEST(lfcControllerTest, notEnoughData) {
|
||||
@@ -155,4 +154,3 @@ TEST(lfcControllerTest, someBadData) {
|
||||
|
||||
EXPECT_THROW(lfcController.parseArgs(argc, argv), InvalidUsage);
|
||||
}
|
||||
//-4 -p previous -i copy -o output -c config -f finish -d
|
||||
|
Reference in New Issue
Block a user