Show the next hop for a specific route
/rest/{version}/admin/test/lrt
Request
-
version(required):
REST API version string.
Available values: v1.2
-
lrtName(required):
Specifies the name of the local route table.
-
maxElements:
The maximum number of configuration element instances that is returned in a paged response. If there are not maxInstances element instances in the requested result set, then the response contains fewer instances than maxInstances. The maxElements range is between 1 and 100.
-
offset:
When requesting multiple instances of a configuration element type that supports paging and a subset of all configured element instances is desired, offset must be supplied and specifies, using a 1-based index, the first instance that is returned in the response.
-
user(required):
Specifies the name of the user within the local route table.
-
Authorization(required):
The value in the Authorization header must be the string "
Bearer {access token}
", where{access token}
is a valid, unexpired token received in response to a prior/rest/{version}/auth/token
request.
Response
200 Response
400 Response
401 Response
403 Response
404 Response
Examples
Examples of Accessing the API
See Authenticate for how to acquire a token.
The following example shows how to get the next hop from the local route table using curl.
curl -X GET \
--header "Accept: application/xml" \
--header "Authorization: Bearer $TOKEN" \
"https://${SBCIP}/rest/v1.2/admin/test/lrt?lrtName=LRT1&user=370"
The following example shows how to get the next hop from the local route table using Python.
import requests
headers = { "Accept":"application/xml", "Authorization":"Bearer " + token }
url = "https://" + sbcip + "/rest/v1.2/admin/test/lrt?lrtName=LRT1&user=370"
resp = requests.get(url, headers=headers)
Note:
The local-route-config element must have been already configured.Example of the Response Body
The following example shows the contents of the response body in XML.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response>
<data>
<testLrt>
<UserName>370</UserName>
<EntryType>E164</EntryType>
<Priority>1</Priority>
<Weight>10</Weight>
<NextHop>!^.*$!sip:\0@SAG-CarrierE!</NextHop>
<NextHopType>regexp</NextHopType>
<Priority>2</Priority>
<Weight>10</Weight>
<NextHop>!^.*$!sip:\0@SAG-CarrierD!</NextHop>
<NextHopType>regexp</NextHopType>
<Priority>3</Priority>
<Weight>20</Weight>
<NextHop>!^.*$!sip:\0@SAG-CarrierC!</NextHop>
<NextHopType>regexp</NextHopType>
<Priority>4</Priority>
<Weight>30</Weight>
<NextHop>!^.*$!sip:\0@SAG-CarrierB!</NextHop>
<NextHopType>regexp</NextHopType>
<Priority>5</Priority>
<Weight>40</Weight>
<NextHop>!^.*$!sip:\0@SAG-CarrierA!</NextHop>
<NextHopType>regexp</NextHopType>
</testLrt>
</data>
<messages/>
<links/>
</response>
Example 2 of Accessing API
Use the maxElements
parameter to specify the number of elements to return
and the offset
parameter to specify where to start fetching the entries.
The offset
parameter uses a 1-based index.
When using paging, the <links>
element contains links to the next page.
If there are no pages left, the <links>
element is empty.
curl -X GET \
--header "Accept: application/xml" \
--header "Authorization: Bearer $TOKEN" \
"https://${SBCIP}/rest/v1.2/admin/test/lrt?lrtName=LRT1&user=370&maxElements=1&offset=2"
The following shows an example response.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response>
<data>
<testLrt>
<UserName>370</UserName>
<EntryType>E164</EntryType>
<Priority>2</Priority>
<Weight>10</Weight>
<NextHop>!^.*$!sip:\0@SAG-CarrierD!</NextHop>
<NextHopType>regexp</NextHopType>
</testLrt>
</data>
<messages/>
<links>
<link>https://10.0.0.3/rest/v1.2/admin/test/lrt?lrtName=LRT1&user=370&offset=3&maxElements=1</link>
</links>
</response>