diff options
author | Daniil Baturin <daniil@baturin.org> | 2018-11-11 16:49:45 +0100 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2018-11-11 16:49:45 +0100 |
commit | 6480b0036050ce669bfd5de2e8b709dd0c0cfdba (patch) | |
tree | b0e5b9b221131e25aa418556bc3795176c59bb72 | |
parent | f9333394d44924d7776b3baf26ac1885d139f61d (diff) | |
download | vyatta-cfg-quagga-6480b0036050ce669bfd5de2e8b709dd0c0cfdba.tar.gz vyatta-cfg-quagga-6480b0036050ce669bfd5de2e8b709dd0c0cfdba.zip |
T964: update commands for community lists.
-rwxr-xr-x | scripts/policy/vyatta-policy.pl | 19 | ||||
-rw-r--r-- | templates/policy/community-list/node.def | 10 | ||||
-rw-r--r-- | templates/policy/community-list/node.tag/rule/node.tag/regex/node.def | 10 | ||||
-rw-r--r-- | templates/policy/large-community-list/node.tag/rule/node.def | 4 |
4 files changed, 14 insertions, 29 deletions
diff --git a/scripts/policy/vyatta-policy.pl b/scripts/policy/vyatta-policy.pl index c5e781ba..7d3edb58 100755 --- a/scripts/policy/vyatta-policy.pl +++ b/scripts/policy/vyatta-policy.pl @@ -49,6 +49,7 @@ sub check_peer_syntax { sub is_community_list { my $list = shift; + # Migration to the new syntax blocked by FRR #3308 my $count = `$VTYSH -c \"show ip community-list $list\" | grep -c $list`; if ( $count > 0 ) { return 1; @@ -61,7 +62,7 @@ sub is_community_list { sub is_extcommunity_list { my $list = shift; - my $count = `$VTYSH -c \"show ip extcommunity-list $list\" | grep -c $list`; + my $count = `$VTYSH -c \"show bgp extcommunity-list $list\" | grep -c $list`; if ( $count > 0 ) { return 1; } @@ -78,10 +79,10 @@ sub update_ext_community_list { # remove the old rules if ( is_extcommunity_list($name) ) { - my $clist = `$VTYSH -c \"show ip extcommunity-list $name\" | grep -v \"expanded list $name\"`; + my $clist = `$VTYSH -c \"show bgp extcommunity-list $name\" | grep -v \"expanded list $name\"`; my @oldrules = split(/\n/, $clist); foreach my $oldrule (@oldrules) { - system("$VTYSH -c \"conf t\" -c \"no ip extcommunity-list expanded $name $oldrule\""); + system("$VTYSH -c \"conf t\" -c \"no bgp extcommunity-list expanded $name $oldrule\""); } } @@ -102,7 +103,7 @@ sub update_ext_community_list { if (!($regex =~ /(.*):(.*)/) and (isIpAddress($1)or($1=~/^\d+$/) ) and ($2=~/^\d+$/)) { die "extcommunity-list $name rule $rule: Malformed extcommunity-list regex"; } - system("$VTYSH -c \"conf t\" -c \"ip extcommunity-list expanded $name $action $regex\""); + system("$VTYSH -c \"conf t\" -c \"bgp extcommunity-list expanded $name $action $regex\""); } exit(0); @@ -119,7 +120,7 @@ sub update_community_list { my $clist = `$VTYSH -c \"show ip community-list $num\" | grep -v \"access list $num\"`; my @oldrules = split(/\n/, $clist); foreach my $oldrule (@oldrules) { - system("$VTYSH -c \"conf t\" -c \"no ip community-list $num $oldrule\""); + system("$VTYSH -c \"conf t\" -c \"no bgp community-list expanded $num $oldrule\""); } } @@ -140,7 +141,7 @@ sub update_community_list { unless $regex; system( -"$VTYSH -c \"configure terminal\" -c \"ip community-list $num $action $regex\" " +"$VTYSH -c \"configure terminal\" -c \"bgp community-list expanded $num $action $regex\" " ); } @@ -151,7 +152,7 @@ sub is_as_path_list { my $list = shift; my $count = - `$VTYSH -c \"show ip as-path-access-list $list\" | grep -c $list`; + `$VTYSH -c \"show bgp as-path-access-list $list\" | grep -c $list`; if ( $count > 0 ) { return 1; } @@ -168,7 +169,7 @@ sub update_as_path { # remove the old rule if ( is_as_path_list($word) ) { system( -"$VTYSH -c \"configure terminal\" -c \"no ip as-path access-list $word\" " +"$VTYSH -c \"configure terminal\" -c \"no bgp as-path access-list $word\" " ); } @@ -188,7 +189,7 @@ sub update_as_path { unless $regex; system( -"$VTYSH -c \"configure terminal\" -c \"ip as-path access-list $word $action $regex\" " +"$VTYSH -c \"configure terminal\" -c \"bgp as-path access-list $word $action $regex\" " ); } diff --git a/templates/policy/community-list/node.def b/templates/policy/community-list/node.def index 5d4dc0bb..af96bbe0 100644 --- a/templates/policy/community-list/node.def +++ b/templates/policy/community-list/node.def @@ -1,14 +1,6 @@ tag: priority: 470 -type: u32 +type: txt help: Border Gateway Protocol (BGP) community-list filter -syntax:expression: $VAR(@) >= 1 && $VAR(@) <= 500; " -community-list must be - <1-99>\tBGP community list (standard) - <100-500>\tBGP community list (expanded) " - -val_help: u32:1-99; BGP community list (standard) -val_help: u32:100-500; BGP community list (expanded) - end: /opt/vyatta/sbin/vyatta-policy.pl --update-community-list $VAR(@) diff --git a/templates/policy/community-list/node.tag/rule/node.tag/regex/node.def b/templates/policy/community-list/node.tag/rule/node.tag/regex/node.def index 8d903b33..48943dcd 100644 --- a/templates/policy/community-list/node.tag/rule/node.tag/regex/node.def +++ b/templates/policy/community-list/node.tag/rule/node.tag/regex/node.def @@ -1,13 +1,5 @@ type: txt help: Regular expression to match against a community list -val_help: Community list regular expression - -syntax:expression: exec " \ -if [ $VAR(../../@) -ge 1 ] && [ $VAR(../../@) -le 99 ]; then \ - if [ -n \"`echo $VAR(@) | sed 's/[0-9]*:[0-9]*//g' | sed -e 's/internet//g' -e 's/local-AS//g' -e 's/no-advertise//g' -e 's/no-export//g'`\" ]; then \ - echo regex $VAR(@) is invalid for a standard community list; \ - exit 1 ; \ - fi ; \ -fi ; " +val_help: Community list regular expression or one of: internet, local-AS, no-advertise, no-export commit:expression: $VAR(../action/@) != ""; "You must specify an action" diff --git a/templates/policy/large-community-list/node.tag/rule/node.def b/templates/policy/large-community-list/node.tag/rule/node.def index cdea7e30..6cb593b7 100644 --- a/templates/policy/large-community-list/node.tag/rule/node.def +++ b/templates/policy/large-community-list/node.tag/rule/node.def @@ -13,8 +13,8 @@ end: if cli-shell-api existsActive policy large-community-list $VAR(../@) rule $VAR(@); then orig_action=$(cli-shell-api returnActiveValue policy large-community-list $VAR(../@) rule $VAR(@) action) orig_regex=$(cli-shell-api returnActiveValue policy large-community-list $VAR(../@) rule $VAR(@) regex) - vtysh -c "configure terminal" -c "no ip large-community-list expanded $VAR(../@) $orig_action $VAR(@) regex $orig_regex" + vtysh -c "configure terminal" -c "no bgp large-community-list expanded $VAR(../@) $orig_action $VAR(@) regex $orig_regex" fi if [[ ${COMMIT_ACTION} != 'DELETE' ]]; then - vtysh -c "configure terminal" -c "ip large-community-list expanded $VAR(../@) $VAR(./action/@) $VAR(@) regex $VAR(./regex/@)" + vtysh -c "configure terminal" -c "bgp large-community-list expanded $VAR(../@) $VAR(./action/@) $VAR(@) regex $VAR(./regex/@)" fi |