This section provides a complete script example that executes a Cisco Connectivity Fault Management feature update job on a series of Cisco 3400 switches. Note the extended series of configuration commands in the trigger process-CFM.
###########################################################################
-
- Export of Script: CFM Update
- Script-Level: 2
Script-Category:
###########################################################################
Script:
CFM Update
Script-Description: A script to dynamically configure CFM on switches Script-Filter:
$Vendor eq "Cisco" and $Model like /3400/
#######
Action: Determine CFM
Action-Description:
Do a show CFM to determine if a device already has CFM. Action-Commands:
SET: $cfm_exists = "yes"
show ethernet cfm maintenance-points local Output-Triggers:
Check CFM
########
Trigger: Check CFM
Trigger-Description:
If CFM is already enabled on the device, we will update the cfm_exists variable to yes Trigger-Template:
Local MEPs: None
Trigger-Commands:
SET: $cfm_exists = "no"
#######
Action:
Get CFM Variables Action-Description:
Perform a "show run interface Gi0/1" to get the existing VLAN information. Action-Filter:
$cfm_exists eq "no" Action-Commands:
sho run interface Gi0/1 SET: $correct_vlan = "no" SET: $UpdateMade = "no" Output-Triggers:
Process CFM Incorrect VLAN
#######
Trigger: Process CFM
Trigger-Description: Parse the output of the show run to get the vlan numbers. Trigger-Variables:
$vlan integer Trigger-Template:
switchport trunk allowed vlan 2[[$vlan]],3\d+ Trigger-Commands:
SET: $correct_vlan = "yes" SET: $UpdateMade = "yes" config t
ethernet cfm ieee ethernet cfm global
ethernet cfm traceroute cache ethernet cfm traceroute cache size 200
ethernet cfm traceroute cache hold-time 60 ethernet cfm mip filter
ethernet cfm alarm notification all ethernet cfm domain Slight level 4 service vlan-id 2$vlan vlan 2$vlan mep mpid 6$vlan
continuity-check
continuity-check interval 1s continuity-check loss-threshold 2 mip auto-create
service vlan-id 3$vlan vlan 3$vlan mep mpid 7$vlan
continuity-check
continuity-check interval 1s continuity-check loss-threshold 2 mip auto-create
ethernet cfm lck link-status global disable
ethernet cfm ais link-status global disable
ethernet evc 2$vlan
oam protocol cfm svlan 2$vlan domain Slight ethernet evc 3$vlan
oam protocol cfm svlan 3$vlan domain Slight Int g0/1
No service-policy input CoS
No service-policy output parent-shape-1Gb/s No l2protocol-tunnel
exit
No policy-map parent-shape-1Gb/s No policy-map child-shape-100Mb/s No policy-map CoS
No policy-map TXQ
policy-map child-shape-100Mb/s class class-default
shape average 100000000 policy-map parent-shape-1Gb/s class class-default
shape average 1000000000
service-policy child-shape-100Mb/s policy-map 100Mb/s
class class-default
trigger-commands:{$Version like /12\.2(55)/}
police cir 100m conform-action transmit exceed-action drop trigger-commands:{$Version not like /12\.2(55)/}
police cir 100m pir 100m conform-action transmit exceed-action drop violate-action drop trigger-commands:
Int g0/1
Service-policy input 100Mb/s
Service-policy output parent-shape-1Gb/s
ethernet cfm mep domain Slight mpid 3$vlan vlan 3$vlan cos 7
ethernet cfm mep domain Slight mpid 2$vlan vlan 2$vlan cos 7
no ethernet cfm ais link-status
########
Action:
End and Write Memory
Action-Description:
End and Write Memory only if we entered config mode. Action-Commands:{$UpdateMade eq "yes"}
end DEBUG:write mem
########
Issue:
Incorrect VLAN Issue-ID:
Incorrect_VLAN_CFM Issue-Severity:
error
Issue-Description:
This device could not be upated by the CFM script Issue-Filter:
$correct_vlan eq "no" Issue-Details:
Host $Name Address $IPAddress