]>
git.proxmox.com Git - mirror_frr.git/blob - tests/topotests/lib/send_bsr_packet.py
1 # SPDX-License-Identifier: ISC
3 # Copyright (c) 2019 by VMware, Inc. ("VMware")
4 # Used Copyright (c) 2018 by Network Device Education Foundation, Inc.
5 # ("NetDEF") in this file.
10 from scapy
.all
import Raw
, sendp
14 def send_packet(packet
, iface
, interval
, count
):
16 Read BSR packet in Raw format and send it to specified interface
20 * `packet` : BSR packet in raw format
21 * `interface` : Interface from which packet would be send
22 * `interval` : Interval between the packets
23 * `count` : Number of packets to be sent
26 data
= binascii
.a2b_hex(packet
)
29 sendp(p
, inter
=int(interval
), iface
=iface
, count
=int(count
))
32 if __name__
== "__main__":
33 parser
= argparse
.ArgumentParser(description
="Send BSR Raw packet")
34 parser
.add_argument("packet", help="Packet in raw format")
35 parser
.add_argument("iface", help="Packet send to this ineterface")
36 parser
.add_argument("--interval", help="Interval between packets", default
=0)
38 "--count", help="Number of times packet is sent repetitively", default
=0
40 args
= parser
.parse_args()
42 if not args
.packet
or not args
.iface
:
45 send_packet(args
.packet
, args
.iface
, args
.interval
, args
.count
)