]> git.ipfire.org Git - thirdparty/lldpd.git/blame - tests/many-neighbors.py
travis: disable integration tests
[thirdparty/lldpd.git] / tests / many-neighbors.py
CommitLineData
3bd96fcb
VB
1#!/usr/bin/env python
2
3# Simple script to generate a lot of neighbors. This uses scapy. It
4# needs a version of Scapy that contains an LLDP dissector. There is
5# one in the scapy community repository:
6# https://hg.secdev.org/scapy-com/file/dc0876d1c302/scapy/layers/lldp.py
7
8from scapy.all import *
9from optparse import OptionParser
10
11parser = OptionParser()
12parser.add_option("-o", "--output", dest="output",
13 help="write PCAP file to FILE", metavar="FILE",
14 default="out.pcap")
15parser.add_option("-n", "--neighbors", dest="neighbors",
16 help="generate N neighbors", metavar="N",
17 default=60, type="int")
18
19(options, args) = parser.parse_args()
20
21wrpcap(options.output,
22 [Ether(dst="01:80:c2:00:00:0e", src="00:17:d1:a8:35:be")/
23 LLDP(tlvlist=[LLDPChassisId(subtype="Locally assigned", value="titi-%03d" % i),
24 LLDPPortId(subtype="Interface name", value="eth0"),
25 LLDPTTL(seconds=120),
26 LLDPDUEnd()])
27 for i in range(options.neighbors)])
28
29# The generated pcap can be replayed with tcpreplay:
30# tcpreplay -i veth0 -t out.pcap