summaryrefslogtreecommitdiffstats
path: root/raddb/mods-config/sql/ippool/mongo
diff options
context:
space:
mode:
Diffstat (limited to 'raddb/mods-config/sql/ippool/mongo')
-rw-r--r--raddb/mods-config/sql/ippool/mongo/queries.conf109
1 files changed, 109 insertions, 0 deletions
diff --git a/raddb/mods-config/sql/ippool/mongo/queries.conf b/raddb/mods-config/sql/ippool/mongo/queries.conf
new file mode 100644
index 0000000..9d7d070
--- /dev/null
+++ b/raddb/mods-config/sql/ippool/mongo/queries.conf
@@ -0,0 +1,109 @@
+# -*- text -*-
+#
+# ippool/mongo/queries.conf -- Mongo queries for rlm_sqlippool
+#
+# $Id$
+
+#
+# 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 = ""
+