-
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 support of IPv4/v6 outer source network for services
- Loading branch information
Showing
36 changed files
with
661 additions
and
22 deletions.
There are no files selected for viewing
Binary file added
BIN
+252 Bytes
autotest/units/001_one_port/068_balancer_outer_source_network/001-expect.pcap
Binary file not shown.
Binary file added
BIN
+172 Bytes
autotest/units/001_one_port/068_balancer_outer_source_network/001-send.pcap
Binary file not shown.
Binary file added
BIN
+212 Bytes
autotest/units/001_one_port/068_balancer_outer_source_network/002-expect.pcap
Binary file not shown.
Binary file added
BIN
+172 Bytes
autotest/units/001_one_port/068_balancer_outer_source_network/002-send.pcap
Binary file not shown.
Binary file added
BIN
+292 Bytes
autotest/units/001_one_port/068_balancer_outer_source_network/003-expect.pcap
Binary file not shown.
Binary file added
BIN
+212 Bytes
autotest/units/001_one_port/068_balancer_outer_source_network/003-send.pcap
Binary file not shown.
Binary file added
BIN
+252 Bytes
autotest/units/001_one_port/068_balancer_outer_source_network/004-expect.pcap
Binary file not shown.
Binary file added
BIN
+212 Bytes
autotest/units/001_one_port/068_balancer_outer_source_network/004-send.pcap
Binary file not shown.
Binary file added
BIN
+292 Bytes
autotest/units/001_one_port/068_balancer_outer_source_network/005-expect.pcap
Binary file not shown.
Binary file added
BIN
+212 Bytes
autotest/units/001_one_port/068_balancer_outer_source_network/005-send.pcap
Binary file not shown.
Binary file added
BIN
+292 Bytes
autotest/units/001_one_port/068_balancer_outer_source_network/006-expect.pcap
Binary file not shown.
Binary file added
BIN
+212 Bytes
autotest/units/001_one_port/068_balancer_outer_source_network/006-send.pcap
Binary file not shown.
Binary file added
BIN
+292 Bytes
autotest/units/001_one_port/068_balancer_outer_source_network/007-expect.pcap
Binary file not shown.
Binary file added
BIN
+212 Bytes
autotest/units/001_one_port/068_balancer_outer_source_network/007-send.pcap
Binary file not shown.
Binary file added
BIN
+292 Bytes
autotest/units/001_one_port/068_balancer_outer_source_network/008-expect.pcap
Binary file not shown.
Binary file added
BIN
+212 Bytes
autotest/units/001_one_port/068_balancer_outer_source_network/008-send.pcap
Binary file not shown.
Binary file added
BIN
+292 Bytes
autotest/units/001_one_port/068_balancer_outer_source_network/009-expect.pcap
Binary file not shown.
Binary file added
BIN
+212 Bytes
autotest/units/001_one_port/068_balancer_outer_source_network/009-send.pcap
Binary file not shown.
Binary file added
BIN
+292 Bytes
autotest/units/001_one_port/068_balancer_outer_source_network/010-expect.pcap
Binary file not shown.
Binary file added
BIN
+212 Bytes
autotest/units/001_one_port/068_balancer_outer_source_network/010-send.pcap
Binary file not shown.
Binary file added
BIN
+292 Bytes
autotest/units/001_one_port/068_balancer_outer_source_network/011-expect.pcap
Binary file not shown.
Binary file added
BIN
+212 Bytes
autotest/units/001_one_port/068_balancer_outer_source_network/011-send.pcap
Binary file not shown.
62 changes: 62 additions & 0 deletions
62
autotest/units/001_one_port/068_balancer_outer_source_network/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,62 @@ | ||
steps: | ||
- ipv4Update: | ||
- "0.0.0.0/0 -> 200.0.0.1" | ||
- "100.0.0.0/8 -> 100.0.0.5" | ||
- ipv6Update: "::/0 -> fe80::1" | ||
- cli: | ||
- balancer real enable balancer0 10.0.0.1 tcp 80 2000::1 80 | ||
- balancer real enable balancer0 10.0.0.42 tcp 80 100.0.0.42 80 | ||
- balancer real enable balancer0 2001:dead:beef::1 tcp 80 2000::1 80 | ||
- balancer real enable balancer0 2001:dead:beef::2 tcp 80 100.0.0.6 80 | ||
- balancer real enable balancer0 2002:dead:beef::3 tcp 80 2000::2 80 | ||
- balancer real enable balancer0 2003:dead:beef::3 tcp 80 2000::2 80 | ||
- balancer real enable balancer0 2004:dead:beef::3 tcp 80 2000::2 80 | ||
- balancer real enable balancer0 2005:dead:beef::3 tcp 80 2000::2 80 | ||
- balancer real enable balancer0 2006:dead:beef::3 tcp 80 2000::2 80 | ||
- balancer real enable balancer0 2007:dead:beef::3 tcp 80 2000::2 80 | ||
- balancer real enable balancer0 2008:dead:beef::3 tcp 80 2000::2 80 | ||
- balancer real 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 | ||
- sendPackets: | ||
- port: kni0 | ||
send: 005-send.pcap | ||
expect: 005-expect.pcap | ||
- sendPackets: | ||
- port: kni0 | ||
send: 006-send.pcap | ||
expect: 006-expect.pcap | ||
- sendPackets: | ||
- port: kni0 | ||
send: 007-send.pcap | ||
expect: 007-expect.pcap | ||
- sendPackets: | ||
- port: kni0 | ||
send: 008-send.pcap | ||
expect: 008-expect.pcap | ||
- sendPackets: | ||
- port: kni0 | ||
send: 009-send.pcap | ||
expect: 009-expect.pcap | ||
- sendPackets: | ||
- port: kni0 | ||
send: 010-send.pcap | ||
expect: 010-expect.pcap | ||
- sendPackets: | ||
- port: kni0 | ||
send: 011-send.pcap | ||
expect: 011-expect.pcap |
48 changes: 48 additions & 0 deletions
48
autotest/units/001_one_port/068_balancer_outer_source_network/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,48 @@ | ||
{ | ||
"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" | ||
}, | ||
"acl0": { | ||
"type": "acl", | ||
"nextModules": [ | ||
"balancer0", | ||
"route0" | ||
] | ||
}, | ||
"balancer0": { | ||
"type": "balancer", | ||
"source": "2000:51b::1", | ||
"source_ipv4": "100.0.0.22", | ||
"services": "services.conf", | ||
"nextModule": "route0" | ||
}, | ||
"route0": { | ||
"type": "route", | ||
"interfaces": { | ||
"kni0.100": { | ||
"neighborIPv6Address": "fe80::1", | ||
"neighborIPv4Address": "100.0.0.5", | ||
"neighborMacAddress": "00:00:00:00:00:01", | ||
"nextModule": "lp0.100" | ||
}, | ||
"kni0.200": { | ||
"neighborIPv4Address": "200.0.0.1", | ||
"neighborMacAddress": "00:00:00:00:00:02", | ||
"nextModule": "lp0.200" | ||
} | ||
} | ||
} | ||
} | ||
} |
134 changes: 134 additions & 0 deletions
134
autotest/units/001_one_port/068_balancer_outer_source_network/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,134 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
|
||
from scapy.all import * | ||
|
||
|
||
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) | ||
|
||
|
||
write_pcap("001-send.pcap", | ||
Ether(dst="00:11:22:33:44:55", src="00:00:00:00:00:02") / Dot1Q(vlan=200) / IP(dst="10.0.0.1", src="1.1.0.1", ttl=64) / TCP(dport=80, sport=12380), | ||
Ether(dst="00:11:22:33:44:55", src="00:00:00:00:00:02") / Dot1Q(vlan=200) / IP(dst="10.0.0.1", src="1.1.0.2", ttl=64) / TCP(dport=80, sport=12380) | ||
) | ||
|
||
write_pcap("001-expect.pcap", | ||
Ether(dst="00:00:00:00:00:01", src="00:11:22:33:44:55")/Dot1Q(vlan=100)/IPv6(dst="2000::1", src="2001:dead:beef::0101:0001:0:1", hlim=63)/IP(dst="10.0.0.1", src="1.1.0.1", ttl=64)/TCP(dport=80, sport=12380), | ||
Ether(dst="00:00:00:00:00:01", src="00:11:22:33:44:55")/Dot1Q(vlan=100)/IPv6(dst="2000::1", src="2001:dead:beef::0101:0002:0:1", hlim=63)/IP(dst="10.0.0.1", src="1.1.0.2", ttl=64)/TCP(dport=80, sport=12380) | ||
) | ||
|
||
|
||
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.0.42", src="1.1.0.1", ttl=64)/TCP(dport=80, sport=12380), | ||
Ether(dst="00:11:22:33:44:55", src="00:00:00:00:00:02")/Dot1Q(vlan=200)/IP(dst="10.0.0.42", src="1.1.0.2", ttl=64)/TCP(dport=80, sport=12380) | ||
) | ||
|
||
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="100.0.0.42", src="123.0.0.12", ttl=63)/IP(dst="10.0.0.42", src="1.1.0.1", ttl=64)/TCP(dport=80, sport=12380), | ||
Ether(dst="00:00:00:00:00:01", src="00:11:22:33:44:55")/Dot1Q(vlan=100)/IP(dst="100.0.0.42", src="123.0.0.12", ttl=63)/IP(dst="10.0.0.42", src="1.1.0.2", ttl=64)/TCP(dport=80, sport=12380) | ||
) | ||
|
||
write_pcap("003-send.pcap", | ||
Ether(dst="00:11:22:33:44:55", src="00:00:00:00:00:02") / Dot1Q(vlan=200) / IPv6(dst="2001:dead:beef::1", src="2002::1", hlim=64) / TCP(dport=80, sport=12443), | ||
Ether(dst="00:11:22:33:44:55", src="00:00:00:00:00:02") / Dot1Q(vlan=200) / IPv6(dst="2001:dead:beef::1", src="2002::2", hlim=64) / TCP(dport=80, sport=12443) | ||
) | ||
|
||
write_pcap("003-expect.pcap", | ||
Ether(dst="00:00:00:00:00:01", src="00:11:22:33:44:55") / Dot1Q(vlan=100) / IPv6(dst="2000::1", src="2001:dead:beef:1234::1:1", hlim=63) / IPv6(dst="2001:dead:beef::1", src="2002::1", hlim=64) / TCP(dport=80, sport=12443), | ||
Ether(dst="00:00:00:00:00:01", src="00:11:22:33:44:55") / Dot1Q(vlan=100) / IPv6(dst="2000::1", src="2001:dead:beef:1234::2:1", hlim=63) / IPv6(dst="2001:dead:beef::1", src="2002::2", hlim=64) / TCP(dport=80, sport=12443) | ||
) | ||
|
||
|
||
write_pcap("004-send.pcap", | ||
Ether(dst="00:11:22:33:44:55", src="00:00:00:00:00:02")/Dot1Q(vlan=200)/IPv6(dst="2001:dead:beef::2", src="2002::10", hlim=64)/TCP(dport=80, sport=12380), | ||
Ether(dst="00:11:22:33:44:55", src="00:00:00:00:00:02")/Dot1Q(vlan=200)/IPv6(dst="2001:dead:beef::2", src="2002::11", hlim=64)/TCP(dport=80, sport=12380) | ||
) | ||
|
||
write_pcap("004-expect.pcap", | ||
Ether(dst="00:00:00:00:00:01", src="00:11:22:33:44:55")/Dot1Q(vlan=100)/IP(dst="100.0.0.6", src="123.0.12.0", ttl=63) /IPv6(dst="2001:dead:beef::2", src="2002::10", hlim=64)/TCP(dport=80, sport=12380), | ||
Ether(dst="00:00:00:00:00:01", src="00:11:22:33:44:55")/Dot1Q(vlan=100)/IP(dst="100.0.0.6", src="123.0.12.0", ttl=63) /IPv6(dst="2001:dead:beef::2", src="2002::11", hlim=64)/TCP(dport=80, sport=12380) | ||
) | ||
|
||
write_pcap("005-send.pcap", | ||
Ether(dst="00:11:22:33:44:55", src="00:00:00:00:00:02") / Dot1Q(vlan=200) / IPv6(dst="2002:dead:beef::3", src="2002::1", hlim=64) / TCP(dport=80, sport=12443), | ||
Ether(dst="00:11:22:33:44:55", src="00:00:00:00:00:02") / Dot1Q(vlan=200) / IPv6(dst="2002:dead:beef::3", src="2002::2", hlim=64) / TCP(dport=80, sport=12443) | ||
) | ||
|
||
write_pcap("005-expect.pcap", | ||
Ether(dst="00:00:00:00:00:01", src="00:11:22:33:44:55") / Dot1Q(vlan=100) / IPv6(dst="2000::2", src="2001:dead:beef:1234:5600:0000:0100:0001", hlim=63) / IPv6(dst="2002:dead:beef::3", src="2002::1", hlim=64) / TCP(dport=80, sport=12443), | ||
Ether(dst="00:00:00:00:00:01", src="00:11:22:33:44:55") / Dot1Q(vlan=100) / IPv6(dst="2000::2", src="2001:dead:beef:1234:5600:0000:0200:0001", hlim=63) / IPv6(dst="2002:dead:beef::3", src="2002::2", hlim=64) / TCP(dport=80, sport=12443) | ||
) | ||
|
||
write_pcap("006-send.pcap", | ||
Ether(dst="00:11:22:33:44:55", src="00:00:00:00:00:02") / Dot1Q(vlan=200) / IPv6(dst="2003:dead:beef::3", src="2002::1", hlim=64) / TCP(dport=80, sport=12443), | ||
Ether(dst="00:11:22:33:44:55", src="00:00:00:00:00:02") / Dot1Q(vlan=200) / IPv6(dst="2003:dead:beef::3", src="2002::2", hlim=64) / TCP(dport=80, sport=12443) | ||
) | ||
|
||
write_pcap("006-expect.pcap", | ||
Ether(dst="00:00:00:00:00:01", src="00:11:22:33:44:55") / Dot1Q(vlan=100) / IPv6(dst="2000::2", src="2001:dead:beef:1234:5600::", hlim=63) / IPv6(dst="2003:dead:beef::3", src="2002::1", hlim=64) / TCP(dport=80, sport=12443), | ||
Ether(dst="00:00:00:00:00:01", src="00:11:22:33:44:55") / Dot1Q(vlan=100) / IPv6(dst="2000::2", src="2001:dead:beef:1234:5600::", hlim=63) / IPv6(dst="2003:dead:beef::3", src="2002::2", hlim=64) / TCP(dport=80, sport=12443) | ||
) | ||
|
||
write_pcap("007-send.pcap", | ||
Ether(dst="00:11:22:33:44:55", src="00:00:00:00:00:02") / Dot1Q(vlan=200) / IPv6(dst="2004:dead:beef::3", src="2002::1", hlim=64) / TCP(dport=80, sport=12443), | ||
Ether(dst="00:11:22:33:44:55", src="00:00:00:00:00:02") / Dot1Q(vlan=200) / IPv6(dst="2004:dead:beef::3", src="2002::2", hlim=64) / TCP(dport=80, sport=12443) | ||
) | ||
|
||
write_pcap("007-expect.pcap", | ||
Ether(dst="00:00:00:00:00:01", src="00:11:22:33:44:55") / Dot1Q(vlan=100) / IPv6(dst="2000::2", src="2001:dead:beef:1234:5600::", hlim=63) / IPv6(dst="2004:dead:beef::3", src="2002::1", hlim=64) / TCP(dport=80, sport=12443), | ||
Ether(dst="00:00:00:00:00:01", src="00:11:22:33:44:55") / Dot1Q(vlan=100) / IPv6(dst="2000::2", src="2001:dead:beef:1234:5600::", hlim=63) / IPv6(dst="2004:dead:beef::3", src="2002::2", hlim=64) / TCP(dport=80, sport=12443) | ||
) | ||
|
||
write_pcap("008-send.pcap", | ||
Ether(dst="00:11:22:33:44:55", src="00:00:00:00:00:02") / Dot1Q(vlan=200) / IPv6(dst="2005:dead:beef::3", src="2002::1", hlim=64) / TCP(dport=80, sport=12443), | ||
Ether(dst="00:11:22:33:44:55", src="00:00:00:00:00:02") / Dot1Q(vlan=200) / IPv6(dst="2005:dead:beef::3", src="2002::2", hlim=64) / TCP(dport=80, sport=12443) | ||
) | ||
|
||
write_pcap("008-expect.pcap", | ||
Ether(dst="00:00:00:00:00:01", src="00:11:22:33:44:55") / Dot1Q(vlan=100) / IPv6(dst="2000::2", src="2001:dead:beef:1234:5600::", hlim=63) / IPv6(dst="2005:dead:beef::3", src="2002::1", hlim=64) / TCP(dport=80, sport=12443), | ||
Ether(dst="00:00:00:00:00:01", src="00:11:22:33:44:55") / Dot1Q(vlan=100) / IPv6(dst="2000::2", src="2001:dead:beef:1234:5600::", hlim=63) / IPv6(dst="2005:dead:beef::3", src="2002::2", hlim=64) / TCP(dport=80, sport=12443) | ||
) | ||
|
||
write_pcap("009-send.pcap", | ||
Ether(dst="00:11:22:33:44:55", src="00:00:00:00:00:02") / Dot1Q(vlan=200) / IPv6(dst="2006:dead:beef::3", src="2002::1234:0:0:1", hlim=64) / TCP(dport=80, sport=12443), | ||
Ether(dst="00:11:22:33:44:55", src="00:00:00:00:00:02") / Dot1Q(vlan=200) / IPv6(dst="2006:dead:beef::3", src="2002::1234:0:0:2", hlim=64) / TCP(dport=80, sport=12443) | ||
) | ||
|
||
write_pcap("009-expect.pcap", | ||
Ether(dst="00:00:00:00:00:01", src="00:11:22:33:44:55") / Dot1Q(vlan=100) / IPv6(dst="2000::2", src="2001:dead:beef:1234:5600::0012:3400", hlim=63) / IPv6(dst="2006:dead:beef::3", src="2002::1234:0:0:1", hlim=64) / TCP(dport=80, sport=12443), | ||
Ether(dst="00:00:00:00:00:01", src="00:11:22:33:44:55") / Dot1Q(vlan=100) / IPv6(dst="2000::2", src="2001:dead:beef:1234:5600::0012:3400", hlim=63) / IPv6(dst="2006:dead:beef::3", src="2002::1234:0:0:2", hlim=64) / TCP(dport=80, sport=12443) | ||
) | ||
|
||
write_pcap("010-send.pcap", | ||
Ether(dst="00:11:22:33:44:55", src="00:00:00:00:00:02") / Dot1Q(vlan=200) / IPv6(dst="2007:dead:beef::3", src="2002::1234:0:0:1", hlim=64) / TCP(dport=80, sport=12443), | ||
Ether(dst="00:11:22:33:44:55", src="00:00:00:00:00:02") / Dot1Q(vlan=200) / IPv6(dst="2007:dead:beef::3", src="2002::1234:0:0:2", hlim=64) / TCP(dport=80, sport=12443) | ||
) | ||
|
||
write_pcap("010-expect.pcap", | ||
Ether(dst="00:00:00:00:00:01", src="00:11:22:33:44:55") / Dot1Q(vlan=100) / IPv6(dst="2000::2", src="2001:dead:beef:1234:5600::1234:0001", hlim=63) / IPv6(dst="2007:dead:beef::3", src="2002::1234:0:0:1", hlim=64) / TCP(dport=80, sport=12443), | ||
Ether(dst="00:00:00:00:00:01", src="00:11:22:33:44:55") / Dot1Q(vlan=100) / IPv6(dst="2000::2", src="2001:dead:beef:1234:5600::1234:0002", hlim=63) / IPv6(dst="2007:dead:beef::3", src="2002::1234:0:0:2", hlim=64) / TCP(dport=80, sport=12443) | ||
) | ||
|
||
write_pcap("011-send.pcap", | ||
Ether(dst="00:11:22:33:44:55", src="00:00:00:00:00:02") / Dot1Q(vlan=200) / IPv6(dst="2008:dead:beef::3", src="2002::1234:0:0:1", hlim=64) / TCP(dport=80, sport=12443), | ||
Ether(dst="00:11:22:33:44:55", src="00:00:00:00:00:02") / Dot1Q(vlan=200) / IPv6(dst="2008:dead:beef::3", src="2002::1234:0:0:2", hlim=64) / TCP(dport=80, sport=12443) | ||
) | ||
|
||
write_pcap("011-expect.pcap", | ||
Ether(dst="00:00:00:00:00:01", src="00:11:22:33:44:55") / Dot1Q(vlan=100) / IPv6(dst="2000::2", src="2001:dead:beef:1234:5600:1234:1:1", hlim=63) / IPv6(dst="2008:dead:beef::3", src="2002::1234:0:0:1", hlim=64) / TCP(dport=80, sport=12443), | ||
Ether(dst="00:00:00:00:00:01", src="00:11:22:33:44:55") / Dot1Q(vlan=100) / IPv6(dst="2000::2", src="2001:dead:beef:1234:5600:1234:2:1", hlim=63) / IPv6(dst="2008:dead:beef::3", src="2002::1234:0:0:2", hlim=64) / TCP(dport=80, sport=12443) | ||
) |
Oops, something went wrong.