Hi, Gourav
Sorry for delaying.

Currently, no way is provided to ignore some layers (ethernet, ipv4, etc...) for the switch test tool.

All you can do is ignoring whole packets at receiving end.
By following fix, you can do it:

diff --git a/ryu/tests/switch/tester.py b/ryu/tests/switch/tester.py
index f907555..56c84b6 100644
--- a/ryu/tests/switch/tester.py
+++ b/ryu/tests/switch/tester.py
@@ -1424,37 +1424,8 @@ class Test(stringify.StringifyMixin):
             else:
raise ValueError('invalid format: "%s" field' % KEY_INGRESS)
             # parse 'egress' or 'PACKET_IN' or 'table-miss'
-            if KEY_EGRESS in test:
-                if isinstance(test[KEY_EGRESS], list):
-                    test_pkt[KEY_EGRESS] = __test_pkt_from_json(
-                        test[KEY_EGRESS])
-                elif isinstance(test[KEY_EGRESS], dict):
-                    throughputs = []
-                    for throughput in test[KEY_EGRESS][KEY_THROUGHPUT]:
-                        one = {}
-                        mod = {
-                            "OFPFlowMod": {
-                                'cookie': THROUGHPUT_COOKIE,
-                                'priority': THROUGHPUT_PRIORITY,
-                                'match': {
-                                    'OFPMatch': throughput[KEY_MATCH]
-                                }
-                            }
-                        }
-                        msg = ofproto_parser.ofp_msg_from_jsondict(
-                            tester_dp, mod)
-                        one[KEY_FLOW] = msg
-                        one[KEY_KBPS] = throughput.get(KEY_KBPS)
-                        one[KEY_PKTPS] = throughput.get(KEY_PKTPS)
-                        if not bool(one[KEY_KBPS]) != bool(one[KEY_PKTPS]):
-                            raise ValueError(
-                                '"%s" requires either "%s" or "%s".' % (
-                                    KEY_THROUGHPUT, KEY_KBPS, KEY_PKTPS))
-                        throughputs.append(one)
-                    test_pkt[KEY_THROUGHPUT] = throughputs
-                else:
- raise ValueError('invalid format: "%s" field' % KEY_EGRESS)
-            elif KEY_PKT_IN in test:
+
+            if KEY_PKT_IN in test:
test_pkt[KEY_PKT_IN] = __test_pkt_from_json(test[KEY_PKT_IN])
             elif KEY_TBL_MISS in test:
                 test_pkt[KEY_TBL_MISS] = test[KEY_TBL_MISS]


Thanks,
Fujimoto

On 2017年08月13日 12:09, Gourav Gopal wrote:
Hi,

I am using RYU for unit testing Openflow based switch with a host running as controller and a connected switch at auxilliary switch (https://osrg.github.io/ryu-book/en/html/switch_test_tool.html)
I am running "ryu manager" with test cases in json files.
I want to know is there any way to ignore some packet content to parse at receiving end.

Like,

"tests":[
            {
                "ingress":[
"ethernet(dst='22:22:22:22:22:22', src='12:11:11:11:11:11', ethertype=2048)", "ipv4(tos=32, proto=6, src='192.168.10.10', dst='192.168.20.20', ttl=64)", "tcp(dst_port=2222, option=bytes(b'\\x00' * 4), src_port=11111)",
"b'\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\t\\n\\x0b\\x0c\\r\\x0e\\x0f\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f'"
                ],
                "egress":[
*"ethernet(dst='22:22:21:22:21:22', src='12:11:11:11:11:11', ethertype=33024)*",
*"vlan(ethertype=2048,pcp=0,vid=1)",*
*"ipv4(tos=32, proto=6, src='192.168.10.10', dst='192.168.20.20', ttl=63)",* "tcp(dst_port=2222, option=bytes(b'\\x00' * 4), src_port=11111)",
"b'\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\t\\n\\x0b\\x0c\\r\\x0e\\x0f\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f'"
                ]
            }
        ]

Is there any way that I can ignore(or don't care) the whole or partial ethernet/vlan/ipv4/ipv6 packet content at receivng end as some of the values can differ in different setup and I don't want to hard code it.

Please let me know if
Thanks and Regards,
Gourav Gopal


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot


_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to