Commit 878c2b1a authored by Tomek Mrugalski's avatar Tomek Mrugalski 🛰

[5014] reservations, pd-pools support implemented

parent 1e0dc8a6
......@@ -125,6 +125,12 @@ JSONString \"{JSONStringCharacter}*\"
\"name\" { return isc::dhcp::Dhcp6Parser::make_NAME(loc); }
\"data\" { return isc::dhcp::Dhcp6Parser::make_DATA(loc); }
\"pools\" { return isc::dhcp::Dhcp6Parser::make_POOLS(loc); }
\"pd-pools\" { return isc::dhcp::Dhcp6Parser::make_PD_POOLS(loc); }
\"prefix\" { return isc::dhcp::Dhcp6Parser::make_PREFIX(loc); }
\"prefix-len\" { return isc::dhcp::Dhcp6Parser::make_PREFIX_LEN(loc); }
\"delegated-len\" { return isc::dhcp::Dhcp6Parser::make_DELEGATED_LEN(loc); }
\"pool\" { return isc::dhcp::Dhcp6Parser::make_POOL(loc); }
\"subnet\" { return isc::dhcp::Dhcp6Parser::make_SUBNET(loc); }
\"interface\" { return isc::dhcp::Dhcp6Parser::make_INTERFACE(loc); }
......@@ -132,6 +138,7 @@ JSONString \"{JSONStringCharacter}*\"
\"code\" { return isc::dhcp::Dhcp6Parser::make_CODE(loc); }
\"mac-sources\" { return isc::dhcp::Dhcp6Parser::make_MAC_SOURCES(loc); }
\"relay-supplied-options\" { return isc::dhcp::Dhcp6Parser::make_RELAY_SUPPLIED_OPTIONS(loc); }
\"host-reservation-identifiers\" { return isc::dhcp::Dhcp6Parser::make_HOST_RESERVATION_IDENTIFIERS(loc); }
\"Logging\" { return isc::dhcp::Dhcp6Parser::make_LOGGING(loc); }
\"loggers\" { return isc::dhcp::Dhcp6Parser::make_LOGGERS(loc); }
......@@ -145,8 +152,12 @@ JSONString \"{JSONStringCharacter}*\"
\"test\" { return isc::dhcp::Dhcp6Parser::make_TEST(loc); }
\"reservations\" { return isc::dhcp::Dhcp6Parser::make_RESERVATIONS(loc); }
\"ip-addresses\" { return isc::dhcp::Dhcp6Parser::make_IP_ADDRESSES(loc); }
\"prefixes\" { return isc::dhcp::Dhcp6Parser::make_PREFIXES(loc); }
\"duid\" { return isc::dhcp::Dhcp6Parser::make_DUID(loc); }
\"hw-address\" { return isc::dhcp::Dhcp6Parser::make_HW_ADDRESS(loc); }
\"hostname\" { return isc::dhcp::Dhcp6Parser::make_HOSTNAME(loc); }
\"space\" { return isc::dhcp::Dhcp6Parser::make_SPACE(loc); }
{JSONString} {
// A string has been matched. It contains the actual string and single quotes.
......
......@@ -62,20 +62,32 @@ using namespace std;
NAME "name"
DATA "data"
CODE "code"
SPACE "space"
POOLS "pools"
POOL "pool"
PD_POOLS "pd-pools"
PREFIX "prefix"
PREFIX_LEN "prefix-len"
DELEGATED_LEN "delegated-len"
SUBNET "subnet"
INTERFACE "interface"
MAC_SOURCES "mac-sources"
RELAY_SUPPLIED_OPTIONS "relay-supplied-options"
HOST_RESERVATION_IDENTIFIERS "host-reservation-identifiers"
CLIENT_CLASSES "client-classes"
TEST "test"
CLIENT_CLASS "client-class"
RESERVATIONS "reservations"
IP_ADDRESSES "ip-addresses"
PREFIXES "prefixes"
DUID "duid"
HW_ADDRESS "hw-address"
HOSTNAME "hostname"
LOGGING "Logging"
LOGGERS "loggers"
......@@ -208,6 +220,7 @@ global_param
| lease_database
| mac_sources
| relay_supplied_options
| host_reservation_identifiers
| client_classes
| option_data_list
;
......@@ -275,6 +288,24 @@ mac_sources: MAC_SOURCES {
ctx.stack_.pop_back();
};
host_reservation_identifiers: HOST_RESERVATION_IDENTIFIERS COLON LSQUARE_BRACKET {
ElementPtr l(new ListElement());
ctx.stack_.back()->set("host-reservation-identifiers", l);
ctx.stack_.push_back(l);
} host_reservation_identifiers_list RSQUARE_BRACKET {
ctx.stack_.pop_back();
};
host_reservation_identifiers_list: host_reservation_identifier
| host_reservation_identifiers_list COMMA host_reservation_identifier;
host_reservation_identifier: DUID {
ElementPtr duid(new StringElement("duid")); ctx.stack_.back()->add(duid);
}
| HW_ADDRESS {
ElementPtr hwaddr(new StringElement("hw-address")); ctx.stack_.back()->add(hwaddr);
}
relay_supplied_options: RELAY_SUPPLIED_OPTIONS {
ElementPtr l(new ListElement());
ctx.stack_.back()->set("relay-supplied-options", l);
......@@ -320,6 +351,7 @@ subnet6_params: subnet6_param
// This defines a list of allowed parameters for each subnet.
subnet6_param: option_data_list
| pools_list
| pd_pools_list
| subnet
| interface
| client_class
......@@ -374,16 +406,29 @@ option_data_params: {}
| option_data_params COMMA option_data_param;
option_data_param:
NAME COLON STRING {
| option_data_name
| option_data_data
| option_data_code
| option_data_space
;
option_data_name: NAME COLON STRING {
ElementPtr name(new StringElement($3)); ctx.stack_.back()->set("name", name);
}
| DATA COLON STRING {
};
option_data_data: DATA COLON STRING {
ElementPtr data(new StringElement($3)); ctx.stack_.back()->set("data", data);
}
| CODE COLON INTEGER {
};
option_data_code: CODE COLON INTEGER {
ElementPtr code(new IntElement($3)); ctx.stack_.back()->set("code", code);
};
option_data_space: SPACE COLON STRING {
ElementPtr space(new StringElement($3)); ctx.stack_.back()->set("space", space);
};
// ---- pools ------------------------------------
// This defines the "pools": [ ... ] entry that may appear in subnet6.
......@@ -416,9 +461,56 @@ pool_param: POOL COLON STRING {
ElementPtr pool(new StringElement($3)); ctx.stack_.back()->set("pool", pool);
}
| option_data_list;
// --- end of pools definition -------------------------------
// --- pd-pools ----------------------------------------------
pd_pools_list: PD_POOLS COLON {
ElementPtr l(new ListElement());
ctx.stack_.back()->set("pd-pools", l);
ctx.stack_.push_back(l);
} LSQUARE_BRACKET pd_pools_list_content RSQUARE_BRACKET {
ctx.stack_.pop_back();
};
// Pools may be empty, contain a single pool entry or multiple entries
// separate by commas.
pd_pools_list_content: { }
| pd_pool_entry
| pd_pools_list_content COMMA pd_pool_entry;
pd_pool_entry: LCURLY_BRACKET {
ElementPtr m(new MapElement());
ctx.stack_.back()->add(m);
ctx.stack_.push_back(m);
} pd_pool_params RCURLY_BRACKET {
ctx.stack_.pop_back();
};
pd_pool_params: pd_pool_param
| pd_pool_params COMMA pd_pool_param;
pd_pool_param: pd_prefix
| pd_prefix_len
| pd_delegated_len
| option_data_list
;
pd_prefix: PREFIX COLON STRING {
ElementPtr prf(new StringElement($3)); ctx.stack_.back()->set("prefix", prf);
}
pd_prefix_len: PREFIX_LEN COLON INTEGER {
ElementPtr prf(new IntElement($3)); ctx.stack_.back()->set("prefix-len", prf);
}
pd_delegated_len: DELEGATED_LEN COLON INTEGER {
ElementPtr deleg(new IntElement($3)); ctx.stack_.back()->set("delegated-len", deleg);
}
// --- end of pd-pools ---------------------------------------
// --- reservations ------------------------------------------
reservations: RESERVATIONS COLON LSQUARE_BRACKET {
ElementPtr l(new ListElement());
......@@ -447,12 +539,41 @@ reservation_params: reservation_param
reservation_param:
| duid
| reservation_client_classes
| ip_addresses
| prefixes
| hw_address
| hostname
| option_data_list
;
ip_addresses: IP_ADDRESSES COLON {
ElementPtr l(new ListElement());
ctx.stack_.back()->set("ip-addresses", l);
ctx.stack_.push_back(l);
} list {
ctx.stack_.pop_back();
};
prefixes: PREFIXES COLON {
ElementPtr l(new ListElement());
ctx.stack_.back()->set("prefixes", l);
ctx.stack_.push_back(l);
} list {
ctx.stack_.pop_back();
};
duid: DUID COLON STRING {
ElementPtr d(new StringElement($3)); ctx.stack_.back()->set("duid", d);
};
hw_address: HW_ADDRESS COLON STRING {
ElementPtr hw(new StringElement($3)); ctx.stack_.back()->set("hw-address", hw);
};
hostname: HOSTNAME COLON STRING {
ElementPtr host(new StringElement($3)); ctx.stack_.back()->set("hostname", host);
}
reservation_client_classes: CLIENT_CLASSES COLON {
ElementPtr c(new ListElement());
ctx.stack_.back()->set("client-classes", c);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment