diff --git a/xos/admin.py b/xos/admin.py
index a6ce270..45c8238 100644
--- a/xos/admin.py
+++ b/xos/admin.py
@@ -107,12 +107,9 @@
 
 
 class VRouterTenantForm(forms.ModelForm):
-    public_ip = forms.CharField(required=True)
-    public_mac = forms.CharField(required=True)
     gateway_ip = forms.CharField(required=False)
     gateway_mac = forms.CharField(required=False)
     cidr = forms.CharField(required=False)
-    address_pool = forms.ModelChoiceField(queryset=AddressPool.objects.all(),required=False)
 
     def __init__(self,*args,**kwargs):
         super (VRouterTenantForm,self ).__init__(*args,**kwargs)
@@ -120,22 +117,16 @@
         self.fields['provider_service'].queryset = VRouterService.get_service_objects().all()
         if self.instance:
             # fields for the attributes
-            self.fields['address_pool'].initial = self.instance.address_pool
-            self.fields['public_ip'].initial = self.instance.public_ip
-            self.fields['public_mac'].initial = self.instance.public_mac
             self.fields['gateway_ip'].initial = self.instance.gateway_ip
             self.fields['gateway_mac'].initial = self.instance.gateway_mac
             self.fields['cidr'].initial = self.instance.cidr
         if (not self.instance) or (not self.instance.pk):
             # default fields for an 'add' form
             self.fields['kind'].initial = VROUTER_KIND
-            if VRouterService.get_service_objects().exists():
-               self.fields["provider_service"].initial = VRouterService.get_service_objects().all()[0]
+            if VRouterService.objects.exists():
+               self.fields["provider_service"].initial = VRouterService.objects.first()
 
     def save(self, commit=True):
-        self.instance.public_ip = self.cleaned_data.get("public_ip")
-        self.instance.public_mac = self.cleaned_data.get("public_mac")
-        self.instance.address_pool = self.cleaned_data.get("address_pool")
         return super(VRouterTenantForm, self).save(commit=commit)
 
     class Meta:
diff --git a/xos/models.py b/xos/models.py
index 8396d3e..016cb3d 100644
--- a/xos/models.py
+++ b/xos/models.py
@@ -32,46 +32,14 @@
     class Meta:
         app_label = APP_LABEL
         verbose_name = "vRouter Service"
-        proxy = True
 
-    default_attributes = {
-        "rest_hostname": "",
-        "rest_port": "8181",
-        "rest_user": "onos",
-        "rest_pass": "rocks"
-    }
+    # Are rest_hostname and rest_port redundant with ONOS service?
+    # Should ONOSService be augmented with rest_user and rest_pass?
 
-    @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)
+    rest_hostname = StrippedCharField(max_length=255, null=True, blank=True)
+    rest_port = models.IntegerField(default=8181)
+    rest_user = StrippedCharField(max_length=255, default="onos")
+    rest_pass = StrippedCharField(max_length=255, default="rocks")
 
     def ip_to_mac(self, ip):
         (a, b, c, d) = ip.split('.')
@@ -112,16 +80,13 @@
 
 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),
-    )
+    public_ip = StrippedCharField(max_length = 30, null=True, blank=True)
+    public_mac = StrippedCharField(max_length = 30, null=True, blank=True)
+    address_pool = models.ForeignKey(AddressPool, related_name='vrouter_tenants', blank=True, null=True)
 
     @property
     def gateway_ip(self):
@@ -150,30 +115,9 @@
                 return int(parts[1].strip())
         return None
 
-    @property
-    def address_pool(self):
-        if getattr(self, "cached_address_pool", None):
-            return self.cached_address_pool
-        if not self.address_pool_id:
-            return None
-        aps = AddressPool.objects.filter(id=self.address_pool_id)
-        if not aps:
-            return None
-        ap = aps[0]
-        self.cached_address_pool = ap
-        return ap
-
-    @address_pool.setter
-    def address_pool(self, value):
-        if value:
-            value = value.id
-        if (value != self.get_attribute("address_pool_id", None)):
-            self.cached_address_pool = None
-        self.set_attribute("address_pool_id", value)
-
     def cleanup_addresspool(self):
-        if self.address_pool_id:
-            ap = AddressPool.objects.filter(id=self.address_pool_id)
+        if self.address_pool:
+            ap = self.address_pool
             if ap:
                 ap[0].put_address(self.public_ip)
                 self.public_ip = None
@@ -182,8 +126,6 @@
         self.cleanup_addresspool()
         super(VRouterTenant, self).delete(*args, **kwargs)
 
-VRouterTenant.setup_simple_attributes()
-
 
 # DEVICES
 class VRouterDevice(PlCoreBase):
