Forum Discussion

mugude_243668's avatar
mugude_243668
Icon for Nimbostratus rankNimbostratus
Aug 24, 2016

IControl Rest - comman show ip route

Hello,

 

Is it possible to do a rest api call to obtain the same result of cli command: show ip route vrf "vrfName"

 

Thanks a lot

 

J. Valentin

 

1 Reply

  • R_Marc's avatar
    R_Marc
    Icon for Nimbostratus rankNimbostratus

    I don't believe iControl exposes IMISH directly, but you could do something like this:

    curl -sk -u admin:$PASS -H "Content-Type: application/json" -X POST  https://bip1/mgmt/tm/util/bash -d  "{\"command\":\"run\",\"utilCmdArgs\":\"-c 'tmsh imish -e \\\"show ip route\\\"'\"}" | python -m json.tool
    {
        "command": "run",
        "commandResult": "Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP\n       O - OSPF, IA - OSPF inter area\n       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2\n       E1 - OSPF external type 1, E2 - OSPF external type 2\n       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area\n       * - candidate default\n\nGateway of last resort is 10.0.244.10 to network 0.0.0.0\n\nK*      0.0.0.0/0 [0/0] via 10.0.244.10, DMZI_VLAN\nC       10.0.244.0/22 is directly connected, DMZI_VLAN\nC       127.0.0.1/32 is directly connected, lo\nC       127.1.1.254/32 is directly connected, tmm\nC       192.168.0.0/24 is directly connected, HA_VLAN\nC       1.64.2.0/24 is directly connected, INTERNET_VLAN\n",
        "kind": "tm:util:bash:runstate",
        "utilCmdArgs": "-c 'tmsh imish -e \"show ip route\"'"
    }