blob: 7beccfd4f3ed400caa56b1d7328b608f2c73b3ca [file] [log] [blame]
Sapan Bhatia06e4e7a2017-09-04 22:15:30 -04001{ {%- 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 Bhatia1e021772017-08-19 02:15:48 -040012 {% endfor %}
Sapan Bhatia06e4e7a2017-09-04 22:15:30 -040013 {% 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 Bhatia09174022017-06-02 13:39:28 +020022}