OpenIxia / ixnetwork_restpy

The IxNetwork python client.
https://openixia.github.io/ixnetwork_restpy/#/
MIT License
30 stars 16 forks source link

getIPv4learnedInfo example #5

Closed skayres closed 5 years ago

skayres commented 5 years ago

Hi! Ixnetwork version: v8.52.1904.2

Couldn't you add a sample how to get IPv4learnedInfo for BGP session?

I try something like this:

topology1 = ixnetwork.Topology.find()
device_group1 = topology1.DeviceGroup.find()
ipv4_loopback1 = device_group1.Ipv4Loopback.find()
bgp_ipv4_peers = ipv4_loopback1.BgpIpv4Peer.find()
response = bgp_ipv4_peers.GetIPv4LearnedInfo('1-3')

And I get 404 error from IxNetwork:

2019-08-02 06:40:12 [ixnetwork_restpy.connection] [DEBUG] POST https://10.27.150.146:11009/api/v1/sessions/1/ixnetwork/topology/1/deviceGroup/1/ipv4Loopback/2/bgpIpv4Peer/1/operations/getipv4learnedinfo {"Arg1": "/ap
i/v1/sessions/1/ixnetwork/topology/1/deviceGroup/1/ipv4Loopback/2/bgpIpv4Peer/1", "Arg2": "1"}
DEBUG:ixnetwork_restpy.connection:POST https://10.27.150.146:11009/api/v1/sessions/1/ixnetwork/topology/1/deviceGroup/1/ipv4Loopback/2/bgpIpv4Peer/1/operations/getipv4learnedinfo {"Arg1": "/api/v1/sessions/1/ixnetwor
k/topology/1/deviceGroup/1/ipv4Loopback/2/bgpIpv4Peer/1", "Arg2": "1"}
DEBUG:urllib3.connectionpool:Resetting dropped connection: 10.27.150.146
DEBUG:urllib3.connectionpool:https://10.27.150.146:11009 "POST /api/v1/sessions/1/ixnetwork/topology/1/deviceGroup/1/ipv4Loopback/2/bgpIpv4Peer/1/operations/getipv4learnedinfo HTTP/1.1" 404 236
2019-08-02 06:40:12 [ixnetwork_restpy.connection] [DEBUG] 404 Not Found
DEBUG:ixnetwork_restpy.connection:404 Not Found

When I use the API browser I get the correct response. The difference in the requests is: API Browser: POST:/api/v1/sessions/1/ixnetwork/topology/deviceGroup/ipv4Loopback/bgpIpv4Peer/operations/getipv4learnedinfo

ixnetwork_restpy: POST:/api/v1/sessions/1/ixnetwork/topology/1/deviceGroup/1/ipv4Loopback/2/bgpIpv4Peer/1/operations/getipv4learnedinfo

Thank you.

ajbalogh commented 5 years ago

You have found a bug in the auto-generated portion of the package which we will be fixing shortly. To workaround the issue pass in a list of the session/device indexes you want to retrieve learned info for:

response = bgp_ipv4_peers.GetIPv4LearnedInfo([1, 2, 3])