Add Flows

This API enables the addition of flows to a test; it is relevant for Multi User mode only.

Note: We recommend not to add flows if transactions were run already in the test.

Custom mode

As in the Custom Start Emulation API, the body of the HTTP request holds a list of Flow parameters including: Flow ID, source IP/Range, destination IP/Range, latency, loss, bandwidth-in, bandwidth-out, capture client PL.

See Start Test: Custom Mode for more information.

Request

JSON

URL http://ip:port/shunra/api/emulation/flow/custom/{testToken}
HTTP Method PUT
HTTP Headers

Content-Type: application/json

Accept: application/json

Authorization: See Web Services Authentication.

Body
{
    "flows": [{
        "flowId": "my_flow",
        "srcIp": "1.1.1.1",
        "destIp": "2.2.2.2",
        "latency": 500,
        "packetloss": 20.0,
        "bandwidthIn": 2048.0,
        "bandwidthOut": 2048.0,
        "isCaptureClientPL": "true"
    }, {
        "flowId": "my_flow2",
        "srcIp": "1.1.2.2",
        "destIp": "2.1.1.1",
        "latency": 500,
        "packetloss": 10.0,
        "bandwidthIn": 2048.0,
        "bandwidthOut": 148.0,
        "isCaptureClientPL": "true"
    }]
}

XML

URL http://ip:port/shunra/api/emulation/flow/custom/{testToken}
HTTP Method PUT
HTTP Headers

Content-Type: application/xml

Accept: application/xml

Authorization: See Web Services Authentication.

Body
<emulationCustomRequest>
	<flows>
		<flowId>my_flow</flowId>
		<srcIp>1.1.1.1</srcIp>
		<destIp>2.2.2.2</destIp>
		<latency>500</latency>
		<packetloss>20</packetloss>
        	<bandwidthIn>2048</bandwidthIn>
        	<bandwidthOut>2048</bandwidthOut>
        	<isCaptureClientPL>true</isCaptureClientPL>
	</flows>	
	<flows>
		<flowId>my_flow2</flowId>
		<srcIp>1.1.2.2</srcIp>
		<destIp>2.1.1.1</destIp>
		<latency>500</latency>
      	 	<packetloss>20</packetloss>
        	<bandwidthIn>2048</bandwidthIn>
        	<bandwidthOut>148</bandwidthOut>
        	<isCaptureClientPL>true</isCaptureClientPL>
	</flows>
</emulationCustomRequest>

Request (Source IP in Range Format)

In order to pass IP Ranges, the request will contain the optional property "srcIpRange", with the list of excluded and included ranges. The previous srcIp property MUST be omitted.

This functionality can be applied on the Destination IP in the exact same way, under the property "destIpRange". Valid in Single User mode only.

JSON

URL http://ip:port/shunra/api/emulation/flow/custom/{testToken}
HTTP Method PUT
HTTP Headers

Content-Type: application/json

Accept: application/json

Authorization: See Web Services Authentication.

Body
{
"flows": [{
	"flowId": "flow33",
	"srcIpRange": {
		"include": [{
			"from": "1.1.1.1",
			"to": "7.7.7.7",
			"port": 5555,
			"protocol": 17
		}, {
			"from": "172.30.4.5",
			"to": "198.168.4.5",
			"port": 5555,
			"protocol": 17
		}],
		"exclude": [{
			"from": "1.2.3.4",
			"to": "1.3.4.5",
			"port": 5555,
			"protocol": 17
		}]
	},
	"destIpRange": {
		"exclude": [{
			"from": "1.1.1.1",
			"to": "7.7.7.7",
			"port": 5555,
			"protocol": 17
		}, {
			"from": "172.30.4.5",
			"to": "198.168.4.5",
			"port": 5555,
			"protocol": 17
		}],
		"include": [{
			"from": "1.2.3.4",
			"to": "1.3.4.5",
			"port": 5555,
			"protocol": 17
		}]
	},
	"latency": 500,
	"packetloss": 20.0,
	"bandwidthIn": 2048.0,
	"bandwidthOut": 2048.0,
	"isCaptureClientPL": "true"
	}]
}

XML

URL http://ip:port/shunra/api/emulation/flow/custom/{testToken}
HTTP Method PUT
HTTP Headers

Content-Type: application/xml

Accept: application/xml

Authorization: See Web Services Authentication.

Body
<emulationCustomRequest>
	<flows>
		<flowId>flow33</flowId>
		<srcIpRange>
			<include>
				<from>1.1.1.1</from>
				<to>7.7.7.7</to>
				<port>5555</port>
				<protocol>17</protocol>
			</include>
			<include>
				<from>172.30.4.5</from>
				<to>198.168.4.5</to>
				<port>5555</port>
				<protocol>17</protocol>
			</include>
			<exclude>
				<from>1.2.3.4</from>
				<to>1.3.4.5</to>
				<port>5555</port>
				<protocol>17</protocol>
			</exclude>
		</srcIpRange>
		<destIpRange>
			<exclude>
				<from>1.1.1.1</from>
				<to>7.7.7.7</to>
				<port>5555</port>
				<protocol>17</protocol>
			</exclude>
			<exclude>
				<from>172.30.4.5</from>
				<to>198.168.4.5</to>
				<port>5555</port>
				<protocol>17</protocol>
			</exclude>
			<include>
				<from>1.2.3.4</from>
				<to>1.3.4.5</to>
				<port>5555</port>
				<protocol>17</protocol>
			</include>
		</destIpRange>
		<latency>500</latency>
		<packetloss>20</packetloss>
		<bandwidthIn>2048</bandwidthIn>
		<bandwidthOut>2048</bandwidthOut>
		<isCaptureClientPL>true</isCaptureClientPL>
	</flows>
	</emulationCustomRequest>

Response

HTTP Response Code 204 - No content
HTTP Headers  
HTTP Body