#include <config.h>
#include <yang/translator_control_socket.h>
+#include <yang/yang_models.h>
#include <yang/tests/sysrepo_setup.h>
#include <gtest/gtest.h>
// This test verifies that an empty control socket can be properly
// translated from YANG to JSON.
TEST_F(TranslatorControlSocketTest, getEmpty) {
- useModel("kea-dhcp4-server");
+ useModel(KEA_DHCP4_SERVER);
// Get empty.
const string& xpath = "/kea-dhcp4-server:config/control-socket";
EXPECT_NO_THROW(sock = t_obj_->getControlSocket(xpath));
EXPECT_FALSE(sock);
}
-
+
// This test verifies that a not empty control socket can be properly
// translated from YANG to JSON.
TEST_F(TranslatorControlSocketTest, get) {
- useModel("kea-dhcp6-server");
+ useModel(KEA_DHCP6_SERVER);
// Set a value.
const string& xpath = "/kea-dhcp6-server:config/control-socket";
// This test verifies that a not empty control socket can be properly
// translated from JSON to YANG.
TEST_F(TranslatorControlSocketTest, set) {
- useModel("kea-ctrl-agent");
+ useModel(KEA_CTRL_AGENT);
// Set a value.
const string& xpath =
// This test verifies that an empty control socket can be properly
// translated from JSON to YANG.
TEST_F(TranslatorControlSocketTest, setEmpty) {
- useModel("kea-dhcp4-server");
+ useModel(KEA_DHCP4_SERVER);
// Set a value.
const string& xpath = "/kea-dhcp4-server:config/control-socket";
#include <yang/translator_control_socket.h>
#include <yang/adaptor.h>
+#include <yang/yang_models.h>
#include <sstream>
using namespace std;
ConstElementPtr
TranslatorControlSocket::getControlSocket(const string& xpath) {
try {
- if ((model_ == "kea-dhcp4-server") ||
- (model_ == "kea-dhcp6-server") ||
- (model_ == "kea-dhcp-ddns") ||
- (model_ == "kea-ctrl-agent")) {
+ if ((model_ == KEA_DHCP4_SERVER) ||
+ (model_ == KEA_DHCP6_SERVER) ||
+ (model_ == KEA_DHCP_DDNS) ||
+ (model_ == KEA_CTRL_AGENT)) {
return (getControlSocketKea(xpath));
}
} catch (const sysrepo_exception& ex) {
TranslatorControlSocket::setControlSocket(const string& xpath,
ConstElementPtr elem) {
try {
- if ((model_ == "kea-dhcp4-server") ||
- (model_ == "kea-dhcp6-server") ||
- (model_ == "kea-dhcp-ddns") ||
- (model_ == "kea-ctrl-agent")) {
+ if ((model_ == KEA_DHCP4_SERVER) ||
+ (model_ == KEA_DHCP6_SERVER) ||
+ (model_ == KEA_DHCP_DDNS) ||
+ (model_ == KEA_CTRL_AGENT)) {
setControlSocketKea(xpath, elem);
} else {
isc_throw(NotImplemented,