Defined Models and REST APIs
TOSCA specs
Synchronizer

Change-Id: Icd9dde1b456711ca7e5f0c69ae547072ff5b3120
diff --git a/xos/admin.py b/xos/admin.py
index 4901939..a6ce270 100644
--- a/xos/admin.py
+++ b/xos/admin.py
@@ -11,7 +11,7 @@
 from django.contrib.contenttypes import generic
 from suit.widgets import LinkedSelect
 from core.models import AddressPool
-from core.admin import ServiceAppAdmin,SliceInline,ServiceAttrAsTabInline, ReadOnlyAwareAdmin, XOSTabularInline, ServicePrivilegeInline, AddressPoolInline
+from core.admin import ServiceAppAdmin, SliceInline, ServiceAttrAsTabInline, ReadOnlyAwareAdmin, XOSTabularInline, ServicePrivilegeInline, AddressPoolInline
 from core.middleware import get_request
 
 from functools import update_wrapper
@@ -19,9 +19,31 @@
 from django.core.urlresolvers import reverse
 from django.contrib.admin.utils import quote
 
+
+class VRouterPortInline(XOSTabularInline):
+    model = VRouterPort
+    fields = ['openflow_id']
+    suit_classes = 'suit-tab suit-tab-vrouter_ports'
+    extra = 0
+
+
+class VRouterInterfaceInline(XOSTabularInline):
+    model = VRouterInterface
+    fields = ['name', 'mac', 'vlan']
+    suit_classes = 'suit-tab suit-tab-vrouter_interfaces'
+    extra = 0
+
+
+class VRouterIpInline(XOSTabularInline):
+    model = VRouterIp
+    fields = ['ip']
+    suit_classes = 'suit-tab suit-tab-vrouter_ips'
+    extra = 0
+
+
 class VRouterServiceForm(forms.ModelForm):
-    def __init__(self,*args,**kwargs):
-        super (VRouterServiceForm,self ).__init__(*args,**kwargs)
+    def __init__(self, *args, **kwargs):
+        super(VRouterServiceForm, self).__init__(*args, **kwargs)
 
     def save(self, commit=True):
         return super(VRouterServiceForm, self).save(commit=commit)
@@ -30,37 +52,60 @@
         model = VRouterService
         fields = '__all__'
 
+
 class VRouterServiceAdmin(ReadOnlyAwareAdmin):
     model = VRouterService
     verbose_name = "vRouter Service"
     verbose_name_plural = "vRouter Service"
     list_display = ("backend_status_icon", "name", "enabled")
     list_display_links = ('backend_status_icon', 'name', )
-    fieldsets = [(None, {'fields': ['backend_status_text', 'name','enabled','versionNumber', 'description', "view_url", "icon_url", ],
-                         'classes':['suit-tab suit-tab-general']})]
-    readonly_fields = ('backend_status_text', )
-    inlines = [SliceInline,ServiceAttrAsTabInline,ServicePrivilegeInline,AddressPoolInline]
+    fieldsets = [(None, {
+        'fields': [
+            'backend_status_text',
+            'name',
+            'enabled',
+            'versionNumber',
+            'description',
+            'view_url',
+            'icon_url',
+            'rest_hostname',
+            'rest_port',
+            'rest_user',
+            'rest_pass',
+        ],
+        'classes':['suit-tab suit-tab-general']})]
+
+    # NOTE make rest_* params editable
+    readonly_fields = (
+        'backend_status_text',
+        'rest_hostname',
+        'rest_port',
+        'rest_user',
+        'rest_pass'
+    )
+    inlines = [SliceInline, ServiceAttrAsTabInline, ServicePrivilegeInline, AddressPoolInline]
     form = VRouterServiceForm
 
     extracontext_registered_admins = True
 
     user_readonly_fields = ["name", "enabled", "versionNumber", "description"]
 
