diff options
Diffstat (limited to 'resources/traffic_scripts/lisp')
-rwxr-xr-x | resources/traffic_scripts/lisp/lisp_check.py | 18 | ||||
-rwxr-xr-x | resources/traffic_scripts/lisp/lispgpe_check.py | 18 |
2 files changed, 28 insertions, 8 deletions
diff --git a/resources/traffic_scripts/lisp/lisp_check.py b/resources/traffic_scripts/lisp/lisp_check.py index 5e1a835b74..9937de8077 100755 --- a/resources/traffic_scripts/lisp/lisp_check.py +++ b/resources/traffic_scripts/lisp/lisp_check.py @@ -72,7 +72,8 @@ def main(): args = TrafficScriptArg( ['tg_src_mac', 'tg_dst_mac', 'src_ip', 'dst_ip', 'dut_if1_mac', - 'dut_if2_mac', 'src_rloc', 'dst_rloc']) + 'dut_if2_mac', 'src_rloc', 'dst_rloc'], + ['ot_mode']) tx_src_mac = args.get_arg('tg_src_mac') tx_dst_mac = args.get_arg('dut_if1_mac') @@ -84,6 +85,7 @@ def main(): dst_rloc = args.get_arg("dst_rloc") tx_if = args.get_arg('tx_if') rx_if = args.get_arg('rx_if') + ot_mode = args.get_arg('ot_mode') rxq = RxQueue(rx_if) txq = TxQueue(tx_if) @@ -124,9 +126,17 @@ def main(): ip = ether.payload - if not isinstance(ip, ip_format): - raise RuntimeError( - "Not an IP packet received {0}".format(ip.__repr__())) + if ot_mode == '6to4': + if not isinstance(ip, IP): + raise RuntimeError( + "Not an IP packet received {0}".format(ip.__repr__())) + elif ot_mode == '4to6': + if not isinstance(ip, IP6): + raise RuntimeError( + "Not an IP packet received {0}".format(ip.__repr__())) + elif not isinstance(ip, ip_format): + raise RuntimeError( + "Not an IP packet received {0}".format(ip.__repr__())) lisp = ether.getlayer(lisp_layer) if not lisp: diff --git a/resources/traffic_scripts/lisp/lispgpe_check.py b/resources/traffic_scripts/lisp/lispgpe_check.py index 7979b6ced9..d4de8635d7 100755 --- a/resources/traffic_scripts/lisp/lispgpe_check.py +++ b/resources/traffic_scripts/lisp/lispgpe_check.py @@ -96,7 +96,8 @@ def main(): args = TrafficScriptArg( ['tg_src_mac', 'tg_dst_mac', 'src_ip', 'dst_ip', 'dut_if1_mac', - 'dut_if2_mac', 'src_rloc', 'dst_rloc']) + 'dut_if2_mac', 'src_rloc', 'dst_rloc'], + ['ot_mode']) tx_src_mac = args.get_arg('tg_src_mac') tx_dst_mac = args.get_arg('dut_if1_mac') @@ -108,6 +109,7 @@ def main(): dst_rloc = args.get_arg("dst_rloc") tx_if = args.get_arg('tx_if') rx_if = args.get_arg('rx_if') + ot_mode = args.get_arg('ot_mode') rxq = RxQueue(rx_if) txq = TxQueue(tx_if) @@ -146,9 +148,17 @@ def main(): ip = ether.payload - if not isinstance(ip, ip_format): - raise RuntimeError( - "Not an IP packet received {0}".format(ip.__repr__())) + if ot_mode == '6to4': + if not isinstance(ip, IP): + raise RuntimeError( + "Not an IP packet received {0}".format(ip.__repr__())) + elif ot_mode == '4to6': + if not isinstance(ip, IPv6): + raise RuntimeError( + "Not an IP packet received {0}".format(ip.__repr__())) + elif not isinstance(ip, ip_format): + raise RuntimeError( + "Not an IP packet received {0}".format(ip.__repr__())) lisp = ether.getlayer(LispGPEHeader).underlayer if not lisp: |