-
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.
Added autotest for random source address in route tunnel
- Loading branch information
Showing
8 changed files
with
159 additions
and
1 deletion.
There are no files selected for viewing
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
Binary file added
BIN
+480 Bytes
autotest/units/001_one_port/076_rfc_5549_route_tunnel_random_source/001-expect.pcap
Binary file not shown.
Binary file added
BIN
+272 Bytes
autotest/units/001_one_port/076_rfc_5549_route_tunnel_random_source/001-send.pcap
Binary file not shown.
Binary file added
BIN
+148 Bytes
autotest/units/001_one_port/076_rfc_5549_route_tunnel_random_source/002-expect.pcap
Binary file not shown.
Binary file added
BIN
+148 Bytes
autotest/units/001_one_port/076_rfc_5549_route_tunnel_random_source/002-send.pcap
Binary file not shown.
27 changes: 27 additions & 0 deletions
27
autotest/units/001_one_port/076_rfc_5549_route_tunnel_random_source/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: | ||
- ipv6Update: "::/0 -> 3333::2" | ||
- cli: | ||
- rib static insert default 1.0.0.0/24 4444::1 1100 10000 1 1 | ||
- rib_insert: | ||
attribute: | ||
protocol: autotest | ||
tables: | ||
- table_name: ipv6 mpls-vpn | ||
large_communities: | ||
- 13238:1:1 | ||
prefixes: | ||
- nexthop: 5555::1 | ||
prefix: 2.0.0.0/24 | ||
path_information: 55.55.55.1:10001 | ||
labels: | ||
- 1200 | ||
- cli: | ||
- rib prefixes | ||
- sendPackets: | ||
- port: kni0 | ||
send: 001-send.pcap | ||
expect: 001-expect.pcap | ||
- sendPackets: | ||
- port: kni0 | ||
send: 002-send.pcap | ||
expect: 002-expect.pcap |
84 changes: 84 additions & 0 deletions
84
autotest/units/001_one_port/076_rfc_5549_route_tunnel_random_source/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,84 @@ | ||
{ | ||
"modules": { | ||
"lp0.100": { | ||
"type": "logicalPort", | ||
"physicalPort": "kni0", | ||
"vlanId": "100", | ||
"macAddress": "00:11:22:33:44:55", | ||
"nextModule": "acl0" | ||
}, | ||
"lp0.200": { | ||
"type": "logicalPort", | ||
"physicalPort": "kni0", | ||
"vlanId": "200", | ||
"macAddress": "00:11:22:33:44:55", | ||
"nextModule": "acl0" | ||
}, | ||
"lp0.300": { | ||
"type": "logicalPort", | ||
"physicalPort": "kni0", | ||
"vlanId": "300", | ||
"macAddress": "00:11:22:33:44:55", | ||
"nextModule": "acl0" | ||
}, | ||
"acl0": { | ||
"type": "acl", | ||
"nextModules": [ | ||
"decap0", | ||
"route0:tunnel" | ||
] | ||
}, | ||
"decap0": { | ||
"type": "decap", | ||
"ipv6DestinationPrefixes": [ | ||
"3333::1" | ||
], | ||
"nextModule": "route0" | ||
}, | ||
"route0": { | ||
"type": "route", | ||
"ipv4SourceAddress": "10.50.0.1", | ||
"ipv6SourceAddress": "3333::1", | ||
"udpDestinationPort": 6635, | ||
"random_source": true, | ||
"interfaces": { | ||
"kni0.100": { | ||
"ipAddresses": [ | ||
"10.0.1.1/24" | ||
], | ||
"acl": "acl0", | ||
"neighborIPv4Address": "10.0.1.2", | ||
"neighborMacAddress": "00:00:00:00:00:01", | ||
"nextModule": "lp0.100" | ||
}, | ||
"kni0.200": { | ||
"ipAddresses": [ | ||
"10.0.2.1/24" | ||
], | ||
"acl": "acl0", | ||
"neighborIPv4Address": "10.0.2.2", | ||
"neighborMacAddress": "00:00:00:00:00:02", | ||
"nextModule": "lp0.200" | ||
}, | ||
"kni0.300": { | ||
"ipAddresses": [ | ||
"3333::1/96" | ||
], | ||
"acl": "acl0", | ||
"neighborIPv6Address": "3333::2", | ||
"neighborMacAddress": "00:00:00:00:00:03", | ||
"nextModule": "lp0.300" | ||
} | ||
}, | ||
"peers": { | ||
"1": "A", | ||
"2": "B", | ||
"3": "C" | ||
}, | ||
"localPrefixes": [ | ||
"10.0.1.0/24", | ||
"10.0.2.0/24" | ||
] | ||
} | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
autotest/units/001_one_port/076_rfc_5549_route_tunnel_random_source/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,45 @@ | ||
#!/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) | ||
|
||
|
||
# Check route tunnel mpls over udp | ||
write_pcap("001-send.pcap", | ||
Ether(dst="00:11:22:33:44:55", src="00:00:00:00:00:01")/Dot1Q(vlan=100)/IP(dst="1.0.0.1", src="10.0.1.2", ttl=64)/ICMP(), | ||
Ether(dst="00:11:22:33:44:55", src="00:00:00:00:00:01")/Dot1Q(vlan=100)/IP(dst="2.0.0.1", src="10.0.1.2", ttl=64)/ICMP(), | ||
Ether(dst="00:11:22:33:44:55", src="00:00:00:00:00:02")/Dot1Q(vlan=200)/IP(dst="1.0.0.1", src="10.0.2.2", ttl=64)/ICMP(), | ||
Ether(dst="00:11:22:33:44:55", src="00:00:00:00:00:02")/Dot1Q(vlan=200)/IP(dst="2.0.0.1", src="10.0.2.2", ttl=64)/ICMP()) | ||
|
||
write_pcap("001-expect.pcap", | ||
Ether(dst="00:00:00:00:00:03", src="00:11:22:33:44:55")/Dot1Q(vlan=300)/IPv6(dst="4444::1", src="3333::a00:102:0:1")/UDP(dport=6635, sport=0xca71, chksum=0)/MPLS(label=1100, ttl=255)/IP(dst="1.0.0.1", src="10.0.1.2", ttl=63)/ICMP(), | ||
Ether(dst="00:00:00:00:00:03", src="00:11:22:33:44:55")/Dot1Q(vlan=300)/IPv6(dst="5555::1", src="3333::a00:102:0:1")/UDP(dport=6635, sport=0xf06f, chksum=0)/MPLS(label=1200, ttl=255)/IP(dst="2.0.0.1", src="10.0.1.2", ttl=63)/ICMP(), | ||
Ether(dst="00:00:00:00:00:03", src="00:11:22:33:44:55")/Dot1Q(vlan=300)/IPv6(dst="4444::1", src="3333::a00:202:0:1")/UDP(dport=6635, sport=0xf621, chksum=0)/MPLS(label=1100, ttl=255)/IP(dst="1.0.0.1", src="10.0.2.2", ttl=63)/ICMP(), | ||
Ether(dst="00:00:00:00:00:03", src="00:11:22:33:44:55")/Dot1Q(vlan=300)/IPv6(dst="5555::1", src="3333::a00:202:0:1")/UDP(dport=6635, sport=0xcc3f, chksum=0)/MPLS(label=1200, ttl=255)/IP(dst="2.0.0.1", src="10.0.2.2", ttl=63)/ICMP()) | ||
|
||
# No tunnel is established between local prefixes | ||
write_pcap("002-send.pcap", | ||
Ether(dst="00:11:22:33:44:55", src="00:00:00:00:00:02")/Dot1Q(vlan=200)/IP(dst="10.0.1.2", src="10.0.2.2", ttl=64)/ICMP(), | ||
Ether(dst="00:11:22:33:44:55", src="00:00:00:00:00:03")/Dot1Q(vlan=100)/IP(dst="10.0.2.2", src="10.0.1.2", ttl=64)/ICMP()) | ||
|
||
write_pcap("002-expect.pcap", | ||
Ether(dst="00:00:00:00:00:01", src="00:11:22:33:44:55")/Dot1Q(vlan=100)/IP(dst="10.0.1.2", src="10.0.2.2", ttl=63)/ICMP(), | ||
Ether(dst="00:00:00:00:00:02", src="00:11:22:33:44:55")/Dot1Q(vlan=200)/IP(dst="10.0.2.2", src="10.0.1.2", ttl=63)/ICMP()) |