Skip to content

Commit

Permalink
Add RT-7.5,8 Match and Action Set Standard and Link-Bw BGP Communities (
Browse files Browse the repository at this point in the history
openconfig#2654)

* add subtests

* Update feature/bgp/policybase/otg_tests/extcomm_action_test/README.md

Co-authored-by: rszarecki <[email protected]>

* Update feature/bgp/policybase/otg_tests/extcomm_action_test/README.md

Co-authored-by: rszarecki <[email protected]>

* Update feature/bgp/policybase/otg_tests/extcomm_action_test/README.md

Co-authored-by: rszarecki <[email protected]>

* Update feature/bgp/policybase/otg_tests/extcomm_action_test/README.md

Co-authored-by: rszarecki <[email protected]>

* Update feature/bgp/policybase/otg_tests/extcomm_action_test/README.md

Co-authored-by: rszarecki <[email protected]>

* Update feature/bgp/policybase/otg_tests/extcomm_action_test/README.md

Co-authored-by: rszarecki <[email protected]>

* split link-bw to RT-7.5

* adjust community values to be easier to read and match

* address comments, fix linkbw comms

* add note for nomatch_100_set_linkbw_2G policy

* update ext community test name

* split comm and ext_comm tests

* clean up cut/pastes on rt-7.11

* fix descriptions for RT-7.8

* typo

* moved RT-7.11 to RT-7.9

* match 7.5 test names

* Add del_linkbw policy

* only use OC 3.x paths

* fix test ids

* dedup rt-7.9 to rt7.10

* use community-member instead of ext-community-member

Co-authored-by: rszarecki <[email protected]>

* fix expected match for not_match_100_set_linkbw_1M

* remove RT-7.8 ext comm match test

* fix registry

* Add DELETE option

* remove rt-7.10 from registry

* add policy rm_any_zero_bw_set_LocPref_5

* Update feature/bgp/policybase/otg_tests/comm_match_action_test/README.md

* Update feature/bgp/policybase/otg_tests/link_bandwidth_test/README.md

* Apply suggestions from code review

* remove extra match rule for del linkbw

* revise localpref policy to match localpref and delete linkbw 0

* fix ext comm match to standard community match for match_as100

* revise linkbw/localpref policy

* Update feature/bgp/policybase/otg_tests/link_bandwidth_test/README.md

Co-authored-by: rszarecki <[email protected]>

* Update feature/bgp/policybase/otg_tests/link_bandwidth_test/README.md

Co-authored-by: rszarecki <[email protected]>

* Update feature/bgp/policybase/otg_tests/link_bandwidth_test/README.md

Co-authored-by: rszarecki <[email protected]>

* Update feature/bgp/policybase/otg_tests/link_bandwidth_test/README.md

Co-authored-by: rszarecki <[email protected]>

* Update feature/bgp/policybase/otg_tests/link_bandwidth_test/README.md

Co-authored-by: rszarecki <[email protected]>

* Update feature/bgp/policybase/otg_tests/link_bandwidth_test/README.md

Co-authored-by: rszarecki <[email protected]>

* Update feature/bgp/policybase/otg_tests/link_bandwidth_test/README.md

Co-authored-by: rszarecki <[email protected]>

* Update feature/bgp/policybase/otg_tests/link_bandwidth_test/README.md

Co-authored-by: rszarecki <[email protected]>

* fix expected match, add description for match_linkbw_0_remove_and_set_localpref_5

* join locpref5 statement

---------

Co-authored-by: rszarecki <[email protected]>
  • Loading branch information
dplore and rszarecki authored Mar 1, 2024
1 parent 9ac8733 commit 8862985
Show file tree
Hide file tree
Showing 5 changed files with 324 additions and 26 deletions.
125 changes: 125 additions & 0 deletions feature/bgp/policybase/otg_tests/comm_match_action_test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# RT-7.8: BGP Policy Match Standard Community and Add Community Import/Export Policy

## Summary

Configure bgp policy to add communities to routes by matching on the following
criteria.

* RT-7.8.1 Validate test environment
* RT-7.8.2 Validate policy to set standard community for various policies using OC release 3.x

## Testbed type

* https://github.com/openconfig/featureprofiles/blob/main/topologies/atedut_2.testbed

## Procedure

* Testbed configuration - Setup eBGP sessions and prefixes.
* Generate config for 2 DUT and ATE ports where:
* DUT port 1 to ATE port 1.
* DUT port 2 to ATE port 2.
* Configure ATE port 1 with an external type BGP session to DUT port 1.
* Advertise ipv4 and ipv6 prefixes to DUT port 1 using the following communities:
* prefix-set-1 with 2 ipv6 and 2 ipv4 routes without communities.
* prefix-set-2 with 2 ipv6 and 2 ipv4 routes with communities `[5:5, 6:6 ]`.

* RT-7.8.1 - Validate prefixes are propagated by DUT
* For IPv4 and IPv6 prefixes:
* Observe received prefixes at ATE port-2.
* Send traffic from ATE port-2 to all prefix-sets-1,2.
* Verify traffic is received on ATE port 1 for all prefixes.
* Stop traffic

* RT-7.8.2 - Create policy to set standard community for all routes using OC release 3.x
* Configure the following community sets on the DUT.
(prefix: `/routing-policy/defined-sets/bgp-defined-sets/`)
* Create a `community-sets/community-set` named 'match_std_comms' with members as follows:
* community-member = [ "5:5" ]
* Create a `community-sets/community-set` named 'add_std_comms' with members as follows:
* community-member = [ "10:10", "20:20", "30:30" ]

* Create `/routing-policy/policy-definitions/policy-definition/policy-definition[name='add_std_comms']/`
with the following `statements/`
* statement[name='add_std_comms']/
* actions/bgp-actions/set-community/reference/config/community-set-refs =
/routing-policy/defined-sets/bgp-defined-sets/community-sets/community-set[name='add_std_comms']
* actions/bgp-actions/set-community/config/options = ADD
* actions/bgp-actions/set-community/config/method = REFERENCE
* actions/config/policy-result = NEXT_STATEMENT
* statement[name='accept_all_routes']/
* actions/config/policy-result = ACCEPT_ROUTE

* Create a `/routing-policy/policy-definitions/policy-definition/policy-definition[name='match_and_add_comms'/`
with the following `statements/`
* statement[name='match_and_add_std_comms']/
* conditions/bgp-conditions/match-community-set/config/community-set = 'match_std_comms'
* conditions/bgp-conditions/match-community-set/config/match-set-options = ANY
* actions/bgp-actions/set-community/reference/config/community-set-refs = 'add_std_comms'
* actions/bgp-actions/set-community/config/options = ADD
* actions/bgp-actions/set-community/config/method = REFERENCE
* actions/config/policy-result = NEXT_STATEMENT
* statement[name='accept_all_routes']/
* actions/config/policy-result = ACCEPT_ROUTE

* For each policy-definition created, run a subtest (RT-7.8.2.x-neighbor-<policy_name_here>) to
* Use gnmi Set REPLACE option for:
* `/routing-policy/policy-definitions` to configure the policy
* Use `/network-instances/network-instance/protocols/protocol/bgp/neighbors/neighbor/afi-safis/afi-safi/apply-policy/config/import-policy`
to apply the policy on the DUT bgp neighbor to the ATE port 1.
* Verify routes are received on ATE port 1 for all prefixes (since all routes are accepted by policies).
* Verify expected communities are present in ATE.
* Verify expected communities are present in DUT state.
* Do not fail test if this path is not supported, only log results
* `/network-instances/network-instance/protocols/protocol/bgp/rib/afi-safis/afi-safi/ipv4-unicast/neighbors/neighbor/adj-rib-in-post/routes/route/state/community-index`
* `/network-instances/network-instance/protocols/protocol/bgp/rib/afi-safis/afi-safi/ipv6-unicast/neighbors/neighbor/adj-rib-in-post/routes/route/state/community-index`

* For each policy-definition created, run a sub-test (RT-7.8.2.x-peer-group-<policy_name_here>) to
* Use gnmi Set REPLACE option for:
* `/routing-policy/policy-definitions` to configure the policy
* Use `/network-instances/network-instance/protocols/protocol/bgp/peer-groups/peer-group/afi-safis/afi-safi/apply-policy/config/import-policy`
to apply the policy on the DUT bgp neighbor to the ATE port 1.
* Verify expected communities are present in ATE.
* Verify expected communities are present in DUT state.
* Do not fail test if this path is not supported, only log results
* `/network-instances/network-instance/protocols/protocol/bgp/rib/afi-safis/afi-safi/ipv4-unicast/neighbors/neighbor/adj-rib-in-post/routes/route/state/community-index`
* `/network-instances/network-instance/protocols/protocol/bgp/rib/afi-safis/afi-safi/ipv6-unicast/neighbors/neighbor/adj-rib-in-post/routes/route/state/community-index`

* Expected result - communities
| | add_std_comms | match_and_add_std_comms |
| ------------ | --------------------------------------------- | --------------------------------- |
| prefix-set-1 | [ 10:10, 20:20, 30:30 ] | none |
| prefix-set-2 | [ 10:10, 20:20, 30:30, 5:5, 6:6 ] | [ 10:10, 20:20, 30:30, 5:5, 6:6 ] |

## Config Parameter Coverage

### Policy for community-set configuration

* /routing-policy/defined-sets/bgp-defined-sets/community-sets/community-set/config/community-set-name
* /routing-policy/defined-sets/bgp-defined-sets/community-sets/community-set/config/community-member

### Policy action configuration

* /routing-policy/policy-definitions/policy-definition/config/name
* /routing-policy/policy-definitions/policy-definition/statements/statement/config/name
* /routing-policy/policy-definitions/policy-definition/statements/statement/actions/bgp-actions/set-community/reference/config/community-set-refs

### Policy for community-set match configuration

* /routing-policy/policy-definitions/policy-definition/statements/statement/conditions/bgp-conditions/config/community-set
* /routing-policy/policy-definitions/policy-definition/statements/statement/conditions/bgp-conditions/match-community-set/config/match-set-options

### Policy attachment point configuration

* /network-instances/network-instance/protocols/protocol/bgp/neighbors/neighbor/afi-safis/afi-safi/apply-policy/config/import-policy
* /network-instances/network-instance/protocols/protocol/bgp/neighbors/neighbor/afi-safis/afi-safi/apply-policy/config/export-policy
* /network-instances/network-instance/protocols/protocol/bgp/peer-groups/peer-group/apply-policy/config/import-policy
* /network-instances/network-instance/protocols/protocol/bgp/peer-groups/peer-group/apply-policy/config/export-policy

## Telemetry Parameter Coverage

* /network-instances/network-instance/protocols/protocol/bgp/rib/afi-safis/afi-safi/ipv4-unicast/neighbors/neighbor/adj-rib-in-post/routes/route/state/community-index
* /network-instances/network-instance/protocols/protocol/bgp/rib/afi-safis/afi-safi/ipv6-unicast/neighbors/neighbor/adj-rib-in-post/routes/route/state/community-index

## Minimum DUT Required

vRX - Virtual Router Device
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# proto-file: github.com/openconfig/featureprofiles/proto/metadata.proto
# proto-message: Metadata

plan_id: "RT-7.8"
description: "BGP Policy Match Standard Community and Add Community Import/Export Policy"
testbed: TESTBED_DUT_ATE_2LINKS
tags: TAGS_AGGREGATION, TAGS_TRANSIT, TAGS_DATACENTER_EDGE
177 changes: 177 additions & 0 deletions feature/bgp/policybase/otg_tests/link_bandwidth_test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
# RT-7.5: BGP Policy - Set Link Bandwidth Community

## Summary

Configure bgp policy to add statically configured BGP link bandwidth
communities to routes based on a prefix match.

## Testbed type

* [2 port ATE to DUT](https://github.com/openconfig/featureprofiles/blob/main/topologies/atedut_2.testbed)

## Procedure

* Testbed configuration - Setup external BGP sessions and prefixes.
* Generate config for 2 DUT and ATE ports where:
* DUT port 1 to ATE port 1.
* DUT port 2 to ATE port 2.
* Configure dummy accept policies and attach it to both sessions on DUT.
* Create a `/routing-policy/policy-definitions/policy-definition/policy-definition`
named 'allow_all' with the following `statements`
* statement[name='allow-all']/
* actions/config/policy-result = ACCEPT_ROUTE
* Use `/network-instances/network-instance/protocols/protocol/bgp/neighbors/neighbor/afi-safis/afi-safi/apply-policy/config/import-policy`
to apply the policy on the DUT bgp neighbor to the ATE port 1.
* Configure ATE port 1 with a BGP session to DUT port 1.
* Advertise ipv4 and ipv6 prefixes to DUT port 1 using the following communities:
* prefix-set-1 with 2 ipv4 and 2 ipv6 routes without communities.
* prefix-set-2 with 2 ipv4 and 2 ipv6 routes with communities `[ "100:100" ]`.
* prefix-set-3 with 2 ipv4 and 2 ipv6 routes with extended communities `[ "link-bandwidth:100:0" ]`.

* RT-7.5.1 - Validate bgp sessions and traffic
* For IPv4 and IPv6 prefixes:
* Observe received prefixes at ATE port-2.
* Generate traffic from ATE port-2 to ATE port-1.
* Verify traffic is received on ATE port 1 for advertised prefixes.
routes.

* RT-7.5.2 - Validate adding and removing link-bandwidth ext-community-sets using OC model release 3.x
* Configure the following extended community sets on the DUT:
(prefix: `routing-policy/defined-sets/bgp-defined-sets/ext-community-sets/ext-community-set`)
* Create an ext-community-set named 'linkbw_0' with:
* ext-community-member = [ "link-bandwidth:100:0" ]
* Create an ext-community-set named 'linkbw_1M' with members as follows:
* ext-community-member = [ "link-bandwidth:100:1M" ]
* Create an ext-community-set named 'linkbw_2G' with members as follows:
* ext-community-member = [ "link-bandwidth:100:2G" ]
* Create an community-set named 'regex_match_as100' with members as follows:
* community-member = [ "^100:.*$" ]
* Create an ext-community-set named 'linkbw_any' with members as follows:
* ext-community-member = [ "^link-bandwidth:.*:.*$" ]
* Create an ext-community-set named 'linkbw_any_0' with members as follows:
* ext-community-member = [ "^link-bandwidth:.*:.0" ]

* Create a `/routing-policy/policy-definitions/policy-definition/policy-definition`
named **'set_linkbw_0'** with the following `statements`
* statement[name='zero_linkbw']/
* actions/bgp-actions/set-ext-community/reference/config/ext-community-set-refs = 'linkbw_0'
* actions/bgp-actions/set-ext-community/config/options = ADD
* actions/bgp-actions/set-community/config/method = REFERENCE
* actions/config/policy-result = NEXT_STATEMENT
* statement[name='accept_all_routes']/
* actions/config/policy-result = ACCEPT_ROUTE

* Create a `/routing-policy/policy-definitions/policy-definition/policy-definition`
named **'not_match_100_set_linkbw_1M'** with the following `statements`
* statement[name='1-megabit-match']/
* conditions/bgp-conditions/match-community-set/config/community-set = 'regex_match_as100'
* conditions/bgp-conditions/match-community-set/config/match-set-options = INVERT
* actions/bgp-actions/set-ext-community/reference/config/ext-community-set-refs = 'linkbw_1M'
* actions/config/policy-result = NEXT_STATEMENT
* statement[name='accept_all_routes']/
* actions/config/policy-result = ACCEPT_ROUTE

* Create a `/routing-policy/policy-definitions/policy-definition/policy-definition`
named 'match_100_set_linkbw_2G' with the following `statements`
* statement[name='2-gigabit-match']/
* conditions/bgp-conditions/match-community-set/config/community-set = 'regex_match_as100'
* conditions/bgp-conditions/match-community-set/config/match-set-options = ANY
* actions/bgp-actions/set-ext-community/reference/config/ext-community-set-refs = 'linkbw_2G'
* actions/config/policy-result = NEXT_STATEMENT
* statement[name='accept_all_routes']/
* actions/config/policy-result = ACCEPT_ROUTE

* Create a `/routing-policy/policy-definitions/policy-definition/policy-definition`
named **'del_linkbw'** with the following `statements`
* statement[name='del_linkbw']/
* actions/bgp-actions/set-ext-community/config/options = 'REMOVE'
* actions/bgp-actions/set-ext-community/config/method = 'REFERENCE'
* actions/bgp-actions/set-ext-community/reference/config/ext-community-set-refs = 'linkbw_any'
* actions/config/policy-result = NEXT_STATEMENT
* statement[name='accept_all_routes']/
* actions/config/policy-result = ACCEPT_ROUTE

* Create a `/routing-policy/policy-definitions/policy-definition/policy-definition`
named 'match_linkbw_0_remove_and_set_localpref_5' with the following `statements`
* statement[name='match_and_remove_linkbw_any_0']/
* conditions/bgp-conditions/match-ext-community-set/config/community-set = 'linkbw_any_0'
* actions/bgp-actions/set-ext-community/reference/config/ext-community-set-refs = 'linkbw_any_0'
* actions/bgp-actions/set-ext-community/config/method = 'REFERENCE'
* actions/bgp-actions/set-ext-community/config/options = 'REMOVE'
* actions/bgp-actions/config/set-local-pref = 5
* actions/config/policy-result = NEXT_STATEMENT
* statement[name='accept_all_routes']/
* actions/config/policy-result = ACCEPT_ROUTE

* For each policy-definition created, run a subtest (RT-7.8.3.x-<policy_name_here>) to
* Use gnmi Set REPLACE option for:
* `/routing-policy/policy-definitions` to configure the policy
* Use `/network-instances/network-instance/protocols/protocol/bgp/neighbors/neighbor/afi-safis/afi-safi/apply-policy/config/import-policy`
to apply the policy on the DUT bgp neighbor to the ATE port 1.
* Verify expected communities are present in ATE.
* Verify expected communities are present in DUT state.
* Do not fail test if this path is not supported, only log results
* `/network-instances/network-instance/protocols/protocol/bgp/rib/afi-safis/afi-safi/ipv4-unicast/neighbors/neighbor/adj-rib-in-post/routes/route/state/ext-community-index`
* `/network-instances/network-instance/protocols/protocol/bgp/rib/afi-safis/afi-safi/ipv6-unicast/neighbors/neighbor/adj-rib-in-post/routes/route/state/ext-community-index`

* Expected community values for each policy
| | zero_linkbw | not_match_100_set_linkbw_1M |
| ------------ | -------------------------------------- | --------------------------- |
| prefix-set-1 | [ "link-bandwidth:100:0" ] | [none] |
| prefix-set-2 | [ "100:100", "link-bandwidth:100:0" ] | [ "100:100" ] |
| prefix-set-3 | [ "link-bandwidth:100:0" ] | [ "link-bandwidth:100:0" ] |

| | match_100_set_linkbw_2G | del_linkbw | rm_any_zero_bw_set_LocPref_5 |
| ------------ | ----------------------------------------------- | ------------- | ---------------------------- |
| prefix-set-1 | [ none ] | [none] | [none] |
| prefix-set-2 | [ "100:100", "link-bandwidth:100:2000000000" ] | [ "100:100" ] | [ "100:100" ] |
| prefix-set-3 | [ "link-bandwidth:100:0" ] | [ none ] | [ none ], localpref=5 |

* LocalPreference
The prefixes of "prefix-set-3" matching policy "rm_any_zero_bw_set_LocPref_5" should have Local Preference value 5.\
All other prefixes, Local Preference should be none or 100 (standard default).\
For all other policies, Local Preference should be none or 100 (standard default)

* Regarding prefix-set-3 and policy "nomatch_100_set_linkbw_2G"
* prefix-set-3 is advertised to the DUT with community "link-bandwidth:100:0" set.
* The DUT evaluates a match for "regex_nomatch_as100". This does not match because the regex pattern does not include the link-bandwidth community type.
* Community linkbw_2G should be added.

* Regarding policy-definition "match_linkbw_0_remove_and_set_localpref_5"
* The link-bandwidth value 0 is interpreted by some implementation as weight "0" in WCMP group. In these implementations the remaining members distribute traffic according to weights.
* Other implementations consider value 0 invalid or not having link-bandwidth. These implementations create ECMP group with all routes including this one, and ignores link-bandwidth of all members - distribute traffic equally.
* This policy intention is to overcome this implementation difference, by deprefering (LocPref) routes with link-bandwidth 0 (only this routes) to prevent them becoming part of multipath, and remove link-bandwidth community so route will not be treated with WCMP behavior.

## Config Parameter Coverage

### Policy for community-set configuration

* /routing-policy/defined-sets/bgp-defined-sets/ext-community-sets/ext-community-set/config/ext-community-set-name
* /routing-policy/defined-sets/bgp-defined-sets/ext-community-sets/ext-community-set/config/community-member

### Policy action configuration

* /routing-policy/policy-definitions/policy-definition/config/name
* /routing-policy/policy-definitions/policy-definition/statements/statement/config/name
* /routing-policy/policy-definitions/policy-definition/statements/statement/actions/bgp-actions/set-ext-community/reference/config/ext-community-set-refs

### Policy for community-set match configuration

* /routing-policy/policy-definitions/policy-definition/statements/statement/conditions/bgp-conditions/config/community-set
* /routing-policy/policy-definitions/policy-definition/statements/statement/conditions/bgp-conditions/match-ext-community-set/config/match-set-options

### Policy attachment point configuration

* /network-instances/network-instance/protocols/protocol/bgp/neighbors/neighbor/afi-safis/afi-safi/apply-policy/config/import-policy
* /network-instances/network-instance/protocols/protocol/bgp/neighbors/neighbor/afi-safis/afi-safi/apply-policy/config/export-policy
* /network-instances/network-instance/protocols/protocol/bgp/peer-groups/peer-group/apply-policy/config/import-policy
* /network-instances/network-instance/protocols/protocol/bgp/peer-groups/peer-group/apply-policy/config/export-policy

## Telemetry Parameter Coverage

* /network-instances/network-instance/protocols/protocol/bgp/rib/afi-safis/afi-safi/ipv4-unicast/neighbors/neighbor/adj-rib-in-post/routes/route/state/ext-community-index
* /network-instances/network-instance/protocols/protocol/bgp/rib/afi-safis/afi-safi/ipv6-unicast/neighbors/neighbor/adj-rib-in-post/routes/route/state/ext-community-index

## Minimum DUT Required

vRX - Virtual Router Device
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# proto-file: github.com/openconfig/featureprofiles/proto/metadata.proto
# proto-message: Metadata

plan_id: "RT-7.5"
description: "BGP Policy - Set Link Bandwidth Community"
testbed: TESTBED_DUT_ATE_2LINKS
tags: TAGS_DATACENTER_EDGE
Loading

0 comments on commit 8862985

Please sign in to comment.