# # Create a new repository with a simple http test named tclsimplehttp.rxf # # # setup path and load IxLoad package # source "../setup_simple.tcl" # # Initialize IxLoad # # IxLoad connect should always be called, even for local scripts ::IxLoad connect $::IxLoadPrivate::SimpleSettings::remoteServer # once we've connected, make sure we disconnect, even if there's a problem if [catch { # # setup logger # set logtag "IxLoad-api" set logName "repnewsimplehttp" set logger [::IxLoad new ixLogger $logtag 1] set logEngine [$logger getEngine] $logEngine setLevels $::ixLogger(kLevelDebug) $::ixLogger(kLevelInfo) $logEngine setFile $logName 2 256 1 #----------------------------------------------------------------------- # Create the repository #----------------------------------------------------------------------- set repository [::IxLoad new ixRepository] #----------------------------------------------------------------------- # Get the repository chassis chain and add chassis to it #----------------------------------------------------------------------- set chassisChain [$repository cget -chassisChain] $chassisChain addChassis $::IxLoadPrivate::SimpleSettings::chassisName #----------------------------------------------------------------------- # Build client and server Network #----------------------------------------------------------------------- set clnt_network [$repository clientNetworkList.addItem \ -name "clnt_network" \ ] $clnt_network globalPlugins.clear set Filter [::IxLoad new ixNetFilterPlugin] # ixNet objects needs to be added in the list before they are configured! $clnt_network globalPlugins.appendItem -object $Filter $Filter config \ -name "Filter" set GratArp [::IxLoad new ixNetGratArpPlugin] # ixNet objects needs to be added in the list before they are configured! $clnt_network globalPlugins.appendItem -object $GratArp $GratArp config \ -enabled true \ -name "GratArp" set TCP [::IxLoad new ixNetTCPPlugin] # ixNet objects needs to be added in the list before they are configured! $clnt_network globalPlugins.appendItem -object $TCP $TCP config \ -tcp_tw_recycle true \ -tcp_keepalive_time 75 \ -tcp_keepalive_intvl 7200 \ -tcp_wmem_default 4096 \ -tcp_port_min 1024 \ -tcp_port_max 65535 \ -tcp_window_scaling false \ -name "TCP" \ -tcp_rmem_default 4096 set DNS [::IxLoad new ixNetDnsPlugin] # ixNet objects needs to be added in the list before they are configured! $clnt_network globalPlugins.appendItem -object $DNS $DNS config \ -name "DNS" $DNS hostList.clear $DNS searchList.clear $DNS nameServerList.clear set Settings [::IxLoad new ixNetIxLoadSettingsPlugin] # ixNet objects needs to be added in the list before they are configured! $clnt_network globalPlugins.appendItem -object $Settings $Settings config \ -name "Settings" set Ethernet__PHY_1 [$clnt_network getL1Plugin] set my_ixNetEthernetELMPlugin [::IxLoad new ixNetEthernetELMPlugin] $my_ixNetEthernetELMPlugin config $Ethernet__PHY_1 config \ -name "Ethernet /PHY-1" \ -cardElm $my_ixNetEthernetELMPlugin $Ethernet__PHY_1 childrenList.clear set MAC_VLAN_1 [::IxLoad new ixNetL2EthernetPlugin] # ixNet objects needs to be added in the list before they are configured! $Ethernet__PHY_1 childrenList.appendItem -object $MAC_VLAN_1 $MAC_VLAN_1 config \ -name "MAC/VLAN-1" $MAC_VLAN_1 childrenList.clear set IP_1 [::IxLoad new ixNetIpV4V6Plugin] # ixNet objects needs to be added in the list before they are configured! $MAC_VLAN_1 childrenList.appendItem -object $IP_1 $IP_1 config \ -name "IP-1" $IP_1 childrenList.clear $IP_1 extensionList.clear $MAC_VLAN_1 extensionList.clear $Ethernet__PHY_1 extensionList.clear ################################################# # Setting the ranges starting with the plugin on top of the stack ################################################# $IP_1 rangeList.clear set ip_1 [::IxLoad new ixNetIpV4V6Range] # ixNet objects needs to be added in the list before they are configured! $IP_1 rangeList.appendItem -object $ip_1 $ip_1 config \ -count 100 \ -name "ip-1" \ -gatewayAddress "0.0.0.0" \ -autoMacGeneration true \ -prefix 16 \ -mss 100 \ -ipAddress "198.18.2.1" set mac_1 [$ip_1 getLowerRelatedRange "MacRange"] $mac_1 config \ -count 100 \ -mac "00:C6:12:02:01:00" \ -name "mac-1" set vlan_1 [$ip_1 getLowerRelatedRange "VlanIdRange"] $vlan_1 config \ -name "vlan-1" \ -idIncrMode 1 \ -priority 0 \ -innerPriority 0 $clnt_network portList.appendItem \ -chassisId 1 \ -cardId $::IxLoadPrivate::SimpleSettings::clientPort(CARD_ID)\ -portId $::IxLoadPrivate::SimpleSettings::clientPort(PORT_ID) set svr_network [$repository serverNetworkList.addItem \ -name "svr_network" \ ] $svr_network globalPlugins.clear set Filter [::IxLoad new ixNetFilterPlugin] # ixNet objects needs to be added in the list before they are configured! $svr_network globalPlugins.appendItem -object $Filter $Filter config \ -name "Filter" set GratArp [::IxLoad new ixNetGratArpPlugin] # ixNet objects needs to be added in the list before they are configured! $svr_network globalPlugins.appendItem -object $GratArp $GratArp config \ -enabled true \ -name "GratArp" set TCP [::IxLoad new ixNetTCPPlugin] # ixNet objects needs to be added in the list before they are configured! $svr_network globalPlugins.appendItem -object $TCP $TCP config \ -tcp_tw_recycle true \ -tcp_keepalive_time 75 \ -tcp_keepalive_intvl 7200 \ -tcp_wmem_default 4096 \ -tcp_port_min 1024 \ -tcp_port_max 65535 \ -tcp_window_scaling false \ -name "TCP" \ -tcp_rmem_default 4096 set DNS [::IxLoad new ixNetDnsPlugin] # ixNet objects needs to be added in the list before they are configured! $svr_network globalPlugins.appendItem -object $DNS $DNS config \ -name "DNS" $DNS hostList.clear $DNS searchList.clear $DNS nameServerList.clear set Settings [::IxLoad new ixNetIxLoadSettingsPlugin] # ixNet objects needs to be added in the list before they are configured! $svr_network globalPlugins.appendItem -object $Settings $Settings config \ -name "Settings" set Ethernet__PHY_2 [$svr_network getL1Plugin] set my_ixNetEthernetELMPlugin [::IxLoad new ixNetEthernetELMPlugin] $my_ixNetEthernetELMPlugin config $Ethernet__PHY_2 config \ -name "Ethernet /PHY-2" \ -cardElm $my_ixNetEthernetELMPlugin $Ethernet__PHY_2 childrenList.clear set MAC_VLAN_2 [::IxLoad new ixNetL2EthernetPlugin] # ixNet objects needs to be added in the list before they are configured! $Ethernet__PHY_2 childrenList.appendItem -object $MAC_VLAN_2 $MAC_VLAN_2 config \ -name "MAC/VLAN-2" $MAC_VLAN_2 childrenList.clear set IP_2 [::IxLoad new ixNetIpV4V6Plugin] # ixNet objects needs to be added in the list before they are configured! $MAC_VLAN_2 childrenList.appendItem -object $IP_2 $IP_2 config \ -name "IP-2" $IP_2 childrenList.clear $IP_2 extensionList.clear $MAC_VLAN_2 extensionList.clear $Ethernet__PHY_2 extensionList.clear ################################################# # Setting the ranges starting with the plugin on top of the stack ################################################# $IP_2 rangeList.clear set ip_2 [::IxLoad new ixNetIpV4V6Range] # ixNet objects needs to be added in the list before they are configured! $IP_2 rangeList.appendItem -object $ip_2 $ip_2 config \ -name "ip-2" \ -gatewayAddress "0.0.0.0" \ -prefix 16 \ -mss 100 \ -ipAddress "198.18.200.1" set mac_2 [$ip_2 getLowerRelatedRange "MacRange"] $mac_2 config \ -mac "00:C6:12:02:02:00" \ -name "mac-2" set vlan_2 [$ip_2 getLowerRelatedRange "VlanIdRange"] $vlan_2 config \ -name "vlan-2" \ -idIncrMode 1 \ -priority 0 \ -innerPriority 0 $svr_network portList.appendItem \ -chassisId 1 \ -cardId $::IxLoadPrivate::SimpleSettings::serverPort(CARD_ID)\ -portId $::IxLoadPrivate::SimpleSettings::serverPort(PORT_ID) #----------------------------------------------------------------------- # Construct Client Traffic # The ActivityModel acts as a factory for creating agents which actually # generate the test traffic #----------------------------------------------------------------------- set clnt_traffic [$repository clientTrafficList.addItem -name "client_traffic"] $clnt_traffic agentList.appendItem \ -name "my_http_client" \ -protocol "HTTP" \ -type "Client" \ -maxSessions 3 \ -httpVersion $::HTTP_Client(kHttpVersion10) \ -keepAlive 0 \ -maxPersistentRequests 3 \ -followHttpRedirects 0 \ -enableCookieSupport 0 \ -enableHttpProxy 0 \ -enableHttpsProxy 0 \ -browserEmulation $::HTTP_Client(kBrowserTypeIE5) \ -enableSsl 0 # # Add actions to this client agent # foreach {pageObject destination} { "/4k.htm" "svr_traffic_my_http_server" "/8k.htm" "svr_traffic_my_http_server" } { $clnt_traffic agentList(0).actionList.appendItem \ -command "GET" \ -destination $destination \ -pageObject $pageObject } #----------------------------------------------------------------------- # Construct Server Traffic #----------------------------------------------------------------------- set svr_traffic [$repository serverTrafficList.addItem -name "svr_traffic"] $svr_traffic agentList.appendItem \ -name "my_http_server" \ -protocol "HTTP" \ -type "Server" \ -httpPort 80 for {set idx 0} {$idx < [$svr_traffic agentList(0).responseHeaderList.indexCount]} {incr idx} { set response [$svr_traffic agentList(0).responseHeaderList.getItem $idx] if {[$response cget -name] == "200_OK"} { set response200ok $response } if {[$response cget -name] == "404_PageNotFound"} { set response404_PageNotFound $response } } # # Clear pre-defined web pages, add new web pages # $svr_traffic agentList(0).webPageList.clear $svr_traffic agentList(0).webPageList.appendItem \ -page "/4k.html" \ -payloadType "range" \ -payloadSize "4096-4096" \ -response $response200ok $svr_traffic agentList(0).webPageList.appendItem \ -page "/8k.html" \ -payloadType "range" \ -payloadSize "8192-8192" \ -response $response404_PageNotFound #----------------------------------------------------------------------- # Create the test #----------------------------------------------------------------------- set test [$repository testList.addItem \ -name "my_test" \ -statsRequired 0 \ -enableResetPorts 0 \ ] # make it the active test (current when loaded into IxLoad) $repository config -activeTest "my_test" #----------------------------------------------------------------------- # Create a client and server mapping for the test and bind into the # network and traffic that they will be employing #----------------------------------------------------------------------- set clnt_t_n_mapping [$test clientCommunityList.appendItem \ -network $clnt_network \ -traffic $clnt_traffic \ -objectiveType $::ixObjective(kObjectiveTypeSimulatedUsers) \ -objectiveValue 20 \ -rampUpValue 5 \ -sustainTime 20 \ -rampDownTime 20 ] set svr_t_n_mapping [$test serverCommunityList.appendItem \ -network $svr_network \ -traffic $svr_traffic \ -matchClientTotalTime 1 ] $repository write -destination tclsimplehttp.rxf -overwrite 1 puts "tclsimplehttp.rxf created" #----------------------------------------------------------------------- # Cleanup #----------------------------------------------------------------------- ::IxLoad delete $repository #----------------------------------------------------------------------- # Disconnect #----------------------------------------------------------------------- }] { puts $errorInfo } # # Disconnect/Release application lock # ::IxLoad disconnect