Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 817798

Summary: REST API: logical network <usages> accept only <usage> as UPPERCASE.
Product: Red Hat Enterprise Virtualization Manager Reporter: Avi Tal <atal>
Component: ovirt-engine-restapiAssignee: Muli Salem <msalem>
Status: CLOSED CURRENTRELEASE QA Contact: Yaniv Kaul <ykaul>
Severity: medium Docs Contact:
Priority: low    
Version: 3.0.0CC: dyasny, ecohen, iheim, jkt, lpeer, mpastern, Rhev-m-bugs, srevivo, ykaul
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: network
Fixed In Version: si16 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-12-04 20:00:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Network RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
engine log
none
console log none

Description Avi Tal 2012-05-01 10:49:14 UTC
POST the following usages collection to api/networks 
<network>
   <name>sw1</name>
   ...
   <usages><usage>vm</usage></usages>
</network>

(NOTE: VM instead of vm will work perfect)

response for lowercase 'vm':
HTTP Status 500 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server encountered an internal error () that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>org.jboss.resteasy.spi.UnhandledException: java.lang.NullPointerException
    org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:340)
    org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:214)
    org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:190)
    org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:540)
    org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:502)
    org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119)
    org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
    org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
    org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
</pre></p><p><b>root cause</b> <pre>java.lang.NullPointerException
    org.ovirt.engine.api.restapi.resource.BackendNetworksResource.getActionParameters(BackendNetworksResource.java:60)
    org.ovirt.engine.api.restapi.resource.BackendNetworksResource.add(BackendNetworksResource.java:35)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    java.lang.reflect.Method.invoke(Method.java:616)
    org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:155)
    org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257)
    org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222)
    org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:211)
    org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:525)
    org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:502)
    org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119)
    org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
    org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
    org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

Comment 1 Avi Tal 2012-05-01 10:49:52 UTC
Created attachment 581347 [details]
engine log

Comment 2 Avi Tal 2012-05-01 10:50:16 UTC
Created attachment 581348 [details]
console log

Comment 3 Muli Salem 2012-07-22 09:49:48 UTC
Proposed patch in:

http://gerrit.ovirt.org/#/c/6502/1

Comment 4 Muli Salem 2012-07-29 14:40:56 UTC
fixed in: 82c3d142c558288aa3b617aaf5ec8c97f4cf7fdd

Comment 5 Avi Tal 2012-08-02 17:35:12 UTC
verify on si13 - PASS

POST
<network>
  <name>sw1</name>
  <data_center id="6af93d87-cdd7-4b22-8a6e-f63285019ac6"/>
  <usages>
   <usage>vm</usage>
  </usages>
</network>

response code 201

Comment 6 Avi Tal 2012-08-23 07:53:33 UTC
Reopen BZ because response body still contain usages in CAPITAL Letters.

response:
<network>
  <name>sw1</name>
  <data_center id="6af93d87-cdd7-4b22-8a6e-f63285019ac6"/>
  <usages>
   <usage>VM</usage>
   <usage>DISPLAY</usage>
  </usages>
</network>

Comment 7 Michael Pasternak 2012-08-23 08:30:32 UTC
why there is no description for this in  /capabilities resource?,
please describe <usages> accordingly.

Comment 8 Muli Salem 2012-08-23 12:17:43 UTC
Proposed patch in http://gerrit.ovirt.org/#/c/7431/

Comment 10 Avi Tal 2012-09-01 08:10:27 UTC
verify on SI16 - PASS

sent:
<usages>
 <usage>vm</usage>
</usages>

response usage is the same.

note: same for "display"