diff --git a/autotest/units/001_one_port/076_rfc_5549_route/autotest.yaml b/autotest/units/001_one_port/076_rfc_5549_route/autotest.yaml index b7bc5c1a..09c3df3d 100644 --- a/autotest/units/001_one_port/076_rfc_5549_route/autotest.yaml +++ b/autotest/units/001_one_port/076_rfc_5549_route/autotest.yaml @@ -13,4 +13,6 @@ steps: - port: kni0 send: 001-send.pcap expect: 001-expect.pcap - +- cli: + - rib static remove default 1.0.0.0/24 c0de::200:1 1001 + \ No newline at end of file diff --git a/autotest/units/001_one_port/076_rfc_5549_route_tunnel_random_source/001-expect.pcap b/autotest/units/001_one_port/076_rfc_5549_route_tunnel_random_source/001-expect.pcap new file mode 100644 index 00000000..c46b874d Binary files /dev/null and b/autotest/units/001_one_port/076_rfc_5549_route_tunnel_random_source/001-expect.pcap differ diff --git a/autotest/units/001_one_port/076_rfc_5549_route_tunnel_random_source/001-send.pcap b/autotest/units/001_one_port/076_rfc_5549_route_tunnel_random_source/001-send.pcap new file mode 100644 index 00000000..93ee0ede Binary files /dev/null and b/autotest/units/001_one_port/076_rfc_5549_route_tunnel_random_source/001-send.pcap differ diff --git a/autotest/units/001_one_port/076_rfc_5549_route_tunnel_random_source/002-expect.pcap b/autotest/units/001_one_port/076_rfc_5549_route_tunnel_random_source/002-expect.pcap new file mode 100644 index 00000000..7bc5e572 Binary files /dev/null and b/autotest/units/001_one_port/076_rfc_5549_route_tunnel_random_source/002-expect.pcap differ diff --git a/autotest/units/001_one_port/076_rfc_5549_route_tunnel_random_source/002-send.pcap b/autotest/units/001_one_port/076_rfc_5549_route_tunnel_random_source/002-send.pcap new file mode 100644 index 00000000..d57f8e0c Binary files /dev/null and b/autotest/units/001_one_port/076_rfc_5549_route_tunnel_random_source/002-send.pcap differ diff --git a/autotest/units/001_one_port/076_rfc_5549_route_tunnel_random_source/autotest.yaml b/autotest/units/001_one_port/076_rfc_5549_route_tunnel_random_source/autotest.yaml new file mode 100644 index 00000000..42d558b3 --- /dev/null +++ b/autotest/units/001_one_port/076_rfc_5549_route_tunnel_random_source/autotest.yaml @@ -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 diff --git a/autotest/units/001_one_port/076_rfc_5549_route_tunnel_random_source/controlplane.conf b/autotest/units/001_one_port/076_rfc_5549_route_tunnel_random_source/controlplane.conf new file mode 100644 index 00000000..05045144 --- /dev/null +++ b/autotest/units/001_one_port/076_rfc_5549_route_tunnel_random_source/controlplane.conf @@ -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" + ] + } + } +} diff --git a/autotest/units/001_one_port/076_rfc_5549_route_tunnel_random_source/gen.py b/autotest/units/001_one_port/076_rfc_5549_route_tunnel_random_source/gen.py new file mode 100755 index 00000000..31969c73 --- /dev/null +++ b/autotest/units/001_one_port/076_rfc_5549_route_tunnel_random_source/gen.py @@ -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())