Testing the tcpdump module with network argument.

-- Testcase --
{% include("./cmd/cmd.uc", { TRACE_CALLS: "stdout" }) %}
-- End --

-- Environment --
cmd={ "command": "trace", "payload": { "network": "testnet" }}
-- End --

-- File fs/stat~_sys_class_net_br-testnet.json --
{}
-- End --

-- Expect stdout --
[call] ubusconn.call object <network.interface> method <status> args <{ "interface": "testnet" }>
[call] fs.stat path </sys/class/net/br-testnet>
[call] time
[call] system command <[ "tcpdump", "-c", 1000, "-W", "1", "-G", 30, "-w", "/tmp/pcap-001122334455-1615382640", "-i", "br-testnet" ]> timeout <null>
[call] ubusconn.call object <ucentral> method <upload> args <{ "file": "/tmp/pcap-001122334455-1615382640", "uri": null, "uuid": null }>
[call] ubusconn.call object <ucentral> method <result> args <{ "id": 0, "status": { /* 4 keys */ } }>
-- End --

-- Expect stderr --
Success
Uploading file
-- End --


Testing the tcpdump module with iface argument.

-- Testcase --
{% include("./cmd/cmd.uc", { TRACE_CALLS: "stdout" }) %}
-- End --

-- Environment --
cmd={ "command": "trace", "payload": { "iface": "eth2" }}
-- End --

-- File fs/stat~_sys_class_net_eth2.json --
{}
-- End --

-- Expect stdout --
[call] fs.stat path </sys/class/net/eth2>
[call] time
[call] system command <[ "tcpdump", "-c", 1000, "-W", "1", "-G", 30, "-w", "/tmp/pcap-001122334455-1615382640", "-i", "eth2" ]> timeout <null>
[call] ubusconn.call object <ucentral> method <upload> args <{ "file": "/tmp/pcap-001122334455-1615382640", "uri": null, "uuid": null }>
[call] ubusconn.call object <ucentral> method <result> args <{ "id": 0, "status": { /* 4 keys */ } }>
-- End --

-- Expect stderr --
Success
Uploading file
-- End --


Testing the tcpdump module with incomplete arguments.

-- Testcase --
{% include("./cmd/cmd.uc", { TRACE_CALLS: "stdout" }) %}
-- End --

-- Environment --
cmd={ "command": "trace", "payload": { } }
-- End --

-- Expect stdout --
[call] ubusconn.call object <ucentral> method <result> args <{ "id": 0, "status": { /* 4 keys */ } }>
-- End --

-- Expect stderr --
Failed
Invalid network device specified
-- End --
