Changeset 6253
- Timestamp:
- Sep 8, 2008, 11:28:41 PM (16 years ago)
- Files:
-
- 4 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/discussion-08-09-2008.txt
r6252 r6253 49 49 - Nic -*> Link -> PublicAP 50 50 - Choice ssid/channel PublicAP precedence 51 - Link needed due desc, status,ip,etc51 - Link needed due desc,ip,etc 52 52 - LinkPool, linkID to Link to indentify master 53 53 -
exodus/models.py
r6234 r6253 6 6 # Create your models here. 7 7 8 class NICType(models.Model): 9 type = models.CharField(max_length=10) 8 #No need to formalize it; CHOICES don't change much 10 9 11 def __str__(self): 12 return self.type 10 STATUS_CHOICES = ( 11 ('up', 'up'), 12 ('dw', 'down'), 13 ('pl', 'planned'), 14 ) 13 15 14 class Polar(models.Model): 15 polar = models.CharField(max_length=10) 16 17 def __str__(self): 18 return self.polar 16 POLAR_CHOICES = ( 17 ('hr', 'horizontal'), 18 ('vr', 'vertical'), 19 ) 19 20 20 class Status(models.Model): 21 status = models.CharField(max_length=200) 22 23 def __str__(self): 24 return self.status 25 26 class Mode(models.Model): 27 mode = models.CharField(max_length=10) 28 29 class Meta: 30 verbose_name = "wifi mode" 31 32 def __str__(self): 33 return self.mode 21 INTERFACE_TYPE_CHOICES = ( 22 ('eth', 'eth'), 23 ('11a', '11a'), 24 ('11b', '11b'), 25 ('11g', '11g'), 26 ) 27 WIFI_MODE_CHOICES = ( 28 ('ms', 'master'), 29 ('mn', 'managed'), 30 ) 34 31 35 32 class Antenna(models.Model): … … 49 46 50 47 51 class Network(models.Model):52 domainname = models.CharField(max_length=50)53 ipspacestart = models.IPAddressField()54 netmask = models.IntegerField()55 56 def __str__(self):57 return self.domainname58 59 48 class DnsServer(models.Model): 60 49 ipaddress = models.IPAddressField( unique=True) 61 domainname = models. ForeignKey(Network)50 domainname = models.CharField(max_length=50) 62 51 63 52 def __str__(self): 64 53 return self.ipaddress 65 54 55 class Network(models.Model): 56 ipspacestart = models.IPAddressField() 57 netmask = models.IntegerField() 58 dnsserver = models.ForeignKey(DnsServer) 59 60 def __str__(self): 61 return self.domainname 62 63 66 64 class Node(models.Model): 67 65 name = models.CharField(max_length=30, unique=True) 68 66 location = models.ForeignKey(Location) 69 status = models. ForeignKey(Status,default=1)67 status = models.CharField(max_length=10, choices=STATUS_CHOICES) 70 68 masterip = models.IPAddressField() 71 69 network = models.ForeignKey(Network,default=1) … … 77 75 return self.name 78 76 79 class NIC(models.Model): 80 node = models.ForeignKey(Node) 81 iface = models.CharField(max_length=10,verbose_name="interface") 82 polar = models.ForeignKey(Polar, blank=True, null=True, 83 verbose_name="polarisation") 84 ssid = models.CharField(max_length=30, blank=True, null=True) 85 mode = models.ForeignKey(Mode, blank=True, null=True) 86 status = models.ForeignKey(Status, default=1) 87 channel = models.IntegerField(blank=True, null=True) 88 antenna = models.ForeignKey(Antenna, blank=True, null=True) 89 type = models.ForeignKey(NICType) 77 class LinkPool(models.Model): 78 netmask = models.IntegerField(default=30) 90 79 91 def __str__(self): 92 return "%s, %s" % (self.node.name, self.iface) 80 class Link(models.Model): 81 ip = models.IPAddressField() 82 shortdesc = models.CharField(max_length=10) 83 desc = models.CharField(max_length=100) 84 linkpool = models.ForeignKey(LinkPool) 93 85 94 class Interlink(models.Model): 95 status = models.ForeignKey(Status,default=1) 96 netmask = models.IntegerField(default=30) 97 iface1 = models.ForeignKey(NIC,related_name='link1') 98 ip1 = models.IPAddressField() 99 iface2 = models.ForeignKey(NIC,related_name='link2') 100 ip2 = models.IPAddressField() 101 shortdesc1 = models.CharField(max_length=10) 102 shortdesc2 = models.CharField(max_length=10) 103 desc1 = models.CharField(max_length=100) 104 desc2 = models.CharField(max_length=100) 86 def __str__(self): 87 return "%s" % (self.shortdesc) 105 88 106 def __str__(self): 107 return "%s to %s" %(self.iface1, self.iface2) 89 class Interface(models.Model): 90 node = models.ForeignKey(Node) 91 iface = models.CharField(max_length=10, verbose_name="interface") 92 polar = models.CharField(max_length=10, choices=POLAR_CHOICES) 93 ssid = models.CharField(max_length=30, blank=True, null=True) 94 mode = models.CharField(max_length=10, choices=WIFI_MODE_CHOICES) 95 channel = models.IntegerField(blank=True, null=True) 96 antenna = models.ForeignKey(Antenna, blank=True, null=True) 97 type = models.CharField(max_length=10, choices=INTERFACE_TYPE_CHOICES) 98 links = models.ManyToManyField(Link) 99 100 def __str__(self): 101 return "%s:%s" % (self.node.name, self.iface) 108 102 109 class Omni(models.Model): 110 iface = models.ForeignKey(NIC,related_name='omni') 111 status = models.ForeignKey(Status,default=1) 103 104 105 class PublicAP(models.Model): 106 iface = models.ForeignKey(Interface) 112 107 ip = models.IPAddressField() 113 108 netmask = models.IntegerField(default=30) … … 118 113 119 114 def __str__(self): 120 return "%s %s" % (self.iface.node.name,self.shortdesc)115 return "%s" % (self.shortdesc) 121 116 122 117 class DhcpStatic(models.Model): … … 124 119 macaddress = models.CharField(max_length=17) 125 120 address = models.IPAddressField() 126 omni = models.ForeignKey(Omni)121 PublicAP = models.ForeignKey(PublicAP) 127 122 128 123 def __str__(self):
Note:
See TracChangeset
for help on using the changeset viewer.