Sapan Bhatia | 06e4e7a | 2017-09-04 22:15:30 -0400 | [diff] [blame] | 1 | { {%- for model in proto.messages %} |
| 2 | {% if model.name not in ["Controller", "XOSBase"] %} |
| 3 | "{{ model.name }}": [ |
| 4 | {% set controller_model_name = "Controller" + model.name %} |
| 5 | {% set controller_model_name_plural = "Controller" + xproto_pluralize(model) %} |
| 6 | {% set controller_models = (proto.message_table[controller_model_name], proto.message_table[controller_model_name_plural]) %} |
| 7 | {% set controller_model = xproto_first_non_empty(controller_models) %} |
| 8 | {% if controller_model %} |
| 9 | {% set controller_links = xproto_base_links(controller_model, proto.message_table) + controller_model.links %} |
| 10 | {% for cl in controller_links %} |
| 11 | {% set _=cl.__setitem__("model_name", cl.options.model) %} |
Sapan Bhatia | 1e02177 | 2017-08-19 02:15:48 -0400 | [diff] [blame] | 12 | {% endfor %} |
Sapan Bhatia | 06e4e7a | 2017-09-04 22:15:30 -0400 | [diff] [blame] | 13 | {% set controller_backlinks = controller_links | selectattr("model_name", "equalto", model.name) %} |
| 14 | {% for backlink in controller_backlinks %} |
| 15 | ["{{ controller_model.name }}", "{{ backlink.dst_port }}", "{{ backlink.src_port }}"], |
| 16 | {% endfor %} |
| 17 | {% endif %} |
| 18 | {% for l in xproto_base_links(model, proto.message_table) + model.links -%} |
| 19 | ["{{ l.peer.name }}", "{{ l.src_port }}", "{{ l.dst_port }}"]{% if not loop.last %},{% endif %} |
| 20 | {% endfor %} |
| 21 | ]{{ "," if not loop.last }}{% endif %}{% endfor %} |
Sapan Bhatia | 0917402 | 2017-06-02 13:39:28 +0200 | [diff] [blame] | 22 | } |