cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1127
Views
0
Helpful
1
Replies

CSS command (socket) execution failed

ngorenko
Level 1
Level 1

I have a CSS reporting script problems when I am using build-in script ap-kal-httptag, here my exact command and CSS failure response:

script play ap-kal-httptag    "192.168.8.22 content/corp/main/en/group.html?noCache=true Sika"

brgsikalb01#

Error in script playback line:37

>>>socket waitfor ${SOCKET} "200 OK" 2000

brgsikalb01#

Script Playback cancelled.

Waitfor: Failed

The CSS build in script ap-kal-httptag failes during execution!

Failure is on line 37 which contains this command [   socket waitfor ${SOCKET} "200 OK" 2000    ]

CSS commits this failure string [  

    Error in script playback line:37

>>> socket waitfor ${SOCKET} "200 OK" 2000

]

Was there a command syntax change and Cisco forgot to reprogram the build-in scripts?

Here I copy the full script taken from CSS in question directly:

show script ap-kal-httptag

!no echo

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

! Filename: ap-kal-httptag

! Parameters: HostName WebPage HostTag

!

! Description:

This script will connect to the remote host and do an HTTP

!   GET method upon the web page that the user has asked for.

!   This script also adds a host tag to the GET request.

!

! Failure Upon:

!   1. Not establishing a connection with the host.

! 2. Not receiving an HTTP status "200 OK"

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

if ${ARGS}[#] "NEQ" "3"

echo "Usage: ap-kal-httptag \'Hostname WebPage HostTag\'"

exit script 1

endbranch

! Defines:

set HostName "${ARGS}[1]"

set WebPage "${ARGS}[2]"

set HostTag "${ARGS}[3]"

! Connect to the remote Host

set EXIT_MSG "Connection Failure"

socket connect host ${HostName} port 80 tcp 2000

! Send the GET request for the web page

set EXIT_MSG "Send: Failed"

socket send ${SOCKET} "GET ${WebPage} HTTP/1.0\nHost: ${HostTag}\n\n"

! Wait for a good status code

set EXIT_MSG "Waitfor: Failed"

socket waitfor ${SOCKET} "200 OK" 2000

no set EXIT_MSG

socket disconnect ${SOCKET}

exit script 0

I can not see any broken limitation on this command [ socket waitfor ${SOCKET} "200 OK" 2000   ]

Thanks for advise and / or correction

1 Reply 1

Gilles Dufour
Cisco Employee
Cisco Employee

The failure just means the server did not respond with an HTTP 200 OK response.

For example, it could be a 302 Redirect or a 404 Unauthorised.

Check with a sniffer trace what is the response from the server.

Gilles.

Review Cisco Networking for a $25 gift card