Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Test deb #89

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,31 @@ jobs:
# todo


build-debian-packet:
needs: build-image-builder
runs-on: ubuntu-latest
container:
image: yanetplatform/builder
steps:
- uses: actions/checkout@v3
- run: |
meson setup --prefix=/target -Dstrip=true build
meson compile -C build
- run: meson install -C build
- uses: jiro4989/build-deb-action@v3
with:
package: yanet
package_root: /target
maintainer: taitov
version: 61.0
arch: amd64
desc: YANET is an open-source extensible framework for software forwarding traffic based on DPDK
- uses: actions/upload-artifact@v4
with:
name: build-debian-packet
path: |
./*.deb

build-unittest:
needs: build-image-builder
runs-on: ubuntu-latest
Expand Down
16 changes: 10 additions & 6 deletions autotest/autotest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1281,6 +1281,12 @@ void tAutotest::mainThread()

fflushSharedMemory();

/// clear dataplane states
{
dataPlane.balancer_state_clear();
dataPlane.neighbor_clear();
}

try
{
{
Expand All @@ -1289,7 +1295,6 @@ void tAutotest::mainThread()
common::icp::loadConfig::request request = prepareLoadConfig(configFilePath, "controlplane.conf");

controlPlane.rib_update({common::icp::rib_update::clear("autotest", std::nullopt)});
controlPlane.rib_flush();

const auto result = controlPlane.loadConfig(request);
if (result != eResult::success)
Expand All @@ -1298,9 +1303,13 @@ void tAutotest::mainThread()
throw "";
}

controlPlane.rib_flush();

this->request.swap(request);
}

dataPlane.neighbor_flush();

YAML::Node yamlRoot = YAML::LoadFile(configFilePath + "/autotest.yaml");

for (const YAML::Node& yamlStep : yamlRoot["steps"])
Expand Down Expand Up @@ -1464,11 +1473,6 @@ void tAutotest::mainThread()
std::abort();
}

/// clear dataplane states
{
dataPlane.balancer_state_clear();
}

YANET_LOG_PRINT(ANSI_COLOR_GREEN "done '%s'\n\n" ANSI_COLOR_RESET, configFilePath.data());
fflush(stdout);
fflush(stderr);
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ steps:
- ipv6Update: "::/0 -> fe80::1"
- ipv6LabelledUpdate:
- "cccc::/16 -> caca::123|210"
- "dddd::/16 -> fe80::1|211"
- "dddd::/16 -> cbcb::1|211"
- sendPackets:
- port: kni0
send: 001-send.pcap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@
"neighborMacAddress": "00:00:00:00:00:02",
"nextModule": "lp0.200"
}
}
},
"ignore_tables": [
"ipv4 mpls",
"ipv6 mpls"
]
}
}
}
71 changes: 36 additions & 35 deletions autotest/units/001_one_port/029_acl_dregress_decap/gen.py

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
52 changes: 52 additions & 0 deletions autotest/units/001_one_port/070_neighbor_resolve/autotest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
steps:
- ipv4Update: "0.0.0.0/0 -> 200.0.0.1"
- ipv6Update: "::/0 -> fe80::1"
- cli_check: |
YANET_FORMAT_COLUMNS=route_name,interface_name,ip_address,mac_address neighbor show
route_name interface_name ip_address mac_address
---------- -------------- ---------- -----------
- sendPackets:
- port: kni0
send: 001-send.pcap
expect: 001-expect.pcap
- sleep: 1
- sendPackets:
- port: kni0
send: 002-send.pcap
expect: 002-expect.pcap
- sendPackets:
- port: kni0
send: 003-send.pcap
expect: 003-expect.pcap
- sleep: 1
- sendPackets:
- port: kni0
send: 004-send.pcap
expect: 004-expect.pcap
- cli_check: |
YANET_FORMAT_COLUMNS=route_name,interface_name,ip_address,mac_address neighbor show
route_name interface_name ip_address mac_address
---------- -------------- ---------- -----------------
route0 kni0.100 200.0.0.1 2C:2C:3D:76:29:FD
route0 kni0.200 fe80::1 42:42:A4:59:BE:A5

- cli: neighbor insert route0 kni0.100 200.0.0.2 00:11:22:33:44:55
- sleep: 1

- cli_check: |
YANET_FORMAT_COLUMNS=route_name,interface_name,ip_address,mac_address neighbor show
route_name interface_name ip_address mac_address
---------- -------------- ---------- -----------------
route0 kni0.100 200.0.0.2 00:11:22:33:44:55
route0 kni0.100 200.0.0.1 2C:2C:3D:76:29:FD
route0 kni0.200 fe80::1 42:42:A4:59:BE:A5

- cli: neighbor remove route0 kni0.100 200.0.0.2
- sleep: 1

- cli_check: |
YANET_FORMAT_COLUMNS=route_name,interface_name,ip_address,mac_address neighbor show
route_name interface_name ip_address mac_address
---------- -------------- ---------- -----------------
route0 kni0.100 200.0.0.1 2C:2C:3D:76:29:FD
route0 kni0.200 fe80::1 42:42:A4:59:BE:A5
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"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": {
"neighborIPv4Address": "200.0.0.1",
"nextModule": "lp0.100"
},
"kni0.200": {
"neighborIPv6Address": "fe80::1",
"nextModule": "lp0.200"
}
}
}
}
}
51 changes: 51 additions & 0 deletions autotest/units/001_one_port/070_neighbor_resolve/gen.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/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)


# ipv4 (first packet. resolve mac)
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="4.4.4.4", src="10.0.0.1", ttl=64)/TCP(dport=2048, sport=8080))

write_pcap("001-expect.pcap")


# ipv4
write_pcap("002-send.pcap",
Ether(dst="00:00:00:11:11:11", src="00:00:DE:AD:00:00")/Dot1Q(vlan=100)/IP(dst="4.4.4.4", src="10.0.0.1", ttl=64)/TCP(dport=2048, sport=8080))

write_pcap("002-expect.pcap",
Ether(dst="2C:2C:3D:76:29:FD", src="00:00:00:11:11:11")/Dot1Q(vlan=100)/IP(dst="4.4.4.4", src="10.0.0.1", ttl=63)/TCP(dport=2048, sport=8080))


# ipv6 (first packet. resolve mac)
write_pcap("003-send.pcap",
Ether(dst="00:00:00:22:22:22", src="00:00:DE:AD:00:00")/Dot1Q(vlan=200)/IPv6(dst="2000:abcd:fefe:b0b0:c0c0:fea6:10.0.0.1", src="6464:6464:6464:6464:6464:6464:0404:0404", hlim=64)/TCP(dport=8080, sport=2048))

write_pcap("003-expect.pcap")


# ipv6
write_pcap("004-send.pcap",
Ether(dst="00:00:00:22:22:22", src="00:00:DE:AD:00:00")/Dot1Q(vlan=200)/IPv6(dst="2000:abcd:fefe:b0b0:c0c0:fea6:10.0.0.1", src="6464:6464:6464:6464:6464:6464:0404:0404", hlim=64)/TCP(dport=8080, sport=2048))

write_pcap("004-expect.pcap",
Ether(dst="42:42:A4:59:BE:A5", src="00:00:00:22:22:22")/Dot1Q(vlan=200)/IPv6(dst="2000:abcd:fefe:b0b0:c0c0:fea6:10.0.0.1", src="6464:6464:6464:6464:6464:6464:0404:0404", hlim=63)/TCP(dport=8080, sport=2048))
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
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"
}
}
}
}
}
Loading
Loading