show bgp paths
Python
Copy
import json

"""
Modify these please
"""
url='http://<IP_Address>/ins'
switchuser='<User_ID>'
switchpassword='<Password>'

myheaders={'content-type':'application/json'}
payload={
  "ins_api":{
  "version": "1.0",
  "type": "cli_show",
  "chunk": "0",
  "sid": "1",
  "input": "show bgp paths",
  "output_format": "json"
}

response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword)).json()
output = json.dumps(response, indent=4, sort_keys=True)


{

  "ins_api": {
    "type": "cli_show",
    "version": "1.0",
    "sid": "eoc",
    "outputs": {
      "output": {
        "input": "show bgp paths",
        "msg": "Success",
        "code": "200",
        "body": {
          "TABLE_id": {
            "ROW_id": [
              {
                "id": "0x7539c21c",
                "hashvalue": "51",
                "refcount": "3",
                "metric": "0",
                "aspath": "10 20 30 40 50 60 70 80 90",
                "origin": "i"
              },
              {
                "id": "0x7539c9d8",
                "hashvalue": "523",
                "refcount": "3",
                "metric": "0",
                "aspath": "10 20 30 40 50 60 70 80 90",
                "origin": "i"
              },
              {
                "id": "0x7539c954",
                "hashvalue": "559",
                "refcount": "1",
                "metric": "0",
                "aspath": null,
                "origin": "i"
              },
              {
                "id": "0x7539c63c",
                "hashvalue": "653",
                "refcount": "1",
                "metric": "0",
                "aspath": "2 3 4",
                "origin": "i"
              },
              {
                "id": "0x7539c84c",
                "hashvalue": "661",
                "refcount": "1",
                "metric": "0",
                "aspath": "888 10 20 30 40 50 60 70 80 90",
                "origin": "i"
              },
              {
                "id": "0x7539c7c8",
                "hashvalue": "665",
                "refcount": "3",
                "metric": "0",
                "aspath": "888 10 20 30 40 50 60 70 80 90",
                "origin": "i"
              },
              {
                "id": "0x7539c534",
                "hashvalue": "665",
                "refcount": "1",
                "metric": "0",
                "aspath": "888 10 20 30 40 50 60 70 80 90",
                "origin": "i"
              },
              {
                "id": "0x7539c2a0",
                "hashvalue": "701",
                "refcount": "2",
                "metric": "0",
                "aspath": "{43428 14808 51723 23103 60017 31397 2777 39692 11071 47986}",
                "origin": "i"
              },
              {
                "id": "0x7539c5b8",
                "hashvalue": "871",
                "refcount": "2",
                "metric": "0",
                "aspath": "200 300 400 500 600 700",
                "origin": "i"
              },
              {
                "id": "0x7539c42c",
                "hashvalue": "1157",
                "refcount": "1",
                "metric": "0",
                "aspath": "2 3 4",
                "origin": "i"
              },
              {
                "id": "0x7539c4b0",
                "hashvalue": "1228",
                "refcount": "1",
                "metric": "2222",
                "aspath": "1 2 3 65000 23",
                "origin": "i"
              },
              {
                "id": "0x7539c8d0",
                "hashvalue": "1285",
                "refcount": "3",
                "metric": "0",
                "aspath": "{1956 38871 10250 47165 18545 55460 26839 63754 35134 6514}",
                "origin": "i"
              },
              {
                "id": "0x7539c6c0",
                "hashvalue": "1730",
                "refcount": "2",
                "metric": "0",
                "aspath": "3 10 20 30 40 50 60 70 80 90",
                "origin": "i"
              },
              {
                "id": "0x7539cae0",
                "hashvalue": "2009",
                "refcount": "1",
                "metric": "0",
                "aspath": "888 10 20 30 40 50 60 70 80 90",
                "origin": "i"
              },
              {
                "id": "0x7539cc6c",
                "hashvalue": "2111",
                "refcount": "2",
                "metric": "0",
                "aspath": null,
                "origin": "?"
              },
              {
                "id": "0x7539cb64",
                "hashvalue": "2223",
                "refcount": "3",
                "metric": "0",
                "aspath": null,
                "origin": "?"
              },
              {
                "id": "0x7539c198",
                "hashvalue": "2249",
                "refcount": "2",
                "metric": "0",
                "aspath": "888 10 20 30 40 50 60 70 80 90",
                "origin": "i"
              },
              {
                "id": "0x7539cbe8",
                "hashvalue": "2303",
                "refcount": "3",
                "metric": "0",
                "aspath": null,
                "origin": "?"
              },
              {
                "id": "0x7539c324",
                "hashvalue": "2431",
                "refcount": "1",
                "metric": "4444",
                "aspath": "3 4 5 6",
                "origin": "i"
              },
              {
                "id": "0x7539ca5c",
                "hashvalue": "2543",
                "refcount": "2",
                "metric": "4444",
                "aspath": "3 10 20 30",
                "origin": "i"
              },
              {
                "id": "0x7539c3a8",
                "hashvalue": "2757",
                "refcount": "2",
                "metric": "4444",
                "aspath": "31397 2777 39692 11071 47986",
                "origin": "i"
              },
              {
                "id": "0x7539c744",
                "hashvalue": "3363",
                "refcount": "1",
                "metric": "4444",
                "aspath": "3 10 20 30 40 50 60 70 80 90",
                "origin": "i"
              }
            ]
          }
        }
      }
    }
  }
}