Coder Social home page Coder Social logo

Comments (6)

bingwang-ms avatar bingwang-ms commented on September 28, 2024

@kellyyeh Can you help check this issue?

from sonic-mgmt.

Stephenxf avatar Stephenxf commented on September 28, 2024

I don't have a dualtor setup, but the active ports on my setup are not starting from index 0, hence the same radv test cases failed for me due to the hardcoded "eth1". This following change fixed the issue, basically replacing the hardcoded "eth1" with constructed "ethX" with the input port index X.

diff --git a/ansible/roles/test/files/ptftests/router_adv_mflag_test.py b/ansible/roles/test/files/ptftests/router_adv_mflag_test.py
index 3049494e..cfaf77c0 100644
--- a/ansible/roles/test/files/ptftests/router_adv_mflag_test.py
+++ b/ansible/roles/test/files/ptftests/router_adv_mflag_test.py
@@ -53,15 +53,16 @@ class DataplaneBaseTest(BaseTest):

     """

-    def create_icmpv6_router_advertisement_packet_send(self, dst_mac, dst_ip, src_mac, src_ip):
+    def create_icmpv6_router_advertisement_packet_send(self, dst_mac, dst_ip, src_mac, src_ip, port_index):
         ether = Ether(dst=dst_mac, src=src_mac)
         ip6 = IPv6(src=src_ip, dst=dst_ip, fl=0, tc=0, hlim=255)
         icmp6 = RA(code=0, M=1, O=0)
         # NOTE: Test expects RA packet to contain route prefix as the first option
         icmp6 /= PrefixInfo(type=3, len=4)
         rapkt = ether / ip6 / icmp6
-        scapy2.sendp(rapkt, iface="eth1")
-        logging.info(scapy2.sniff(iface='eth1', timeout=10))
+        iface = "eth" + str(port_index)
+        scapy2.sendp(rapkt, iface=iface)
+        logging.info(scapy2.sniff(iface=iface, timeout=10))
         return rapkt

     """
@@ -136,7 +137,8 @@ class RadvUnSolicitedRATest(DataplaneBaseTest):
             src_mac=self.downlink_vlan_mac,
             dst_mac=ALL_NODES_MULTICAST_MAC_ADDRESS,
             src_ip=self.downlink_vlan_ip6,
-            dst_ip=ALL_NODES_IPV6_MULTICAST_ADDRESS)
+            dst_ip=ALL_NODES_IPV6_MULTICAST_ADDRESS,
+            port_index=self.ptf_port_index)
         self.masked_rapkt = self.mask_off_dont_care_ra_packet_fields(rapkt)

     def tearDown(self):
@@ -188,7 +190,8 @@ class RadvSolicitedRATest(DataplaneBaseTest):
             src_mac=self.downlink_vlan_mac,
             dst_mac=self.ptf_port_mac,
             src_ip=self.downlink_vlan_ip6,
-            dst_ip=self.ptf_port_ip6)
+            dst_ip=self.ptf_port_ip6,
+            port_index=self.ptf_port_index)

         self.masked_rapkt = self.mask_off_dont_care_ra_packet_fields(rapkt)
         self.rs_packet = self.create_icmpv6_router_solicitation_packet()

from sonic-mgmt.

echuawu avatar echuawu commented on September 28, 2024

I don't have a dualtor setup, but the active ports on my setup are not starting from index 0, hence the same radv test cases failed for me due to the hardcoded "eth1". This following change fixed the issue, basically replacing the hardcoded "eth1" with constructed "ethX" with the input port index X.

diff --git a/ansible/roles/test/files/ptftests/router_adv_mflag_test.py b/ansible/roles/test/files/ptftests/router_adv_mflag_test.py
index 3049494e..cfaf77c0 100644
--- a/ansible/roles/test/files/ptftests/router_adv_mflag_test.py
+++ b/ansible/roles/test/files/ptftests/router_adv_mflag_test.py
@@ -53,15 +53,16 @@ class DataplaneBaseTest(BaseTest):

     """

-    def create_icmpv6_router_advertisement_packet_send(self, dst_mac, dst_ip, src_mac, src_ip):
+    def create_icmpv6_router_advertisement_packet_send(self, dst_mac, dst_ip, src_mac, src_ip, port_index):
         ether = Ether(dst=dst_mac, src=src_mac)
         ip6 = IPv6(src=src_ip, dst=dst_ip, fl=0, tc=0, hlim=255)
         icmp6 = RA(code=0, M=1, O=0)
         # NOTE: Test expects RA packet to contain route prefix as the first option
         icmp6 /= PrefixInfo(type=3, len=4)
         rapkt = ether / ip6 / icmp6
-        scapy2.sendp(rapkt, iface="eth1")
-        logging.info(scapy2.sniff(iface='eth1', timeout=10))
+        iface = "eth" + str(port_index)
+        scapy2.sendp(rapkt, iface=iface)
+        logging.info(scapy2.sniff(iface=iface, timeout=10))
         return rapkt

     """
@@ -136,7 +137,8 @@ class RadvUnSolicitedRATest(DataplaneBaseTest):
             src_mac=self.downlink_vlan_mac,
             dst_mac=ALL_NODES_MULTICAST_MAC_ADDRESS,
             src_ip=self.downlink_vlan_ip6,
-            dst_ip=ALL_NODES_IPV6_MULTICAST_ADDRESS)
+            dst_ip=ALL_NODES_IPV6_MULTICAST_ADDRESS,
+            port_index=self.ptf_port_index)
         self.masked_rapkt = self.mask_off_dont_care_ra_packet_fields(rapkt)

     def tearDown(self):
@@ -188,7 +190,8 @@ class RadvSolicitedRATest(DataplaneBaseTest):
             src_mac=self.downlink_vlan_mac,
             dst_mac=self.ptf_port_mac,
             src_ip=self.downlink_vlan_ip6,
-            dst_ip=self.ptf_port_ip6)
+            dst_ip=self.ptf_port_ip6,
+            port_index=self.ptf_port_index)

         self.masked_rapkt = self.mask_off_dont_care_ra_packet_fields(rapkt)
         self.rs_packet = self.create_icmpv6_router_solicitation_packet()

Thank you @Stephenxf !
Could you associate the fix PR with this issue?

from sonic-mgmt.

Stephenxf avatar Stephenxf commented on September 28, 2024

@echuawu can you take the patch and verify if it fixes the problem on your dualtor setup by any chance? If it works, I can create a PR. I don't know much about the dualtor layout, so just want the confirmation.

from sonic-mgmt.

echuawu avatar echuawu commented on September 28, 2024

@echuawu can you take the patch and verify if it fixes the problem on your dualtor setup by any chance? If it works, I can create a PR. I don't know much about the dualtor layout, so just want the confirmation.

Hi @Stephenxf , currently I don't have time on it, but I had already added a task about it. I will update the validate result then.

from sonic-mgmt.

echuawu avatar echuawu commented on September 28, 2024

Hi @Stephenxf, could you push the fix directly? If there is new issue, we could update it by a new PR.

from sonic-mgmt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.