mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-25 04:43:10 +00:00
documentation
This commit is contained in:
parent
303defa16d
commit
e4789c6d8b
1 changed files with 11 additions and 2 deletions
|
@ -185,6 +185,11 @@ def post_auth(data):
|
||||||
instance_stack = nas_machine.switch.stack
|
instance_stack = nas_machine.switch.stack
|
||||||
if instance_stack:
|
if instance_stack:
|
||||||
# If it is a stack, we select the correct switch in the stack
|
# If it is a stack, we select the correct switch in the stack
|
||||||
|
#
|
||||||
|
# For Juniper, the result looks something like this: NAS-Port-Id = "ge-0/0/6.0""
|
||||||
|
# For other brands (e.g. HP or Mikrotik), the result usually looks like: NAS-Port-Id = "6.0"
|
||||||
|
# This "magic split" handles both cases
|
||||||
|
# Cisco can rot in Hell for all I care, so their format is not supported (it looks like NAS-Port-ID = atm 31/31/7:255.65535 guangzhou001/0/31/63/31/127)
|
||||||
id_stack_member = port.split("-")[1].split("/")[0]
|
id_stack_member = port.split("-")[1].split("/")[0]
|
||||||
nas_machine = (
|
nas_machine = (
|
||||||
Switch.objects.filter(stack=instance_stack)
|
Switch.objects.filter(stack=instance_stack)
|
||||||
|
@ -192,8 +197,12 @@ def post_auth(data):
|
||||||
.prefetch_related("interface_set__domain__extension")
|
.prefetch_related("interface_set__domain__extension")
|
||||||
.first()
|
.first()
|
||||||
)
|
)
|
||||||
# Find the port number from freeradius, works both with HP, Cisco
|
# Find the port number from freeradius
|
||||||
# and juniper output
|
#
|
||||||
|
# For Juniper, the result looks something like this: NAS-Port-Id = "ge-0/0/6.0""
|
||||||
|
# For other brands (e.g. HP or Mikrotik), the result usually looks like: NAS-Port-Id = "6.0"
|
||||||
|
# This "magic split" handles both cases
|
||||||
|
# Cisco can rot in Hell for all I care, so their format is not supported (it looks like NAS-Port-ID = atm 31/31/7:255.65535 guangzhou001/0/31/63/31/127)
|
||||||
port = port.split(".")[0].split("/")[-1][-2:]
|
port = port.split(".")[0].split("/")[-1][-2:]
|
||||||
out = decide_vlan_switch(nas_machine, nas_type, port, mac)
|
out = decide_vlan_switch(nas_machine, nas_type, port, mac)
|
||||||
sw_name, room, reason, vlan_id, decision, attributes = out
|
sw_name, room, reason, vlan_id, decision, attributes = out
|
||||||
|
|
Loading…
Reference in a new issue