Skip to content

Commit

Permalink
removal of set_native_acl deviation (openconfig#2952)
Browse files Browse the repository at this point in the history
* removal of set_native_acl deviation
"This code is a Contribution to the OpenConfig Feature Profiles project ("Work") made under the Google Software Grant and Corporate Contributor License Agreement ("CLA") and governed by the Apache License 2.0. No other rights or licenses in or to any of Nokia's intellectual property are granted for any other purpose. This code is provided on an "as is" basis without any warranties of any kind."

* removed unused imports
"This code is a Contribution to the OpenConfig Feature Profiles project ("Work") made under the Google Software Grant and Corporate Contributor License Agreement ("CLA") and governed by the Apache License 2.0. No other rights or licenses in or to any of Nokia's intellectual property are granted for any other purpose. This code is provided on an "as is" basis without any warranties of any kind."

* fixed metadata after merge
"This code is a Contribution to the OpenConfig Feature Profiles project ("Work") made under the Google Software Grant and Corporate Contributor License Agreement ("CLA") and governed by the Apache License 2.0. No other rights or licenses in or to any of Nokia's intellectual property are granted for any other purpose. This code is provided on an "as is" basis without any warranties of any kind."

* migrated paths/rpcs to yaml block
"This code is a Contribution to the OpenConfig Feature Profiles project ("Work") made under the Google Software Grant and Corporate Contributor License Agreement ("CLA") and governed by the Apache License 2.0. No other rights or licenses in or to any of Nokia's intellectual property are granted for any other purpose. This code is provided on an "as is" basis without any warranties of any kind."

* fixed title in readme for rpc
"This code is a Contribution to the OpenConfig Feature Profiles project ("Work") made under the Google Software Grant and Corporate Contributor License Agreement ("CLA") and governed by the Apache License 2.0. No other rights or licenses in or to any of Nokia's intellectual property are granted for any other purpose. This code is provided on an "as is" basis without any warranties of any kind."

* validate_readme_spec isn't working locally
"This code is a Contribution to the OpenConfig Feature Profiles project ("Work") made under the Google Software Grant and Corporate Contributor License Agreement ("CLA") and governed by the Apache License 2.0. No other rights or licenses in or to any of Nokia's intellectual property are granted for any other purpose. This code is provided on an "as is" basis without any warranties of any kind.

* fixed 1 path
"This code is a Contribution to the OpenConfig Feature Profiles project ("Work") made under the Google Software Grant and Corporate Contributor License Agreement ("CLA") and governed by the Apache License 2.0. No other rights or licenses in or to any of Nokia's intellectual property are granted for any other purpose. This code is provided on an "as is" basis without any warranties of any kind."

* trying only rpcs
this is complaining about the title, but it's there.

* added ll gr
"This code is a Contribution to the OpenConfig Feature Profiles project ("Work") made under the Google Software Grant and Corporate Contributor License Agreement ("CLA") and governed by the Apache License 2.0. No other rights or licenses in or to any of Nokia's intellectual property are granted for any other purpose. This code is provided on an "as is" basis without any warranties of any kind."

* fixed title
"This code is a Contribution to the OpenConfig Feature Profiles project ("Work") made under the Google Software Grant and Corporate Contributor License Agreement ("CLA") and governed by the Apache License 2.0. No other rights or licenses in or to any of Nokia's intellectual property are granted for any other purpose. This code is provided on an "as is" basis without any warranties of any kind."

* fixing readme for 2byte_4byte_asn_policy_test
"This code is a Contribution to the OpenConfig Feature Profiles project ("Work") made under the Google Software Grant and Corporate Contributor License Agreement ("CLA") and governed by the Apache License 2.0. No other rights or licenses in or to any of Nokia's intellectual property are granted for any other purpose. This code is provided on an "as is" basis without any warranties of any kind."
  • Loading branch information
MarcCharlebois authored and frasieroh committed Jun 25, 2024
1 parent 12512c3 commit 52f724b
Show file tree
Hide file tree
Showing 11 changed files with 94 additions and 548 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ The origial RFC4724 had no coverage for Graceful restart process post send/recei
* Start traffic from ATE Port1 towards ATE Port2. Confirm there is zero packet loss. Stop traffic.
* Revert ATE configurtion blocking TCP connection to/from DUT over TCP-Port:179 so the EBGP peering between ATE:Port1 <> DUT:port1 is reestablished. Restart traffic and confirm that there is zero packet loss.
* Restart the above procedure for the IBGP peering between DUT port-2 and ATE port-2

## Config Parameter Coverage

For prefixes:
Expand Down Expand Up @@ -140,3 +139,15 @@ BGP conifguration:
* /network-instances/network-instance/protocols/protocol/bgp/neighbors/neighbor/afi-safis/afi-safi/graceful-restart/state/received
* /network-instances/network-instance/protocols/protocol/bgp/global/graceful-restart/state/restart-time
* /network-instances/network-instance/protocols/protocol/bgp/global/graceful-restart/state/stale-routes-time

## OpenConfig Path and RPC Coverage

```yaml
rpcs:
gnmi:
gNMI.Set:
gNMI.Get:
gNMI.Subscribe:
gnoi:
system.System.KillProcess:
```
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,12 @@
package bgp_graceful_restart_test

import (
"context"
"encoding/json"
"testing"
"time"

"github.com/openconfig/featureprofiles/internal/attrs"
"github.com/openconfig/featureprofiles/internal/deviations"
"github.com/openconfig/featureprofiles/internal/fptest"
gpb "github.com/openconfig/gnmi/proto/gnmi"
"github.com/openconfig/ondatra"
"github.com/openconfig/ondatra/gnmi"
"github.com/openconfig/ondatra/gnmi/oc"
Expand Down Expand Up @@ -466,221 +463,6 @@ func configACLInterface(t *testing.T, iFace *oc.Acl_Interface, ifName string) *a
return aclConf
}

// Helper function to replicate configACL() configs in native model
// Define the values for each ACL entry and marshal for json encoding.
// Then craft a gNMI set Request to update the changes.
func configACLNative(t testing.TB, d *ondatra.DUTDevice, name string) {
t.Helper()
switch d.Vendor() {
case ondatra.NOKIA:
var aclEntry10Val = []any{
map[string]any{
"action": map[string]any{
"drop": map[string]any{},
},
"match": map[string]any{
"ipv4": map[string]any{
"destination-ip": map[string]any{
"prefix": ateDstCIDR,
},
"source-ip": map[string]any{
"prefix": aclNullPrefix,
},
},
},
},
}
entry10Update, err := json.Marshal(aclEntry10Val)
if err != nil {
t.Fatalf("Error with json Marshal: %v", err)
}

var aclEntry20Val = []any{
map[string]any{
"action": map[string]any{
"drop": map[string]any{},
},
"match": map[string]any{
"ipv4": map[string]any{
"source-ip": map[string]any{
"prefix": ateDstCIDR,
},
"destination-ip": map[string]any{
"prefix": aclNullPrefix,
},
},
},
},
}
entry20Update, err := json.Marshal(aclEntry20Val)
if err != nil {
t.Fatalf("Error with json Marshal: %v", err)
}

var aclEntry30Val = []any{
map[string]any{
"action": map[string]any{
"accept": map[string]any{},
},
"match": map[string]any{
"ipv4": map[string]any{
"source-ip": map[string]any{
"prefix": aclNullPrefix,
},
"destination-ip": map[string]any{
"prefix": aclNullPrefix,
},
},
},
},
}
entry30Update, err := json.Marshal(aclEntry30Val)
if err != nil {
t.Fatalf("Error with json Marshal: %v", err)
}
gpbSetRequest := &gpb.SetRequest{
Prefix: &gpb.Path{
Origin: "native",
},
Update: []*gpb.Update{
{
Path: &gpb.Path{
Elem: []*gpb.PathElem{
{Name: "acl"},
{Name: "acl-filter", Key: map[string]string{"name": name, "type": "ipv4"}},
{Name: "entry", Key: map[string]string{"sequence-id": "10"}},
},
},
Val: &gpb.TypedValue{
Value: &gpb.TypedValue_JsonIetfVal{
JsonIetfVal: entry10Update,
},
},
},
{
Path: &gpb.Path{
Elem: []*gpb.PathElem{
{Name: "acl"},
{Name: "acl-filter", Key: map[string]string{"name": name, "type": "ipv4"}},
{Name: "entry", Key: map[string]string{"sequence-id": "20"}},
},
},
Val: &gpb.TypedValue{
Value: &gpb.TypedValue_JsonIetfVal{
JsonIetfVal: entry20Update,
},
},
},
{
Path: &gpb.Path{
Elem: []*gpb.PathElem{
{Name: "acl"},
{Name: "acl-filter", Key: map[string]string{"name": name, "type": "ipv4"}},
{Name: "entry", Key: map[string]string{"sequence-id": "30"}},
},
},
Val: &gpb.TypedValue{
Value: &gpb.TypedValue_JsonIetfVal{
JsonIetfVal: entry30Update,
},
},
},
},
}
gnmiClient := d.RawAPIs().GNMI(t)
if _, err := gnmiClient.Set(context.Background(), gpbSetRequest); err != nil {
t.Fatalf("Unexpected error configuring SRL ACL: %v", err)
}
default:
t.Fatalf("Unsupported vendor %s for deviation 'UseVendorNativeACLConfiguration'", d.Vendor())
}
}

// Helper function to replicate AdmitAllACL() configs in native model,
// then craft a gNMI set Request to update the changes.
func configAdmitAllACLNative(t testing.TB, d *ondatra.DUTDevice, name string) {
t.Helper()
switch d.Vendor() {
case ondatra.NOKIA:
gpbDelRequest := &gpb.SetRequest{
Prefix: &gpb.Path{
Origin: "native",
},
Delete: []*gpb.Path{
{
Elem: []*gpb.PathElem{
{Name: "acl"},
{Name: "acl-filter", Key: map[string]string{"name": name, "type": "ipv4"}},
{Name: "entry", Key: map[string]string{"sequence-id": "10"}},
},
},
{
Elem: []*gpb.PathElem{
{Name: "acl"},
{Name: "acl-filter", Key: map[string]string{"name": name, "type": "ipv4"}},
{Name: "entry", Key: map[string]string{"sequence-id": "20"}},
},
},
},
}
gnmiClient := d.RawAPIs().GNMI(t)
if _, err := gnmiClient.Set(context.Background(), gpbDelRequest); err != nil {
t.Fatalf("Unexpected error removing SRL ACL: %v", err)
}
default:
t.Fatalf("Unsupported vendor %s for deviation 'UseVendorNativeACLConfiguration'", d.Vendor())
}
}

// Helper function to replicate configACLInterface in native model.
// Set ACL at interface ingress,
// then craft a gNMI set Request to update the changes.
func configACLInterfaceNative(t *testing.T, d *ondatra.DUTDevice, ifName string) {
t.Helper()
switch d.Vendor() {
case ondatra.NOKIA:
var interfaceAclVal = []any{
map[string]any{
"acl-filter": map[string]any{
"name": aclName,
"type": "ipv4",
},
},
}
interfaceAclUpdate, err := json.Marshal(interfaceAclVal)
if err != nil {
t.Fatalf("Error with json Marshal: %v", err)
}
gpbSetRequest := &gpb.SetRequest{
Prefix: &gpb.Path{
Origin: "native",
},
Update: []*gpb.Update{
{
Path: &gpb.Path{
Elem: []*gpb.PathElem{
{Name: "acl"},
{Name: "interface", Key: map[string]string{"interface-id": ifName + ".0"}},
{Name: "input"},
},
},
Val: &gpb.TypedValue{
Value: &gpb.TypedValue_JsonIetfVal{
JsonIetfVal: interfaceAclUpdate,
},
},
},
},
}
gnmiClient := d.RawAPIs().GNMI(t)
if _, err := gnmiClient.Set(context.Background(), gpbSetRequest); err != nil {
t.Fatalf("Unexpected error configuring interface ACL: %v", err)
}
default:
t.Fatalf("Unsupported vendor %s for deviation 'UseVendorNativeACLConfiguration'", d.Vendor())
}
}

func TestTrafficWithGracefulRestartSpeaker(t *testing.T) {
dut := ondatra.DUT(t, "dut")
ate := ondatra.ATE(t, "ate")
Expand Down Expand Up @@ -734,14 +516,9 @@ func TestTrafficWithGracefulRestartSpeaker(t *testing.T) {
startTime := time.Now()
t.Log("Trigger Graceful Restart on ATE")
ate.Actions().NewBGPGracefulRestart().WithRestartTime(grRestartTime * time.Second).WithPeers(bgpPeer).Send(t)
if deviations.UseVendorNativeACLConfig(dut) {
configACLNative(t, dut, aclName)
configACLInterfaceNative(t, dut, ifName)
} else {
gnmi.Replace(t, dut, gnmi.OC().Acl().AclSet(aclName, oc.Acl_ACL_TYPE_ACL_IPV4).Config(), configACL(d, aclName))
aclConf := configACLInterface(t, iFace, ifName)
gnmi.Replace(t, dut, aclConf.Config(), iFace)
}
gnmi.Replace(t, dut, gnmi.OC().Acl().AclSet(aclName, oc.Acl_ACL_TYPE_ACL_IPV4).Config(), configACL(d, aclName))
aclConf := configACLInterface(t, iFace, ifName)
gnmi.Replace(t, dut, aclConf.Config(), iFace)
replaceDuration := time.Since(startTime)
time.Sleep(grTimer - stopDuration - replaceDuration)
t.Log("Send Traffic while GR timer counting down. Traffic should pass as BGP GR is enabled!")
Expand Down Expand Up @@ -776,14 +553,9 @@ func TestTrafficWithGracefulRestartSpeaker(t *testing.T) {

t.Run("RemoveAclInterface", func(t *testing.T) {
t.Log("Removing Acl on the interface to restore BGP GR. Traffic should now pass!")
if deviations.UseVendorNativeACLConfig(dut) {
configAdmitAllACLNative(t, dut, aclName)
configACLInterfaceNative(t, dut, ifName)
} else {
gnmi.Replace(t, dut, gnmi.OC().Acl().AclSet(aclName, oc.Acl_ACL_TYPE_ACL_IPV4).Config(), configAdmitAllACL(d, aclName))
aclPath := configACLInterface(t, iFace, ifName)
gnmi.Replace(t, dut, aclPath.Config(), iFace)
}
gnmi.Replace(t, dut, gnmi.OC().Acl().AclSet(aclName, oc.Acl_ACL_TYPE_ACL_IPV4).Config(), configAdmitAllACL(d, aclName))
aclPath := configACLInterface(t, iFace, ifName)
gnmi.Replace(t, dut, aclPath.Config(), iFace)
})

t.Run("VerifyBGPEstablished", func(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ platform_exceptions: {
vendor: NOKIA
}
deviations: {
use_vendor_native_acl_config: true
explicit_port_speed: true
explicit_interface_in_default_vrf: true
interface_enabled: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,15 @@ BGP Long-Lived Graceful Restart
* /neighbors/neighbor/afi-safis/afi-safi/graceful-restart/state/received
* /neighbors/neighbor/afi-safis/afi-safi/graceful-restart/state/advertised

## Protocol/RPC Parameter coverage
## OpenConfig Path and RPC Coverage

N/A
```yaml
rpcs:
gnmi:
gNMI.Set:
gNMI.Get:
gNMI.Subscribe:
```
## Minimum DUT platform requirement
Expand Down
Loading

0 comments on commit 52f724b

Please sign in to comment.