-    suit_form_tabs =(('general', 'vRouter Service Details'),
+    suit_form_tabs = (
+        ('general', 'vRouter Service Details'),
         ('administration', 'Administration'),
         ('addresspools', 'Addresses'),
-        #('tools', 'Tools'),
-        ('slices','Slices'),
-        ('serviceattrs','Additional Attributes'),
-        ('serviceprivileges','Privileges'),
+        # ('tools', 'Tools'),
+        ('slices', 'Slices'),
+        ('serviceattrs', 'Additional Attributes'),
+        ('serviceprivileges', 'Privileges'),
     )
 
-    suit_form_includes = (('vrouteradmin.html', 'top', 'administration'),
-                           ) #('hpctools.html', 'top', 'tools') )
+    suit_form_includes = ('vrouteradmin.html', 'top', 'administration')  # ('hpctools.html', 'top', 'tools') )
 
     def get_queryset(self, request):
         return VRouterService.get_service_objects_by_user(request.user)
 
+
 class VRouterTenantForm(forms.ModelForm):
     public_ip = forms.CharField(required=True)
     public_mac = forms.CharField(required=True)
@@ -97,20 +142,82 @@
         model = VRouterTenant
         fields = '__all__'
 
+
 class VRouterTenantAdmin(ReadOnlyAwareAdmin):
-    list_display = ('backend_status_icon', 'id', 'subscriber_tenant', 'public_ip' )
+    list_display = ('backend_status_icon', 'id', 'subscriber_tenant', 'public_ip')
     list_display_links = ('backend_status_icon', 'id')
-    fieldsets = [ (None, {'fields': ['backend_status_text', 'kind', 'provider_service', 'subscriber_tenant', 'subscriber_service',
-                                     'address_pool', 'public_ip', 'public_mac', 'gateway_ip', 'gateway_mac', 'cidr'],
-                          'classes':['suit-tab suit-tab-general']})]
+    fieldsets = [(None, {
+        'fields': [
+            'backend_status_text', 'kind', 'provider_service', 'subscriber_tenant', 'subscriber_service',
+            'address_pool', 'public_ip', 'public_mac', 'gateway_ip', 'gateway_mac', 'cidr'],
+        'classes':['suit-tab suit-tab-general']
+    })]
     readonly_fields = ('backend_status_text', 'service_specific_attribute', 'gateway_ip', 'gateway_mac', 'cidr')
     form = VRouterTenantForm
 
-    suit_form_tabs = (('general','Details'),)
+    suit_form_tabs = (('general', 'Details'),)
 
     def get_queryset(self, request):
         return VRouterTenant.get_tenant_objects_by_user(request.user)
 
+
+class VRouterDeviceAdmin(ReadOnlyAwareAdmin):
+    list_display = ('name', 'openflow_id', 'config_key', 'driver')
+    fieldsets = [(None, {
+        'fields': ['name', 'openflow_id', 'vrouter_service', 'config_key', 'driver'],
+        'classes':['suit-tab suit-tab-general']
+    })]
+    inlines = [VRouterPortInline]
+
+    suit_form_tabs = (
+        ('general', 'Device Details'),
+        ('vrouter_ports', 'Ports'),
+    )
+
+
+class VRouterPortAdmin(ReadOnlyAwareAdmin):
+    list_display = ('name', 'openflow_id', 'vrouter_device')
+    fieldsets = [(None, {
+        'fields': ['name', 'openflow_id', 'vrouter_service', 'vrouter_device'],
+        'classes':['suit-tab suit-tab-general']
+    })]
+    inlines = [VRouterInterfaceInline]
+
+    suit_form_tabs = (
+        ('general', 'Ports Details'),
+        ('vrouter_interfaces', 'Interfaces'),
+    )
+
+
+class VRouterInterfaceAdmin(ReadOnlyAwareAdmin):
+    list_display = ('name', 'mac', 'vlan')
+    fieldsets = [(None, {
+        'fields': ['name', 'vrouter_port', 'mac', 'vlan'],
+        'classes':['suit-tab suit-tab-general']
+    })]
+    inlines = [VRouterIpInline]
+
+    suit_form_tabs = (
+        ('general', 'Interfaces Details'),
+        ('vrouter_ips', 'Ips'),
+    )
+
+
+class VRouterIpAdmin(ReadOnlyAwareAdmin):
+    list_display = ('name', 'ip', 'vrouter_interface')
+    fieldsets = [(None, {'fields': ['name', 'ip', 'vrouter_interface']})]
+
+
+class VRouterAppAdmin(ReadOnlyAwareAdmin):
+    list_display = ('name', 'control_plane_connect_point', 'ospf_enabled')
+    fieldsets = [(None, {'fields': ['name', 'vrouter_service', 'control_plane_connect_point', 'ospf_enabled']})]
+
+
 admin.site.register(VRouterService, VRouterServiceAdmin)
 admin.site.register(VRouterTenant, VRouterTenantAdmin)
+admin.site.register(VRouterDevice, VRouterDeviceAdmin)
+admin.site.register(VRouterPort, VRouterPortAdmin)
+admin.site.register(VRouterInterface, VRouterInterfaceAdmin)
+admin.site.register(VRouterIp, VRouterIpAdmin)
+admin.site.register(VRouterApp, VRouterAppAdmin)
 
diff --git a/xos/api/service/vrouter.py b/xos/api/service/vrouter.py
new file mode 100644
index 0000000..a932931
--- /dev/null
+++ b/xos/api/service/vrouter.py
@@ -0,0 +1,146 @@
+from rest_framework.decorators import api_view
+from rest_framework.response import Response
+from rest_framework.reverse import reverse
+from rest_framework import serializers
+from rest_framework import generics
+from rest_framework import status
+from core.models import *
+from django.forms import widgets
+from services.vrouter.models import *
+from xos.apibase import XOSListCreateAPIView, XOSRetrieveUpdateDestroyAPIView, XOSPermissionDenied
+from api.xosapi_helpers import PlusModelSerializer, XOSViewSet, ReadOnlyField
+import json
+
+BASE_NAME = 'vrouter'
+
+
+class VRouterServiceSerializer(PlusModelSerializer):
+    id = ReadOnlyField()
+    name = serializers.CharField(required=False)
+    kind = serializers.CharField(required=False)
+    service_specific_attribute = serializers.CharField(required=False)
+    humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+
+    class Meta:
+        model = VRouterService
+        fields = ('humanReadableName', 'id', 'name', 'kind', 'service_specific_attribute')
+
+    def getHumanReadableName(self, obj):
+        return obj.__unicode__()
+
+
+class VRouterDeviceSerializer(PlusModelSerializer):
+    id = ReadOnlyField()
+    name = serializers.CharField(required=False)
+    openflow_id = serializers.CharField(required=False)
+    config_key = serializers.CharField(required=False)
+    driver = serializers.CharField(required=False)
+    vrouter_service = serializers.PrimaryKeyRelatedField(read_only=True)
+
+    ports = serializers.SerializerMethodField("getDevicePorts")
+
+    def getDevicePorts(self, device):
+        ports = VRouterPort.objects.filter(vrouter_device=device.id)
+        return VRouterPortSerializer(ports, many=True).data
+
+    class Meta:
+        model = VRouterDevice
+        fields = ('id', 'name', 'openflow_id', 'config_key', 'driver', 'vrouter_service', 'ports')
+
+
+class VRouterPortSerializer(PlusModelSerializer):
+    id = ReadOnlyField()
+    name = serializers.CharField(required=False)
+    openflow_id = serializers.CharField(required=False)
+    interfaces = serializers.SerializerMethodField("getPortInterfaces")
+
+    def getPortInterfaces(self, port):
+        interfaces = VRouterInterface.objects.filter(vrouter_port=port.id)
+        return VRouterInterfaceSerializer(interfaces, many=True).data
+
+    class Meta:
+        model = VRouterPort
+        fields = ('id', 'name', 'openflow_id', 'interfaces')
+
+
+class VRouterInterfaceSerializer(PlusModelSerializer):
+    id = ReadOnlyField()
+    name = serializers.CharField(required=False)
+    mac = serializers.CharField(required=False)
+    vlan = serializers.CharField(required=False)
+    ips = serializers.SerializerMethodField("getInterfaceIps")
+
+    def getInterfaceIps(self, interface):
+        interfaces = VRouterIp.objects.filter(vrouter_interface=interface.id)
+        return VRouterIpSerializer(interfaces, many=True).data
+
+    class Meta:
+        model = VRouterPort
+        fields = ('id', 'name', 'mac', 'vlan', 'ips')
+
+
+class VRouterIpSerializer(PlusModelSerializer):
+    id = ReadOnlyField()
+    ip = serializers.CharField(required=False)
+    name = serializers.CharField(required=False)
+
+    class Meta:
+        model = VRouterIp
+        fields = ('id', 'ip', 'name')
+
+
+class VRouterAppSerializer(PlusModelSerializer):
+    id = ReadOnlyField()
+    name = serializers.CharField(required=False)
+    control_plane_connect_point = serializers.CharField(required=False)
+    ospf_enabled = serializers.BooleanField(required=False)
+    interfaces = serializers.SerializerMethodField("dumpInterfaces")
+
+    def dumpInterfaces(self, app):
+        return json.dumps(app.interfaces)
+
+    class Meta:
+        model = VRouterApp
+        fields = ('id', 'name', 'control_plane_connect_point', 'ospf_enabled', 'interfaces')
+
+
+class VRouterServiceViewSet(XOSViewSet):
+    base_name = BASE_NAME
+    method_name = "vrouter"
+    method_kind = "viewset"
+    queryset = VRouterService.objects.filter(kind='vROUTER')
+    serializer_class = VRouterServiceSerializer
+
+    @classmethod
+    def get_urlpatterns(self, api_path="^"):
+        patterns = super(VRouterServiceViewSet, self).get_urlpatterns(api_path=api_path)
+
+        patterns.append(self.detail_url("devices/$", {
+            "get": "get_devices"
+        }, "vrouter_devices"))
+
+        patterns.append(self.detail_url("apps/$", {
+            "get": "get_apps"
+        }, "vrouter_apps"))
+
+        return patterns
+
+    def get_devices(self, request, pk=None):
+        if (not request.user.is_authenticated()):
+            raise XOSPermissionDenied("You must be authenticated in order to use this API")
+        else:
+            if(pk is not None):
+                devices = VRouterDevice.objects.filter(vrouter_service=pk)
+            else:
+                devices = VRouterDevice.objects.all()
+            return Response(VRouterDeviceSerializer(devices, many=True).data)
+
+    def get_apps(self, request, pk=None):
+        if (not request.user.is_authenticated()):
+            raise XOSPermissionDenied("You must be authenticated in order to use this API")
+        else:
+            if(pk is not None):
+                apps = VRouterApp.objects.filter(vrouter_service=pk)
+            else:
+                apps = VRouterApp.objects.all()
+            return Response(VRouterAppSerializer(apps, many=True).data)
diff --git a/xos/macros.m4 b/xos/macros.m4
new file mode 100644
index 0000000..1f48f10
--- /dev/null
+++ b/xos/macros.m4
@@ -0,0 +1,84 @@
+# Note: Tosca derived_from isn't working the way I think it should, it's not
+#    inheriting from the parent template. Until we get that figured out, use
+#    m4 macros do our inheritance
+
+define(xos_base_props,
+            no-delete:
+                type: boolean
+                default: false
+                description: Do not allow Tosca to delete this object
+            no-create:
+                type: boolean
+                default: false
+                description: Do not allow Tosca to create this object
+            no-update:
+                type: boolean
+                default: false
+                description: Do not allow Tosca to update this object
+            replaces:
+                type: string
+                required: false
+                descrption: Replaces/renames this object)
+# Service
+define(xos_base_service_caps,
+            scalable:
+                type: tosca.capabilities.Scalable
+            service:
+                type: tosca.capabilities.xos.Service)
+define(xos_base_service_props,
+            kind:
+                type: string
+                default: generic
+                description: Type of service.
+            view_url:
+                type: string
+                required: false
+                description: URL to follow when icon is clicked in the Service Directory.
+            icon_url:
+                type: string
+                required: false
+                description: ICON to display in the Service Directory.
+            enabled:
+                type: boolean
+                default: true
+            published:
+                type: boolean
+                default: true
+                description: If True then display this Service in the Service Directory.
+            public_key:
+                type: string
+                required: false
+                description: Public key to install into Instances to allows Services to SSH into them.
+            private_key_fn:
+                type: string
+                required: false
+                description: Location of private key file
+            versionNumber:
+                type: string
+                required: false
+                description: Version number of Service.)
+# Subscriber
+define(xos_base_subscriber_caps,
+            subscriber:
+                type: tosca.capabilities.xos.Subscriber)
+define(xos_base_subscriber_props,
+            kind:
+                type: string
+                default: generic
+                description: Kind of subscriber
+            service_specific_id:
+                type: string
+                required: false
+                description: Service specific ID opaque to XOS but meaningful to service)
+define(xos_base_tenant_props,
+            kind:
+                type: string
+                default: generic
+                description: Kind of tenant
+            service_specific_id:
+                type: string
+                required: false
+                description: Service specific ID opaque to XOS but meaningful to service)
+
+# end m4 macros
+
diff --git a/xos/models.py b/xos/models.py
index d302b13..8396d3e 100644
--- a/xos/models.py
+++ b/xos/models.py
@@ -12,35 +12,77 @@
 from xos.exceptions import *
 from xos.config import Config
 
+
 class ConfigurationError(Exception):
     pass
 
 
 VROUTER_KIND = "vROUTER"
+APP_LABEL = "vrouter"
 
 # NOTE: don't change VROUTER_KIND unless you also change the reference to it
 #   in tosca/resources/network.py
 
 CORD_USE_VTN = getattr(Config(), "networking_use_vtn", False)
 
+
 class VRouterService(Service):
     KIND = VROUTER_KIND
 
     class Meta:
-        app_label = "vrouter"
+        app_label = APP_LABEL
         verbose_name = "vRouter Service"
         proxy = True
 
+    default_attributes = {
+        "rest_hostname": "",
+        "rest_port": "8181",
+        "rest_user": "onos",
+        "rest_pass": "rocks"
+    }
+
+    @property
+    def rest_hostname(self):
+        return self.get_attribute("rest_hostname", self.default_attributes["rest_hostname"])
+
+    @rest_hostname.setter
+    def rest_hostname(self, value):
+        self.set_attribute("rest_hostname", value)
+
+    @property
+    def rest_port(self):
+        return self.get_attribute("rest_port", self.default_attributes["rest_port"])
+
+    @rest_port.setter
+    def rest_port(self, value):
+        self.set_attribute("rest_port", value)
+
+    @property
+    def rest_user(self):
+        return self.get_attribute("rest_user", self.default_attributes["rest_user"])
+
+    @rest_user.setter
+    def rest_user(self, value):
+        self.set_attribute("rest_user", value)
+
+    @property
+    def rest_pass(self):
+        return self.get_attribute("rest_pass", self.default_attributes["rest_pass"])
+
+    @rest_pass.setter
+    def rest_pass(self, value):
+        self.set_attribute("rest_pass", value)
+
     def ip_to_mac(self, ip):
         (a, b, c, d) = ip.split('.')
         return "02:42:%02x:%02x:%02x:%02x" % (int(a), int(b), int(c), int(d))
 
     def get_gateways(self):
-        gateways=[]
+        gateways = []
 
         aps = self.addresspools.all()
         for ap in aps:
-            gateways.append( {"gateway_ip": ap.gateway_ip, "gateway_mac": ap.gateway_mac} )
+            gateways.append({"gateway_ip": ap.gateway_ip, "gateway_mac": ap.gateway_mac})
 
         return gateways
 
@@ -67,18 +109,19 @@
 
         return t
 
-#VRouterService.setup_simple_attributes()
 
 class VRouterTenant(Tenant):
     class Meta:
         proxy = True
+        verbose_name = "vRouter Tenant"
 
     KIND = VROUTER_KIND
 
-    simple_attributes = ( ("public_ip", None),
-                          ("public_mac", None),
-                          ("address_pool_id", None),
-                          )
+    simple_attributes = (
+        ("public_ip", None),
+        ("public_mac", None),
+        ("address_pool_id", None),
+    )
 
     @property
     def gateway_ip(self):
@@ -103,7 +146,7 @@
         # return number of bits in the network portion of the cidr
         if self.cidr:
             parts = self.cidr.split("/")
-            if len(parts)==2:
+            if len(parts) == 2:
                 return int(parts[1].strip())
         return None
 
@@ -113,10 +156,10 @@
             return self.cached_address_pool
         if not self.address_pool_id:
             return None
-        aps=AddressPool.objects.filter(id=self.address_pool_id)
+        aps = AddressPool.objects.filter(id=self.address_pool_id)
         if not aps:
             return None
-        ap=aps[0]
+        ap = aps[0]
         self.cached_address_pool = ap
         return ap
 
@@ -125,7 +168,7 @@
         if value:
             value = value.id
         if (value != self.get_attribute("address_pool_id", None)):
-            self.cached_address_pool=None
+            self.cached_address_pool = None
         self.set_attribute("address_pool_id", value)
 
     def cleanup_addresspool(self):
@@ -141,3 +184,75 @@
 
 VRouterTenant.setup_simple_attributes()
 
+
+# DEVICES
+class VRouterDevice(PlCoreBase):
+    """define the information related to an device used by vRouter"""
+    class Meta:
+        app_label = APP_LABEL
+        verbose_name = "vRouter Device"
+
+    name = models.CharField(max_length=20, help_text="device friendly name", null=True, blank=True)
+    openflow_id = models.CharField(max_length=20, help_text="device identifier in ONOS", null=False, blank=False)
+    config_key = models.CharField(max_length=32, help_text="configuration key", null=False, blank=False, default="basic")
+    driver = models.CharField(max_length=32, help_text="driver type", null=False, blank=False)
+    vrouter_service = models.ForeignKey(VRouterService, related_name='devices')
+
+
+# PORTS
+class VRouterPort(PlCoreBase):
+    class Meta:
+        app_label = APP_LABEL
+        verbose_name = "vRouter Port"
+
+    name = models.CharField(max_length=20, help_text="port friendly name", null=True, blank=True)
+    openflow_id = models.CharField(max_length=21, help_text="port identifier in ONOS", null=False, blank=False)
+    vrouter_device = models.ForeignKey(VRouterDevice, related_name='ports')
+    # NOTE probably is not meaningful to relate a port to a service
+    vrouter_service = models.ForeignKey(VRouterService, related_name='device_ports')
+
+
+class VRouterInterface(PlCoreBase):
+    class Meta:
+        app_label = APP_LABEL
+        verbose_name = "vRouter Interface"
+
+    name = models.CharField(max_length=20, help_text="interface friendly name", null=True, blank=True)
+    vrouter_port = models.ForeignKey(VRouterPort, related_name='interfaces')
+    name = models.CharField(max_length=10, help_text="interface name", null=False, blank=False)
+    mac = models.CharField(max_length=17, help_text="interface mac", null=False, blank=False)
+    vlan = models.CharField(max_length=10, help_text="interface vlan id", null=True, blank=True)
+
+
+class VRouterIp(PlCoreBase):
+    class Meta:
+        app_label = APP_LABEL
+        verbose_name = "vRouter Ip"
+
+    name = models.CharField(max_length=20, help_text="ip friendly name", null=True, blank=True)
+    vrouter_interface = models.ForeignKey(VRouterInterface, related_name='ips')
+    ip = models.CharField(max_length=19, help_text="interface ips", null=False, blank=False)
+
+
+# APPS
+class VRouterApp(PlCoreBase):
+    class Meta:
+        app_label = "vrouter"
+        verbose_name = "vRouter App"
+
+    def _get_interfaces(self):
+        app_interfaces = []
+        devices = VRouterDevice.objects.filter(vrouter_service=self.vrouter_service)
+        for device in devices:
+            ports = VRouterPort.objects.filter(vrouter_device=device.id)
+            for port in ports:
+                interfaces = VRouterInterface.objects.filter(vrouter_port=port.id)
+                for iface in interfaces:
+                    app_interfaces.append(iface.name)
+        return app_interfaces
+
+    vrouter_service = models.ForeignKey(VRouterService, related_name='apps')
+    name = models.CharField(max_length=50, help_text="application name", null=False, blank=False)
+    control_plane_connect_point = models.CharField(max_length=21, help_text="port identifier in ONOS", null=False, blank=False)
+    ospf_enabled = models.BooleanField(default=True, help_text="ospf enabled")
+    interfaces = property(_get_interfaces)
diff --git a/xos/synchronizer/curl_sample.md b/xos/synchronizer/curl_sample.md
new file mode 100644
index 0000000..4675fd8
--- /dev/null
+++ b/xos/synchronizer/curl_sample.md
@@ -0,0 +1,13 @@
+# vRouter App
+
+## Configure vRouter App in ONOS
+`curl -H "Content-Type: application/json" -X POST -d '{"controlPlaneConnectPoint":"of:001/1", "ospfEnabled": "true", "interfaces": ["b1-1"]}' --user onos:rocks http://onos-fabric:8181/onos/v1/network/configuration/apps/org.onosproject.router/router/`
+
+## Delete vRotuer App config
+`curl -X DELETE --user onos:rocks http://onos-fabric:8181/onos/v1/network/configuration/apps/org.onosproject.router/router/`
+
+## Check vRotuer App config
+`curl --user onos:rocks http://onos-fabric:8181/onos/v1/network/configuration/apps/org.onosproject.router/router/`
+
+## Add Port
+`curl --user onos:rocks -H "Content-Type: application/json" -X POST -d {"of:000000000001/1": {"interfaces": [{"ips": ["10.0.4.2/24"], "mac": "00:00:00:00:00:01", "vlan": "100", "name": "b1-1"}]}} http://onos-fabric:8181/onos/v1/network/configuration/ports/`
\ No newline at end of file
diff --git a/xos/synchronizer/manifest b/xos/synchronizer/manifest
new file mode 100644
index 0000000..e2483ed
--- /dev/null
+++ b/xos/synchronizer/manifest
@@ -0,0 +1,8 @@
+manifest
+model_deps
+run.sh
+steps/sync_vrouterapp.py
+steps/sync_vrouterdevice.py
+steps/sync_vrouterports.py
+vrouter-synchronizer.py
+vrouter_config
diff --git a/xos/synchronizer/model_deps b/xos/synchronizer/model_deps
new file mode 100644
index 0000000..9e26dfe
--- /dev/null
+++ b/xos/synchronizer/model_deps
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/xos/synchronizer/run.sh b/xos/synchronizer/run.sh
new file mode 100644
index 0000000..64600d6
--- /dev/null
+++ b/xos/synchronizer/run.sh
@@ -0,0 +1,2 @@
+export XOS_DIR=/opt/xos
+python vrouter-synchronizer.py  -C $XOS_DIR/synchronizers/vrouter/vrouter_config
\ No newline at end of file
diff --git a/xos/synchronizer/steps/sync_vrouterapp.py b/xos/synchronizer/steps/sync_vrouterapp.py
new file mode 100644
index 0000000..b7d3576
--- /dev/null
+++ b/xos/synchronizer/steps/sync_vrouterapp.py
@@ -0,0 +1,75 @@
+import os
+import sys
+import requests
+import json
+from django.db.models import Q, F
+from services.vrouter.models import *
+from synchronizers.base.syncstep import SyncStep
+from xos.logger import Logger, logging
+
+# from core.models import Service
+from requests.auth import HTTPBasicAuth
+
+parentdir = os.path.join(os.path.dirname(__file__), "..")
+sys.path.insert(0, parentdir)
+
+logger = Logger(level=logging.INFO)
+
+
+class SyncVRouterApp(SyncStep):
+    provides = [VRouterApp]
+
+    observes = VRouterApp
+
+    requested_interval = 0
+
+    def __init__(self, *args, **kwargs):
+        super(SyncVRouterApp, self).__init__(*args, **kwargs)
+
+    def get_onos_fabric_addr(self, app):
+        vrouter_service = VRouterService.objects.get(id=app.vrouter_service_id)
+
+        return "http://%s:%s/onos/v1/network/configuration/" % (vrouter_service.rest_hostname, vrouter_service.rest_port)
+
+    def get_onos_fabric_auth(self, app):
+        vrouter_service = VRouterService.objects.get(id=app.vrouter_service_id)
+
+        return HTTPBasicAuth(vrouter_service.rest_user, vrouter_service.rest_pass)
+
+    def sync_record(self, app):
+
+        logger.info("Sync'ing Edited vRouterApps: %s" % app.name)
+
+        onos_addr = self.get_onos_fabric_addr(app)
+
+        data = {}
+        data["controlPlaneConnectPoint"] = app.control_plane_connect_point
+        data["ospfEnabled"] = app.ospf_enabled
+        data["interfaces"] = app.interfaces
+
+        url = onos_addr + "apps/" + app.name + "/router/"
+
+        print "POST %s for app %s" % (url, app.name)
+
+        # XXX fixme - hardcoded auth
+        auth = self.get_onos_fabric_auth(app)
+        r = requests.post(url, data=json.dumps(data), auth=auth)
+        if (r.status_code != 200):
+            print r
+            raise Exception("Received error from vrouter app update (%d)" % r.status_code)
+
+    def delete_record(self, app):
+
+        logger.info("Sync'ing Deleted vRouterApps: %s" % app.name)
+
+        onos_addr = self.get_onos_fabric_addr()
+
+        url = onos_addr + "apps/" + app.name + "/"
+
+        print "DELETE %s for app %s" % (url, app.name)
+
+        auth = self.get_onos_fabric_auth(app)
+        r = requests.delete(url, auth=auth)
+        if (r.status_code != 204):
+            print r
+            raise Exception("Received error from vrouter app deletion (%d)" % r.status_code)
\ No newline at end of file
diff --git a/xos/synchronizer/steps/sync_vrouterdevice.py b/xos/synchronizer/steps/sync_vrouterdevice.py
new file mode 100644
index 0000000..36e00db
--- /dev/null
+++ b/xos/synchronizer/steps/sync_vrouterdevice.py
@@ -0,0 +1,72 @@
+import os
+import sys
+import requests
+import json
+from django.db.models import Q, F
+from services.vrouter.models import *
+from synchronizers.base.syncstep import SyncStep
+from xos.logger import Logger, logging
+
+# from core.models import Service
+from requests.auth import HTTPBasicAuth
+
+parentdir = os.path.join(os.path.dirname(__file__), "..")
+sys.path.insert(0, parentdir)
+
+logger = Logger(level=logging.INFO)
+
+
+class SyncVRouterDevice(SyncStep):
+    provides = [VRouterDevice]
+
+    observes = VRouterDevice
+
+    requested_interval = 0
+
+    def __init__(self, *args, **kwargs):
+        super(SyncVRouterDevice, self).__init__(*args, **kwargs)
+
+    def get_onos_fabric_addr(self, app):
+        vrouter_service = VRouterService.objects.get(id=app.vrouter_service_id)
+
+        return "http://%s:%s/onos/v1/network/configuration/" % (vrouter_service.rest_hostname, vrouter_service.rest_port)
+
+    def get_onos_fabric_auth(self, app):
+        vrouter_service = VRouterService.objects.get(id=app.vrouter_service_id)
+
+        return HTTPBasicAuth(vrouter_service.rest_user, vrouter_service.rest_pass)
+
+    def sync_record(self, device):
+
+        logger.info("Sync'ing Edited vRouterDevice: %s" % device.name)
+
+        onos_addr = self.get_onos_fabric_addr(device)
+
+        data = {}
+        data["driver"] = device.driver
+
+        url = onos_addr + "devices/" + device.openflow_id + "/" + device.config_key + "/"
+
+        print "POST %s for device %s" % (url, device.name)
+
+        auth = self.get_onos_fabric_auth(device)
+        r = requests.post(url, data=json.dumps(data), auth=auth)
+        if (r.status_code != 200):
+            print r
+            raise Exception("Received error from vrouter device update (%d)" % r.status_code)
+
+    def delete_record(self, device):
+
+        logger.info("Sync'ing Deleted vRouterDevice: %s" % device.name)
+
+        onos_addr = self.get_onos_fabric_addr()
+
+        url = onos_addr + "devices/" + device.openflow_id + "/"
+
+        print "DELETE %s for device %s" % (url, device.name)
+
+        auth = self.get_onos_fabric_auth(device)
+        r = requests.delete(url, auth=auth)
+        if (r.status_code != 204):
+            print r
+            raise Exception("Received error from vrouter device deletion (%d)" % r.status_code)
\ No newline at end of file
diff --git a/xos/synchronizer/steps/sync_vrouterports.py b/xos/synchronizer/steps/sync_vrouterports.py
new file mode 100644
index 0000000..e19c51e
--- /dev/null
+++ b/xos/synchronizer/steps/sync_vrouterports.py
@@ -0,0 +1,95 @@
+import os
+import sys
+import requests
+import json
+import urllib
+from django.db.models import Q, F
+from services.vrouter.models import *
+from synchronizers.base.syncstep import SyncStep
+from xos.logger import Logger, logging
+
+# from core.models import Service
+from requests.auth import HTTPBasicAuth
+
+parentdir = os.path.join(os.path.dirname(__file__), "..")
+sys.path.insert(0, parentdir)
+
+logger = Logger(level=logging.INFO)
+
+
+class SyncVRouterPort(SyncStep):
+    provides = [VRouterPort]
+
+    observes = VRouterPort
+
+    requested_interval = 0
+
+    def __init__(self, *args, **kwargs):
+        super(SyncVRouterPort, self).__init__(*args, **kwargs)
+
+    def get_onos_fabric_addr(self, app):
+        vrouter_service = VRouterService.objects.get(id=app.vrouter_service_id)
+
+        return "http://%s:%s/onos/v1/network/configuration/" % (vrouter_service.rest_hostname, vrouter_service.rest_port)
+
+    def get_onos_fabric_auth(self, app):
+        vrouter_service = VRouterService.objects.get(id=app.vrouter_service_id)
+
+        return HTTPBasicAuth(vrouter_service.rest_user, vrouter_service.rest_pass)
+
+    def sync_record(self, port):
+
+        logger.info("Sync'ing Edited vRouterPort: %s" % port.name)
+
+        # NOTE port is now related to service,
+        # probably it makes more sense to relate them to a device (and device is related to service)
+        onos_addr = self.get_onos_fabric_addr(port)
+
+        # NOTE
+        # from a port read all interfaces
+        # from interfaces read all ips
+
+        ifaces = []
+        for interface in port.interfaces.all():
+            iface = {
+                'name': interface.name,
+                'mac': interface.mac,
+                'vlan': interface.vlan,
+                'ips': []
+            }
+
+            for ip in interface.ips.all():
+                iface["ips"].append(ip.ip)
+
+            ifaces.append(iface)
+
+        data = {}
+        data[port.openflow_id] = {
+            'interfaces': ifaces
+        }
+
+        url = onos_addr + "ports/"
+
+        print "POST %s for port %s" % (url, port.name)
+
+        auth = self.get_onos_fabric_auth(port)
+        r = requests.post(url, data=json.dumps(data), auth=auth)
+        if (r.status_code != 200):
+            print r
+            raise Exception("Received error from vrouter port update (%d)" % r.status_code)
+
+    def delete_record(self, port):
+
+        logger.info("Sync'ing Deleted vRouterPort: %s" % port.name)
+
+        onos_addr = self.get_onos_fabric_addr()
+
+        url = onos_addr + "ports/" + urllib.quote(port.openflow_id, safe='') + "/"
+
+        print "DELETE %s for port %s" % (url, port.name)
+
+        auth = self.get_onos_fabric_auth(port)
+        r = requests.delete(url, auth=auth)
+        if (r.status_code != 204):
+            print r
+            raise Exception("Received error from vrouter port deletion (%d)" % r.status_code)
\ No newline at end of file
diff --git a/xos/synchronizer/vrouter-synchronizer.py b/xos/synchronizer/vrouter-synchronizer.py
new file mode 100644
index 0000000..93dcb72
--- /dev/null
+++ b/xos/synchronizer/vrouter-synchronizer.py
@@ -0,0 +1,13 @@
+#!/usr/bin/env python
+
+# Runs the standard XOS synchronizer
+
+import importlib
+import os
+import sys
+
+synchronizer_path = os.path.join(os.path.dirname(
+    os.path.realpath(__file__)), "../../synchronizers/base")
+sys.path.append(synchronizer_path)
+mod = importlib.import_module("xos-synchronizer")
+mod.main()
diff --git a/xos/synchronizer/vrouter_config b/xos/synchronizer/vrouter_config
new file mode 100644
index 0000000..2af1700
--- /dev/null
+++ b/xos/synchronizer/vrouter_config
@@ -0,0 +1,23 @@
+# Required by XOS
+[db]
+name=xos
+user=postgres
+password=password
+host=localhost
+port=5432
+ 
+# Required by XOS
+[api]
+nova_enabled=True
+ 
+# Sets options for the synchronizer
+[observer]
+name=vrouter
+dependency_graph=/opt/xos/synchronizers/vrouter/model_deps
+steps_dir=/opt/xos/synchronizers/vrouter/steps
+sys_dir=/opt/xos/synchronizers/vrouter/sys
+logfile=/var/log/xos_backend.log
+pretend=False
+backoff_disabled=True
+save_ansible_output=True
+proxy_ssh=False
\ No newline at end of file
diff --git a/xos/templates/vrouteradmin.html b/xos/templates/vrouteradmin.html
index e69de29..205ad3e 100644
--- a/xos/templates/vrouteradmin.html
+++ b/xos/templates/vrouteradmin.html
@@ -0,0 +1,22 @@
+<div class="row">
+  <div class="col-sm-4">
+    <a href="/admin/vrouter/vroutertenant/" class="btn btn-primary">vRouter Tenants</a>
+  </div>
+  <div class="col-sm-4">
+    <a href="/admin/vrouter/vrouterapps/" class="btn btn-primary">vRouter Apps</a>
+  </div>
+  <div class="col-sm-4">
+    <a href="/admin/vrouter/vrouterdevices/" class="btn btn-primary">vRouter Devices</a>
+  </div>
+</div>
+<div class="row">
+  <div class="col-sm-4">
+    <a href="/admin/vrouter/vrouterports/" class="btn btn-primary">vRouter Ports</a>
+  </div>
+  <div class="col-sm-4">
+    <a href="/admin/vrouter/vrouterinterfaces/" class="btn btn-primary">vRouter Interfaces</a>
+  </div>
+  <div class="col-sm-4">
+    <a href="/admin/vrouter/vrouterips/" class="btn btn-primary">vRouter Ips</a>
+  </div>
+</div>
\ No newline at end of file
diff --git a/xos/tosca/resources/vrouterservice.py b/xos/tosca/resources/vrouterservice.py
index 64ee455..6b422c2 100644
--- a/xos/tosca/resources/vrouterservice.py
+++ b/xos/tosca/resources/vrouterservice.py
@@ -1,8 +1,90 @@
 from service import XOSService
-from services.vrouter.models import VRouterService
+from services.vrouter.models import *
+
 
 class XOSVRouterService(XOSService):
     provides = "tosca.nodes.VRouterService"
     xos_model = VRouterService
-    copyin_props = ["view_url", "icon_url", "enabled", "published", "public_key", "versionNumber"]
+    copyin_props = ["view_url", "icon_url", "enabled", "published", "public_key", "versionNumber",
+                    "rest_hostname", "rest_port", "rest_user", "rest_pass"]
 
+
+class XOSVRouterDevice(XOSService):
+    provides = "tosca.nodes.VRouterDevice"
+    xos_model = VRouterDevice
+    copyin_props = ['openflow_id', 'config_key', 'driver']
+
+    def get_xos_args(self):
+        args = super(XOSVRouterDevice, self).get_xos_args()
+
+        serviceName = self.get_requirement("tosca.relationships.MemberOfService", throw_exception=False)
+        if serviceName:
+            service = self.get_xos_object(Service, name=serviceName)
+            args["vrouter_service_id"] = service.id
+        return args
+
+
+class XOSVRouterPort(XOSService):
+    provides = "tosca.nodes.VRouterPort"
+    xos_model = VRouterPort
+    copyin_props = ['openflow_id']
+
+    def get_xos_args(self):
+        args = super(XOSVRouterPort, self).get_xos_args()
+
+        deviceName = self.get_requirement("tosca.relationships.PortOfDevice", throw_exception=False)
+        if deviceName:
+            device = self.get_xos_object(VRouterDevice, name=deviceName)
+            args["vrouter_device"] = device
+
+        serviceName = self.get_requirement("tosca.relationships.MemberOfService", throw_exception=False)
+        if serviceName:
+            service = self.get_xos_object(Service, name=serviceName)
+            args["vrouter_service_id"] = service.id
+
+        return args
+
+
+class XOSVRouterInterface(XOSService):
+    provides = "tosca.nodes.VRouterInterface"
+    xos_model = VRouterInterface
+    copyin_props = ['name', 'mac', 'vlan']
+
+    def get_xos_args(self):
+        args = super(XOSVRouterInterface, self).get_xos_args()
+
+        portName = self.get_requirement("tosca.relationships.InterfaceOfPort", throw_exception=False)
+        if portName:
+            port = self.get_xos_object(VRouterPort, name=portName)
+            args["vrouter_port"] = port
+        return args
+
+
+class XOSVRouterIp(XOSService):
+    provides = "tosca.nodes.VRouterIp"
+    xos_model = VRouterIp
+    copyin_props = ['ip']
+
+    def get_xos_args(self):
+        args = super(XOSVRouterIp, self).get_xos_args()
+
+        interfaceName = self.get_requirement("tosca.relationships.IpOfInterface", throw_exception=False)
+        if interfaceName:
+            interface = self.get_xos_object(VRouterInterface, name=interfaceName)
+            args["vrouter_interface"] = interface
+        return args
+
+
+class XOSVRouterApp(XOSService):
+    provides = "tosca.nodes.VRouterApp"
+    xos_model = VRouterApp
+    copyin_props = ['name', 'control_plane_connect_point', 'ospf_enabled']
+
+    def get_xos_args(self):
+        args = super(XOSVRouterApp, self).get_xos_args()
+
+        serviceName = self.get_requirement("tosca.relationships.MemberOfService", throw_exception=True)
+        if serviceName:
+            service = self.get_xos_object(Service, name=serviceName)
+            args["vrouter_service_id"] = service.id
+        return args
diff --git a/xos/tosca/sample.yaml b/xos/tosca/sample.yaml
new file mode 100644
index 0000000..f1131f2
--- /dev/null
+++ b/xos/tosca/sample.yaml
@@ -0,0 +1,74 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: Just enough Tosca to get the vSG slice running on the CORD POD
+
+imports:
+   - custom_types/xos.yaml
+   - custom_types/vrouter.yaml
+
+topology_template:
+  node_templates:
+
+    service#vRouterSample:
+      type: tosca.nodes.VRouterService
+      properties:
+          view_url: /admin/vrouter/vrouterservice/$id$/
+          rest_hostname: 10.0.2.2
+          rest_port: 8181
+          rest_user: onos
+          rest_pass: rocks
+    
+    device#switch:
+      type: tosca.nodes.VRouterDevice
+      properties:
+        openflow_id: of:000000000001
+        driver: softrouter
+        # config_key: basic
+      requirements:
+        - service#vRouterSample:
+            node: service#vRouterSample
+            relationship: tosca.relationships.MemberOfService
+
+    port#sample_port:
+      type: tosca.nodes.VRouterPort
+      properties:
+        openflow_id: of:000000000001/1
+      requirements:
+        - device#switch:
+            node: device#switch
+            relationship: tosca.relationships.PortOfDevice
+        - service#vRouterSample:
+            node: service#vRouterSample
+            relationship: tosca.relationships.MemberOfService
+
+    interface#b1-1:
+      type: tosca.nodes.VRouterInterface
+      properties:
+        name: b1-1
+        mac: 00:00:00:00:00:01
+        vlan: 100
+      requirements:
+        - port#sample_port:
+            node: port#sample_port
+            relationship: tosca.relationships.InterfaceOfPort
+
+    vrouter_ips:
+      type: tosca.nodes.VRouterIp
+      properties:
+        ip: 10.0.4.2/24
+      requirements:
+        - interface#b1-1:
+            node: interface#b1-1
+            relationship: tosca.relationships.IpOfInterface
+
+    app#vrouterApp:
+      type: tosca.nodes.VRouterApp
+      properties:
+        name: org.onosproject.router
+        # can we use a relation to specify the connect point port?
+        control_plane_connect_point: of:00000000000000b1/5
+        ospf_enabled: true
+      requirements:
+          - service#vRouterSample:
+              node: service#vRouterSample
+              relationship: tosca.relationships.MemberOfService
diff --git a/xos/vrouter-onboard.yaml b/xos/vrouter-onboard.yaml
index af479e0..f53c212 100644
--- a/xos/vrouter-onboard.yaml
+++ b/xos/vrouter-onboard.yaml
@@ -16,5 +16,9 @@
           models: models.py
           admin: admin.py
           admin_template: templates/vrouteradmin.html
+          tosca_custom_types: vrouter.yaml
           tosca_resource: tosca/resources/vrouterservice.py
+          rest_service: api/service/vrouter.py
+          synchronizer: synchronizer/manifest
+          synchronizer_run: vrouter-synchronizer.py
 
diff --git a/xos/vrouter.m4 b/xos/vrouter.m4
new file mode 100644
index 0000000..08e1e69
--- /dev/null
+++ b/xos/vrouter.m4
@@ -0,0 +1,120 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+# compile this with "m4 vrouter.m4 > vrouter.yaml"
+
+# include macros
+include(macros.m4)
+
+node_types:
+    
+    tosca.nodes.VRouterService:
+        derived_from: tosca.nodes.Root
+        description: >
+            CORD: The vRouter Service.
+        capabilities:
+            xos_base_service_caps
+        properties:
+            xos_base_props
+            xos_base_service_props
+            rest_hostname:
+                type: string
+                required: false
+            rest_port:
+                type: string
+                required: false
+            rest_user:
+                type: string
+                required: false
+            rest_pass:
+                type: string
+                required: false
+
+    tosca.nodes.VRouterDevice:
+        derived_from: tosca.nodes.Root
+        description: >
+            CORD: The vRouter Device.
+        capabilities:
+            xos_base_service_caps
+        properties:
+            xos_base_props
+            openflow_id:
+                type: string
+                required: true
+            config_key:
+                type: string
+                required: false
+            driver:
+                type: string
+                required: true
+
+    tosca.nodes.VRouterPort:
+        derived_from: tosca.nodes.Root
+        description: >
+            CORD: The vRouter Port.
+        capabilities:
+            xos_base_service_caps
+        properties:
+            xos_base_props
+            openflow_id:
+                type: string
+                required: true
+
+    tosca.nodes.VRouterInterface:
+        derived_from: tosca.nodes.Root
+        description: >
+            CORD: The vRouter Interface.
+        capabilities:
+            xos_base_service_caps
+        properties:
+            xos_base_props
+            name:
+                type: string
+                required: true
+            mac:
+                type: string
+                required: true
+            vlan:
+                type: string
+                required: false
+
+    tosca.nodes.VRouterIp:
+        derived_from: tosca.nodes.Root
+        description: >
+            CORD: The vRouter Ip.
+        capabilities:
+            xos_base_service_caps
+        properties:
+            xos_base_props
+            ip:
+                type: string
+                required: true
+
+    tosca.nodes.VRouterApp:
+        derived_from: tosca.nodes.Root
+        description: >
+            CORD: The vRouter ONOS App Config.
+        capabilities:
+            xos_base_service_caps
+        properties:
+            xos_base_props
+            name:
+                type: string
+                required: true
+            control_plane_connect_point:
+                type: string
+                required: true
+            ospf_enabled:
+                type: boolean
+                required: true
+
+    tosca.relationships.PortOfDevice:
+            derived_from: tosca.relationships.Root
+            valid_target_types: [ tosca.capabilities.xos.VRouterPort ]
+
+    tosca.relationships.InterfaceOfPort:
+            derived_from: tosca.relationships.Root
+            valid_target_types: [ tosca.capabilities.xos.VRouterInterface ]
+
+    tosca.relationships.IpOfInterface:
+            derived_from: tosca.relationships.Root
+            valid_target_types: [ tosca.capabilities.xos.VRouterIp ]
\ No newline at end of file
diff --git a/xos/vrouter.yaml b/xos/vrouter.yaml
new file mode 100644
index 0000000..1f087ce
--- /dev/null
+++ b/xos/vrouter.yaml
@@ -0,0 +1,273 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+# compile this with "m4 vrouter.m4 > vrouter.yaml"
+
+# include macros
+# Note: Tosca derived_from isn't working the way I think it should, it's not
+#    inheriting from the parent template. Until we get that figured out, use
+#    m4 macros do our inheritance
+
+
+# Service
+
+
+# Subscriber
+
+
+
+
+# end m4 macros
+
+
+
+node_types:
+    
+    tosca.nodes.VRouterService:
+        derived_from: tosca.nodes.Root
+        description: >
+            CORD: The vRouter Service.
+        capabilities:
+            scalable:
+                type: tosca.capabilities.Scalable
+            service:
+                type: tosca.capabilities.xos.Service
+        properties:
+            no-delete:
+                type: boolean
+                default: false
+                description: Do not allow Tosca to delete this object
+            no-create:
+                type: boolean
+                default: false
+                description: Do not allow Tosca to create this object
+            no-update:
+                type: boolean
+                default: false
+                description: Do not allow Tosca to update this object
+            replaces:
+                type: string
+                required: false
+                descrption: Replaces/renames this object
+            kind:
+                type: string
+                default: generic
+                description: Type of service.
+            view_url:
+                type: string
+                required: false
+                description: URL to follow when icon is clicked in the Service Directory.
+            icon_url:
+                type: string
+                required: false
+                description: ICON to display in the Service Directory.
+            enabled:
+                type: boolean
+                default: true
+            published:
+                type: boolean
+                default: true
+                description: If True then display this Service in the Service Directory.
+            public_key:
+                type: string
+                required: false
+                description: Public key to install into Instances to allows Services to SSH into them.
+            private_key_fn:
+                type: string
+                required: false
+                description: Location of private key file
+            versionNumber:
+                type: string
+                required: false
+                description: Version number of Service.
+            rest_hostname:
+                type: string
+                required: false
+            rest_port:
+                type: string
+                required: false
+            rest_user:
+                type: string
+                required: false
+            rest_pass:
+                type: string
+                required: false
+
+    tosca.nodes.VRouterDevice:
+        derived_from: tosca.nodes.Root
+        description: >
+            CORD: The vRouter Device.
+        capabilities:
+            scalable:
+                type: tosca.capabilities.Scalable
+            service:
+                type: tosca.capabilities.xos.Service
+        properties:
+            no-delete:
+                type: boolean
+                default: false
+                description: Do not allow Tosca to delete this object
+            no-create:
+                type: boolean
+                default: false
+                description: Do not allow Tosca to create this object
+            no-update:
+                type: boolean
+                default: false
+                description: Do not allow Tosca to update this object
+            replaces:
+                type: string
+                required: false
+                descrption: Replaces/renames this object
+            openflow_id:
+                type: string
+                required: true
+            config_key:
+                type: string
+                required: false
+            driver:
+                type: string
+                required: true
+
+    tosca.nodes.VRouterPort:
+        derived_from: tosca.nodes.Root
+        description: >
+            CORD: The vRouter Port.
+        capabilities:
+            scalable:
+                type: tosca.capabilities.Scalable
+            service:
+                type: tosca.capabilities.xos.Service
+        properties:
+            no-delete:
+                type: boolean
+                default: false
+                description: Do not allow Tosca to delete this object
+            no-create:
+                type: boolean
+                default: false
+                description: Do not allow Tosca to create this object
+            no-update:
+                type: boolean
+                default: false
+                description: Do not allow Tosca to update this object
+            replaces:
+                type: string
+                required: false
+                descrption: Replaces/renames this object
+            openflow_id:
+                type: string
+                required: true
+
+    tosca.nodes.VRouterInterface:
+        derived_from: tosca.nodes.Root
+        description: >
+            CORD: The vRouter Interface.
+        capabilities:
+            scalable:
+                type: tosca.capabilities.Scalable
+            service:
+                type: tosca.capabilities.xos.Service
+        properties:
+            no-delete:
+                type: boolean
+                default: false
+                description: Do not allow Tosca to delete this object
+            no-create:
+                type: boolean
+                default: false
+                description: Do not allow Tosca to create this object
+            no-update:
+                type: boolean
+                default: false
+                description: Do not allow Tosca to update this object
+            replaces:
+                type: string
+                required: false
+                descrption: Replaces/renames this object
+            name:
+                type: string
+                required: true
+            mac:
+                type: string
+                required: true
+            vlan:
+                type: string
+                required: false
+
+    tosca.nodes.VRouterIp:
+        derived_from: tosca.nodes.Root
+        description: >
+            CORD: The vRouter Ip.
+        capabilities:
+            scalable:
+                type: tosca.capabilities.Scalable
+            service:
+                type: tosca.capabilities.xos.Service
+        properties:
+            no-delete:
+                type: boolean
+                default: false
+                description: Do not allow Tosca to delete this object
+            no-create:
+                type: boolean
+                default: false
+                description: Do not allow Tosca to create this object
+            no-update:
+                type: boolean
+                default: false
+                description: Do not allow Tosca to update this object
+            replaces:
+                type: string
+                required: false
+                descrption: Replaces/renames this object
+            ip:
+                type: string
+                required: true
+
+    tosca.nodes.VRouterApp:
+        derived_from: tosca.nodes.Root
+        description: >
+            CORD: The vRouter ONOS App Config.
+        capabilities:
+            scalable:
+                type: tosca.capabilities.Scalable
+            service:
+                type: tosca.capabilities.xos.Service
+        properties:
+            no-delete:
+                type: boolean
+                default: false
+                description: Do not allow Tosca to delete this object
+            no-create:
+                type: boolean
+                default: false
+                description: Do not allow Tosca to create this object
+            no-update:
+                type: boolean
+                default: false
+                description: Do not allow Tosca to update this object
+            replaces:
+                type: string
+                required: false
+                descrption: Replaces/renames this object
+            name:
+                type: string
+                required: true
+            control_plane_connect_point:
+                type: string
+                required: true
+            ospf_enabled:
+                type: boolean
+                required: true
+
+    tosca.relationships.PortOfDevice:
+            derived_from: tosca.relationships.Root
+            valid_target_types: [ tosca.capabilities.xos.VRouterPort ]
+
+    tosca.relationships.InterfaceOfPort:
+            derived_from: tosca.relationships.Root
+            valid_target_types: [ tosca.capabilities.xos.VRouterInterface ]
+
+    tosca.relationships.IpOfInterface:
+            derived_from: tosca.relationships.Root
+            valid_target_types: [ tosca.capabilities.xos.VRouterIp ]
\ No newline at end of file