<div dir="ltr"><div dir="ltr"><div dir="ltr">Hi,<div><br></div><div>I'm trying to use tosca-parser to parse CSAR files. Its working quite well, until I hit a wall with capabilities today. Specifically I am testing with the single instance wordpress example CSAR, which uses a get_input for the num_cpus argument for host capabilities for the server.</div><div><br>Based on how properties work, I would expect to get a function back for anything which requires referencing another value, but in the case of capabilities I either get the hardcoded value (strings, ints etc), or a None for values which would be functions if we were talking about prototypes.</div><div><br></div><div>Here's a snippet of example code:</div><div><br></div><div><div>#!/usr/bin/python</div><div><br></div><div>import sys</div><div><br></div><div>from jinja2 import Template</div><div>import toscaparser.functions</div><div>from toscaparser.tosca_template import ToscaTemplate</div><div><br></div><div>tosca = ToscaTemplate(sys.argv[1])</div><div><br></div><div>for nodetemplate in tosca.nodetemplates:</div><div>    print</div><div>    print('Processing node template %s'% <a href="http://nodetemplate.name">nodetemplate.name</a>)</div><div><br></div><div>    capabilities = nodetemplate.get_capabilities_objects()</div><div>    for cap in capabilities:</div><div>        propobjs = cap.get_properties_objects()</div><div>        if not propobjs:</div><div>            continue</div><div><br></div><div>        for po in propobjs:</div><div>            print('  %s: %s' %(<a href="http://po.name">po.name</a>, po.value))</div></div><div><br></div><div>Which returns this:</div><div><br></div><div><div>$ python _capabilities.py csar_wordpress.zip </div><div>No handlers could be found for logger "tosca.model"</div><div><br></div><div>Processing node template wordpress</div><div>  network_name: PRIVATE</div><div>  initiator: source</div><div>  protocol: tcp</div><div>  secure: False</div><div><br></div><div>Processing node template webserver</div><div>  network_name: PRIVATE</div><div>  initiator: source</div><div>  protocol: tcp</div><div>  secure: False</div><div>  secure: True</div><div><br></div><div>Processing node template mysql_dbms</div><div><br></div><div>Processing node template mysql_database</div><div><br></div><div>Processing node template server</div><div>  secure: True</div><div>  min_instances: 1</div><div>  max_instances: 1</div><div>  mem_size: 4096 MB</div><div>  num_cpus: None</div><div>  disk_size: 10 GB</div><div>  distribution: Fedora</div><div>  version: 18.0</div><div>  type: Linux</div><div>  architecture: x86_64</div></div><div><br></div><div>I would expect num_cpus for the "server" node_template to be a GetInput() function based on its definition in the CSAR, but instead I get None.</div><div><br></div><div>Is there an example somewhere of how to correctly access functions for capabilities?</div><div><br></div><div>Thanks,</div><div>Michael</div></div></div></div>