Thursday 10 April 2014

PORT MAPPING - One change which does all

         The Web (HTTP/HTML) protocol is the most commonly used of LoadRunner’s vast range of protocols.  This protocol adds a dialog to the Virtual User Generator (VuGen) called the Port Mapping dialog, which allows you to perform some very important configurations.

This dialog was initially designed with one purpose : to allow special treatment of certain IP addresses and ports during the recording and  added more and more functionality to it.

Scenario 1: Recording all of an application’s HTTP activity

       This is the simplest scenario, and just uses the default settings of the Port Mapping dialog. No changes to the dialog are necessary.

p1.png

    Make sure the default Capture level (‘Socket level data’) is selected.  This is actually the default capture level that we’ll use in all of the scenarios in this article.

Scenario 2: Capturing all HTTP activity except messages sent to server 123.123.123.123

        This situation can arise when some network traffic is not part of the business process. For example, whenever Google’s Chrome browser is used, Google’s own servers are constantly updated about the user’s browsing patterns. To exclude this traffic, the Port Mapping dialog setting needs to include an entry for the appropriate server (in this case, 123.123.123.123), and this entry must be disabled.  Click on ‘New Entry’ in the dialog, and the following dialog will open:

p2.png

p3.png

Scenario 3: Capturing all HTTP activity except messages sent to a specific port on server 123.123.123.123

    You want to exclude HTTP traffic sent to port 80, but include other types of traffic, e.g. SSL (which is routed through port 443).

     Specify the port number to be excluded, in the ‘Port’ setting of the ‘Server Entry’ dialog.   The Port Mapping dialog should look like this:

p4.png

Scenario 4: Capturing traffic to server 123.123.123.123 on port 80 only, disregarding all other traffic

The dialog will include two entries:
  • A disabled entry for all servers
  • An enabled entry for 123.123.123.123:80
It should look like this:

p5.png

Scenario 5: In addition to the previous scenario, capturing SSL traffic to 123.123.123.124, on port 443

       Let’s say that the SSL version used there is SSL 3, and the SSL cipher is RC4-SHA.  Create a new server entry which specifies the SSL version and ciphers:


p6.png

The new entry is enabled in the Port Mappings dialog as follows:

p7.png

Scenario 6: Recording an application that uses TLS 1.0

      Open the Advanced Port Mapping Settings dialog by clicking the Options button in the Port Mapping dialog, and check ‘Enable auto-SSL detection’.  Set the SSL Version to TLS 1.x:


p8.png

Because the settings in the Advanced Port Mapping Settings dialog affect all addresses and ports, the list of servers is left empty:

p9.png

Scenario 7: Recording the traffic to 3 servers only: 123.123.123.123 (SSL 3 version), 123.123.123.124 (TLS 1.0 version), and 123.123.123.125 (plain HTTP), with all the servers listening on port 443

         The Port Mapping dialog should include four entries - a disabled entry for all servers, and a separate entry for each server, configured to listen on port 443 and the relevant SSL version for the server, as follows:


p10.png

Scenario 8: Recording SSL 3 traffic to the server at 123.123.123.123, when you have a client certificate (PEM) file and its password

There are two options to choose from:
  • Install the client certificate (client_cer.pem)  on your machine (in the local certificate keystore) and choose it from the list of available client certificates during the recording
  • Use the Port Mapping dialog and define the client certificate there
The first option is applicable when the certificate should be installed anyway, and will result in the script using the certificate during the replay.

The second option is used when the PEM file is not installed, but is available as a file on the local machine. In this case the script needs to read and use the file during recording and replay.  Create a new entry for the server at 123.123.123.123, and configure the location and password of the client certificate:


p11.png

Note that the dialog has a ‘Test SSL’ button which can be used to test the SSL connection with the certificate.

Scenario 9: Recording the scenario takes considerably more time than performing the scenario without recording

        If the application doesn’t use SSL, you can record all the traffic using the so-called ‘direct’ connection mode.  VuGen’s default connection mode is called a ‘proxy’ mode, and as its name suggests, it uses a proxy in order to capture the network traffic between the client and the server (not to be confused with Proxy Recording in LoadRunner!). When no SSL is used, the ‘proxy’ mode can be substituted by the ‘direct’ mode, which allows a direct connection between the client and the servers.  The ‘direct’ mode is much less time consuming than the ‘proxy’ mode.  In order to enable the ‘direct’ mode, create a new entry for all of the connections, and set the ‘Record Type’ to ‘Direct’:


p12.png

p13.png

No comments:

Post a Comment