109 lines
1.8 KiB
Text
109 lines
1.8 KiB
Text
# -*- text -*-
|
|
#
|
|
# ippool/mongo/queries.conf -- Mongo queries for rlm_sqlippool
|
|
#
|
|
# $Id: 9d7d07079741236ca74f8b09b1f7948833197c47 $
|
|
|
|
#
|
|
# The IP Pool queries expect a result like:
|
|
#
|
|
# {
|
|
# pool_key: "bob"
|
|
# pool_name: "my_pool"
|
|
# expiry_time: xxx
|
|
# value: "192.168.1.1"
|
|
# }
|
|
#
|
|
# i.e. the results are in "value", and not "framed_ip_address".
|
|
#
|
|
# When using dynamic expansions such as "%{sql:... mongo query ...}",
|
|
# Mongo uses a lot of curly brackets, {..}. Any closing braces have
|
|
# to be escaped as %}. Sorry, that is a limitation of the FreeRADIUS
|
|
# parser.
|
|
#
|
|
|
|
#
|
|
# TBD
|
|
#
|
|
on_begin = ""
|
|
off_begin = ""
|
|
|
|
allocate_begin = ""
|
|
|
|
#
|
|
# This query allocates an IP address from the Pool
|
|
#
|
|
allocate_find = "db.mypool_collection.findAndModify( \
|
|
{ \
|
|
'query': {' \
|
|
'$and': [ \
|
|
{ \
|
|
'pool_name': '%{control:Pool-Name}' \
|
|
}, \
|
|
{ \
|
|
'nas_ip': '%{Nas-IP-Address}' \
|
|
}, \
|
|
{ \
|
|
'$or': [ \
|
|
{ \
|
|
'calling_station_id': '%{Calling-Station-Id}' \
|
|
}, \
|
|
{ \
|
|
'locked': 0 \
|
|
} \
|
|
] \
|
|
} \
|
|
] \
|
|
}, \
|
|
'update': { \
|
|
'locked': 1', \
|
|
'calling_station_id': '%{Calling-Station-Id'}' \
|
|
}, \
|
|
'fields': { \
|
|
'_id': 0, 'framed_ip_address': 1 \
|
|
} \
|
|
})"
|
|
|
|
allocate_update = ""
|
|
|
|
allocate_clear = "db.mypool_collection.findAndModify( \
|
|
{ \
|
|
'query': { \
|
|
'$and': [ \
|
|
{ \
|
|
'pool_name': '%{Control:Pool-Name}' \
|
|
}, \
|
|
{ \
|
|
'nas_ip': '%{Nas-IP-Address}' \
|
|
}, \
|
|
{ \
|
|
'calling_station_id': '%{Calling-Station-Id}' \
|
|
}, \
|
|
{ \
|
|
'locked': 1 \
|
|
} \
|
|
] \
|
|
}, \
|
|
'update': { \
|
|
'locked': 0, \
|
|
'calling_station_id': '' \
|
|
} \
|
|
})"
|
|
|
|
allocate_commit = ""
|
|
|
|
start_begin = ""
|
|
start_update = ""
|
|
start_commit = ""
|
|
|
|
stop_begin = ""
|
|
stop_clear = ""
|
|
stop_commit = ""
|
|
|
|
alive_begin = ""
|
|
alive_update = ""
|
|
alive_commit = ""
|
|
|
|
on_clear = ""
|
|
off_clear = ""
|
|
|