Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
b6d4dff8
Commit
b6d4dff8
authored
Apr 06, 2018
by
Francis Dupont
Browse files
[5374] Checkpoint before regen
parent
ed00b40d
Changes
32
Hide whitespace changes
Inline
Side-by-side
doc/guide/classify.xml
View file @
b6d4dff8
...
...
@@ -759,9 +759,9 @@ concatenation of the strings</entry></row>
<title>
Configuring Classes
</title>
<para>
A class contains five items: a name, a test expression, option data,
option definition and
eval on-deman
d flag.
option definition and
only-if-require
d flag.
The name must exist and must be unique amongst all classes. The test
expression, option data and definition, and
eval on-deman
d flag are
expression, option data and definition, and
only-if-require
d flag are
optional.
</para>
...
...
@@ -786,21 +786,21 @@ concatenation of the strings</entry></row>
Usually the test expression is evaluated before subnet selection
but in some cases it is useful to evaluate it later when the
subnet, shared-network or pools are known but output option
processing not yet done. The
eval-on-deman
d flag, false by default,
allows to
defer and make only on-demand
the evaluation of the
test expression
.
processing not yet done. The
only-if-require
d flag, false by default,
allows to
perform
the evaluation of the
test expression only
when it was required, i.e. in a required-client-classes list
.
</para>
<para>
The
eval
-client-classes list which is valid for shared-network,
The
required
-client-classes list which is valid for shared-network,
subnet and pool scope specifies the classes which are evaluated
in the second pass before output option processing.
The list is built in the reversed precedence order of option
data, i.e. an option data in a subnet takes precedence on one
in a shared-network but
an on-deman
d class in a subnet is added
in a shared-network but
require
d class in a subnet is added
after one in a shared-network.
The mechanism is related to the
eval-on-deman
d flag but it is
not
required
that the flag was set to true.
The mechanism is related to the
only-if-require
d flag but it is
not
mandatory
that the flag was set to true.
</para>
<para>
...
...
doc/guide/dhcp4-srv.xml
View file @
b6d4dff8
...
...
@@ -2095,8 +2095,8 @@ It is merely echoed by the server
is to assess an incoming packet and assign it to zero or more classes. The
second step is to choose a subnet, possibly based on the class information.
The third step is to assign classes from host reservations.
The forth step is to build the list of
on-deman
d classes and perform
deferred
evaluation for each class of the list.
The forth step is to build the list of
require
d classes and perform
the
evaluation for each class of the list.
The last step is to assign options, again possibly based on the class
information.
</para>
...
...
@@ -2248,23 +2248,23 @@ It is merely echoed by the server
</para>
</section>
<section
id=
"dhcp4-
on-deman
d-class"
>
<title>
On-deman
d classification
</title>
<section
id=
"dhcp4-
require
d-class"
>
<title>
Require
d classification
</title>
<para>
In some cases it is useful to limit the scope of class.
Two devices are available to perform evaluation of test
expressions so assignment when it
returns true only on-deman
d.
expressions so assignment when it
was require
d.
</para>
<para>
The first one is the per-class
<command>
eval-on-deman
d
</command>
The first one is the per-class
<command>
only-if-require
d
</command>
flag which is false by default. When it is set to
<command>
true
</command>
the test expression of the class is not
evaluated at the reception of a new incoming ticket.
</para>
<para>
The second is the
<command>
eval
-client-classes
</command>
which
The second is the
<command>
required
-client-classes
</command>
which
takes a list of class names and is valid in shared-network,
subnet and pool scope. Classes in these lists are evaluated
after resource assignment and before output option processing.
...
...
@@ -2280,7 +2280,7 @@ It is merely echoed by the server
{
<userinput>
"name": "Client_foo",
"test": "'' == ''",
"
eval-on-deman
d": true
</userinput>
"
only-if-require
d": true
</userinput>
},
...
],
...
...
@@ -2288,7 +2288,7 @@ It is merely echoed by the server
{
"subnet": "192.0.2.0/24",
"pools": [ { "pool": "192.0.2.10 - 192.0.2.20" } ],
<userinput>
"
eval
-client-classes": [ "Client_foo" ],
</userinput>
<userinput>
"
required
-client-classes": [ "Client_foo" ],
</userinput>
...
},
...
...
...
doc/guide/dhcp6-srv.xml
View file @
b6d4dff8
...
...
@@ -1955,8 +1955,8 @@ should include options from the isc option space:
is to assess an incoming packet and assign it to zero or more classes. The
second step is to choose a subnet, possibly based on the class information.
The third step is to assign classes from host reservations.
The forth step is to build the list of
on-deman
d classes and perform
deferred
evaluation for each class of the list.
The forth step is to build the list of
require
d classes and perform
the
evaluation for each class of the list.
The last step is to assign options again possibly based on the class
information.
</para>
...
...
@@ -2041,23 +2041,23 @@ should include options from the isc option space:
</para>
</section>
<section
id=
"dhcp6-
on-deman
d-class"
>
<title>
On-deman
d classification
</title>
<section
id=
"dhcp6-
require
d-class"
>
<title>
Require
d classification
</title>
<para>
In some cases it is useful to limit the scope of class.
Two devices are available to perform evaluation of test
expressions so assignment when it
returns true only on-deman
d.
expressions so assignment when it
was require
d.
</para>
<para>
The first one is the per-class
<command>
eval-on-deman
d
</command>
The first one is the per-class
<command>
only-if-require
d
</command>
flag which is false by default. When it is set to
<command>
true
</command>
the test expression of the class is not
evaluated at the reception of a new incoming ticket.
</para>
<para>
The second is the
<command>
eval
-client-classes
</command>
which
The second is the
<command>
required
-client-classes
</command>
which
takes a list of class names and is valid in shared-network,
subnet and pool scope. Classes in these lists are evaluated
after resource assignment and before output option processing.
...
...
@@ -2073,7 +2073,7 @@ should include options from the isc option space:
{
<userinput>
"name": "Client_foo",
"test": "'' == ''",
"
eval-on-deman
d": true
</userinput>
"
only-if-require
d": true
</userinput>
},
...
],
...
...
@@ -2085,7 +2085,7 @@ should include options from the isc option space:
"pool": "2001:db8:1::-2001:db8:1::ffff"
}
],
<userinput>
"
eval
-client-classes": [ "Client_foo" ],
</userinput>
<userinput>
"
required
-client-classes": [ "Client_foo" ],
</userinput>
...
},
...
...
...
src/bin/dhcp4/dhcp4_lexer.ll
View file @
b6d4dff8
...
...
@@ -795,14 +795,14 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
}
}
\"
eval
-client-classes\
" {
\"
required
-client-classes\
" {
switch(driver.ctx_) {
case isc::dhcp::Parser4Context::SUBNET4:
case isc::dhcp::Parser4Context::POOLS:
case isc::dhcp::Parser4Context::SHARED_NETWORK:
return isc::dhcp::Dhcp4Parser::make_
EVAL
_CLIENT_CLASSES(driver.loc_);
return isc::dhcp::Dhcp4Parser::make_
REQUIRED
_CLIENT_CLASSES(driver.loc_);
default:
return isc::dhcp::Dhcp4Parser::make_STRING("
eval
-client-classes
", driver.loc_);
return isc::dhcp::Dhcp4Parser::make_STRING("
required
-client-classes
", driver.loc_);
}
}
...
...
@@ -827,12 +827,12 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
}
}
\"
eval-on-deman
d\
" {
\"
only-if-require
d\
" {
switch(driver.ctx_) {
case isc::dhcp::Parser4Context::CLIENT_CLASSES:
return isc::dhcp::Dhcp4Parser::make_
EVAL_ON_DEMAN
D(driver.loc_);
return isc::dhcp::Dhcp4Parser::make_
ONLY_IF_REQUIRE
D(driver.loc_);
default:
return isc::dhcp::Dhcp4Parser::make_STRING("
eval-on-deman
d
", driver.loc_);
return isc::dhcp::Dhcp4Parser::make_STRING("
only-if-require
d
", driver.loc_);
}
}
...
...
src/bin/dhcp4/dhcp4_messages.mes
View file @
b6d4dff8
# Copyright (C) 2012-201
7
Internet Systems Consortium, Inc. ("ISC")
# Copyright (C) 2012-201
8
Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
...
...
@@ -59,12 +59,12 @@ which cannot be found in the configuration. Either a hook written
before the classification was added to Kea is used, or class naming is
inconsistent.
% DHCP4_CLASS_UN
KNOWN on-deman
d class %1 has no definition
This debug message informs that a class is listed for
late
evaluation but
% DHCP4_CLASS_UN
DEFINED require
d class %1 has no definition
This debug message informs that a class is listed for
required
evaluation but
has no definition.
% DHCP4_CLASS_UNTESTABLE
on-deman
d class %1 has no test expression
This debug message informs that a class was listed for
late
evaluation but
% DHCP4_CLASS_UNTESTABLE
require
d class %1 has no test expression
This debug message informs that a class was listed for
required
evaluation but
its definition does not include a test expression to evaluate.
% DHCP4_CLIENTID_IGNORED_FOR_LEASES %1: not using client identifier for lease allocation for subnet %2
...
...
src/bin/dhcp4/dhcp4_parser.yy
View file @
b6d4dff8
...
...
@@ -123,9 +123,9 @@ using namespace std;
HOST_RESERVATION_IDENTIFIERS "host-reservation-identifiers"
CLIENT_CLASSES "client-classes"
EVAL
_CLIENT_CLASSES "
eval
-client-classes"
REQUIRED
_CLIENT_CLASSES "
required
-client-classes"
TEST "test"
EVAL_ON_DEMAND "eval-on-deman
d"
ONLY_IF_REQUIRED "only-if-require
d"
CLIENT_CLASS "client-class"
RESERVATIONS "reservations"
...
...
@@ -911,7 +911,7 @@ subnet4_param: valid_lifetime
| id
| rapid_commit
| client_class
|
eval
_client_classes
|
required
_client_classes
| reservations
| reservation_mode
| relay
...
...
@@ -982,9 +982,9 @@ client_class: CLIENT_CLASS {
ctx.leave();
};
eval
_client_classes:
EVAL
_CLIENT_CLASSES {
required
_client_classes:
REQUIRED
_CLIENT_CLASSES {
ElementPtr c(new ListElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("
eval
-client-classes", c);
ctx.stack_.back()->set("
required
-client-classes", c);
ctx.stack_.push_back(c);
ctx.enter(ctx.NO_KEYWORD);
} COLON list_strings {
...
...
@@ -1061,7 +1061,7 @@ shared_network_param: name
| relay
| reservation_mode
| client_class
|
eval
_client_classes
|
required
_client_classes
| valid_lifetime
| unknown_map_entry
;
...
...
@@ -1344,7 +1344,7 @@ pool_params: pool_param
pool_param: pool_entry
| option_data_list
| client_class
|
eval
_client_classes
|
required
_client_classes
| user_context
| unknown_map_entry
;
...
...
@@ -1575,7 +1575,7 @@ not_empty_client_class_params: client_class_param
client_class_param: client_class_name
| client_class_test
|
eval_on_deman
d
|
only_if_require
d
| option_def_list
| option_data_list
| next_server
...
...
@@ -1594,9 +1594,9 @@ client_class_test: TEST {
ctx.leave();
};
eval_on_demand: EVAL_ON_DEMAN
D COLON BOOLEAN {
only_if_required: ONLY_IF_REQUIRE
D COLON BOOLEAN {
ElementPtr b(new BoolElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set("
eval-on-deman
d", b);
ctx.stack_.back()->set("
only-if-require
d", b);
};
// --- end of client classes ---------------------------------
...
...
src/bin/dhcp4/dhcp4_srv.cc
View file @
b6d4dff8
// Copyright (C) 2011-201
7
Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011-201
8
Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
...
...
@@ -2340,8 +2340,8 @@ Dhcpv4Srv::processDiscover(Pkt4Ptr& discover) {
if
(
!
ex
.
getResponse
()
->
getYiaddr
().
isV4Zero
())
{
// Assign reserved classes.
ex
.
setReservedClientClasses
();
//
Late
classification
late
Classify
(
ex
);
//
Required
classification
required
Classify
(
ex
);
buildCfgOptionList
(
ex
);
appendRequestedOptions
(
ex
);
...
...
@@ -2397,8 +2397,8 @@ Dhcpv4Srv::processRequest(Pkt4Ptr& request) {
if
(
!
ex
.
getResponse
()
->
getYiaddr
().
isV4Zero
())
{
// Assign reserved classes.
ex
.
setReservedClientClasses
();
//
Late
classification
late
Classify
(
ex
);
//
Required
classification
required
Classify
(
ex
);
buildCfgOptionList
(
ex
);
appendRequestedOptions
(
ex
);
...
...
@@ -2683,7 +2683,7 @@ Dhcpv4Srv::processInform(Pkt4Ptr& inform) {
Pkt4Ptr
ack
=
ex
.
getResponse
();
ex
.
setReservedClientClasses
();
late
Classify
(
ex
);
required
Classify
(
ex
);
buildCfgOptionList
(
ex
);
appendRequestedOptions
(
ex
);
...
...
@@ -2986,8 +2986,8 @@ void Dhcpv4Srv::classifyPacket(const Pkt4Ptr& pkt) {
if
(
!
expr_ptr
)
{
continue
;
}
// Not the right time if on
deman
d
if
((
*
it
)
->
get
OnDeman
d
())
{
// Not the right time if on
ly when require
d
if
((
*
it
)
->
get
Require
d
())
{
continue
;
}
// Evaluate the expression which can return false (no match),
...
...
@@ -3017,8 +3017,8 @@ void Dhcpv4Srv::classifyPacket(const Pkt4Ptr& pkt) {
}
}
void
Dhcpv4Srv
::
late
Classify
(
Dhcpv4Exchange
&
ex
)
{
// First collect
on-deman
d classes
void
Dhcpv4Srv
::
required
Classify
(
Dhcpv4Exchange
&
ex
)
{
// First collect
require
d classes
Pkt4Ptr
query
=
ex
.
getQuery
();
ClientClasses
classes
=
query
->
getClasses
(
true
);
Subnet4Ptr
subnet
=
ex
.
getContext
()
->
subnet_
;
...
...
@@ -3028,7 +3028,7 @@ void Dhcpv4Srv::lateClassify(Dhcpv4Exchange& ex) {
SharedNetwork4Ptr
network
;
subnet
->
getSharedNetwork
(
network
);
if
(
network
)
{
const
ClientClasses
&
to_add
=
network
->
get
OnDeman
dClasses
();
const
ClientClasses
&
to_add
=
network
->
get
Require
dClasses
();
for
(
ClientClasses
::
const_iterator
cclass
=
to_add
.
cbegin
();
cclass
!=
to_add
.
cend
();
++
cclass
)
{
classes
.
insert
(
*
cclass
);
...
...
@@ -3036,7 +3036,7 @@ void Dhcpv4Srv::lateClassify(Dhcpv4Exchange& ex) {
}
// Followed by the subnet
const
ClientClasses
&
to_add
=
subnet
->
get
OnDeman
dClasses
();
const
ClientClasses
&
to_add
=
subnet
->
get
Require
dClasses
();
for
(
ClientClasses
::
const_iterator
cclass
=
to_add
.
cbegin
();
cclass
!=
to_add
.
cend
();
++
cclass
)
{
classes
.
insert
(
*
cclass
);
...
...
@@ -3051,7 +3051,7 @@ void Dhcpv4Srv::lateClassify(Dhcpv4Exchange& ex) {
if
(
!
addr
.
isV4Zero
())
{
PoolPtr
pool
=
subnet
->
getPool
(
Lease
::
TYPE_V4
,
addr
,
false
);
if
(
pool
)
{
const
ClientClasses
&
to_add
=
pool
->
get
OnDeman
dClasses
();
const
ClientClasses
&
to_add
=
pool
->
get
Require
dClasses
();
for
(
ClientClasses
::
const_iterator
cclass
=
to_add
.
cbegin
();
cclass
!=
to_add
.
cend
();
++
cclass
)
{
classes
.
insert
(
*
cclass
);
...
...
@@ -3070,7 +3070,7 @@ void Dhcpv4Srv::lateClassify(Dhcpv4Exchange& ex) {
cclass
!=
classes
.
cend
();
++
cclass
)
{
const
ClientClassDefPtr
class_def
=
dict
->
findClass
(
*
cclass
);
if
(
!
class_def
)
{
LOG_DEBUG
(
dhcp4_logger
,
DBG_DHCP4_BASIC
,
DHCP4_CLASS_UN
KNOWN
)
LOG_DEBUG
(
dhcp4_logger
,
DBG_DHCP4_BASIC
,
DHCP4_CLASS_UN
DEFINED
)
.
arg
(
*
cclass
);
continue
;
}
...
...
src/bin/dhcp4/dhcp4_srv.h
View file @
b6d4dff8
// Copyright (C) 2011-201
7
Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011-201
8
Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
...
...
@@ -803,17 +803,17 @@ protected:
/// @param pkt packet to be classified
void
classifyPacket
(
const
Pkt4Ptr
&
pkt
);
/// @brief Assigns incoming packet to zero or more classes (
late
pass).
/// @brief Assigns incoming packet to zero or more classes (
required
pass).
///
/// @note This
late
classification evaluates all classes which
/// were marked for
this deferred/on-demand pass. Classes are
///
collec
ted in the reversed order than output option processing.
/// @note This
required
classification evaluates all classes which
/// were marked for
required evaluation. Classes are collected so
///
evalua
ted in the reversed order than output option processing.
///
/// @note The
eval-on-deman
d flag is related because it avoids
/// @note The
only-if-require
d flag is related because it avoids
/// double evaluation (which is not forbidden).
///
/// @param ex The exchange holding needed informations.
void
late
Classify
(
Dhcpv4Exchange
&
ex
);
void
required
Classify
(
Dhcpv4Exchange
&
ex
);
/// @brief Perform deferred option unpacking.
///
...
...
src/bin/dhcp4/tests/classify_unittest.cc
View file @
b6d4dff8
// Copyright (C) 2016-201
7
Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2016-201
8
Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
...
...
@@ -56,7 +56,7 @@ namespace {
/// or member(<last two>), set boot-file-name to pxelinux.0
///
/// - Configuration 3:
/// - Used for
late/on-deman
d classification
/// - Used for
require
d classification
/// - 1 subnet: 10.0.0.0/24
/// - 1 pool: 10.0.0.10-10.0.0.100
/// - the following classes defined:
...
...
@@ -185,19 +185,19 @@ const char* CONFIGS[] = {
"{"
"
\"
name
\"
:
\"
pxe1
\"
,"
"
\"
test
\"
:
\"
option[93].hex == 0x0009
\"
,"
"
\"
eval-on-deman
d
\"
: true,"
"
\"
only-if-require
d
\"
: true,"
"
\"
next-server
\"
:
\"
1.2.3.4
\"
"
"},"
"{"
"
\"
name
\"
:
\"
pxe2
\"
,"
"
\"
test
\"
:
\"
option[93].hex == 0x0007
\"
,"
"
\"
eval-on-deman
d
\"
: true,"
"
\"
only-if-require
d
\"
: true,"
"
\"
server-hostname
\"
:
\"
deneb
\"
"
"},"
"{"
"
\"
name
\"
:
\"
pxe3
\"
,"
"
\"
test
\"
:
\"
option[93].hex == 0x0006
\"
,"
"
\"
eval-on-deman
d
\"
: false,"
"
\"
only-if-require
d
\"
: false,"
"
\"
boot-file-name
\"
:
\"
pxelinux.0
\"
"
"},"
"{"
...
...
@@ -209,7 +209,7 @@ const char* CONFIGS[] = {
"
\"
subnet
\"
:
\"
10.0.0.0/24
\"
, "
"
\"
id
\"
: 1,"
"
\"
pools
\"
: [ {
\"
pool
\"
:
\"
10.0.0.10-10.0.0.100
\"
} ],"
"
\"
eval
-client-classes
\"
: [
\"
pxe2
\"
]"
"
\"
required
-client-classes
\"
: [
\"
pxe2
\"
]"
" } ]"
"}"
...
...
@@ -566,7 +566,7 @@ TEST_F(ClassifyTest, fixedFieldsInformNoClasses3) {
testFixedFields
(
CONFIGS
[
3
],
DHCPINFORM
,
OptionPtr
(),
"0.0.0.0"
,
""
,
""
);
}
// Class 'pxe1' is on
-deman
d and not subject to
late
evaluation
// Class 'pxe1' is on
ly-if-require
d and not subject to
required
evaluation
TEST_F
(
ClassifyTest
,
fixedFieldsDiscoverNextServer3
)
{
OptionPtr
pxe
(
new
OptionInt
<
uint16_t
>
(
Option
::
V4
,
93
,
0x0009
));
...
...
@@ -584,7 +584,7 @@ TEST_F(ClassifyTest, fixedFieldsInformNextServer3) {
}
// Class pxe2 is on
-deman
d but the subnet requ
est
s its
late
evaluation
// Class pxe2 is on
ly-if-require
d but the subnet requ
ire
s its evaluation
TEST_F
(
ClassifyTest
,
fixedFieldsDiscoverHostname3
)
{
OptionPtr
pxe
(
new
OptionInt
<
uint16_t
>
(
Option
::
V4
,
93
,
0x0007
));
...
...
@@ -633,7 +633,7 @@ TEST_F(ClassifyTest, fixedFieldsInformFile32) {
testFixedFields
(
CONFIGS
[
3
],
DHCPINFORM
,
pxe
,
"0.0.0.0"
,
""
,
"ipxe.efi"
);
}
// This test checks the precedence order in requ
ested late
evaluation.
// This test checks the precedence order in requ
ired
evaluation.
// This order is: shared-network > subnet > pools
TEST_F
(
ClassifyTest
,
precedenceNone
)
{
std
::
string
config
=
...
...
@@ -650,7 +650,7 @@ TEST_F(ClassifyTest, precedenceNone) {
" {"
"
\"
name
\"
:
\"
for-pool
\"
,"
"
\"
test
\"
:
\"
member('all')
\"
,"
"
\"
eval-on-deman
d
\"
: true,"
"
\"
only-if-require
d
\"
: true,"
"
\"
option-data
\"
: [ {"
"
\"
name
\"
:
\"
domain-name-servers
\"
,"
"
\"
data
\"
:
\"
10.0.0.1
\"
"
...
...
@@ -659,7 +659,7 @@ TEST_F(ClassifyTest, precedenceNone) {
" {"
"
\"
name
\"
:
\"
for-subnet
\"
,"
"
\"
test
\"
:
\"
member('all')
\"
,"
"
\"
eval-on-deman
d
\"
: true,"
"
\"
only-if-require
d
\"
: true,"
"
\"
option-data
\"
: [ {"
"
\"
name
\"
:
\"
domain-name-servers
\"
,"
"
\"
data
\"
:
\"
10.0.0.2
\"
"
...
...
@@ -668,7 +668,7 @@ TEST_F(ClassifyTest, precedenceNone) {
" {"
"
\"
name
\"
:
\"
for-network
\"
,"
"
\"
test
\"
:
\"
member('all')
\"
,"
"
\"
eval-on-deman
d
\"
: true,"
"
\"
only-if-require
d
\"
: true,"
"
\"
option-data
\"
: [ {"
"
\"
name
\"
:
\"
domain-name-servers
\"
,"
"
\"
data
\"
:
\"
10.0.0.3
\"
"
...
...
@@ -705,7 +705,7 @@ TEST_F(ClassifyTest, precedenceNone) {
EXPECT_FALSE
(
opt
);
}
// This test checks the precedence order in requ
ested late
evaluation.
// This test checks the precedence order in requ
ired
evaluation.
// This order is: shared-network > subnet > pools
TEST_F
(
ClassifyTest
,
precedencePool
)
{
std
::
string
config
=
...
...
@@ -722,7 +722,7 @@ TEST_F(ClassifyTest, precedencePool) {
" {"
"
\"
name
\"
:
\"
for-pool
\"
,"
"
\"
test
\"
:
\"
member('all')
\"
,"
"
\"
eval-on-deman
d
\"
: true,"
"
\"
only-if-require
d
\"
: true,"
"
\"
option-data
\"
: [ {"
"
\"
name
\"
:
\"
domain-name-servers
\"
,"
"
\"
data
\"
:
\"
10.0.0.1
\"
"
...
...
@@ -731,7 +731,7 @@ TEST_F(ClassifyTest, precedencePool) {
" {"
"
\"
name
\"
:
\"
for-subnet
\"
,"
"
\"
test
\"
:
\"
member('all')
\"
,"
"
\"
eval-on-deman
d
\"
: true,"
"
\"
only-if-require
d
\"
: true,"
"
\"
option-data
\"
: [ {"
"
\"
name
\"
:
\"
domain-name-servers
\"
,"
"
\"
data
\"
:
\"
10.0.0.2
\"
"
...
...
@@ -740,7 +740,7 @@ TEST_F(ClassifyTest, precedencePool) {
" {"
"
\"
name
\"
:
\"
for-network
\"
,"
"
\"
test
\"
:
\"
member('all')
\"
,"
"
\"
eval-on-deman
d
\"
: true,"
"
\"
only-if-require
d
\"
: true,"
"
\"
option-data
\"
: [ {"
"
\"
name
\"
:
\"
domain-name-servers
\"
,"
"
\"
data
\"
:
\"
10.0.0.3
\"
"
...
...
@@ -754,7 +754,7 @@ TEST_F(ClassifyTest, precedencePool) {
"
\"
id
\"
: 1,"
"
\"
pools
\"
: [ { "
"
\"
pool
\"
:
\"
10.0.0.10-10.0.0.100
\"
,"
"
\"
eval
-client-classes
\"
: [
\"
for-pool
\"
]"
"
\"
required
-client-classes
\"
: [
\"
for-pool
\"
]"
" } ]"
" } ]"
"} ]"
...
...
@@ -784,7 +784,7 @@ TEST_F(ClassifyTest, precedencePool) {
EXPECT_EQ
(
"10.0.0.1"
,
addrs
[
0
].
toText
());
}
// This test checks the precedence order in requ
ested late
evaluation.
// This test checks the precedence order in requ
ired
evaluation.
// This order is: shared-network > subnet > pools
TEST_F
(
ClassifyTest
,
precedenceSubnet
)
{
std
::
string
config
=
...
...
@@ -801,7 +801,7 @@ TEST_F(ClassifyTest, precedenceSubnet) {
" {"
"
\"
name
\"
:
\"
for-pool
\"
,"
"
\"
test
\"
:
\"
member('all')
\"
,"
"
\"
eval-on-deman
d
\"
: true,"
"
\"
only-if-require
d
\"
: true,"
"
\"
option-data
\"
: [ {"
"
\"
name
\"
:
\"
domain-name-servers
\"
,"
"
\"
data
\"
:
\"
10.0.0.1
\"
"
...
...
@@ -810,7 +810,7 @@ TEST_F(ClassifyTest, precedenceSubnet) {
" {"
"
\"
name
\"
:
\"
for-subnet
\"
,"
"
\"
test
\"
:
\"
member('all')
\"
,"
"
\"
eval-on-deman
d
\"
: true,"
"
\"
only-if-require
d
\"
: true,"
"
\"
option-data
\"
: [ {"
"
\"
name
\"
:
\"
domain-name-servers
\"
,"
"
\"
data
\"
:
\"
10.0.0.2
\"
"
...
...
@@ -819,7 +819,7 @@ TEST_F(ClassifyTest, precedenceSubnet) {
" {"
"
\"
name
\"
:
\"
for-network
\"
,"
"
\"
test
\"
:
\"
member('all')
\"
,"
"
\"
eval-on-deman
d
\"
: true,"
"
\"
only-if-require
d
\"
: true,"
"
\"
option-data
\"
: [ {"
"
\"
name
\"
:
\"
domain-name-servers
\"
,"
"
\"
data
\"
:
\"
10.0.0.3
\"
"
...
...
@@ -831,10 +831,10 @@ TEST_F(ClassifyTest, precedenceSubnet) {
"
\"
subnet4
\"
: [ { "
"
\"
subnet
\"
:
\"
10.0.0.0/24
\"
,"
"
\"
id
\"
: 1,"
"
\"
eval
-client-classes
\"
: [
\"
for-subnet
\"
],"
"
\"
required
-client-classes
\"
: [
\"
for-subnet
\"
],"
"
\"
pools
\"
: [ { "
"
\"
pool
\"
:
\"
10.0.0.10-10.0.0.100
\"
,"
"
\"
eval
-client-classes
\"
: [
\"
for-pool
\"
]"
"
\"
required
-client-classes
\"
: [
\"
for-pool
\"
]"
" } ]"
" } ]"
"} ]"
...
...
@@ -864,7 +864,7 @@ TEST_F(ClassifyTest, precedenceSubnet) {
EXPECT_EQ
(
"10.0.0.2"
,
addrs
[
0
].
toText
());
}
// This test checks the precedence order in requ
ested late
evaluation.
// This test checks the precedence order in requ
ired
evaluation.
// This order is: shared-network > subnet > pools
TEST_F
(
ClassifyTest
,
precedenceNetwork
)
{
std
::
string
config
=
...
...
@@ -881,7 +881,7 @@ TEST_F(ClassifyTest, precedenceNetwork) {
" {"
"
\"
name
\"
:
\"
for-pool
\"
,"
"
\"
test
\"
:
\"
member('all')
\"
,"
"
\"
eval-on-deman
d
\"
: true,"
"
\"
only-if-require
d
\"
: true,"
"
\"
option-data
\"
: [ {"
"
\"
name
\"
:
\"
domain-name-servers
\"
,"
"
\"
data
\"
:
\"
10.0.0.1
\"
"
...
...
@@ -890,7 +890,7 @@ TEST_F(ClassifyTest, precedenceNetwork) {
" {"
"
\"
name
\"
:
\"
for-subnet
\"
,"
"
\"
test
\"
:
\"
member('all')
\"
,"
"
\"
eval-on-deman
d
\"
: true,"
"
\"
only-if-require
d
\"
: true,"
"
\"
option-data
\"
: [ {"
"
\"
name
\"
:
\"
domain-name-servers
\"
,"
"
\"
data
\"
:
\"
10.0.0.2
\"
"
...
...
@@ -899,7 +899,7 @@ TEST_F(ClassifyTest, precedenceNetwork) {
" {"
"
\"
name
\"
:
\"
for-network
\"
,"
"
\"
test
\"
:
\"
member('all')
\"
,"
"
\"
eval-on-deman
d
\"
: true,"
"
\"
only-if-require
d
\"
: true,"
"
\"
option-data
\"
: [ {"
"
\"
name
\"
:
\"
domain-name-servers
\"
,"
"
\"
data
\"
:
\"
10.0.0.3
\"
"
...
...
@@ -908,14 +908,14 @@ TEST_F(ClassifyTest, precedenceNetwork) {
"],"
"
\"
shared-networks
\"
: [ {"
"
\"
name
\"
:
\"
frog
\"
,"
"
\"
eval
-client-classes
\"
: [
\"
for-network
\"
],"