I am using the iRule statement “set macparta [[lindex [split $radname1 “-” ] 5 ]” for the calling station id (containing the MAC address) field is (with as separator “-“) But if the MAC addressfield is with as separator “:“) . How will be my iRule statement to work in both case .
For E.g; if the Calling-Station-Id mac address format is
Calling-Station-Id = “2C-1F-23-45-3B-1E” Calling-Station-Id = “dc:9b:9c:cd:43:e5”
Use log local0 in order to identify how it would look.
set macparta [[lindex [split $radname1 "-" ] 5 ]
Assuming, $radname1 refers to the Calling-Station-Id, the answer would be 1E for MAC address with - and it won’t work for MAC address with :
Hi,
you can convert the calling station id with the expected format:
set radname1 "2C:1F:23:45:3B:1E"
set radname1 [string map {: -} $radname1]
set macparta [[lindex [split $radname1 "-" ] 5 ]
Hi Sukumar,
how about using a
[split]
command which splits the input MAC on both the “:” or “-” char at the same time…
set radname1 "2C:1F-23:45-3B:1E"
set macparta [[lindex [split $radname1 ":-" ] 5 ]
Cheers, Kai