CORD-1677: Update synchronizer configuration generation to support
synchronizer core refactoring

Change-Id: I5ef48637a5da48d1cc23b217d940001ccab5b3f6
diff --git a/lib/xos-genx/xosgenx/jinja2_extensions/django.py b/lib/xos-genx/xosgenx/jinja2_extensions/django.py
index 6b7f372..593fefb 100644
--- a/lib/xos-genx/xosgenx/jinja2_extensions/django.py
+++ b/lib/xos-genx/xosgenx/jinja2_extensions/django.py
@@ -16,6 +16,7 @@
 
 from base import *
 import pdb
+import re
 
 def django_content_type_string(xptags):
     # Check possibility of KeyError in caller
@@ -159,6 +160,9 @@
 
     return format_options_string(output_dict)
 
+def xproto_camel_to_underscore(name):
+    return re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
+
 def xproto_validations(options):
     try:
         return [map(str.strip, validation.split(':')) for validation in unquote(options['validators']).split(',')]
diff --git a/lib/xos-genx/xosgenx/targets/model-deps.xtarget b/lib/xos-genx/xosgenx/targets/model-deps.xtarget
index 65a3742..74a8647 100644
--- a/lib/xos-genx/xosgenx/targets/model-deps.xtarget
+++ b/lib/xos-genx/xosgenx/targets/model-deps.xtarget
@@ -1,8 +1,9 @@
-{
-{%- for model in proto.messages %}
-{%- if model.links %}
-    "{{ model.name }}": [
-        {{ model.links | map(attribute='peer') | format_list("\"%s\"") |join(',\n\t\t') }}
-    ],{% endif -%}
-{% endfor %}
+{ {%- for model in proto.messages %} "{{ model.name }}": [
+        {% for l in xproto_base_links(model, proto.message_table) + model.links -%}
+        {% if "Controller" + l.peer.name in proto.message_names -%}
+        ["Controller{{ l.peer.name }}", "{{ l.src_port }}", "{{ xproto_camel_to_underscore(l.peer.name).lower() }}"],
+        {% endif %}
+        ["{{ l.peer.name }}", "{{ l.src_port }}", ""]{% if not loop.last %},{% endif %}
+        {% endfor %}
+    ]{{ "," if not loop.last }}{% endfor %}
 }