LUA in IPOE
-
- Posts: 15
- Joined: 13 Nov 2018, 12:32
LUA in IPOE
good afternoon guys, I'm facing a little problem,
Some onu'ssend their serial with the following format FHTT-XXXXXX and others send without the "-" ... would like to always send them with the "-" in the file lua, would have perform?
Some onu'ssend their serial with the following format FHTT-XXXXXX and others send without the "-" ... would like to always send them with the "-" in the file lua, would have perform?
-
- Posts: 15
- Joined: 13 Nov 2018, 12:32
Re: LUA in IPOE
my accel-ppp.lua file:
function username(pkt)
return pkt:agent_circuit_id('')
end
function username(pkt)
return pkt:agent_circuit_id('')
end
Re: LUA in IPOE
Hi, try this
OR
Code: Select all
function username(pkt)
acid=pkt:agent_circuit_id()
if(string.sub(acid, 5, 5) ~= "-") then
modAcid=string.sub(acid, 0, 4) .. "-" .. string.sub(acid, 5)
return modAcid
else
return acid
end
end
Code: Select all
function username(pkt)
acid=pkt:agent_circuit_id()
if(string.sub(acid, 5, 5) ~= "-") then
modAcid=string.gsub(acid, "FTTH", "FTTH-")
return modAcid
else
return acid
end
end
-
- Posts: 15
- Joined: 13 Nov 2018, 12:32
Re: LUA in IPOE
in some worked others not ... I think it's because my circuit id is olt card number / port number olt / serial onu for example I have two scenarios ... 14/2 / FHTT-XXXXX and 13/16 / PRKS- XXXXX
-
- Posts: 15
- Joined: 13 Nov 2018, 12:32
Re: LUA in IPOE
What would this script do?
Code: Select all
function username(pkt) acid=pkt:agent_circuit_id() if(string.sub(acid, 5, 5) ~= "-") then modAcid1=string.gsub(acid, "(FHTT)", "%1-") return modAcid1 elseif(string.sub(acid, 5, 5) ~= "-") then modAcid2=string.gsub(acid, "(FHTT-)", "%1-") return modAcid2 elseif(string.sub(acid, 5, 5) ~= "-") then modAcid3=string.gsub(acid, "(PRKS)", "%1-") else return acid end end
Re: LUA in IPOE
show me more agent_circuit_id "LIKE 13/16 / PARKS- XXXXX" and result what are you need
-
- Posts: 15
- Joined: 13 Nov 2018, 12:32
Re: LUA in IPOE
My log accel-ppp
I needed all the agent_cirquit_id to have the "-" so that there was no divergence ... could be different, if I had to remove all the "-" agents_circuit_id already solved the problem, because this only happens with the FHTTCode: Select all
[2018-12-07 10:55:41]: info: IPoE-826: send [RADIUS(1) Accounting-Request id=1 <User-Name "13/2/FHTT06ef7e10"> <NAS-Identifier "IPoE"> <NAS-IP-Address 172.19.2.22> <NAS-Port 2002> <NAS-Port-Id "IPoE-826"> <NAS-Port-Type Ethernet> <Calling-Station-Id "18:0d:2c:18:6c:11"> <Called-Station-Id "eth0.1300"> <DHCP-Option82 > <Acct-Status-Type Start> <Acct-Authentic RADIUS> <Acct-Session-Id "dfa706c01a0c5cff"> <Acct-Session-Time 0> <Acct-Input-Octets 0> <Acct-Output-Octets 0> <Acct-Input-Packets 0> <Acct-Output-Packets 0> <Acct-Input-Gigawords 0> <Acct-Output-Gigawords 0> <Framed-IP-Address 45.228.117.233>] [2018-12-07 10:55:41]: info: IPoE-826: send [DHCPv4 Ack xid=39716f01 yiaddr=45.228.117.233 chaddr=18:0d:2c:18:6c:11 <Message-Type Ack> <Server-ID 172.19.2.22> <Lease-Time 100> <T1 300> <Router 172.19.2.22> <Subnet 255.255.255.255> <DNS 177.67.32.2,8.8.8.8>] [2018-12-07 10:55:41]: debug: IPoE-826: radius(1): req_exit 0 [2018-12-07 10:55:41]: info: IPoE-826: recv [RADIUS(1) Accounting-Response id=1] [2018-12-07 10:55:41]: info: IPoE-826: ipoe: session started [2018-12-07 10:55:42]: info: IPoE-133: recv [DHCPv4 Request xid=42549ebb ciaddr=45.228.117.213 chaddr=c4:71:54:53:f1:91 <Message-Type Request> <Max-Message-Size 1024> <Client-ID 01c4715453f191> <Host-Name NETSLIM> <Vendor-Class 4d53465420352e30> <Request-List Subnet,Router,DNS,Domain-Name,Vendor-Specific,44,46,47,66,Route,Classless-Route,249> <Relay-Agent {Agent-Circuit-ID 13/11/PRKS00bd6fc8} {Agent-Remote-ID }>] [2018-12-07 10:55:42]: info: IPoE-133: send [DHCPv4 Ack xid=42549ebb ciaddr=45.228.117.213 yiaddr=45.228.117.213 chaddr=c4:71:54:53:f1:91 <Message-Type Ack> <Server-ID 172.19.2.22> <Lease-Time 100> <T1 300> <Router 172.19.2.22> <Subnet 255.255.255.255> <DNS 177.67.32.2,8.8.8.8>] [2018-12-07 10:56:10]: info: IPoE-263: ipoe: session timed out [2018-12-07 10:56:10]: debug: IPoE-263: terminate [2018-12-07 10:56:10]: debug: IPoE-263: radius(1): req_enter 1 [2018-12-07 10:56:10]: info: IPoE-263: send [RADIUS(1) Accounting-Request id=1 <User-Name "14/3/FHTT-091a2200"> <NAS-Identifier "IPoE"> <NAS-IP-Address 172.19.2.22> <NAS-Port 1995> <NAS-Port-Id "IPoE-263"> <NAS-Port-Type Ethernet> <Calling-Station-Id "18:0d:2c:18:6c:17"> <Called-Station-Id "eth0.1300"> <DHCP-Option82 > <Acct-Status-Type Stop> <Acct-Authentic RADIUS> <Acct-Session-Id "ec1b98bb7b7daa74"> <Acct-Session-Time 102> <Acct-Input-Octets 0> <Acct-Output-Octets 972> <Acct-Input-Packets 0> <Acct-Output-Packets 14> <Acct-Input-Gigawords 0> <Acct-Output-Gigawords 0> <Framed-IP-Address 45.228.117.211> <Acct-Terminate-Cause Lost-Carrier>]
Re: LUA in IPOE
try this for remove "-"
Code: Select all
function username(pkt)
acid=pkt:agent_circuit_id()
modAcid=string.gsub(acid, "-", "")
return modAcid
end
-
- Posts: 1
- Joined: 03 Mar 2021, 12:23
Re: LUA in IPOE
rodrigoselau wrote: ↑07 Dec 2018, 12:43 What would this script do?
Code: Select all
function username(pkt) acid=pkt:agent_circuit_id() if(string.sub(acid, 5, 5) ~= "-") then modAcid1=string.gsub(acid, "(FHTT)", "%1-") return modAcid1 elseif(string.sub(acid, 5, 5) ~= "-") then modAcid2=string.gsub(acid, "(FHTT-)", "%1-") return modAcid2 elseif(string.sub(acid, 5, 5) ~= "-") then modAcid3=string.gsub(acid, "(PRKS)", "%1-") else return acid end end
thank you very much, it worked perfect.
But I need one more situation.
I would like that after "FHTT-" all characters are uppercase.
EX: "FHTT-975480f8" >> "FHTT-975480F8"