Blob Blame History Raw
/* BEGIN_ICS_COPYRIGHT10 ****************************************

Copyright (c) 2015-2020, Intel Corporation
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
 are permitted provided that the following conditions are met: 
- Redistributions of source code must retain the above copyright notice,
  this list of conditions and the following disclaimer. 
- Redistributions in binary form must reproduce the above copyright notice,
  this list of conditions and the following disclaimer in the documentation
  and/or other materials provided with the distribution. 
- Neither the name of Intel Corporation nor the names of its contributors may
  be used to endorse or promote products derived from this software without
  specific prior written permission. 

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL INTEL, THE COPYRIGHT OWNER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF YOUR
JURISDICTION. It is licensee's responsibility to comply with any export
regulations applicable in licensee's jurisdiction. Under CURRENT (May 2000)
U.S. export regulations this software is eligible for export from the U.S.
and can be downloaded by or otherwise exported or reexported worldwide EXCEPT
to U.S. embargoed destinations which include Cuba, Iraq, Libya, North Korea,
Iran, Syria, Sudan, Afghanistan and any other country to which the U.S. has
embargoed goods and services.

** END_ICS_COPYRIGHT10  ****************************************/

/* [ICS VERSION STRING: unknown] */
MAI unit test using two process client server

Instructions for client.c and server.c sample programs.

COMPONENT BEING TESTED: Management API 

PURPOSE: The client.c sample program will send a MAD to a server 
		and wait for acknowledgement from the server.
	    The server.c sample program executes a loop which receives 
		a MAD based on filters that are specified by command line arguments.

CONFIGURATION:  System A (Linux machine) and system B (Linux machine).
   	   	 NOTE: These sample programs may be executed on the same machine. 
		 If executing the sample programs from the same machine and the "mclass" filter has been specified,
		 the server will receive its own acknowledgement. 

SETUP: Start the Subnet Manager (SM) on system A to initialize the fabric.

INSTRUCTIONS:

1. Execute server.c from system A:

	# ./server

    Syntax: server [ -d <ibdev> -p <ibport> -m <manager class> -s <sport> -n <sname> -h ]

    Where -d  specifies the IBA device to open (default = 0)
	-p  specifies the IBA port  on the device (default = 5)
	-r   specifies the how many times to execute loop (default = 1)
	-m specifies the manager class (default = 7)
	-f   specifies the filter to attach to handle
		1 - mclass filter
		2 - method filter for SEND_ONE
		3 - option filter for SEND_ONE, AID_ONE
	-t  specifies the how long to wait for message (msecs)
	-s  specifies the simulator IP port to use
	-n  specifies the simulator host machine name
	-?  displays help

2. Execute client.c from system B:

	#  ./client -l <slid>

    Syntax: client [ -d <ibdev> -p <ibport> -c <command> -m <manager class> -l <slid> -s <sport> -n <sname> -h ]

    Where	-d  specifies the IBA device to open (default = 0)
	-p  specifies the IBA port  on the device (default = 5)
	-m specifies the manager class (default = 7)
	-l   specifies the sender LID (slid); see SM output for SLID (default = 1)
	-r   specifies the receiver LID (dlid); see SM output for DLID (default = 1)
	-k   specifies the how many times to execute loop (default = 1)
	-c  specifies the method to use (default = SEND_ONE)
		1 - Send SEND_ONE.
		2 - Send GET_ONE.
	-a  specifies the AID to send (default = AID_ONE)
		1 - Send AID_ONE
		2 - Send AID_TWO
	-t   specifies the how long to wait for acknowledgement (msecs)
	-s  specifies the simulator IP port to use
	-n  specifies the simulator host machine name
	-?  displays help

NOTE: When running client from the same system as server, client parameters are optional; 
	i.e., the sender LID does not need to be specified.

3. Verify that the test was successful by referring to the output:

   server.c output will be similar to the following:

	Opened a handle: 0 
	Waiting for MADs
	SEND_ONE received
	AID_ONE received
	Loop 0: 
	Waiting for MADs
	SEND_ONE received
	AID_ONE received
	Loop 1: 
	Test successful!!

   client.c output will be similar to the following:

	MAD sent
	Waiting for acknowledgement
	Acknowledgement received
	Passed Loop 0
	MAD sent
	Waiting for acknowledgement
	Acknowledgement received
	Passed Loop 1

/*****************************************************************************/

OVERVIEW:

The client.c sample program performs the following actions:

1. Parses the command line arguments. 
2. Initializes the MAI subsystem.
3. Creates an MAI handle.
4. Initializes the MAD to be sent.
5. Creates a filter to listen for response.
6. Initiates a loop to send the MAD to receiver. The loop performs the following actions:
	- Gets a transaction ID for message we are about to send
     	- Assigns transaction ID to the MAD to be sent
	- Sends command to receiver
	- Gets acknowledgement
7. Deletes the filter.
8. Closes the MAI channel.

The server.c sample program performs the following actions:

1. Parse command line arguments. 
2. Initializes the MAI subsystem.
3. Opens a connection to listen for messages on the device and port that was passed in.
4. Creates the filters that will allow receipt of the commands on the handle.      
5. Initiates a loop to receive messages. The loop performs the following actions:
	- Determines what method was received.
	- Determines what AID was received.
	- Prepares to send acknowledgement.
	- Swizzles destination and source LID.
	- Sends acknowledgement MAD.
6. Deletes the filter.
7. Closes the MAI channel.