From 4ce14870e42de9b99d3112cebfc8a3b053de0564 Mon Sep 17 00:00:00 2001 From: Sapan Bhatia Date: Fri, 14 Mar 2008 21:14:46 +0000 Subject: [PATCH] Added test for planetflow 2. --- qaapi/qa/tests/node/pf2test.pl | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 qaapi/qa/tests/node/pf2test.pl diff --git a/qaapi/qa/tests/node/pf2test.pl b/qaapi/qa/tests/node/pf2test.pl new file mode 100644 index 0000000..4a8df91 --- /dev/null +++ b/qaapi/qa/tests/node/pf2test.pl @@ -0,0 +1,28 @@ +#!/usr/bin/perl + +print "Warning! This test runs only once. I.e., it will usually not run twice in succession till syslog sees some new activitt\n"; +print "Preparing..."; + +system("cp /var/log/messages /tmp/pf2_test"); + +# ping magic IP address +print "Sending out packet...\n"; +system("su -c \"ping -c 1 64.34.177.39\" pl_netflow -"); # hm. Sapan doesn't own this IP anymore. We should change it at some point. + +print "Waiting for flow to appear...\n"; +sleep(10); + +open PIP,"|/usr/bin/diff -u /tmp/pf2_test /var/log/messages"; + +while () { + if (/Received test flow to corewars.org from slice ([0-9]+)/) { + $xid = int($1); + print "Slice id: $xid"; + ($xid==0 || $xid==-1) && die("Slice id incorrect"); + } +} + +close PIP; + +print "Test successful."; + -- 2.45.2