diff --git a/doc/manual/source/test-framework.rst b/doc/manual/source/test-framework.rst index 8d5b73a8d..722eadab2 100644 --- a/doc/manual/source/test-framework.rst +++ b/doc/manual/source/test-framework.rst @@ -485,17 +485,18 @@ System Tests ++++++++++++ System tests are those that involve more than one module in the system. We -have lots of this kind of test running in our current regression framework, +have some of this kind of test running in our current regression framework, but they are typically overloaded examples. We provide a new place for this kind of test in the directory ``src/test``. The file -src/test/ns3tcp/ns3-interop-test-suite.cc is an example of this kind of +``src/test/ns3tcp/ns3tcp-loss-test-suite.cc`` is an example of this kind of test. It uses NSC TCP to test the |ns3| TCP implementation. Often there will be test vectors required for this kind of test, and they are stored in the directory where the test lives. For example, -ns3tcp-interop-response-vectors.pcap is a file consisting of a number of TCP -headers that are used as the expected responses of the |ns3| TCP under test -to a stimulus generated by the NSC TCP which is used as a ''known good'' -implementation. +``ns3tcp-loss-NewReno0-response-vectors.pcap`` is a file consisting of a number of TCP +headers that are used as the expected responses of the |ns3| TCP under test. + +Note that Unit Tests are often preferrable to System Tests, as they are more +independent from small changes in the modules that are not the goal of the test. Examples ++++++++ diff --git a/doc/tutorial/source/getting-started.rst b/doc/tutorial/source/getting-started.rst index 1e0d8c3e3..09d406a1c 100644 --- a/doc/tutorial/source/getting-started.rst +++ b/doc/tutorial/source/getting-started.rst @@ -591,7 +591,6 @@ output that looks similar to the following:: Checking for header net/ethernet.h : yes Checking for header linux/if_tun.h : yes Checking for header netpacket/packet.h : yes - Checking for NSC location : not found Checking for 'sqlite3' : not found Checking for header linux/if_tun.h : yes Checking for python module 'gi' : 3.26.1 @@ -625,7 +624,6 @@ output that looks similar to the following:: MPI Support : not enabled (option --enable-mpi not selected) NS-3 Click Integration : not enabled (nsclick not enabled (see option --with-nsclick)) NS-3 OpenFlow Integration : not enabled (Required boost libraries not found) - Network Simulation Cradle : not enabled (NSC not found (see option --with-nsc)) PlanetLab FdNetDevice : not enabled (PlanetLab operating system not detected (see option --force-planetlab)) PyViz visualizer : enabled Python API Scanning Support : not enabled (Missing 'pygccxml' Python module) diff --git a/src/internet/helper/internet-stack-helper.cc b/src/internet/helper/internet-stack-helper.cc index 6d85d58a6..ff745df5d 100644 --- a/src/internet/helper/internet-stack-helper.cc +++ b/src/internet/helper/internet-stack-helper.cc @@ -257,13 +257,6 @@ InternetStackHelper::SetTcp (const std::string tid) m_tcpFactory.SetTypeId (tid); } -void -InternetStackHelper::SetTcp (std::string tid, std::string n0, const AttributeValue &v0) -{ - m_tcpFactory.SetTypeId (tid); - m_tcpFactory.Set (n0,v0); -} - void InternetStackHelper::Install (NodeContainer c) const { diff --git a/src/internet/helper/internet-stack-helper.h b/src/internet/helper/internet-stack-helper.h index 3231cc5e0..fd13ad61d 100644 --- a/src/internet/helper/internet-stack-helper.h +++ b/src/internet/helper/internet-stack-helper.h @@ -185,20 +185,6 @@ public: */ void SetTcp (std::string tid); - /** - * \brief This function is used to setup the Network Simulation Cradle stack with library value. - * - * Give the NSC stack a shared library file name to use when creating the - * stack implementation. The attr string is actually the attribute name to - * be setup and val is its value. The attribute is the stack implementation - * to be used and the value is the shared library name. - * - * \param tid The type id, for the case of nsc it would be "ns3::NscTcpL4Protocol" - * \param attr The attribute name that must be setup, for example "Library" - * \param val The attribute value, which will be in fact the shared library name (example:"liblinux2.6.26.so") - */ - void SetTcp (std::string tid, std::string attr, const AttributeValue &val); - /** * \brief Enable/disable IPv4 stack install. * \param enable enable state diff --git a/src/internet/model/sim_errno.h b/src/internet/model/sim_errno.h deleted file mode 100644 index 22f3a19a4..000000000 --- a/src/internet/model/sim_errno.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/* - * Copyright (c) 2008 INRIA - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation; - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Author: Mathieu Lacage - */ - -#ifndef NSC_SIM_ERRNO_H -#define NSC_SIM_ERRNO_H - -/** - * \ingroup nsctcp - * - * List of network stack errors that may happen in a simulation, - * and can be handled by the simulator in a sane way. - * - * Note that NSC handles several errors internally though - * nsc_assert, BUG() and friends, because they (should) never - * happen in a simulation (e.g. ESOCKTNOSUPPORT). - * - * These values are returned by the various methods provided by nsc. - * They must always be < 0, as values >= 0 are a success indicator; - * e.g. send_data() will return the number of bytes sent or one of - * the nsc_errno numbers below, accept() will return 0 on success or - * one of the nsc_errno numbers below, etc. - * - */ -enum nsc_errno { - NSC_EUNKNOWN = -1, - NSC_EADDRINUSE = -10, - NSC_EADDRNOTAVAIL = -11, - NSC_EAGAIN = -12, - NSC_EALREADY = -25, - NSC_ECONNREFUSED = -32, - NSC_ECONNRESET = -33, - NSC_EHOSTDOWN = -50, - NSC_EHOSTUNREACH = -51, - NSC_EINPROGRESS = -60, - NSC_EISCONN = -61, - NSC_EMSGSIZE = -70, - NSC_ENETUNREACH = -82, - NSC_ENOTCONN = -86, - NSC_ENOTDIR = -87, // used by sysctl(2) - NSC_ESHUTDOWN = -130, - NSC_ETIMEDOUT = -140, -}; - -#endif /* NSC_SIM_ERRNO_H */ diff --git a/src/internet/model/sim_interface.h b/src/internet/model/sim_interface.h deleted file mode 100644 index bae6117c2..000000000 --- a/src/internet/model/sim_interface.h +++ /dev/null @@ -1,436 +0,0 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/* - Network Simulation Cradle - Copyright (C) 2003-2005 Sam Jansen - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the Free - Software Foundation; either version 2 of the License, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., 59 - Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef NSC_SIM_INTERFACE_H -#define NSC_SIM_INTERFACE_H - -#define NSC_VERSION 0x000500 - -/** - * \ingroup nsctcp - * \brief Struct interface to NSC stack - */ -struct INetStack -{ - virtual ~INetStack() {} - - /** - * \brief Initialize the stack - * \param hz timer_interrupt frequency - */ - virtual void init (int hz) = 0; - - /** - * \brief Deliver complete packet to the NSC network stack - * \param if_id interface ID - * \param data data - * \param datalen data length - */ - virtual void if_receive_packet (int if_id, const void *data, int datalen) = 0; - /** - * \brief Send complete packet to the NSC network stack - * \param data data - * \param datalen data length - */ - virtual void if_send_packet (const void *data, int datalen) = 0; - /** - * \brief Signal the completion of send procedure to the NSC network stack - * \param if_id interface ID - */ - virtual void if_send_finish (int if_id) = 0; - - /** - * \brief Attach an interface to the stack - * \param addr address - * \param mask network mask - * \param mtu MTU - */ - virtual void if_attach (const char *addr, const char *mask, int mtu) = 0; - /** - * \brief Add a default gateway to the interface - * \param addr gateway address - */ - virtual void add_default_gateway (const char *addr) = 0; - - /** - * \brief Returns the internal id of the stack instance. - * - * Purely for debugging/diagnostic purposes. - * \return internal stack id - */ - virtual int get_id () = 0; - - /** - * \brief Return a short one-word name of the stack - * - * Should return a short one-word name of the stack. Eg. Linux 2.4.x -> - * linux24, FreeBSD 5.x -> freebsd5. This can be used to identify output - * from a stack, for example a packet trace file. - * \return short one-word name of the stack - */ - virtual const char *get_name () = 0; - - /** - * \brief Get the timer_interrupt frequency - * - * This is used so the simulator can call the stack timer_interrupt function - * the correct amount of times per second. For example, lwip has a hz of 10, - * which it returns here to say that it's timer_interrupt should be called - * 10 times a second. FreeBSD uses 100, as does Linux 2.4, while Linux 2.6 - * uses 1000. (This is often configurable in the kernel in question, also.) - * - * \return frequency - */ - virtual int get_hz () = 0; - - /** - * \brief The stack timer_interrupt function - */ - virtual void timer_interrupt () = 0; - - /** - * \brief Increment the time ticks - */ - virtual void increment_ticks () = 0; - - /** - * \brief Set the buffer size - * \param size the buffer size. - */ - virtual void buffer_size (int size) = 0; - - /** - * \brief Create a new UDP socket - * \returns A new UDP socket. - */ - virtual struct INetDatagramSocket *new_udp_socket () { return NULL; } - /** - * \brief Create a new TCP socket - * \returns A new TCP socket. - */ - virtual struct INetStreamSocket *new_tcp_socket () { return NULL; } - /** - * \brief Create a new SCTP socket - * \returns A new SCTP socket. - */ - virtual struct INetStreamSocket *new_sctp_socket () { return NULL; } - - // The following I've made optional to implement for now. Eases - // integration of new features. - /** - * \brief use sysctl to modify system parameters - * \param sysctl_name name of the parameter to modify - * \param oldval old value - * \param oldlenp old value length - * \param newval new value - * \param newlen new value length - * \returns The status code. - */ - virtual int sysctl (const char *sysctl_name, void *oldval, size_t *oldlenp, - void *newval, size_t newlen) - { - return -1; - } - - // alternate, simpler interface. the stack cradle code is expected - // to convert the string-value to something that the stack can handle. - // The idea here is that this is a front-end to the sysctl(2) call, - // much like the sysctl(8) program. - /** - * \brief Set system parameters using sysctl - * \param name name of the parameter to modify - * \param value new value - * \returns - */ - virtual int sysctl_set (const char *name, const char *value) - { - return -1; - } - - // same as above, cradle code is expected to convert the sysctl value - // into a string. - // returns length of the string in value, i.e. retval > len: 'output truncated'. - /** - * \brief Get system parameters using sysctl - * \param name name of the parameter to modify - * \param value value - * \param len value length - * \returns length of the string in value, i.e. retval > len: 'output truncated'. - */ - virtual int sysctl_get (const char *name, char *value, size_t len) - { - return -1; - } - - /** - * \brief Tell the cradle code to put the name of sysctl number 'idx' into name[]. - * - * The idea is that this can be used to get a list of all available sysctls: - * \verbatim - char buf[256] - for (i=0; sysctl_getnum(i, buf, sizeof(buf)) > 0 ;i++) - puts(buf); - \endverbatim - * - * \param idx index - * \param name sysctl name - * \param len sysctl length - * \returns -1 if idx is out of range and the length of the sysctl name otherwise. - */ - virtual int sysctl_getnum (size_t idx, char *name, size_t len) - { - return -1; - } - - /** - * \brief Show the NSC configuration - */ - virtual void show_config () - { - ; - } - - /** - * \brief Optional function to get variables for this stack - * \param var the variable - * \param result the result - * \param result_len result length - * \returns true on success - */ - virtual bool get_var (const char *var, char *result, int result_len) - { - return false; - } - - /** - * \brief Optional function to set variables for this stack - * \param var the variable - * \param val the new value - * \returns true on success - */ - virtual bool set_var (const char *var, const char *val) - { - return false; - } - - /** - * \brief Set the level of debugging or diagnostic information to print out. - * - * This normally means kernel messages printed out during initialisation but - * may also include extra debugging messages that are part of NSC. - * - * \param level debugging/diagnostic level - */ - virtual void set_diagnostic (int level) {} - - /** - * \brief Simple interface to support sending any textual command to a stack - * - * @returns 0 on success - */ - virtual int cmd (const char *) - { - return 1; - } -}; - -/** - * \ingroup nsctcp - * \brief Struct interface to NSC Stream (i.e., TCP) Sockets - */ -struct INetStreamSocket -{ - virtual ~INetStreamSocket() {} - - /** - * \brief Connect to a remote peer - */ - virtual void connect (const char *, int) = 0; - /** - * \brief Disconnect from a remote peer - */ - virtual void disconnect () = 0; - /** - * \brief Put the socket in Listening state on a port - */ - virtual void listen (int) = 0; - /** - * \brief Accept an incoming connection - * \param handler a handler to the INetStreamSocket. - * \returns The status code. - */ - virtual int accept (INetStreamSocket **handler) = 0; - /** - * \brief Send some data - * \param data the data - * \param datalen data length - * \return the number of data sent or -1 on error - */ - virtual int send_data (const void *data, int datalen) = 0; - /** - * \brief Read some data - * \param buf the buffer to store the data - * \param buflen buffer length - * \return the number of data read or -1 on error - */ - virtual int read_data (void *buf, int *buflen) = 0; - /** - * \brief Set the socket options - * - * We need to pass the option name in as a string here. The reason for - * this is that different operating systems you compile on will have - * different numbers defined for the constants SO_SNDBUF and so on. - * - * \param optname name of the option - * \param val option value - * \param valsize size of the option value - * \returns - */ - virtual int setsockopt (char *optname, void *val, size_t valsize) = 0; - /** - * \brief Print the socket state - */ - virtual void print_state (FILE *) = 0; - /** - * \brief Check the connection state - * \returns true if socket is in connected state - */ - virtual bool is_connected () = 0; - /** - * \brief Check the listening state - * \returns true if socket is in listening state - */ - virtual bool is_listening () = 0; - /** - * \brief Get the peer name - * - * \note not implemented - * - * \param sa sockaddr structure to fill - * \param salen sockaddr structure length - * \returns -1 on error (always returns -1) - */ - virtual int getpeername (struct sockaddr *sa, size_t *salen) { - return -1; - } - /** - * \brief Get the socket local name - * - * \note not implemented - * - * \param sa sockaddr structure to fill - * \param salen sockaddr structure length - * \returns -1 on error (always returns -1) - */ - virtual int getsockname (struct sockaddr *sa, size_t *salen) { - return -1; - } - /** - * \brief Optional function used to get variables for this TCP connection. - * - * \note not implemented - * - * \param var variable requested - * \param result result result - * \param result_len result length - * \return always false - */ - virtual bool get_var (const char *var, char *result, int result_len) - { - return false; - } - /** - * \brief Optional function used to set variables for this TCP connection. - * - * \note not implemented - * - * \param var variable to set - * \param val value to set - * \return always false - */ - virtual bool set_var (const char *var, const char *val) - { - return false; - } -}; - -/** - * \ingroup nsctcp - * \brief Struct interface to NSC Datagram (i.e., UDP) Sockets - */ -struct INetDatagramSocket -{ - virtual ~INetDatagramSocket() {} - - /** - * \brief Set the destination address and port - */ - virtual void set_destination (const char *, int) = 0; - /** - * \brief Send a datagram - * \param data the data - * \param datalen data length - */ - virtual void send_data (const void *data, int datalen) = 0; -}; - -/** - * \ingroup nsctcp - * \brief Struct interface to NSC send capabilities - */ -struct ISendCallback -{ - virtual ~ISendCallback() {} - - /** - * \brief Invoked by NSCs 'ethernet driver' to re-inject a packet into ns-3. - * \param data the data. - * \param datalen the data length. - */ - virtual void send_callback (const void *data, int datalen) = 0; -}; - -/** - * \ingroup nsctcp - * \brief Struct interface to NSC soft interrupt capabilities - */ -struct IInterruptCallback -{ - virtual ~IInterruptCallback() {} - - /** - * \brief Called by the NSC stack whenever something of interest has happened - */ - virtual void wakeup () = 0; - /** - * \brief Get the actual time - */ - virtual void gettime (unsigned int *, unsigned int *) = 0; -}; - -typedef int (*FRandom)(); -typedef INetStack *(*FCreateStack)(ISendCallback *, IInterruptCallback *, - FRandom); - -#define CREATE_STACK_FUNC(a,b,c) extern "C" INetStack *nsc_create_stack ( \ - ISendCallback *a, IInterruptCallback *b, FRandom c) - -#endif /* NSC_SIM_INTERFACE_H */