Skip to content

Commit

Permalink
Merge branch 'refs/heads/main' into cisco_logical_channels
Browse files Browse the repository at this point in the history
# Conflicts:
#	proto/metadata.proto
#	proto/metadata_go_proto/metadata.pb.go
  • Loading branch information
karthikeya-remilla committed Oct 3, 2024
2 parents def718d + 43e3890 commit d9476ea
Show file tree
Hide file tree
Showing 67 changed files with 1,544 additions and 1,163 deletions.
5 changes: 5 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,23 @@
* @openconfig/featureprofiles-maintainers

# /feature folders each have owners who are auto requested for review and may merge PR's
/feature/acl/ @alokmtri-g
/feature/bgp/ @dplore
/feature/dhcp/ @alokmtri-g
/feature/ethernet/ @ram-mac
/feature/interface/ @ram-mac
/feature/isis/ @rohit-rp
/feature/lldp/ @alokmtri-g
/feature/mpls/ @swetha-haridasula
/feature/mtu/ @swetha-haridasula
/feature/networkinstance/ @swetha-haridasula
/feature/platform/ @amrindrr
/feature/policy_forwarding/ @swetha-haridasula
/feature/qos @sezhang2
/feature/routing_policy/ @swetha-haridasula
/feature/security @mihirpitale-googler
/feature/staticroute/ @swetha-haridasula
/feature/stp/ @alokmtri-g
/feature/system @self-maurya
/feature/vrrp @amrindrr

Expand Down
23 changes: 22 additions & 1 deletion feature/bgp/policybase/otg_tests/community_test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,27 @@ BGP policy configuration for Community Sets
* Verify traffic is received on ATE port 1 for accepted prefixes.
* Verify traffic is not received on ATE port 1 for rejected prefixes.

* RT-7.2.3 - Update community set and validate
1. Configure a community-set named `update_comm_set` with "100:1" as member.

2. Create a `policy-definition` named 'community-match' with the following `statements`
* statement[name='accept_update_comm_set']/
* conditions/bgp-conditions/match-community-set/config/community-set = 'update_comm_set'
* conditions/bgp-conditions/match-community-set/config/match-set-options = INVERT
* actions/config/policy-result = ACCEPT_ROUTE

3. Send traffic from ATE port-2 to all prefix-sets.
* Verify traffic is received on ATE port 1 for accepted prefixes for all community set except "100:1".
* Verify traffic is not received on ATE port 1 for rejected prefixes for community set "100:1".

4. Update the community-set named `update_comm_set` with "200:2" as member.

5. Send traffic from ATE port-2 to all prefix-sets.
* Verify traffic is received on ATE port 1 for accepted prefixes for all community set except "200:1".
* Verify traffic is not received on ATE port 1 for rejected prefixes for community set "200:1".



### Expected community matches

| prefix-set | any_my_3_comms | all_3_comms | no_3_comms | any_my_regex_comms |
Expand Down Expand Up @@ -155,4 +176,4 @@ rpcs:
gnmi:
gNMI.Set:
gNMI.Subscribe:
```
```
103 changes: 77 additions & 26 deletions feature/bgp/policybase/otg_tests/community_test/community_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,32 +225,7 @@ type testCase struct {
}

func TestCommunitySet(t *testing.T) {
bs := cfgplugins.NewBGPSession(t, cfgplugins.PortCount2, nil)
bs.WithEBGP(t, []oc.E_BgpTypes_AFI_SAFI_TYPE{oc.BgpTypes_AFI_SAFI_TYPE_IPV4_UNICAST, oc.BgpTypes_AFI_SAFI_TYPE_IPV6_UNICAST}, []string{"port2"}, true, true)

var communityMembers = [][][]int{
{
{100, 1}, {200, 2}, {300, 3},
},
{
{100, 1}, {101, 1}, {200, 2},
},
{
{107, 1}, {108, 1}, {109, 1},
},
{
{400, 1}, {500, 1}, {600, 1},
},
}

configureOTG(t, bs, prefixesV4, prefixesV6, communityMembers)
bs.PushAndStart(t)

t.Log("Verify DUT BGP sessions up")
cfgplugins.VerifyDUTBGPEstablished(t, bs.DUT)
t.Log("Verify OTG BGP sessions up")
cfgplugins.VerifyOTGBGPEstablished(t, bs.ATE)

bs := testSetup(t)
ipv4 := bs.ATETop.Devices().Items()[1].Ethernets().Items()[0].Ipv4Addresses().Items()[0].Address()
ipv6 := bs.ATETop.Devices().Items()[1].Ethernets().Items()[0].Ipv6Addresses().Items()[0].Address()

Expand Down Expand Up @@ -319,3 +294,79 @@ func TestCommunitySet(t *testing.T) {
})
}
}

