2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-31 14:05:33 +00:00

[#2601] fix YANG compilation: use SubnetIDSet from dhcpsrv

This commit is contained in:
Andrei Pavel
2022-11-22 16:05:59 +02:00
committed by Razvan Becheriu
parent a2a35ede21
commit 009fe0c300
5 changed files with 13 additions and 11 deletions

View File

@@ -6,6 +6,7 @@
#include <config.h> #include <config.h>
#include <dhcpsrv/subnet_id.h>
#include <yang/adaptor_config.h> #include <yang/adaptor_config.h>
using namespace std; using namespace std;

View File

@@ -7,6 +7,7 @@
#ifndef ISC_ADAPTOR_CONFIG_H #ifndef ISC_ADAPTOR_CONFIG_H
#define ISC_ADAPTOR_CONFIG_H 1 #define ISC_ADAPTOR_CONFIG_H 1
#include <dhcpsrv/subnet_id.h>
#include <yang/adaptor_host.h> #include <yang/adaptor_host.h>
#include <yang/adaptor_option.h> #include <yang/adaptor_option.h>
#include <yang/adaptor_pool.h> #include <yang/adaptor_pool.h>
@@ -60,7 +61,7 @@ protected:
/// @param set The reference to the set of assigned IDs. /// @param set The reference to the set of assigned IDs.
/// @return True if all subnets have an ID, false otherwise. /// @return True if all subnets have an ID, false otherwise.
static bool subnetsCollectID(isc::data::ConstElementPtr subnets, static bool subnetsCollectID(isc::data::ConstElementPtr subnets,
SubnetIDSet& set); isc::dhcp::SubnetIDSet& set);
/// @brief Collects subnet-ids in all subnets in all shared network list. /// @brief Collects subnet-ids in all subnets in all shared network list.
/// ///
@@ -74,7 +75,7 @@ protected:
/// @param subsel The subnet list name. /// @param subsel The subnet list name.
/// @return True if all subnets have an ID, false otherwise. /// @return True if all subnets have an ID, false otherwise.
static bool sharedNetworksCollectID(isc::data::ConstElementPtr networks, static bool sharedNetworksCollectID(isc::data::ConstElementPtr networks,
SubnetIDSet& set, isc::dhcp::SubnetIDSet& set,
const std::string& subsel); const std::string& subsel);
/// @brief Assigns subnet-id to every subnet in a subnet list. /// @brief Assigns subnet-id to every subnet in a subnet list.
@@ -86,7 +87,8 @@ protected:
/// @param set The reference to the set of assigned IDs. /// @param set The reference to the set of assigned IDs.
/// @param next The next ID. /// @param next The next ID.
static void subnetsAssignID(isc::data::ConstElementPtr subnets, static void subnetsAssignID(isc::data::ConstElementPtr subnets,
SubnetIDSet& set, isc::dhcp::SubnetID& next); isc::dhcp::SubnetIDSet& set,
isc::dhcp::SubnetID& next);
/// @brief Assigns subnet-id to every subnet in a shared network list. /// @brief Assigns subnet-id to every subnet in a shared network list.
/// ///
@@ -98,7 +100,7 @@ protected:
/// @param next The next ID. /// @param next The next ID.
/// @param subsel The subnet list name. /// @param subsel The subnet list name.
static void sharedNetworksAssignID(isc::data::ConstElementPtr networks, static void sharedNetworksAssignID(isc::data::ConstElementPtr networks,
SubnetIDSet& set, isc::dhcp::SubnetIDSet& set,
isc::dhcp::SubnetID& next, isc::dhcp::SubnetID& next,
const std::string& subsel); const std::string& subsel);

View File

@@ -6,6 +6,7 @@
#include <config.h> #include <config.h>
#include <dhcpsrv/subnet_id.h>
#include <yang/adaptor_subnet.h> #include <yang/adaptor_subnet.h>
using namespace std; using namespace std;

View File

@@ -10,14 +10,9 @@
#include <dhcpsrv/subnet_id.h> #include <dhcpsrv/subnet_id.h>
#include <yang/adaptor.h> #include <yang/adaptor.h>
#include <unordered_set>
namespace isc { namespace isc {
namespace yang { namespace yang {
/// @brief Set of SubnetIDs.
using SubnetIDSet = std::unordered_set<isc::dhcp::SubnetID>;
/// @brief JSON adaptor for subnets adding IDs and canonizes relays. /// @brief JSON adaptor for subnets adding IDs and canonizes relays.
/// ///
/// Adding IDs is done in two passes walking through subnets. /// Adding IDs is done in two passes walking through subnets.
@@ -38,14 +33,16 @@ public:
/// @param subnet The subnet. /// @param subnet The subnet.
/// @param set The reference to the set of assigned IDs. /// @param set The reference to the set of assigned IDs.
/// @return True if the subnet has an ID, false otherwise. /// @return True if the subnet has an ID, false otherwise.
static bool collectID(isc::data::ConstElementPtr subnet, SubnetIDSet& set); static bool collectID(isc::data::ConstElementPtr subnet,
isc::dhcp::SubnetIDSet& set);
/// @brief Assign subnet ID. /// @brief Assign subnet ID.
/// ///
/// @param subnet The subnet. /// @param subnet The subnet.
/// @param set The reference to the set of assigned IDs. /// @param set The reference to the set of assigned IDs.
/// @param next The next ID. /// @param next The next ID.
static void assignID(isc::data::ElementPtr subnet, SubnetIDSet& set, static void assignID(isc::data::ElementPtr subnet,
isc::dhcp::SubnetIDSet& set,
isc::dhcp::SubnetID& next); isc::dhcp::SubnetID& next);
/// @brief Update relay. /// @brief Update relay.

View File

@@ -8,6 +8,7 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <dhcpsrv/subnet_id.h>
#include <testutils/gtest_utils.h> #include <testutils/gtest_utils.h>
#include <yang/adaptor_subnet.h> #include <yang/adaptor_subnet.h>