Yang template for the generator. use -d type_map
diff --git a/xos/tools/apigen/type_map b/xos/tools/apigen/type_map
new file mode 100644
index 0000000..ac4a8a8
--- /dev/null
+++ b/xos/tools/apigen/type_map
@@ -0,0 +1,10 @@
+{
+    "AutoField":"int64",
+    "ForeignKey":"InstanceIdentifier",
+    "CharField":"string",
+    "TextField":"string",
+    "FloatField":"float64",
+    "BooleanField":"boolean",
+    "StrippedCharField":"string",
+    "DateTimeField":"date-and-time"
+}
diff --git a/xos/tools/apigen/yang.template.txt b/xos/tools/apigen/yang.template.txt
new file mode 100644
index 0000000..ad4b1b1
--- /dev/null
+++ b/xos/tools/apigen/yang.template.txt
@@ -0,0 +1,21 @@
+{% for app,files in generator.apps.items %}
+{% for file,m in files.items %}
+module xos-{{ app }}-{{ file }} {
+    namespace "urn:xos:{{app}}.{{ file }}";
+    prefix xos-cs;
+
+    import complex-types {prefix ct;}
+    revision 2016-2-24 {
+        description "Initial";
+    }   
+
+    complex-type {{ m.class_name }} {
+      {% for f in m.fields %}
+
+      leaf {{ f.name }} { type {{ f.type }}{% ifequal f.type "ForeignKey" %} { ct:instance-type {{f.related.model.class_name}};{% if f.null%}{%else%}require-instance true{% endif %}{% endifequal %};{% if f.max_length %} { length {{ f.max_length }};{% endif %}{% if None %}default "{{ f.default }}";{% endif %}}
+      {% endfor %}
+    }
+}
++++ {{ app }}-{{ file}}.yang
+{% endfor %}
+{% endfor %}