-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add autotest for check directly connected routes
- Loading branch information
Timur Aitov
committed
Jan 25, 2024
1 parent
aa4e89d
commit a5e7aa4
Showing
11 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
Binary file added
BIN
+272 Bytes
autotest/units/001_one_port/071_route_directly_connected/001-expect.pcap
Binary file not shown.
Binary file added
BIN
+396 Bytes
autotest/units/001_one_port/071_route_directly_connected/001-send.pcap
Binary file not shown.
Binary file added
BIN
+352 Bytes
autotest/units/001_one_port/071_route_directly_connected/002-expect.pcap
Binary file not shown.
Binary file added
BIN
+516 Bytes
autotest/units/001_one_port/071_route_directly_connected/002-send.pcap
Binary file not shown.
Binary file added
BIN
+272 Bytes
autotest/units/001_one_port/071_route_directly_connected/003-expect.pcap
Binary file not shown.
Binary file added
BIN
+396 Bytes
autotest/units/001_one_port/071_route_directly_connected/003-send.pcap
Binary file not shown.
Binary file added
BIN
+352 Bytes
autotest/units/001_one_port/071_route_directly_connected/004-expect.pcap
Binary file not shown.
Binary file added
BIN
+516 Bytes
autotest/units/001_one_port/071_route_directly_connected/004-send.pcap
Binary file not shown.
27 changes: 27 additions & 0 deletions
27
autotest/units/001_one_port/071_route_directly_connected/autotest.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
steps: | ||
- cli: | ||
- neighbor insert route0 kni0.100 10.10.0.2 00:00:ee:10:44:02 | ||
- neighbor insert route0 kni0.100 10.10.0.250 00:00:ee:10:44:fa | ||
- neighbor insert route0 kni0.100 2000:100::2 00:00:ee:10:66:02 | ||
- neighbor insert route0 kni0.100 2000:100::fa 00:00:ee:10:66:fa | ||
- neighbor insert route0 kni0.200 10.20.0.2 00:00:ee:20:44:02 | ||
- neighbor insert route0 kni0.200 10.20.0.250 00:00:ee:20:44:fa | ||
- neighbor insert route0 kni0.200 2000:200::2 00:00:ee:20:66:02 | ||
- neighbor insert route0 kni0.200 2000:200::fa 00:00:ee:20:66:fa | ||
- neighbor flush | ||
- sendPackets: | ||
- port: kni0 | ||
send: 001-send.pcap | ||
expect: 001-expect.pcap | ||
- sendPackets: | ||
- port: kni0 | ||
send: 002-send.pcap | ||
expect: 002-expect.pcap | ||
- sendPackets: | ||
- port: kni0 | ||
send: 003-send.pcap | ||
expect: 003-expect.pcap | ||
- sendPackets: | ||
- port: kni0 | ||
send: 004-send.pcap | ||
expect: 004-expect.pcap |
43 changes: 43 additions & 0 deletions
43
autotest/units/001_one_port/071_route_directly_connected/controlplane.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"modules": { | ||
"lp0.100": { | ||
"type": "logicalPort", | ||
"physicalPort": "kni0", | ||
"vlanId": "100", | ||
"macAddress": "00:00:00:11:11:11", | ||
"nextModule": "acl0" | ||
}, | ||
"lp0.200": { | ||
"type": "logicalPort", | ||
"physicalPort": "kni0", | ||
"vlanId": "200", | ||
"macAddress": "00:00:00:22:22:22", | ||
"nextModule": "acl0" | ||
}, | ||
"acl0": { | ||
"type": "acl", | ||
"nextModules": [ | ||
"route0" | ||
] | ||
}, | ||
"route0": { | ||
"type": "route", | ||
"interfaces": { | ||
"kni0.100": { | ||
"ipAddresses": [ | ||
"10.10.0.1/24", | ||
"2000:100::1/96" | ||
], | ||
"nextModule": "lp0.100" | ||
}, | ||
"kni0.200": { | ||
"ipAddresses": [ | ||
"10.20.0.1/24", | ||
"2000:200::1/96" | ||
], | ||
"nextModule": "lp0.200" | ||
} | ||
} | ||
} | ||
} | ||
} |
86 changes: 86 additions & 0 deletions
86
autotest/units/001_one_port/071_route_directly_connected/gen.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
|
||
from scapy.all import * | ||
from scapy.contrib.mpls import MPLS | ||
|
||
|
||
def write_pcap(filename, *packetsList): | ||
if len(packetsList) == 0: | ||
PcapWriter(filename)._write_header(Ether()) | ||
return | ||
|
||
PcapWriter(filename) | ||
|
||
for packets in packetsList: | ||
if type(packets) == list: | ||
for packet in packets: | ||
packet.time = 0 | ||
wrpcap(filename, [p for p in packet], append=True) | ||
else: | ||
packets.time = 0 | ||
wrpcap(filename, [p for p in packets], append=True) | ||
|
||
|
||
# 10.10.0.0/24 -> kni0.100 | ||
write_pcap("001-send.pcap", | ||
Ether(dst="00:00:00:11:11:11", src="00:00:DE:AD:00:00")/Dot1Q(vlan=100)/IP(dst="10.10.0.2", src="222.222.222.222")/UDP(), | ||
Ether(dst="00:00:00:11:11:11", src="00:00:DE:AD:00:00")/Dot1Q(vlan=100)/IP(dst="10.10.0.111", src="222.222.222.222")/UDP(), # neighbor mac invalid | ||
Ether(dst="00:00:00:11:11:11", src="00:00:DE:AD:00:00")/Dot1Q(vlan=100)/IP(dst="10.10.0.250", src="222.222.222.222")/UDP(), | ||
Ether(dst="00:00:00:22:22:22", src="00:00:DE:AD:00:00")/Dot1Q(vlan=200)/IP(dst="10.10.0.2", src="222.222.222.222")/UDP(), | ||
Ether(dst="00:00:00:22:22:22", src="00:00:DE:AD:00:00")/Dot1Q(vlan=200)/IP(dst="10.10.0.111", src="222.222.222.222")/UDP(), # neighbor mac invalid | ||
Ether(dst="00:00:00:22:22:22", src="00:00:DE:AD:00:00")/Dot1Q(vlan=200)/IP(dst="10.10.0.250", src="222.222.222.222")/UDP()) | ||
|
||
write_pcap("001-expect.pcap", | ||
Ether(dst="00:00:EE:10:44:02", src="00:00:00:11:11:11")/Dot1Q(vlan=100)/IP(dst="10.10.0.2", src="222.222.222.222", ttl=63)/UDP(), | ||
Ether(dst="00:00:EE:10:44:FA", src="00:00:00:11:11:11")/Dot1Q(vlan=100)/IP(dst="10.10.0.250", src="222.222.222.222", ttl=63)/UDP(), | ||
Ether(dst="00:00:EE:10:44:02", src="00:00:00:11:11:11")/Dot1Q(vlan=100)/IP(dst="10.10.0.2", src="222.222.222.222", ttl=63)/UDP(), | ||
Ether(dst="00:00:EE:10:44:FA", src="00:00:00:11:11:11")/Dot1Q(vlan=100)/IP(dst="10.10.0.250", src="222.222.222.222", ttl=63)/UDP()) | ||
|
||
|
||
# 2000:100::/96 -> kni0.100 | ||
write_pcap("002-send.pcap", | ||
Ether(dst="00:00:00:11:11:11", src="00:00:DE:AD:00:00")/Dot1Q(vlan=100)/IPv6(dst="2000:100::2", src="2222::2222")/UDP(), | ||
Ether(dst="00:00:00:11:11:11", src="00:00:DE:AD:00:00")/Dot1Q(vlan=100)/IPv6(dst="2000:100::6F", src="2222::2222")/UDP(), # neighbor mac invalid | ||
Ether(dst="00:00:00:11:11:11", src="00:00:DE:AD:00:00")/Dot1Q(vlan=100)/IPv6(dst="2000:100::FA", src="2222::2222")/UDP(), | ||
Ether(dst="00:00:00:22:22:22", src="00:00:DE:AD:00:00")/Dot1Q(vlan=200)/IPv6(dst="2000:100::2", src="2222::2222")/UDP(), | ||
Ether(dst="00:00:00:22:22:22", src="00:00:DE:AD:00:00")/Dot1Q(vlan=200)/IPv6(dst="2000:100::6F", src="2222::2222")/UDP(), # neighbor mac invalid | ||
Ether(dst="00:00:00:22:22:22", src="00:00:DE:AD:00:00")/Dot1Q(vlan=200)/IPv6(dst="2000:100::FA", src="2222::2222")/UDP()) | ||
|
||
write_pcap("002-expect.pcap", | ||
Ether(dst="00:00:EE:10:66:02", src="00:00:00:11:11:11")/Dot1Q(vlan=100)/IPv6(dst="2000:100::2", src="2222::2222", hlim=63)/UDP(), | ||
Ether(dst="00:00:EE:10:66:FA", src="00:00:00:11:11:11")/Dot1Q(vlan=100)/IPv6(dst="2000:100::FA", src="2222::2222", hlim=63)/UDP(), | ||
Ether(dst="00:00:EE:10:66:02", src="00:00:00:11:11:11")/Dot1Q(vlan=100)/IPv6(dst="2000:100::2", src="2222::2222", hlim=63)/UDP(), | ||
Ether(dst="00:00:EE:10:66:FA", src="00:00:00:11:11:11")/Dot1Q(vlan=100)/IPv6(dst="2000:100::FA", src="2222::2222", hlim=63)/UDP()) | ||
|
||
|
||
# 10.20.0.0/24 -> kni0.200 | ||
write_pcap("003-send.pcap", | ||
Ether(dst="00:00:00:11:11:11", src="00:00:DE:AD:00:00")/Dot1Q(vlan=100)/IP(dst="10.20.0.2", src="222.222.222.222")/UDP(), | ||
Ether(dst="00:00:00:11:11:11", src="00:00:DE:AD:00:00")/Dot1Q(vlan=100)/IP(dst="10.20.0.111", src="222.222.222.222")/UDP(), # neighbor mac invalid | ||
Ether(dst="00:00:00:11:11:11", src="00:00:DE:AD:00:00")/Dot1Q(vlan=100)/IP(dst="10.20.0.250", src="222.222.222.222")/UDP(), | ||
Ether(dst="00:00:00:22:22:22", src="00:00:DE:AD:00:00")/Dot1Q(vlan=200)/IP(dst="10.20.0.2", src="222.222.222.222")/UDP(), | ||
Ether(dst="00:00:00:22:22:22", src="00:00:DE:AD:00:00")/Dot1Q(vlan=200)/IP(dst="10.20.0.111", src="222.222.222.222")/UDP(), # neighbor mac invalid | ||
Ether(dst="00:00:00:22:22:22", src="00:00:DE:AD:00:00")/Dot1Q(vlan=200)/IP(dst="10.20.0.250", src="222.222.222.222")/UDP()) | ||
|
||
write_pcap("003-expect.pcap", | ||
Ether(dst="00:00:EE:20:44:02", src="00:00:00:22:22:22")/Dot1Q(vlan=200)/IP(dst="10.20.0.2", src="222.222.222.222", ttl=63)/UDP(), | ||
Ether(dst="00:00:EE:20:44:FA", src="00:00:00:22:22:22")/Dot1Q(vlan=200)/IP(dst="10.20.0.250", src="222.222.222.222", ttl=63)/UDP(), | ||
Ether(dst="00:00:EE:20:44:02", src="00:00:00:22:22:22")/Dot1Q(vlan=200)/IP(dst="10.20.0.2", src="222.222.222.222", ttl=63)/UDP(), | ||
Ether(dst="00:00:EE:20:44:FA", src="00:00:00:22:22:22")/Dot1Q(vlan=200)/IP(dst="10.20.0.250", src="222.222.222.222", ttl=63)/UDP()) | ||
|
||
|
||
# 2000:200::/96 -> kni0.200 | ||
write_pcap("004-send.pcap", | ||
Ether(dst="00:00:00:11:11:11", src="00:00:DE:AD:00:00")/Dot1Q(vlan=100)/IPv6(dst="2000:200::2", src="2222::2222")/UDP(), | ||
Ether(dst="00:00:00:11:11:11", src="00:00:DE:AD:00:00")/Dot1Q(vlan=100)/IPv6(dst="2000:200::6F", src="2222::2222")/UDP(), # neighbor mac invalid | ||
Ether(dst="00:00:00:11:11:11", src="00:00:DE:AD:00:00")/Dot1Q(vlan=100)/IPv6(dst="2000:200::FA", src="2222::2222")/UDP(), | ||
Ether(dst="00:00:00:22:22:22", src="00:00:DE:AD:00:00")/Dot1Q(vlan=200)/IPv6(dst="2000:200::2", src="2222::2222")/UDP(), | ||
Ether(dst="00:00:00:22:22:22", src="00:00:DE:AD:00:00")/Dot1Q(vlan=200)/IPv6(dst="2000:200::6F", src="2222::2222")/UDP(), # neighbor mac invalid | ||
Ether(dst="00:00:00:22:22:22", src="00:00:DE:AD:00:00")/Dot1Q(vlan=200)/IPv6(dst="2000:200::FA", src="2222::2222")/UDP()) | ||
|
||
write_pcap("004-expect.pcap", | ||
Ether(dst="00:00:EE:20:66:02", src="00:00:00:22:22:22")/Dot1Q(vlan=200)/IPv6(dst="2000:200::2", src="2222::2222", hlim=63)/UDP(), | ||
Ether(dst="00:00:EE:20:66:FA", src="00:00:00:22:22:22")/Dot1Q(vlan=200)/IPv6(dst="2000:200::FA", src="2222::2222", hlim=63)/UDP(), | ||
Ether(dst="00:00:EE:20:66:02", src="00:00:00:22:22:22")/Dot1Q(vlan=200)/IPv6(dst="2000:200::2", src="2222::2222", hlim=63)/UDP(), | ||
Ether(dst="00:00:EE:20:66:FA", src="00:00:00:22:22:22")/Dot1Q(vlan=200)/IPv6(dst="2000:200::FA", src="2222::2222", hlim=63)/UDP()) |