THE GAME HAS CHANGED

Introducing Infoblox Universal DDI ManagementTM

Watch the launch to discover the new era of management for critical network services. Watch Now

Network Change & Configuration Management

Reply

Reset switch port script.

Authority
Posts: 13
6791     0

Hi,

 

I'm looking if there is way to reset all the switch ports the ones showing in "Ports in Error Disable State"?

 

Thanks,

Re: Reset switch port script.

Superuser
Posts: 115
6792     0

You can start here with this script

 

https://github.com/infobloxopen/netmri-toolkit/blob/master/CCS/Scripts/Port%20Security.ccs

 

This one  'Enable Port Security and add mac-address to the port config' but you can modify this to get what you are looking for.

 

Additional script

https://github.com/infobloxopen/netmri-toolkit

 

Reply with your completed script or if you got stuck!

Follow me on LinkedIn: https://www.linkedin.com/in/sifbaksh
Twitter: https://twitter.com/sifbaksh

https://sifbaksh.com

Re: Reset switch port script.

Authority
Posts: 13
6792     0

Thanks SBaksh! I will check it and let you now.

Re: Reset switch port script.

Authority
Posts: 13
6792     0

I'm getting this error

Unable to run this job:
Validation failed: Validate job *** ERROR: (Line 20) Duplicate attribute found 'Script' ***

 

My script:

###########################################################################
## Export of Script: Reset Ports on err-disabled Status
## Script-Level: 3
## Script-Category:
## Script-Language: CCS
###########################################################################

Script:
Port on err-disabled Status

Script-Description:
'Reset Ports on err-disabled Status'

Script-Filter:
$vendor eq "Cisco"

############################
Action:
Show Port on err-disabled Status

Action-Commands:
show int status | i err-disabled

############################
Action:
Show int status

Action-Commands:
SET: $UpdatePort = "no"
show int status | i err-disabled

Output-Triggers:
Process Port Status

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

Trigger:
Process Port Status

Trigger-Description:
Process the output of the show command to find the port with err-disabled

Trigger-Variables:
$port string

Trigger-Template:
[[$port]]\s*(err-disabled)

Trigger-Commands:$UpdatePort eq "no"}
DEBUG: config t

Trigger-Commands:
DEBUG: int $port
DEBUG: shut
DEBUG: no shut
SET: $UpdatePort = "yes"

###################
Action:
End

Re: Reset switch port script.

Superuser
Posts: 115
6792     0

Remove the following lines from the script

 

###########################################################################
## Export of Script: Reset Ports on err-disabled Status
## Script-Level: 3
## Script-Category:
## Script-Language: CCS
###########################################################################

Script:
Port on err-disabled Status

Script-Description:
'Reset Ports on err-disabled Status'
Follow me on LinkedIn: https://www.linkedin.com/in/sifbaksh
Twitter: https://twitter.com/sifbaksh

https://sifbaksh.com

Re: Reset switch port script.

Authority
Posts: 13
6792     0
2.1. Trigger: 'Process Port Status' Output: 'Show int status' ['Process the output of the show command to find the port with err-disabled'] 12:54:48 Trigger-Template 12:54:48 Template matches 12:54:48 (Gi1/1/2 )s*(err-disabled) 12:54:48 Trigger-Variables 12:54:48 $port = 'Gi1/1/2 ' 12:54:48 Trigger-Commands 12:54:48 no eq "no"} 12:54:49 *** Invalid input detected [Last executed command: 'no eq "no"}' ] *** % Invalid input detected at '^' marker. stack-wpg-b3s-1#exit Connection to 10.254.254.173 closed by remote host. Connection to 10.254.254.173 closed.

Re: Reset switch port script.

Superuser
Posts: 115
6792     0

You are missing a open { bracket

 

Trigger-Commands:$UpdatePort eq "no"}

should be

Trigger-Commands:{$UpdatePort eq "no"}
Follow me on LinkedIn: https://www.linkedin.com/in/sifbaksh
Twitter: https://twitter.com/sifbaksh

https://sifbaksh.com

Re: Reset switch port script.

[ Edited ]
Superuser
Posts: 115
6792     0

Also, you can join us on Dis cord

https://discord.gg/QebESC3T7X

Follow me on LinkedIn: https://www.linkedin.com/in/sifbaksh
Twitter: https://twitter.com/sifbaksh

https://sifbaksh.com
Showing results for 
Search instead for 
Did you mean: 

Recommended for You