mirror of
https://github.com/akvorado/akvorado.git
synced 2025-12-12 06:24:10 +01:00
Resolve L4 ports protocol names (#1257)
* fix: generation of protocols.csv file * feat: generation of ports-tcp.csv and ports-udp.csv files * build: add rules for creating udp and tcp csv files * feat: create dictionary tcp and udp * refactor: add replaceRegexpOne * test: transform src port and dest port columns in SQL * test: add TCP and UDP dictionaries for migration testing
This commit is contained in:
@@ -105,6 +105,12 @@ func TestQueryColumnSQLSelect(t *testing.T) {
|
||||
Input: schema.ColumnTCPFlags,
|
||||
// Can be tested with "WITH 16 AS TCPFlags SELECT ..."
|
||||
Expected: `arrayStringConcat([if(bitTest(TCPFlags, 0) = 1, 'F', ''), if(bitTest(TCPFlags, 1) = 1, 'S', ''), if(bitTest(TCPFlags, 2) = 1, 'R', ''), if(bitTest(TCPFlags, 3) = 1, 'P', ''), if(bitTest(TCPFlags, 4) = 1, '.', ''), if(bitTest(TCPFlags, 5) = 1, 'U', ''), if(bitTest(TCPFlags, 6) = 1, 'E', ''), if(bitTest(TCPFlags, 7) = 1, 'C', ''), if(bitTest(TCPFlags, 8) = 1, 'N', '')], '')`,
|
||||
}, {
|
||||
Input: schema.ColumnDstPort,
|
||||
Expected: "replaceRegexpOne(multiIf(Proto==6, concat(toString(DstPort), '/', dictGetOrDefault('tcp', 'name', DstPort,'')), Proto==17, concat(toString(DstPort), '/', dictGetOrDefault('udp', 'name', DstPort,'')), toString(DstPort)), '/$', '')",
|
||||
}, {
|
||||
Input: schema.ColumnSrcPort,
|
||||
Expected: "replaceRegexpOne(multiIf(Proto==6, concat(toString(SrcPort), '/', dictGetOrDefault('tcp', 'name', SrcPort,'')), Proto==17, concat(toString(SrcPort), '/', dictGetOrDefault('udp', 'name', SrcPort,'')), toString(SrcPort)), '/$', '')",
|
||||
},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
|
||||
Reference in New Issue
Block a user