Include subnet and pool user context in lease database
I would like the option to copy the information from user-context on subnet level and from pool level to user-context in lease4/lease6 table after a lease accepted. What I would like to see it is :
Example config:
{
"name": "CMTS-4",
"relay": {
"ip-addresses": [ "0123:4567:891b:cd::1" ]
},
"subnet6": [
{
"subnet": "0123:4567:891b:cd::/64",
"id": 40001,
"pools": [
{ "pool": "0123:4567:891b:cd:4000::a - 0123:4567:891b:cd:7fff:ffff:ffff:ffff" ,"client-class": "pool_one", "user-context": { "pool": "pool_one", "name" : "av", "size" : "10" }} ,
{ "pool": "0123:4567:891b:cd::a - 0123:4567:891b:cd:3fff:ffff:ffff:ffff" ,"client-class": "gamers", "user-context": { "pool": "gamers", "name" : "computers", "size" : "1000" } } ,
{ "pool": "0123:4567:891b:cd:8000::a - 0123:4567:891b:cd:bfff:ffff:ffff:ffff" ,"client-class": "internet"}
],
"pd-pools": [
{
"prefix": "abcd:ef01:9044::",
"client-class": "pool_one",
"prefix-len": 46,
"delegated-len": 56,
"user-context": { "pdpool": "pool_one", "name" : "av" }
},
{
"prefix": "abcd:ef01:9444::",
"client-class": "gamers",
"prefix-len": 46,
"delegated-len": 56,
"user-context": { "pdpool": "gamers", "name" : "lan" }
},
{
"prefix": "abcd:ef01:8120::",
"client-class": "internet",
"prefix-len": 44,
"delegated-len": 56
}
],
"user-context": {
"device": "CMTS-4",
"location": "Partner"
}
}
]
}
When a user gets a lease with "client-class: gamers" then on the lease record in the lease table he will have the next json:
"user-context": {
shared-network: {}, ## <- came from shared-network level
"subnet" : { "device": "CMTS-4", "location": "Partner"}, ## <- came from subnet level
"pd-pool" : { "pdpool": "gamers", "name" : "lan" }, ## <- came from pd-pool level
"pool" : { "pool": "gamers", "name" : "computers", "size" : "1000" } ## <- came from pool level
}
This will help me get info on my subscribers, the lease table doesnt have specific info,
Lets say that I have a few pools under one subnet(like the example),
with that info I can get more accurate statistics on the leased addresses.
How many subscribers I have in gamers.
Another idea is to add info from other hook,
We are using radius hook,
So If was I able to select fields from radius hook, like "username" or some other attribute (that came from radius) and put it inside user-context:
"user-context": {
"radius" : { "username" : "xxxxx", }
}