-
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.
- Loading branch information
Sergei Tolmachev
committed
Jan 30, 2025
1 parent
9fccdf6
commit 61569ef
Showing
10 changed files
with
161 additions
and
1 deletion.
There are no files selected for viewing
Binary file added
BIN
+1.22 KB
autotest/units/001_one_port/080_balancer_pure_round_robin/001-expect.pcap
Binary file not shown.
Binary file added
BIN
+768 Bytes
autotest/units/001_one_port/080_balancer_pure_round_robin/001-send.pcap
Binary file not shown.
14 changes: 14 additions & 0 deletions
14
autotest/units/001_one_port/080_balancer_pure_round_robin/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,14 @@ | ||
steps: | ||
- ipv4Update: "0.0.0.0/0 -> 200.0.0.1" | ||
- ipv6Update: "::/0 -> fe80::1" | ||
- cli: | ||
- balancer real enable balancer0 10.0.0.3 udp 80 2000::1 80 | ||
- balancer real enable balancer0 10.0.0.3 udp 80 2000::2 80 | ||
- balancer real enable balancer0 10.0.0.3 udp 80 2000::3 80 | ||
- balancer real enable balancer0 10.0.0.3 udp 81 2000::1 81 | ||
- balancer real enable balancer0 10.0.0.3 udp 81 2000::2 81 | ||
- balancer real flush | ||
- sendPackets: | ||
- port: kni0 | ||
send: 001-send.pcap | ||
expect: 001-expect.pcap |
46 changes: 46 additions & 0 deletions
46
autotest/units/001_one_port/080_balancer_pure_round_robin/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,46 @@ | ||
{ | ||
"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", | ||
"services": "services.conf", | ||
"nextModule": "route0" | ||
}, | ||
"route0": { | ||
"type": "route", | ||
"interfaces": { | ||
"kni0.100": { | ||
"neighborIPv6Address": "fe80::1", | ||
"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" | ||
} | ||
} | ||
} | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
autotest/units/001_one_port/080_balancer_pure_round_robin/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,50 @@ | ||
#!/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.3", src="1.1.0.1", ttl=64)/UDP(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.3", src="1.1.0.1", ttl=64)/UDP(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.3", src="1.1.0.1", ttl=64)/UDP(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.3", src="1.1.0.1", ttl=64)/UDP(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.3", src="1.1.0.1", ttl=64)/UDP(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.3", src="1.1.0.1", ttl=64)/UDP(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.3", src="1.1.0.1", ttl=64)/UDP(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.3", src="1.1.0.1", ttl=64)/UDP(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.3", src="1.1.0.1", ttl=64)/UDP(dport=81, 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.3", src="1.1.0.1", ttl=64)/UDP(dport=81, 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.3", src="1.1.0.1", ttl=64)/UDP(dport=81, 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.3", src="1.1.0.1", ttl=64)/UDP(dport=81, 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::2", src="2000:51b::0101:0001:0:1", hlim=63, fl=0)/IP(dst="10.0.0.3", src="1.1.0.1", ttl=64)/UDP(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::3", src="2000:51b::0101:0001:0:1", hlim=63, fl=0)/IP(dst="10.0.0.3", src="1.1.0.1", ttl=64)/UDP(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="2000:51b::0101:0001:0:1", hlim=63, fl=0)/IP(dst="10.0.0.3", src="1.1.0.1", ttl=64)/UDP(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::2", src="2000:51b::0101:0001:0:1", hlim=63, fl=0)/IP(dst="10.0.0.3", src="1.1.0.1", ttl=64)/UDP(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::3", src="2000:51b::0101:0001:0:1", hlim=63, fl=0)/IP(dst="10.0.0.3", src="1.1.0.1", ttl=64)/UDP(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="2000:51b::0101:0001:0:1", hlim=63, fl=0)/IP(dst="10.0.0.3", src="1.1.0.1", ttl=64)/UDP(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::2", src="2000:51b::0101:0001:0:1", hlim=63, fl=0)/IP(dst="10.0.0.3", src="1.1.0.1", ttl=64)/UDP(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::3", src="2000:51b::0101:0001:0:1", hlim=63, fl=0)/IP(dst="10.0.0.3", src="1.1.0.1", ttl=64)/UDP(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="2000:51b::0101:0001:0:1", hlim=63, fl=0)/IP(dst="10.0.0.3", src="1.1.0.1", ttl=64)/UDP(dport=81, 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="2000:51b::0101:0001:0:1", hlim=63, fl=0)/IP(dst="10.0.0.3", src="1.1.0.1", ttl=64)/UDP(dport=81, 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="2000:51b::0101:0001:0:1", hlim=63, fl=0)/IP(dst="10.0.0.3", src="1.1.0.1", ttl=64)/UDP(dport=81, 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="2000:51b::0101:0001:0:1", hlim=63, fl=0)/IP(dst="10.0.0.3", src="1.1.0.1", ttl=64)/UDP(dport=81, sport=12380)) |
40 changes: 40 additions & 0 deletions
40
autotest/units/001_one_port/080_balancer_pure_round_robin/services.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,40 @@ | ||
[ | ||
{ | ||
"vip": "10.0.0.3", | ||
"proto": "udp", | ||
"vport": "80", | ||
"scheduler": "rr", | ||
"pure_round_robin": true, | ||
"ops": true, | ||
"reals": [ | ||
{ | ||
"ip": "2000::1", | ||
"port": "80" | ||
}, | ||
{ | ||
"ip": "2000::2", | ||
"port": "80" | ||
}, | ||
{ | ||
"ip": "2000::3", | ||
"port": "80" | ||
} | ||
] | ||
}, | ||
{ | ||
"vip": "10.0.0.3", | ||
"proto": "udp", | ||
"vport": "81", | ||
"scheduler": "rr", | ||
"reals": [ | ||
{ | ||
"ip": "2000::1", | ||
"port": "81" | ||
}, | ||
{ | ||
"ip": "2000::2", | ||
"port": "81" | ||
} | ||
] | ||
} | ||
] |
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
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
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
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