blob: f272881199c1094e9e18b21d957c1676410febcc [file] [log] [blame]
Sapan Bhatia084c0982017-04-21 14:47:40 +02001from header import *
Scott Baker171d35e2016-06-20 17:36:29 -07002
Scott Baker171d35e2016-06-20 17:36:29 -07003
Scott Baker171d35e2016-06-20 17:36:29 -07004
Sapan Bhatia084c0982017-04-21 14:47:40 +02005from core.models import ContentType#from core.models.tenant import Tenant
6from core.models import Tenant
Scott Baker171d35e2016-06-20 17:36:29 -07007
Scott Baker171d35e2016-06-20 17:36:29 -07008
Scott Baker171d35e2016-06-20 17:36:29 -07009
Sapan Bhatia084c0982017-04-21 14:47:40 +020010#from core.models.service import Service
11from core.models import Service
12
13
14
15
Scott Baker171d35e2016-06-20 17:36:29 -070016
17class VTRTenant(Tenant):
Scott Baker171d35e2016-06-20 17:36:29 -070018
Sapan Bhatia084c0982017-04-21 14:47:40 +020019 KIND = "vTR"
Scott Baker5db44a92017-03-06 17:27:52 -080020
Sapan Bhatia084c0982017-04-21 14:47:40 +020021 class Meta:
22 app_label = "vtr"
23 name = "vtr"
24 verbose_name = "Virtual Truck Roll Service"
Scott Baker171d35e2016-06-20 17:36:29 -070025
Sapan Bhatia084c0982017-04-21 14:47:40 +020026 # Primitive Fields (Not Relations)
27 test = StrippedCharField( choices = (('ping', 'Ping'), ('traceroute', 'Trace Route'), ('tcpdump', 'Tcp Dump'), ('memory', 'Memory'), ('bandwidth', 'Bandwidth')), max_length = 30, blank = False, help_text = "type of test", null = False, db_index = False )
28 scope = StrippedCharField( choices = (('container', 'Container'), ('vm', 'VM')), max_length = 30, blank = False, help_text = "scope of test", null = False, db_index = False )
29 argument = StrippedCharField( db_index = False, max_length = 40, null = True, blank = True )
30 result = TextField( blank = True, null = True, db_index = False )
31 result_code = StrippedCharField( db_index = False, max_length = 32, null = True, blank = True )
32 target_id = IntegerField( blank = False, null = False, db_index = False )
33
Scott Baker171d35e2016-06-20 17:36:29 -070034
Sapan Bhatia084c0982017-04-21 14:47:40 +020035 # Relations
36
37 target_type = ForeignKey(ContentType, db_index = True, related_name = 'vtrtenant', null = False, blank = False )
Scott Baker171d35e2016-06-20 17:36:29 -070038
Sapan Bhatia084c0982017-04-21 14:47:40 +020039 sync_attributes = ( 'test', 'argument', "scope" )
40
41 def __init__(self, *args, **kwargs):
42 vtr_services = VTRService.get_service_objects().all()
43 if vtr_services:
44 self._meta.get_field("provider_service").default = vtr_services[0].id
45 super(VTRTenant, self).__init__(*args, **kwargs)
46
47 def save(self, *args, **kwargs):
48 super(VTRTenant, self).save(*args, **kwargs)
49
50 def delete(self, *args, **kwargs):
51 super(VTRTenant, self).delete(*args, **kwargs)
52
53 pass
Scott Baker171d35e2016-06-20 17:36:29 -070054
Scott Baker171d35e2016-06-20 17:36:29 -070055
Sapan Bhatia084c0982017-04-21 14:47:40 +020056
57
58class VTRService(Service):
59
60 KIND = "vTR"
61
62 class Meta:
63 app_label = "vtr"
64 name = "vtr"
65 verbose_name = "Virtual Truck Roll Service"
66
67 # Primitive Fields (Not Relations)
68
69
70 # Relations
71
72
73
74 pass
75
Scott Baker171d35e2016-06-20 17:36:29 -070076