<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
tt
        {mso-style-priority:99;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hi dwj,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I’m passing the question (and answer) to openstack mailing list.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">You are right. In case of an invalid vitrage id, we should not return HTTP 404 error. I think the correct behavior would be to return a nice error message like
 “Alarm XYZ does not exist”.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">You can open a bug about it.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Thanks,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Ifat.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> dong.wenjuan@zte.com.cn [mailto:dong.wenjuan@zte.com.cn]
<br>
<b>Sent:</b> Wednesday, May 25, 2016 9:24 AM<br>
<b>To:</b> Weyl, Alexey (Nokia - IL); Afek, Ifat (Nokia - IL); Rosensweig, Elisha (Nokia - IL); Shamir, Ohad (Nokia - IL)<br>
<b>Subject:</b> input erroneous `vitrage_id` in `vitrage rca show`API or `vitrage topology show` API<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><br>
<span style="font-size:10.0pt;font-family:"Arial","sans-serif"">Hi folks,</span> <br>
<br>
<span style="font-size:10.0pt;font-family:"Arial","sans-serif"">`vitrage rca show` has the positional arguments: alarm_id
</span><br>
<br>
<span style="font-size:10.0pt;font-family:"Arial","sans-serif"">`vitrage topology show` API has the optional arguments: --root</span>
<br>
<br>
<span style="font-size:10.0pt;font-family:"Arial","sans-serif"">They all means the `vitrage_id` in vertex, and those APIs also call the</span>
<br>
<span style="font-size:10.0pt;font-family:"Arial","sans-serif"">function of `</span><b><span style="font-size:10.0pt;font-family:"Courier New"">graph_query_vertices</span></b><span style="font-size:10.0pt;font-family:"Courier New"">(<i>self</i>, query_dict=<span style="color:blue">None</span>,
 root_id=<span style="color:blue">None</span>, depth=<span style="color:blue">None</span>,</span>
<br>
<span style="font-size:10.0pt;font-family:"Courier New"">                             direction=Direction.BOTH)</span><span style="font-size:10.0pt;font-family:"Arial","sans-serif"">`</span>
<br>
<span style="font-size:10.0pt;font-family:"Arial","sans-serif""><br>
</span><span style="font-size:10.0pt">But if the user input the erroneous</span><tt><span style="font-size:10.0pt;color:#333333">
</span></tt><span style="font-size:10.0pt;font-family:"Arial","sans-serif"">`vitrage_id`</span><span style="font-size:10.0pt"> which was not exist in the nodes,</span>
<br>
<span style="font-size:10.0pt">Do the APIs all need to return the HTTP 404 error?</span>
<br>
<br>
<span style="font-size:10.0pt">See the code: </span><br>
<span style="font-size:10.0pt"><a href="https://github.com/openstack/vitrage/blob/master/vitrage/graph/algo_driver/networkx_algorithm.py#L43">https://github.com/openstack/vitrage/blob/master/vitrage/graph/algo_driver/networkx_algorithm.py#L43</a></span>
<br>
<br>
<span style="font-size:10.0pt;font-family:"Arial","sans-serif"">Do we need to unify the return value as a empty graph in function `</span><b><span style="font-size:10.0pt;font-family:"Courier New"">graph_query_vertices</span></b><span style="font-size:10.0pt;font-family:"Arial","sans-serif"">`
</span><br>
<span style="font-size:10.0pt;font-family:"Arial","sans-serif"">if the root is not be found or the root_data don't match the query?</span>
<br>
<span style="font-size:10.0pt;font-family:"Arial","sans-serif"">Or leave it, don't modify, return the HTTP 404?</span>
<br>
<br>
<span style="font-size:10.0pt;font-family:"Arial","sans-serif"">Thanks.</span> <br>
<br>
<span style="font-size:10.0pt">The error log:</span> <br>
<span style="font-size:10.0pt">stack@cloud:~$ vitrage rca show 'ALARM:nagios:cloud:test'</span>
<br>
<span style="font-size:10.0pt">Unknown Error (HTTP 404)</span> <br>
<br>
<span style="font-size:10.0pt">2016-05-25 12:26:08.734 10742 DEBUG vitrage.entity_graph.api_handler.entity_graph_api [-] EntityGraphApis get_rca root:ALARM:nagios:cloud:test get_rca /opt/stack/vitrage/vitrage/entity_graph/api_handler/entity_graph_api.py:114</span>
<br>
<span style="font-size:10.0pt">2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher [-] Exception during message handling: u'ALARM:nagios:cloud:test'</span>
<br>
<span style="font-size:10.0pt">2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher Traceback (most recent call last):</span>
<br>
<span style="font-size:10.0pt">2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher   File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 138, in _dispatch_and_reply</span>
<br>
<span style="font-size:10.0pt">2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher     incoming.message))</span>
<br>
<span style="font-size:10.0pt">2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher   File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 185, in _dispatch</span>
<br>
<span style="font-size:10.0pt">2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher     return self._do_dispatch(endpoint, method, ctxt, args)</span>
<br>
<span style="font-size:10.0pt">2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher   File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 127, in _do_dispatch</span>
<br>
<span style="font-size:10.0pt">2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher     result = func(ctxt, **new_args)</span>
<br>
<span style="font-size:10.0pt">2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher   File "/opt/stack/vitrage/vitrage/entity_graph/api_handler/entity_graph_api.py", line 120, in get_rca</span>
<br>
<span style="font-size:10.0pt">2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher     direction=Direction.IN)</span>
<br>
<span style="font-size:10.0pt">2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher   File "/opt/stack/vitrage/vitrage/graph/algo_driver/networkx_algorithm.py", line 43, in graph_query_vertices</span>
<br>
<span style="font-size:10.0pt">2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher     root_data = self.graph._g.node[root_id]</span>
<br>
<span style="font-size:10.0pt">2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher KeyError: u'ALARM:nagios:cloud:test'</span>
<br>
<span style="font-size:10.0pt">2016-05-25 12:26:08.735 10742 ERROR oslo_messaging.rpc.dispatcher
</span><br>
<span style="font-size:10.0pt">2016-05-25 12:26:08.759 10742 ERROR oslo_messaging._drivers.common [-] Returning exception u'ALARM:nagios:cloud:test' to caller</span>
<br>
<br>
BR, <br>
dwj <o:p></o:p></p>
<pre><span style="color:blue"><o:p> </o:p></span></pre>
<pre><span style="color:blue">--------------------------------------------------------<o:p></o:p></span></pre>
<pre><span style="color:blue">ZTE Information Security Notice: The information contained in this mail (and any attachment transmitted herewith) is privileged and confidential and is intended for the exclusive use of the addressee(s).  If you are not an intended recipient, any disclosure, reproduction, distribution or other dissemination or use of the information contained is strictly prohibited.  If you have received this mail in error, please delete it and notify us immediately.<o:p></o:p></span></pre>
<pre><span style="color:blue"><o:p> </o:p></span></pre>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>