Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Searching network based on EA's not working when body is passed in GET request #18

Closed
ishantt opened this issue Jul 6, 2017 · 1 comment
Assignees

Comments

@ishantt
Copy link

ishantt commented Jul 6, 2017

The call https://github.com/infobloxopen/docker-infoblox/blob/v1.1.0-pre/driver/infoblox_ipam.go#L117

networkByName, err := ibDrv.objMgr.GetNetwork(netview, "", ibclient.EA{"Network Name": networkName})

eventually constructs the URL as

$ curl -k -u admin:infoblox -H "Content-Type:application/json" -X GET 'https://10.120.21.150:443/wapi/v2.6/network?%2ANetwork+Name=new-net1&_return_fields=extattrs%2Cnetwork%2Cnetwork_view' -d '{"network_view":"global"}

'[
   {
       "_ref": "network/ZG5zLm5ldHdvcmskNDAuMC4wLjAvMjQvMA:40.0.0.0/24/default",
       "extattrs": {
           "CMP Type": {
               "value": "Docker"
           },
           "Cloud API Owned": {
               "value": "True"
           },
           "Network Name": {
               "value": "new-net1"
           },
           "Tenant ID": {
               "value": "DVZR:HNJZ:42OG:XTRO:YOHD:VDYA:EBKK:UDO7:ILEA:JF7R:KYGG:QCIO"
           }
       },
       "network": "40.0.0.0/24",
       "network_view": "default"
   }

It queried for a network with EA “network-name = new-net1” in “global” network view but got the network with this name in “default” view. The GET request ignores the body if there are parameters in the query string. This request should have failed but currently passes in our code.

So either all parameters needs to be passed in the body or as query parameters.

  1. Passing all prams as body
$ curl -k -u admin:infoblox -H "Content-Type:application/json" -X GET 'https://10.120.21.150:443/wapi/v2.6/network?_return_fields=extattrs%2Cnetwork%2Cnetwork_view' -d '{ "*Network Name":"new-net1"}'

[
   {
       "_ref": "network/ZG5zLm5ldHdvcmskNDAuMC4wLjAvMjQvMA:40.0.0.0/24/default",
       "extattrs": {
           "CMP Type": {
               "value": "Docker"
           },
           "Cloud API Owned": {
               "value": "True"
           },
           "Network Name": {
               "value": "new-net1"
           },
           "Tenant ID": {
               "value": "DVZR:HNJZ:42OG:XTRO:YOHD:VDYA:EBKK:UDO7:ILEA:JF7R:KYGG:QCIO"
           }
       },
       "network": "40.0.0.0/24",
       "network_view": "default"
   }



$ curl -k -u admin:infoblox -H "Content-Type:application/json" -X GET 'https://10.120.21.150:443/wapi/v2.6/network?_return_fields=extattrs%2Cnetwork%2Cnetwork_view' -d '{"network_view":"global", "*Network Name":"new-net1"}'

{ "Error": "AdmConDataNotFoundError: Network View global not found",
 "code": "Client.Ibap.Data.NotFound",
 "text": "Network View global not found"
}
  1. Passing all prams in query
$ curl -k -u admin:infoblox -H "Content-Type:application/json" -X GET 'https://10.120.21.150:443/wapi/v2.6/network?%2ANetwork+Name=new-net1&network_view=default&_return_fields=extattrs%2Cnetwork%2Cnetwork_view'

[
   {
       "_ref": "network/ZG5zLm5ldHdvcmskNDAuMC4wLjAvMjQvMA:40.0.0.0/24/default",
       "extattrs": {
           "CMP Type": {
               "value": "Docker"
           },
           "Cloud API Owned": {
               "value": "True"
           },
           "Network Name": {
               "value": "new-net1"
           },
           "Tenant ID": {
               "value": "DVZR:HNJZ:42OG:XTRO:YOHD:VDYA:EBKK:UDO7:ILEA:JF7R:KYGG:QCIO"
           }
       },
       "network": "40.0.0.0/24",
       "network_view": "default"
   }



$ curl -k -u admin:infoblox -H "Content-Type:application/json" -X GET 'https://10.120.21.150:443/wapi/v2.6/network?%2ANetwork+Name=new-net1&network_view=global&_return_fields=extattrs%2Cnetwork%2Cnetwork_view'
{ "Error": "AdmConDataNotFoundError: Network View global not found",
 "code": "Client.Ibap.Data.NotFound",
 "text": "Network View global not found"
}
@ishantt ishantt self-assigned this Jul 6, 2017
ishantt pushed a commit to ishantt/infoblox-go-client that referenced this issue Jul 6, 2017
This patch passes EA's in body instead of query string because of
the issue infobloxopen#18.
Also Fixes issues where error is not returned when there is error
in the request response body.
ishantt pushed a commit to ishantt/infoblox-go-client that referenced this issue Jul 10, 2017
This patch passes EA's in body instead of query string because of
the issue infobloxopen#18.
Also Fixes issues where error is not returned when there is error
in the request response body.
johnbelamaric pushed a commit that referenced this issue Jul 17, 2017
* [WIP]Search EA's by passing in body instead of query string

This patch passes EA's in body instead of query string because of
the issue #18.
Also Fixes issues where error is not returned when there is error
in the request response body.

* Search EA's by passing in body instead of query string

This patch passes EA's in body instead of query string because of
the issue #18.
Also Fixes issues where error is not returned when there is error
in the request response body.

* Define new type for the EA Search

This patch defines new type for the EA Search object
and implements MarshalJSON for this type.

* Rename EA Search type from EAS to EASearch

* Use byte(',') instead of []byte(",")
@ishantt
Copy link
Author

ishantt commented Jul 18, 2017

Issue is fixed now.

@ishantt ishantt closed this as completed Jul 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant