src/olsr/test/tc-regression-test.h
author Josh Pelkey <jpelkey@gatech.edu>
Fri, 13 May 2011 14:58:13 -0400
changeset 7184 a15feb312428
parent 6852 8f1a53d3f6ca
child 7353 09fccf6195ea
permissions -rw-r--r--
olsr coding style changes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5763
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
     2
/*
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
     3
 * Copyright (c) 2009 IITP RAS
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
     4
 *
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
     8
 *
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    12
 * GNU General Public License for more details.
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    13
 *
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    17
 *
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    18
 * Authors: Pavel Boyko <boyko@iitp.ru>
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    19
 */
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    20
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    21
#ifndef TCREGRESSIONTEST_H_
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    22
#define TCREGRESSIONTEST_H_
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    23
#include "ns3/test.h"
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    24
#include "ns3/nstime.h"
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    25
#include "ns3/node-container.h"
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    26
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    27
namespace ns3
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    28
{
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    29
namespace olsr
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    30
{
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    31
/**
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    32
 * \ingroup olsr
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    33
 * \brief Less trivial test of OLSR Topology Control message generation
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    34
 * 
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    35
 * This test creates 3 WiFi stations with chain topology and runs OLSR without any extra traffic. 
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    36
 * It is expected that only second station will send TC messages.
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    37
 * 
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    38
 * Expected trace (20 seconds, note random b-cast jitter):
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    39
   \verbatim
7184
a15feb312428 olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6852
diff changeset
    40
         1       2       3
5763
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    41
         |<------|------>|              HELLO (empty) src = 10.1.1.2
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    42
         |       |<------|------>       HELLO (empty) src = 10.1.1.3
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    43
  <------|------>|       |              HELLO (empty) src = 10.1.1.1
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    44
  <------|------>|       |              HELLO (Link Type: Asymmetric, Neighbor: 10.1.1.2) src = 10.1.1.1
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    45
         |       |<------|------>       HELLO (Link Type: Asymmetric, Neighbor: 10.1.1.2) src = 10.1.1.3
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    46
         |<------|------>|              HELLO (Link Type: Asymmetric, Neighbor: 10.1.1.3; Link Type: Asymmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
7184
a15feb312428 olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6852
diff changeset
    47
         |<------|------>|              HELLO (Link Type: Asymmetric, Neighbor: 10.1.1.3; Link Type: Asymmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
5763
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    48
  <------|------>|       |              HELLO (Link Type: Symmetric, Neighbor: 10.1.1.2) src = 10.1.1.1
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    49
         |       |<------|------>       HELLO (Link Type: Symmetric, Neighbor: 10.1.1.2) src = 10.1.1.3
7184
a15feb312428 olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6852
diff changeset
    50
         |<------|------>|              HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
5763
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    51
  <------|------>|       |              HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.1
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    52
         |       |<------|------>       HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.3
7184
a15feb312428 olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6852
diff changeset
    53
         |<------|------>|              HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
5763
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    54
  <------|------>|       |              HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.1
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    55
         |       |<------|------>       HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.3
7184
a15feb312428 olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6852
diff changeset
    56
         |<======|======>|              TC (10.1.1.3; 10.1.1.1) + HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
5763
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    57
         |       |<------|------>       HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.3
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    58
  <------|------>|       |              HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.1
7184
a15feb312428 olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6852
diff changeset
    59
         |<------|------>|              HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
5763
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    60
  <------|------>|       |              HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.1
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    61
         |       |<------|------>       HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.3
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    62
  <------|------>|       |              HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.1
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    63
         |       |<------|------>       HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.3
7184
a15feb312428 olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6852
diff changeset
    64
         |<------|------>|              HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
a15feb312428 olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6852
diff changeset
    65
         |<======|======>|              TC (10.1.1.3; 10.1.1.1) src = 10.1.1.2
5763
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    66
         |       |<------|------>       HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.3
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    67
  <------|------>|       |              HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.1
7184
a15feb312428 olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6852
diff changeset
    68
         |<------|------>|              HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
5763
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    69
  <------|------>|       |              HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.1
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    70
         |       |<------|------>       HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.3
7184
a15feb312428 olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6852
diff changeset
    71
         |<------|------>|              HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
5763
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    72
   \endverbatim 
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    73
 */
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    74
class TcRegressionTest : public TestCase
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    75
{
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    76
public:
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    77
  TcRegressionTest(); 
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    78
  ~TcRegressionTest();
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    79
private:
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    80
  /// Unique PCAP files prefix for this test
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    81
  static const char * const PREFIX;
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    82
  /// Total simulation time
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    83
  const Time m_time;
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    84
  /// Distance between nodes in meters, 0.8 of RX range is recommended
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    85
  const double m_step;
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    86
  /// Create & configure test network
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    87
  void CreateNodes ();
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    88
  /// Compare traces with reference ones
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    89
  void CheckResults ();
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    90
  /// Go
6775
0783f42a364b Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents: 5763
diff changeset
    91
  void DoRun ();
5763
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    92
};
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    93
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    94
}
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    95
}
04848ede4d04 [olsr] Two basic trace based OLSR regression tests added together with reference traces
Pavel Boyko <boyko@iitp.ru>
parents:
diff changeset
    96
#endif /* TCREGRESSIONTEST_H_ */