blob: ced91cfa26f604e8b5bc91f7c309a84493610a3d [file] [log] [blame]
Scott Baker40695e12014-03-13 22:50:45 -07001from core.models import User,Site,Service,SingletonModel,PlCoreBase, Slice
Siobhan Tullyce652d02013-10-08 21:52:35 -04002import os
3from django.db import models
4from django.forms.models import model_to_dict
5
6# Create your models here.
7
8class RequestRouterService(SingletonModel,Service):
9 class Meta:
10 app_label = "requestrouter"
11 verbose_name = "Request Router Service"
12
13 behindNat = models.BooleanField(default=False, help_text="Enables 'Behind NAT' mode.")
14 defaultTTL = models.PositiveIntegerField(default=30, help_text="DNS response time-to-live(TTL)")
15 defaultAction = models.CharField(max_length=30, default = "best", help_text="Review if this should be enum")
16 lastResortAction = models.CharField(max_length=30, default = "random", help_text="Review if this should be enum")
17 maxAnswers = models.PositiveIntegerField(default=3, help_text="Maximum number of answers in DNS response.")
Scott Baker40695e12014-03-13 22:50:45 -070018
Siobhan Tullyce652d02013-10-08 21:52:35 -040019 def __unicode__(self): return u'RequestRouterService'
20
Scott Baker40695e12014-03-13 22:50:45 -070021class ServiceMap(models.Model):
22 name = models.SlugField(max_length=50, unique=True, blank=False, null=False, help_text="name of this service map")
23 owner = models.ForeignKey(Service, help_text="service which owns this map")
24 slice = models.ForeignKey(Slice, help_text="slice that implements this service")
25 prefix = models.CharField(max_length=256, help_text="FQDN of the region of URI space managed by RR on behalf of this service")
26 siteMap = models.FileField(upload_to="maps/", help_text="maps client requests to service instances")
27 accessMap = models.FileField(upload_to="maps/", help_text="specifies which client requests are allowed")
Siobhan Tullycf04fb62014-01-11 11:25:57 -050028
Scott Baker40695e12014-03-13 22:50:45 -070029 def siteMapName(self):
30 return self.name + ".site"
31
32 def accessMapName(self):
33 return self.name + ".access"
34
35 def __unicode__(self): return u'%s' % self.name
36
37
38