Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests for ACL DSCP change table. #14791

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

siqbal1986
Copy link
Contributor

Description of PR

Summary:
Fixes # (issue)
NOTE: This PR must merge after sonic-net/sonic-swss#3307
These Tests are for a new feature ACL DSCP change table.

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Back port request

  • 202012
  • 202205
  • 202305
  • 202311
  • 202405

Approach

What is the motivation for this PR?

These tests for added to check the functionality of newly proposed feature ACL DSCP change table.
These Tables changes the outer DSCP value of the vxlan tunneled packet based on the ACL match criteria of the inner packet.
These table are onyl supported on mlnx platforms. Support for Cisco-8000 is expected soon.

How did you do it?

The tests adds Vxlan tunnels on the device. It then adds the Underlay SET dscp acl. THis followd by sending packtes which match the ACL criteria. The encapsualted packets are recieved and verified against the orignal packet and expected outer DSCP header value.

How did you verify/test it?

Ran it.

Any platform specific information?

THis test can only run on Cisco-8000 and mlnx platforms as these platforms support the ACL_META_DATA fields.

Supported testbed topology if it's a new test case?

T1

Documentation

@siqbal1986 siqbal1986 changed the title Added Tests for ACL DSCP change table. Tests for ACL DSCP change table. Sep 30, 2024
@siqbal1986 siqbal1986 requested a review from kperumalbfn October 2, 2024 21:19
@siqbal1986
Copy link
Contributor Author

/azpw run

@mssonicbld
Copy link
Collaborator

/AzurePipelines run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@bingwang-ms
Copy link
Collaborator

Can you paste the link to the test plan to this PR?

@pytest.fixture(scope='module')
def prepare_test_port(rand_selected_dut, tbinfo):
mg_facts = rand_selected_dut.get_extended_minigraph_facts(tbinfo)
if tbinfo["topo"]["type"] == "mx":
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why mx is handled? The test should be enabled only on T1.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

upstream_port_ids = []
for interface, neighbor in list(mg_facts["minigraph_neighbors"].items()):
port_id = mg_facts["minigraph_ptf_indices"][interface]
if (topo == "t1" and "T2" in neighbor["name"]) or (topo == "t0" and "T1" in neighbor["name"]) or \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not required as the topo is t1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

if asic_type in ["cisco-8000", "mellanox"]:
data['tolerance'] = 0.03
else:
raise RuntimeError("Pls update this script for your platform.")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will cause test error on Non-Cisco or Non-Mellanox platform. Suggest skipping the test on non-supported platforms.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed


asic_type = duthost.facts["asic_type"]
if asic_type in ["cisco-8000", "mellanox"]:
data['tolerance'] = 0.03
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is data['tolerance'] used?

Copy link
Contributor Author

@siqbal1986 siqbal1986 Dec 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not needed here. i have removed it.

py_assert(
duthost.shell("redis-cli -n 6 hgetall 'ACL_TABLE_TABLE|OVERLAY_MARK_META_TEST'")['stdout'] == 'status\nActive')
py_assert(duthost.shell(
"redis-cli -n 6 hgetall 'ACL_TABLE_TABLE|OVERLAY_MARK_META_TESTV6'")['stdout'] == 'status\nActive')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest redis-cli -n 6 hget 'ACL_TABLE_TABLE|OVERLAY_MARK_META_TEST' 'status'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


exp_pkt.mask[inner_ether_hdr_end + 8] = 0x00 # TTL is changed
exp_pkt.mask[inner_ether_hdr_end + 10] = 0x00 # checksum is changed
exp_pkt.mask[inner_ether_hdr_end + 11] = 0x00 # checksum is changed
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose to check TTL and checksum to 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part adds the packet mask. setting the mask means that this portion of the received packet should be ignored when comparing with the expected packet.

duthost.shell("redis-cli -n 4 del 'ACL_TABLE|OVERLAY_MARK_META_TESTV6' ")


def create_acl_Rule(duthost, tableName, ruleNumber, priority, dscpAction, dstIp, qualifer=None):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def create_acl_Rule(duthost, tableName, ruleNumber, priority, dscpAction, dstIp, qualifer=None):
def create_acl_rule(duthost, tableName, ruleNumber, priority, dscpAction, dstIp, qualifer=None):

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

pkt = create_inner_packet(setup_vnet, duthost, encap_type, match_fields)
exp_pkt = create_expected_packet(setup_vnet, duthost, encap_type, expectedDscp, pkt)
setup_vnet['ptfadapter'].dataplane.flush()
testutils.send(test=setup_vnet['ptfadapter'], port_id=setup_vnet['ptf_src_port'], pkt=pkt)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the traffic direction here? Is it from T1 to T0? How do you ensure that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THere is no set direction as overlay ecmp packets can come form T2 and go back to default route as well. Son in this case we are injecting thetraffic from a randomly selected interface and capture on all interfaces.

@bingwang-ms
Copy link
Collaborator

Please add the test result to the PR description. Thanks!

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@siqbal1986
Copy link
Contributor Author

@bingwang-ms I have added a testplan and updted wthe PR based on review comments.

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants