|
Packit |
1422b7 |
# added 2015-04-13 by Rainer Gerhards
|
|
Packit |
1422b7 |
# This file is part of the liblognorm project, released under ASL 2.0
|
|
Packit |
1422b7 |
. $srcdir/exec.sh
|
|
Packit |
1422b7 |
|
|
Packit |
1422b7 |
test_def $0 "cisco-interface-spec syntax"
|
|
Packit |
1422b7 |
add_rule 'rule=:begin %field:cisco-interface-spec% end'
|
|
Packit |
1422b7 |
|
|
Packit |
1422b7 |
execute 'begin outside:176.97.252.102/50349 end'
|
|
Packit |
1422b7 |
assert_output_json_eq '{"field": { "interface": "outside", "ip": "176.97.252.102", "port": "50349" } }'
|
|
Packit |
1422b7 |
|
|
Packit |
1422b7 |
execute 'begin outside:176.97.252.102/50349(DOMAIN\rainer) end'
|
|
Packit |
1422b7 |
# we need to add the backslash escape for the testbench plumbing
|
|
Packit |
1422b7 |
assert_output_json_eq '{"field": { "interface": "outside", "ip": "176.97.252.102", "port": "50349", "user": "DOMAIN\\rainer" } }'
|
|
Packit |
1422b7 |
|
|
Packit |
1422b7 |
execute 'begin outside:176.97.252.102/50349(test/rainer) end'
|
|
Packit |
1422b7 |
# we need to add the backslash escape for the testbench plumbing
|
|
Packit |
1422b7 |
assert_output_json_eq '{"field": { "interface": "outside", "ip": "176.97.252.102", "port": "50349", "user": "test/rainer" } }'
|
|
Packit |
1422b7 |
|
|
Packit |
1422b7 |
execute 'begin outside:176.97.252.102/50349(rainer) end'
|
|
Packit |
1422b7 |
# we need to add the backslash escape for the testbench plumbing
|
|
Packit |
1422b7 |
assert_output_json_eq '{"field": { "interface": "outside", "ip": "176.97.252.102", "port": "50349", "user": "rainer" } }'
|
|
Packit |
1422b7 |
|
|
Packit |
1422b7 |
execute 'begin outside:192.168.1.13/50179 (192.168.1.13/50179)(LOCAL\some.user) end'
|
|
Packit |
1422b7 |
assert_output_json_eq ' { "field": { "interface": "outside", "ip": "192.168.1.13", "port": "50179", "ip2": "192.168.1.13", "port2": "50179", "user": "LOCAL\\some.user" } }'
|
|
Packit |
1422b7 |
|
|
Packit |
1422b7 |
execute 'begin outside:192.168.1.13/50179 (192.168.1.13/50179) (LOCAL\some.user) end'
|
|
Packit |
1422b7 |
assert_output_json_eq ' { "field": { "interface": "outside", "ip": "192.168.1.13", "port": "50179", "ip2": "192.168.1.13", "port2": "50179", "user": "LOCAL\\some.user" } }'
|
|
Packit |
1422b7 |
|
|
Packit |
1422b7 |
execute 'begin 192.168.1.13/50179 (192.168.1.13/50179) (LOCAL\without.if) end'
|
|
Packit |
1422b7 |
assert_output_json_eq ' { "field": { "ip": "192.168.1.13", "port": "50179", "ip2": "192.168.1.13", "port2": "50179", "user": "LOCAL\\without.if" } }'
|
|
Packit |
1422b7 |
|
|
Packit |
1422b7 |
#
|
|
Packit |
1422b7 |
# Test for things that MUST NOT match!
|
|
Packit |
1422b7 |
#
|
|
Packit |
1422b7 |
|
|
Packit |
1422b7 |
# the SP before the second IP is missing:
|
|
Packit |
1422b7 |
execute 'begin outside:192.168.1.13/50179(192.168.1.13/50179)(LOCAL\some.user) end'
|
|
Packit |
1422b7 |
# note: the expected result looks a bit strange. This is the case because we
|
|
Packit |
1422b7 |
# cannot (yet?) detect that "(192.168.1.13/50179)" is not a valid user name.
|
|
Packit |
1422b7 |
assert_output_json_eq '{ "originalmsg": "begin outside:192.168.1.13\/50179(192.168.1.13\/50179)(LOCAL\\some.user) end", "unparsed-data": "(LOCAL\\some.user) end" }'
|
|
Packit |
1422b7 |
|
|
Packit |
1422b7 |
|
|
Packit |
1422b7 |
cleanup_tmp_files
|
|
Packit |
1422b7 |
|