CI: add PR workflow to check IPFIX element consistency with libfds #5
Workflow file for this run
This file contains hidden or 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
| name: checkIpfixElements | |
| on: | |
| pull_request: | |
| jobs: | |
| ipfix-elements-checks: | |
| runs-on: ubuntu-latest | |
| container: oraclelinux:9 | |
| steps: | |
| - name: Check out repository code | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| dnf install -y dnf-plugins-core epel-release cpp | |
| dnf copr enable @CESNET/NEMEA | |
| dnf install cesnet-ipfix-elements | |
| - name: Check IPFIX elements | |
| run: | | |
| cd include/ipfixprobe | |
| diff_output=$(comm -23 \ | |
| <(echo -e '#include "ipfix-elements.hpp"\n#define F(ENUMBER, EID, LENGTH, SOURCE) \ | |
| e ## ENUMBER ## id ## EID\n#define X(FIELD) FIELD(F),\nstart\nIPFIX_ENABLED_TEMPLATES(X)\n \ | |
| ' | cpp | sed -n '/^start/,$p;' | sed 's/start//; s/, \?/\n/g' | sort | uniq) \ | |
| <(/opt/libfds/bin/get-ipfix-elementlist-from-libfds.py /opt/libfds/system/elements/* | sort | uniq)) | |
| echo "$diff_output" | |
| - name: Check for missing elements | |
| run: | | |
| echo "$diff_output" | |
| if [ -n "$diff_output" ]; then | |
| echo "Missing IPFIX elements:" | |
| echo "$diff_output" | |
| exit 1 | |
| else | |
| echo "All IPFIX elements are present." | |
| fi |