Making Your Tests Portable

You should be able to run your test configurations, as defined, on any comparable platform. In order to make your tests truly portable, however, you need a method by which you can identify the IP addresses assigned to your nodes. dsTest accomplishes this with Local Aliases that relate either host names or physical interface aliases with IP addresses.

Developing and consistently using naming conventions are critical to successfully implementing your IP address aliases. Use alias names that clearly convey their intended use and/or role: v_ntwk_client_ip1, for example, indicates that a client node's source address will allow it to communicate with other nodes in the "visited" network, while dra_uplink and dra_downlink define DUT addresses for an MME and an HSS involved in DRA testing.

You will typically establish these types of aliases separately from your test configurations. You can either dynamically load aliases, run a set of tests, clear or overwrite those aliases, and then load new aliases for the next set of tests or you can load one set of aliases that are always available. You can accomplish the former through commands or by loading different alias configurations. To accomplish the latter, load your alias configurations when dsTest launches by using the -c option when you launch dsTest or by including that option in dsTest.conf if you run dsTest as a service.

Host Aliases: The Host Alias associates a host name used in your test with an IP address either via DNS or through the use of a hosts file. When the matching host name appears in your interface configuration (Destination Host Name in a Diameter configuration, for example), the IP address associated with that name will be used in your socket configuration as either the source or destination address depending on the context. This type of alias may only be used where the host name will be resolved to an address - not where the value will simply be used in a message.

Interface Aliases: When you need to define more than one interface on a node you can define an Interface Alias for each interface. In this case dsTest inspects the Local Interface elements in socket and connection configurations looking for values that match alias names.

Text Variables: Use string variables to define aliases for text values such as APN name or DNN name. When you use the alias, enclose the variable name in tildes (e.g. ~dnn_name~).

In both of the scenarios described above you could employ a hosts file (/etc/hosts) to resolve the IP addresses and use the host names from that file as the alias values. This solution completely removes hard-coded IP addresses from your configurations. Be aware, however, that this approach will not work if you use the count attribute to create multiple nodes. In that case dsTest must be able to increment the IP address for the second and subsequent nodes and it cannot increment a host name.

Example

The example below is from our lab where we have over 100 dsTest platforms, most of which are running automated tests around the clock. Tests are loaded on platforms as the platforms become available which means that a particular test may be executed on any platform that is suitable in terms of capacity. None of these tests utilize hard-coded IP addresses.

Assuming that we have the following entries in our hosts file:

10.128.46.1          test46_ifc0_ip0.dstest.net
10.128.46.2          test46_ifc0_ip1.dstest.net
10.128.47.3          test47_ifc0_ip2.dstest.net
10.128.47.4          test47_ifc0_ip3.dstest.net 

We can then configure the standard aliases used in our tests. Our automation tool uses the command method to establish aliases prior to loading a test, overwriting any aliases that were previously configured:

aliases interface:"client_ifc0_ip2" "test47_ifc0_ip2.dstest.net";true
aliases interface:"client_ifc0_ip3" "test47_ifc0_ip3.dstest.net";true
aliases host:"server_ifc0_ip0" "test46_ifc0_ip0.dstest.net";true
aliases host:"server_ifc1_ip0" "test46_ifc0_ip1.dstest.net";true

Finally, our tests are configured to reference the aliases. Note the difference between host alias and interface alias usage:

<nodes>
  <mme name="mme_1">
    <auto_start>true</auto_start>
      <s11>
        <user_data>
          <delay>100</delay>
          <verification>
            <dest_host>server_ifc1_ip0</dest_host>
            <timeout>2000</timeout>
            <size>32</size>
          </verification>
        </user_data>
      </s11>
      <gtp_interface>
        <version>2</version>
        <type>S11 MME GTP-C</type>
        <control_socket>
          <sport>2123</sport>
          <local_interface>client_ifc0_ip2</local_interface>
        </control_socket>
        <user_socket>
          <local_interface>client_ifc0_ip3</local_interface>
        </user_socket>
        <gtp name="gtp">
          <peer_host_name>server_ifc0_ip0</peer_host_name>
          <peer_port>2123</peer_port>
        </gtp>
      </gtp_interface>
      ...