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

Add more autotests #65

Merged
merged 7 commits into from
Oct 20, 2023
Merged
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ __pycache__
.settings/
.pydevproject
report/
.*
38 changes: 30 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,40 @@ You can build YANET in [docker](https://www.docker.com/) container and run it wi

Or build on bare metal. See [documentation](docs/build.md).
## Running Autotests
Pull docker image:
```
docker pull yanetplatform/builder
```

Add alias for run commands on docker:
```
alias yanet-builder="docker run --rm -it -v /run/yanet:/run/yanet -v $PWD:/project yanetplatform/builder"
```

Once setup `build_autotest` directory:
```
yanet-builder meson setup -Dtarget=autotest build_autotest
```

Compile:
```
yanet-builder meson compile -C build_autotest
```

Run autotest with all units in `autotest/units/001_one_port`:
```
yanet-builder ./autotest/yanet-autotest-run.py --prefix=build_autotest autotest/units/001_one_port
```
$ cd yanet
$ docker run --rm -it -v $PWD:/project yanetplatform/builder

# meson setup --prefix=/usr -Dtarget=autotest build_autotest
# meson compile -C build_autotest
# meson install -C build_autotest
# yanet-autotest-run.py autotest/units/001_one_port
or
# yanet-autotest-run.py autotest/units/001_one_port autotest/units/001_one_port/019_acl_decap_route
Or run one unit:
```
yanet-builder ./autotest/yanet-autotest-run.py --prefix=build_autotest autotest/units/001_one_port autotest/units/001_one_port/019_acl_decap_route
```

For more information about the autotests run:
```
yanet-builder ./autotest/yanet-autotest-run.py -h
```
## Dependencies
- [DPDK](https://github.com/DPDK/dpdk)
- [JSON](https://github.com/nlohmann/json)
Expand Down
5 changes: 5 additions & 0 deletions autotest/autotest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1441,6 +1441,11 @@ 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

This file was deleted.

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.
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,35 @@
steps:
- ipv4Update: "0.0.0.0/0 -> 200.0.0.1"
- ipv6Update: "::/0 -> fe80::1"
- 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
- sleep: 1
- sendPackets:
- port: kni0
send: 004-send.pcap
expect: 004-expect.pcap
- clearFWState: 1
- sendPackets:
- port: kni0
send: 005-send.pcap
expect: 005-expect.pcap
- sleep: 1
- sendPackets:
- port: kni0
send: 006-send.pcap
expect: 006-expect.pcap
- sendPackets:
- port: kni0
send: 007-send.pcap
expect: 007-expect.pcap
- clearFWState: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"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.2000": {
"type": "logicalPort",
"physicalPort": "kni0",
"vlanId": "2000",
"macAddress": "00:11:22:33:44:55",
"nextModule": "acl0"
},
"acl0": {
"type": "acl",
"firewall": "firewall.txt",
"synchronization": {
"ipv6SourceAddress": "fe80::f1",
"multicastIpv6Address": "ff02::1",
"multicastDestinationPort": 11995,
"logicalPorts": [
"lp0.2000"
],
"ingressNextModule": "vrf0"
},
"nextModules": [
"vrf0"
]
},
"vrf0": {
"type": "route",
"interfaces": {
"kni0.100": {
"ipv6Prefix": "fe80::2/64",
"neighborIPv6Address": "fe80::1",
"neighborMacAddress": "00:00:00:11:11:11",
"nextModule": "lp0.100"
},
"kni0.200": {
"ipv4Prefix": "200.0.0.2/24",
"neighborIPv4Address": "200.0.0.1",
"neighborMacAddress": "00:00:00:22:22:22",
"nextModule": "lp0.200"
},
"kni0.2000": {
"ipAddresses": ["ff02::2000"],
"neighborIPv6Address": "fe80::2000",
"neighborMacAddress": "00:00:00:33:33:33",
"nextModule": "lp0.2000"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
:BEGIN
add skipto :IN ip from any to any in

:IN
add allow ip from 13.0.0.0/24 to any keep-state
add allow ip from any to 2332:898:ff1c:2030::/64 keep-state
add allow tcp from 2332:898:ffee:0:0:5678::/ffff:ffff:ffff:0000:ffff:ffff:: to 2332:898:ffee:0:0:5678::/ffff:ffff:ffff:0000:ffff:ffff:: 10053 keep-state
add deny ip from any to any
Loading