func testSetup(t *testing.T) *cfgplugins.BGPSession {
t.Helper()

bs := cfgplugins.NewBGPSession(t, cfgplugins.PortCount2, nil)
bs.WithEBGP(t, []oc.E_BgpTypes_AFI_SAFI_TYPE{oc.BgpTypes_AFI_SAFI_TYPE_IPV4_UNICAST, oc.BgpTypes_AFI_SAFI_TYPE_IPV6_UNICAST}, []string{"port2"}, true, true)

var communityMembers = [][][]int{
{
{100, 1}, {200, 2}, {300, 3},
},
{
{100, 1}, {101, 1}, {200, 2},
},
{
{107, 1}, {108, 1}, {109, 1},
},
{
{400, 1}, {500, 1}, {600, 1},
},
}

configureOTG(t, bs, prefixesV4, prefixesV6, communityMembers)
bs.PushAndStart(t)

t.Log("Verify DUT BGP sessions up")
cfgplugins.VerifyDUTBGPEstablished(t, bs.DUT)
t.Log("Verify OTG BGP sessions up")
cfgplugins.VerifyOTGBGPEstablished(t, bs.ATE)

return bs
}

func TestCommunitySetUpdate(t *testing.T) {
bs := testSetup(t)
ipv4 := bs.ATETop.Devices().Items()[1].Ethernets().Items()[0].Ipv4Addresses().Items()[0].Address()
ipv6 := bs.ATETop.Devices().Items()[1].Ethernets().Items()[0].Ipv6Addresses().Items()[0].Address()

commMatch := [3]string{"100:1"}
configureImportBGPPolicy(t, bs.DUT, ipv4, ipv6, "update_comm_set", commMatch, oc.BgpPolicy_MatchSetOptionsType_INVERT)
validateCommunitySetUpdateTraffic(t, bs)

// change community match set
commMatch = [3]string{"200:2"}
configureImportBGPPolicy(t, bs.DUT, ipv4, ipv6, "update_comm_set", commMatch, oc.BgpPolicy_MatchSetOptionsType_INVERT)
validateCommunitySetUpdateTraffic(t, bs)
}

func validateCommunitySetUpdateTraffic(t *testing.T, bs *cfgplugins.BGPSession) {
t.Helper()

sleepTime := time.Duration(totalPackets/trafficPps) + 2
bs.ATETop.Flows().Clear()
for index, prefixPairV4 := range prefixesV4 {
configureFlow(t, bs, prefixPairV4, "ipv4", index)
configureFlow(t, bs, prefixesV6[index], "ipv6", index)
}
bs.PushAndStartATE(t)

// Verify BGP session after its reset with OTG push config & start
cfgplugins.VerifyDUTBGPEstablished(t, bs.DUT)

t.Logf("Starting traffic for IPv4 and v6")
bs.ATE.OTG().StartTraffic(t)
time.Sleep(sleepTime * time.Second)
bs.ATE.OTG().StopTraffic(t)
otgutils.LogFlowMetrics(t, bs.ATE.OTG(), bs.ATETop)

testResults := [4]bool{false, false, true, true}
for index, prefixPairV4 := range prefixesV4 {
t.Logf("Validating traffic test for IPv4 prefixes: [%s, %s]. Expected Result: [%t]", prefixPairV4[0], prefixPairV4[1], testResults[index])
verifyTraffic(t, bs.ATE, "ipv4", testResults[index], index)
t.Logf("Validating traffic test for IPv6 prefixes: [%s, %s]. Expected Result: [%t]", prefixesV6[index][0], prefixesV6[index][1], testResults[index])
verifyTraffic(t, bs.ATE, "ipv6", testResults[index], index)
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit d9476ea

Please sign in to comment.