cancel
Showing results for 
Search instead for 
Did you mean: 

Script to detect Device

Script to detect Device

Giuseppe_Montan
Contributor

Good Evening, I have an X440 G2 configured in this way:

Port 1 → VoIP device

Port 3 → AP Device

Port 5 → TVCC

Port 24 → trunk to the network

 

I have created 3 different Vlan

VoIPVLAN tag 2

WiFIVLAN tag 10

DataVLAN tag 5

 

I do this:

 

→ create upm profile DETECT_DEVICE

set var VLAN5 DataVLAN
set var VLAN2 VoIPVLAN
set var VLAN10 WiFIVLAN
set var MAC1 94:e1:ac:
set var VENDOR1 HIKVISION
set var myWaitVar $TCL(after [expr 2000 * 6])
set var CLI.OUT ""
show fdb ports $EVENT.LOG_PARAM_0 | include Default
set var list1 $TCL(split ${CLI.OUT})
set var list2 $TCL(string range $(list1) 0 😎

if (!$match($list2, $MAC1)) then
configure vlan $VLAN5 add port $EVENT.LOG_PARAM_0 untag
create log message TVCC_was_detected_on_Port_$EVENT.LOG_PARAM_0
else
if (!$match($EVENT.NAME, DEVICE-DETECT)) then
    if (!$match($EVENT.DEVICE, GEN_TEL_PHONE)) then
    create log message Starting_Script_DETECT_DEVICE
    create log message PHONE_was_detected_on_Port_$EVENT.USER_PORT
    configure vlan $VLAN5 add port $EVENT.USER_PORT untag
    configure vlan $VLAN2 add port $EVENT.USER_PORT tag
    configure lldp port $EVENT.USER_PORT advertise system-name
    configure lldp port $EVENT.USER_PORT advertise system-description
    configure lldp port $EVENT.USER_PORT advertise system-capabilities
    configure lldp port $EVENT.USER_PORT advertise vendor-specific med capabilities
    configure lldp port $EVENT.USER_PORT advertise vendor-specific med power-via-mdi
    configure lldp port $EVENT.USER_PORT advertise vendor-specific dot1 port-protocol-vlan-id vlan VoIPVLAN
    configure lldp port $EVENT.USER_PORT advertise vendor-specific dot1 vlan-name vlan VoIPVLAN
    configure lldp port $EVENT.USER_PORT advertise vendor-specific med policy application voice vlan VoIPVLAN dscp 46
    else
        if  (!$match($EVENT.DEVICE, WLAN_ACCESS_PT)) then
        create log message AP_was_detected_on_Port_$EVENT.USER_PORT
        configure $VLAN10 add port $EVENT.USER_PORT untag
        configure $VLAN2 add port $EVENT.USER_PORT tag
        endif
endif
endif
endif
.

configure upm event device-detect profile DETECT_DEVICE ports 1,3,5

create log filter Log_PortUp
create log filter Log_PortDown
configure log filter Log_PortUp add events vlan.msgs.portLinkStateUp
configure log filter Log_PortDown add events vlan.msgs.portLinkStateDown
create log target upm DETECT_DEVICE
enable log target upm DETECT_DEVICE
configure log target upm DETECT_DEVICE filter Log_PortUp severity Info only.

#######################################################################

For port 1 and port 3 no problem, the device goes in to the correct vlan, for port 5 I can not put in the correct vlan but the UPM profile pass.

Anybody can help me ?

thanks

Giuseppe

 

 

 

0 REPLIES 0
GTM-P2G8KFN