Answer by rmustakov · Aug 14, 2015 at 10:27 AM
As of Velocity 5.0, there is no public API to request resource discovery. This API will be added in future versions.
It is possible to automate discovery in a fashion similar to your approach - by making request to the endpoint used by Web UI. However, it is a fragile approach, as it basically means relying on implementation details which may (and will) change in the future.
Below are details on how to accomplish that. I will use `curl` in examples, but they can easily be mapped into iTest actions. Replace `velocity.example.com` as needed.
1. Log in and obtain `JSESSIONID` and `user_token`.
curl 'https://velocity.example.com/velocity/login.loginform' -H 'X-Requested-With: XMLHttpRequest' --data 'username=my_username&password=my_password&t%3Aformdata=RKIANTvJ3Ugm2L20c%2B7jeEPcZB0%3D%3AH4sIAAAAAAAAAJWQMUvDUBCAr0WlGJDa4uTiUNd0sYsudhGHoELQwe0luaRPkvee7y5NXFz9F%2F4CcXbv4OZ%2F8Ae4OjmYNBSHiOB08HHH93FPH7BeDGHb04lUh0KFM23nIs2RLBxrm7jCiHCGLguDxPZu4obaYiqDamZGK1RM7qmMIlSjC6tDJPLzIJNEUqvrh71hufuy0YWOB06oFVudnokMGQbejZiLcSpUMvbZSpUclYbBaQqu6oKiD1tNVk5oVXVWNU3%2BbAoEoTsNKihCPpGYRiMfOTf7lwvnfef1qxVyC%2FfQqcW9leNX6%2FS%2F1tYrFs%2FRQfz5%2BNYFKM2PwwiiQtuI6pC1KmMF2iv1Rq8YQL%2FBLDPUcUzIy1tg2KzR%2BRJ9A%2BMzFhzWAQAA&t%3Azoneid=loginZone&timeOffset=0'
Change `my_username` and `my_password` to actual username/password. Store `JSESSIONID` and `user_token` cookies, returned within `Set-Cookie` headers into variables. I will refer to them as ${sessionId} and ${token} in the next step.
2. Request resource discovery. Parameters here are: ${resourceId}, ${sessionId}, ${token}
curl 'https://velocity.example.com/velocity/inventory/resource.discoverybutton/${resourceId}?t:ac=${resourceId}' -H 'Cookie: JSESSIONID=${sessionId}; user_token=${token}' -H 'X-Requested-With: XMLHttpRequest' --data 't%3Azoneid=discoveryStartedZone'
The above steps could be executed via iTest using the REST session. Very cool. Thanks for the suggestion, and yes, this should only be a stop-gap solution as it is not via the documented API.
Is there a way (API) to get all the attributes of a header under streamblock ? 3 Answers
REST GET taking 9s in 4.3.0 and 2s in 4.1.3 1 Answer
Python API for Spirent Test center 2 Answers
Can I access the Abacus API via the serial port 2 Answers
Getting started with Spirent Test center automation using Java API 3 Answers
Copyright 2008- Spirent Communications, all rights reserved. Terms and Conditions.