← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1263551] Re: neutron port-list -f csv outputs poorly formatted JSON strings.

 

** Changed in: neutron
   Importance: Undecided => Medium

** Project changed: neutron => python-neutronclient

** Changed in: python-neutronclient
       Status: New => Confirmed

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1263551

Title:
  neutron port-list -f csv outputs poorly formatted JSON strings.

Status in Python client library for Neutron:
  Confirmed

Bug description:
  I have two IPs attached to a port. One IPv4 address and one IPv6
  address:

  $ neutron port-list -f table | grep '..relevant lines..'
  | f59ec695-d52d-40b0-9d7c-1d8ebe315305 |                                | fa:16:3e:7d:99:3a | {"subnet_id": "1bb2eda5-5860-4864-84a3-4e31e3a0f130", "ip_address": "192.168.2.102"}       |
  |                                      |                                |                   | {"subnet_id": "81aa0d62-4b8d-4494-98c8-50b434b067d8", "ip_address": "2607:f088:0:2::1338"} |

  $ neutron port-list -f csv | grep '..relevant lines..'
  "f59ec695-d52d-40b0-9d7c-1d8ebe315305","","fa:16:3e:7d:99:3a","{""subnet_id"": ""1bb2eda5-5860-4864-84a3-4e31e3a0f130"", ""ip_address"": ""192.168.2.102""}
  {""subnet_id"": ""81aa0d62-4b8d-4494-98c8-50b434b067d8"", ""ip_address"": ""2607:f088:0:2::1338""}"

  Running this through a CSV filter:

  $VAR1 = '10fd0850-7799-4ac7-ae54-09ecb3ac8b8f';
  $VAR2 = '';
  $VAR3 = 'fa:16:3e:37:ac:cc';
  $VAR4 = '{"subnet_id": "1bb2eda5-5860-4864-84a3-4e31e3a0f130", "ip_address": "192.168.2.104"}
  {"subnet_id": "81aa0d62-4b8d-4494-98c8-50b434b067d8", "ip_address": "2607:f088:0:2::133a"}';

  Finally, attempting to parse the JSON string ($VAR4) in perl:

  garbage after JSON object, at character offset 85 (before
  "{"subnet_id": "81aa0...") at ./neutron_ports line 48,
  <$NEUTRON_PORTS> line 15.

  Indeed, this isn't perl's fault. Putting the string through
  http://jsonlint.com/ comes up with a similar error.

  The two strings need to be contained in a larger structure: [{...},{...}]
  instead of just concatenated together: {...}{...}

  Or the output specification needs to be changed.

  Package/version information:
  # dpkg -l | awk '/neutron/ {print $3 " " $2}'
  1:2013.2-0ubuntu1 neutron-common
  1:2013.2-0ubuntu1 neutron-dhcp-agent
  1:2013.2-0ubuntu1 neutron-metadata-agent
  1:2013.2-0ubuntu1 neutron-plugin-linuxbridge
  1:2013.2-0ubuntu1 neutron-plugin-linuxbridge-agent
  1:2013.2-0ubuntu1 neutron-plugin-openvswitch
  1:2013.2-0ubuntu1 neutron-server
  1:2013.2-0ubuntu1 python-neutron
  1:2.3.0-0ubuntu1 python-neutronclient

To manage notifications about this bug go to:
https://bugs.launchpad.net/python-neutronclient/+bug/1263551/+subscriptions


References