0001_initial.py 60 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979
  1. # Generated by Django 4.2.9 on 2024-01-18 18:27
  2. import dcim.fields
  3. import django.contrib.postgres.fields
  4. import django.core.validators
  5. from django.db import migrations, models
  6. import django.db.models.deletion
  7. import timezone_field.fields
  8. import utilities.fields
  9. import utilities.json
  10. import utilities.ordering
  11. import utilities.query_functions
  12. import utilities.tracking
  13. import utilities.validators
  14. class Migration(migrations.Migration):
  15. initial = True
  16. dependencies = [
  17. ]
  18. operations = [
  19. migrations.CreateModel(
  20. name='Cable',
  21. fields=[
  22. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  23. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  24. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  25. ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
  26. ('description', models.CharField(blank=True, max_length=200)),
  27. ('comments', models.TextField(blank=True)),
  28. ('type', models.CharField(blank=True, max_length=50)),
  29. ('status', models.CharField(default='connected', max_length=50)),
  30. ('label', models.CharField(blank=True, max_length=100)),
  31. ('color', utilities.fields.ColorField(blank=True, max_length=6)),
  32. ('length', models.DecimalField(blank=True, decimal_places=2, max_digits=8, null=True)),
  33. ('length_unit', models.CharField(blank=True, max_length=50)),
  34. ('_abs_length', models.DecimalField(blank=True, decimal_places=4, max_digits=10, null=True)),
  35. ],
  36. options={
  37. 'verbose_name': 'cable',
  38. 'verbose_name_plural': 'cables',
  39. 'ordering': ('pk',),
  40. },
  41. ),
  42. migrations.CreateModel(
  43. name='CablePath',
  44. fields=[
  45. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  46. ('path', models.JSONField(default=list)),
  47. ('is_active', models.BooleanField(default=False)),
  48. ('is_complete', models.BooleanField(default=False)),
  49. ('is_split', models.BooleanField(default=False)),
  50. ('_nodes', dcim.fields.PathField(base_field=models.CharField(max_length=40), size=None)),
  51. ],
  52. options={
  53. 'verbose_name': 'cable path',
  54. 'verbose_name_plural': 'cable paths',
  55. },
  56. ),
  57. migrations.CreateModel(
  58. name='CableTermination',
  59. fields=[
  60. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  61. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  62. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  63. ('cable_end', models.CharField(max_length=1)),
  64. ('termination_id', models.PositiveBigIntegerField()),
  65. ],
  66. options={
  67. 'verbose_name': 'cable termination',
  68. 'verbose_name_plural': 'cable terminations',
  69. 'ordering': ('cable', 'cable_end', 'pk'),
  70. },
  71. ),
  72. migrations.CreateModel(
  73. name='ConsolePort',
  74. fields=[
  75. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  76. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  77. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  78. ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
  79. ('name', models.CharField(max_length=64)),
  80. ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)),
  81. ('label', models.CharField(blank=True, max_length=64)),
  82. ('description', models.CharField(blank=True, max_length=200)),
  83. ('cable_end', models.CharField(blank=True, max_length=1)),
  84. ('mark_connected', models.BooleanField(default=False)),
  85. ('type', models.CharField(blank=True, max_length=50)),
  86. ('speed', models.PositiveIntegerField(blank=True, null=True)),
  87. ],
  88. options={
  89. 'verbose_name': 'console port',
  90. 'verbose_name_plural': 'console ports',
  91. 'ordering': ('device', '_name'),
  92. 'abstract': False,
  93. },
  94. bases=(models.Model, utilities.tracking.TrackingModelMixin),
  95. ),
  96. migrations.CreateModel(
  97. name='ConsolePortTemplate',
  98. fields=[
  99. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  100. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  101. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  102. ('name', models.CharField(max_length=64)),
  103. ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)),
  104. ('label', models.CharField(blank=True, max_length=64)),
  105. ('description', models.CharField(blank=True, max_length=200)),
  106. ('type', models.CharField(blank=True, max_length=50)),
  107. ],
  108. options={
  109. 'verbose_name': 'console port template',
  110. 'verbose_name_plural': 'console port templates',
  111. 'ordering': ('device_type', 'module_type', '_name'),
  112. 'abstract': False,
  113. },
  114. bases=(models.Model, utilities.tracking.TrackingModelMixin),
  115. ),
  116. migrations.CreateModel(
  117. name='ConsoleServerPort',
  118. fields=[
  119. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  120. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  121. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  122. ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
  123. ('name', models.CharField(max_length=64)),
  124. ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)),
  125. ('label', models.CharField(blank=True, max_length=64)),
  126. ('description', models.CharField(blank=True, max_length=200)),
  127. ('cable_end', models.CharField(blank=True, max_length=1)),
  128. ('mark_connected', models.BooleanField(default=False)),
  129. ('type', models.CharField(blank=True, max_length=50)),
  130. ('speed', models.PositiveIntegerField(blank=True, null=True)),
  131. ],
  132. options={
  133. 'verbose_name': 'console server port',
  134. 'verbose_name_plural': 'console server ports',
  135. 'ordering': ('device', '_name'),
  136. 'abstract': False,
  137. },
  138. bases=(models.Model, utilities.tracking.TrackingModelMixin),
  139. ),
  140. migrations.CreateModel(
  141. name='ConsoleServerPortTemplate',
  142. fields=[
  143. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  144. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  145. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  146. ('name', models.CharField(max_length=64)),
  147. ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)),
  148. ('label', models.CharField(blank=True, max_length=64)),
  149. ('description', models.CharField(blank=True, max_length=200)),
  150. ('type', models.CharField(blank=True, max_length=50)),
  151. ],
  152. options={
  153. 'verbose_name': 'console server port template',
  154. 'verbose_name_plural': 'console server port templates',
  155. 'ordering': ('device_type', 'module_type', '_name'),
  156. 'abstract': False,
  157. },
  158. bases=(models.Model, utilities.tracking.TrackingModelMixin),
  159. ),
  160. migrations.CreateModel(
  161. name='Device',
  162. fields=[
  163. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  164. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  165. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  166. ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
  167. ('description', models.CharField(blank=True, max_length=200)),
  168. ('comments', models.TextField(blank=True)),
  169. ('local_context_data', models.JSONField(blank=True, null=True)),
  170. ('name', models.CharField(blank=True, max_length=64, null=True)),
  171. ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize, null=True)),
  172. ('serial', models.CharField(blank=True, max_length=50)),
  173. ('asset_tag', models.CharField(blank=True, max_length=50, null=True, unique=True)),
  174. ('position', models.DecimalField(blank=True, decimal_places=1, max_digits=4, null=True, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(100.5)])),
  175. ('face', models.CharField(blank=True, max_length=50)),
  176. ('status', models.CharField(default='active', max_length=50)),
  177. ('airflow', models.CharField(blank=True, max_length=50)),
  178. ('vc_position', models.PositiveSmallIntegerField(blank=True, null=True, validators=[django.core.validators.MaxValueValidator(255)])),
  179. ('vc_priority', models.PositiveSmallIntegerField(blank=True, null=True, validators=[django.core.validators.MaxValueValidator(255)])),
  180. ('latitude', models.DecimalField(blank=True, decimal_places=6, max_digits=8, null=True)),
  181. ('longitude', models.DecimalField(blank=True, decimal_places=6, max_digits=9, null=True)),
  182. ('console_port_count', utilities.fields.CounterCacheField(default=0, editable=False, to_field='device', to_model='dcim.ConsolePort')),
  183. ('console_server_port_count', utilities.fields.CounterCacheField(default=0, editable=False, to_field='device', to_model='dcim.ConsoleServerPort')),
  184. ('power_port_count', utilities.fields.CounterCacheField(default=0, editable=False, to_field='device', to_model='dcim.PowerPort')),
  185. ('power_outlet_count', utilities.fields.CounterCacheField(default=0, editable=False, to_field='device', to_model='dcim.PowerOutlet')),
  186. ('interface_count', utilities.fields.CounterCacheField(default=0, editable=False, to_field='device', to_model='dcim.Interface')),
  187. ('front_port_count', utilities.fields.CounterCacheField(default=0, editable=False, to_field='device', to_model='dcim.FrontPort')),
  188. ('rear_port_count', utilities.fields.CounterCacheField(default=0, editable=False, to_field='device', to_model='dcim.RearPort')),
  189. ('device_bay_count', utilities.fields.CounterCacheField(default=0, editable=False, to_field='device', to_model='dcim.DeviceBay')),
  190. ('module_bay_count', utilities.fields.CounterCacheField(default=0, editable=False, to_field='device', to_model='dcim.ModuleBay')),
  191. ('inventory_item_count', utilities.fields.CounterCacheField(default=0, editable=False, to_field='device', to_model='dcim.InventoryItem')),
  192. ],
  193. options={
  194. 'verbose_name': 'device',
  195. 'verbose_name_plural': 'devices',
  196. 'ordering': ('_name', 'pk'),
  197. },
  198. bases=(utilities.tracking.TrackingModelMixin, models.Model),
  199. ),
  200. migrations.CreateModel(
  201. name='DeviceBay',
  202. fields=[
  203. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  204. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  205. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  206. ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
  207. ('name', models.CharField(max_length=64)),
  208. ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)),
  209. ('label', models.CharField(blank=True, max_length=64)),
  210. ('description', models.CharField(blank=True, max_length=200)),
  211. ],
  212. options={
  213. 'verbose_name': 'device bay',
  214. 'verbose_name_plural': 'device bays',
  215. 'ordering': ('device', '_name'),
  216. 'abstract': False,
  217. },
  218. bases=(models.Model, utilities.tracking.TrackingModelMixin),
  219. ),
  220. migrations.CreateModel(
  221. name='DeviceBayTemplate',
  222. fields=[
  223. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  224. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  225. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  226. ('name', models.CharField(max_length=64)),
  227. ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)),
  228. ('label', models.CharField(blank=True, max_length=64)),
  229. ('description', models.CharField(blank=True, max_length=200)),
  230. ],
  231. options={
  232. 'verbose_name': 'device bay template',
  233. 'verbose_name_plural': 'device bay templates',
  234. 'ordering': ('device_type', '_name'),
  235. 'abstract': False,
  236. },
  237. bases=(models.Model, utilities.tracking.TrackingModelMixin),
  238. ),
  239. migrations.CreateModel(
  240. name='DeviceRole',
  241. fields=[
  242. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  243. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  244. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  245. ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
  246. ('name', models.CharField(max_length=100, unique=True)),
  247. ('slug', models.SlugField(max_length=100, unique=True)),
  248. ('description', models.CharField(blank=True, max_length=200)),
  249. ('color', utilities.fields.ColorField(default='9e9e9e', max_length=6)),
  250. ('vm_role', models.BooleanField(default=True)),
  251. ],
  252. options={
  253. 'verbose_name': 'device role',
  254. 'verbose_name_plural': 'device roles',
  255. 'ordering': ('name',),
  256. },
  257. ),
  258. migrations.CreateModel(
  259. name='DeviceType',
  260. fields=[
  261. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  262. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  263. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  264. ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
  265. ('description', models.CharField(blank=True, max_length=200)),
  266. ('comments', models.TextField(blank=True)),
  267. ('weight', models.DecimalField(blank=True, decimal_places=2, max_digits=8, null=True)),
  268. ('weight_unit', models.CharField(blank=True, max_length=50)),
  269. ('_abs_weight', models.PositiveBigIntegerField(blank=True, null=True)),
  270. ('model', models.CharField(max_length=100)),
  271. ('slug', models.SlugField(max_length=100)),
  272. ('part_number', models.CharField(blank=True, max_length=50)),
  273. ('u_height', models.DecimalField(decimal_places=1, default=1.0, max_digits=4)),
  274. ('is_full_depth', models.BooleanField(default=True)),
  275. ('subdevice_role', models.CharField(blank=True, max_length=50)),
  276. ('airflow', models.CharField(blank=True, max_length=50)),
  277. ('front_image', models.ImageField(blank=True, upload_to='devicetype-images')),
  278. ('rear_image', models.ImageField(blank=True, upload_to='devicetype-images')),
  279. ('console_port_template_count', utilities.fields.CounterCacheField(default=0, editable=False, to_field='device_type', to_model='dcim.ConsolePortTemplate')),
  280. ('console_server_port_template_count', utilities.fields.CounterCacheField(default=0, editable=False, to_field='device_type', to_model='dcim.ConsoleServerPortTemplate')),
  281. ('power_port_template_count', utilities.fields.CounterCacheField(default=0, editable=False, to_field='device_type', to_model='dcim.PowerPortTemplate')),
  282. ('power_outlet_template_count', utilities.fields.CounterCacheField(default=0, editable=False, to_field='device_type', to_model='dcim.PowerOutletTemplate')),
  283. ('interface_template_count', utilities.fields.CounterCacheField(default=0, editable=False, to_field='device_type', to_model='dcim.InterfaceTemplate')),
  284. ('front_port_template_count', utilities.fields.CounterCacheField(default=0, editable=False, to_field='device_type', to_model='dcim.FrontPortTemplate')),
  285. ('rear_port_template_count', utilities.fields.CounterCacheField(default=0, editable=False, to_field='device_type', to_model='dcim.RearPortTemplate')),
  286. ('device_bay_template_count', utilities.fields.CounterCacheField(default=0, editable=False, to_field='device_type', to_model='dcim.DeviceBayTemplate')),
  287. ('module_bay_template_count', utilities.fields.CounterCacheField(default=0, editable=False, to_field='device_type', to_model='dcim.ModuleBayTemplate')),
  288. ('inventory_item_template_count', utilities.fields.CounterCacheField(default=0, editable=False, to_field='device_type', to_model='dcim.InventoryItemTemplate')),
  289. ],
  290. options={
  291. 'verbose_name': 'device type',
  292. 'verbose_name_plural': 'device types',
  293. 'ordering': ['manufacturer', 'model'],
  294. },
  295. ),
  296. migrations.CreateModel(
  297. name='FrontPort',
  298. fields=[
  299. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  300. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  301. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  302. ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
  303. ('name', models.CharField(max_length=64)),
  304. ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)),
  305. ('label', models.CharField(blank=True, max_length=64)),
  306. ('description', models.CharField(blank=True, max_length=200)),
  307. ('cable_end', models.CharField(blank=True, max_length=1)),
  308. ('mark_connected', models.BooleanField(default=False)),
  309. ('type', models.CharField(max_length=50)),
  310. ('color', utilities.fields.ColorField(blank=True, max_length=6)),
  311. ('rear_port_position', models.PositiveSmallIntegerField(default=1, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(1024)])),
  312. ],
  313. options={
  314. 'verbose_name': 'front port',
  315. 'verbose_name_plural': 'front ports',
  316. 'ordering': ('device', '_name'),
  317. 'abstract': False,
  318. },
  319. bases=(models.Model, utilities.tracking.TrackingModelMixin),
  320. ),
  321. migrations.CreateModel(
  322. name='FrontPortTemplate',
  323. fields=[
  324. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  325. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  326. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  327. ('name', models.CharField(max_length=64)),
  328. ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)),
  329. ('label', models.CharField(blank=True, max_length=64)),
  330. ('description', models.CharField(blank=True, max_length=200)),
  331. ('type', models.CharField(max_length=50)),
  332. ('color', utilities.fields.ColorField(blank=True, max_length=6)),
  333. ('rear_port_position', models.PositiveSmallIntegerField(default=1, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(1024)])),
  334. ],
  335. options={
  336. 'verbose_name': 'front port template',
  337. 'verbose_name_plural': 'front port templates',
  338. 'ordering': ('device_type', 'module_type', '_name'),
  339. 'abstract': False,
  340. },
  341. bases=(models.Model, utilities.tracking.TrackingModelMixin),
  342. ),
  343. migrations.CreateModel(
  344. name='Interface',
  345. fields=[
  346. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  347. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  348. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  349. ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
  350. ('name', models.CharField(max_length=64)),
  351. ('label', models.CharField(blank=True, max_length=64)),
  352. ('description', models.CharField(blank=True, max_length=200)),
  353. ('cable_end', models.CharField(blank=True, max_length=1)),
  354. ('mark_connected', models.BooleanField(default=False)),
  355. ('enabled', models.BooleanField(default=True)),
  356. ('mac_address', dcim.fields.MACAddressField(blank=True, null=True)),
  357. ('mtu', models.PositiveIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(65536)])),
  358. ('mode', models.CharField(blank=True, max_length=50)),
  359. ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize_interface)),
  360. ('type', models.CharField(max_length=50)),
  361. ('mgmt_only', models.BooleanField(default=False)),
  362. ('speed', models.PositiveIntegerField(blank=True, null=True)),
  363. ('duplex', models.CharField(blank=True, max_length=50, null=True)),
  364. ('wwn', dcim.fields.WWNField(blank=True, null=True)),
  365. ('rf_role', models.CharField(blank=True, max_length=30)),
  366. ('rf_channel', models.CharField(blank=True, max_length=50)),
  367. ('rf_channel_frequency', models.DecimalField(blank=True, decimal_places=2, max_digits=7, null=True)),
  368. ('rf_channel_width', models.DecimalField(blank=True, decimal_places=3, max_digits=7, null=True)),
  369. ('tx_power', models.PositiveSmallIntegerField(blank=True, null=True, validators=[django.core.validators.MaxValueValidator(127)])),
  370. ('poe_mode', models.CharField(blank=True, max_length=50)),
  371. ('poe_type', models.CharField(blank=True, max_length=50)),
  372. ],
  373. options={
  374. 'verbose_name': 'interface',
  375. 'verbose_name_plural': 'interfaces',
  376. 'ordering': ('device', utilities.query_functions.CollateAsChar('_name')),
  377. 'abstract': False,
  378. },
  379. bases=(models.Model, utilities.tracking.TrackingModelMixin),
  380. ),
  381. migrations.CreateModel(
  382. name='InterfaceTemplate',
  383. fields=[
  384. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  385. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  386. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  387. ('name', models.CharField(max_length=64)),
  388. ('label', models.CharField(blank=True, max_length=64)),
  389. ('description', models.CharField(blank=True, max_length=200)),
  390. ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize_interface)),
  391. ('type', models.CharField(max_length=50)),
  392. ('enabled', models.BooleanField(default=True)),
  393. ('mgmt_only', models.BooleanField(default=False)),
  394. ('poe_mode', models.CharField(blank=True, max_length=50)),
  395. ('poe_type', models.CharField(blank=True, max_length=50)),
  396. ('rf_role', models.CharField(blank=True, max_length=30)),
  397. ],
  398. options={
  399. 'verbose_name': 'interface template',
  400. 'verbose_name_plural': 'interface templates',
  401. 'ordering': ('device_type', 'module_type', '_name'),
  402. 'abstract': False,
  403. },
  404. bases=(models.Model, utilities.tracking.TrackingModelMixin),
  405. ),
  406. migrations.CreateModel(
  407. name='InventoryItem',
  408. fields=[
  409. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  410. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  411. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  412. ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
  413. ('name', models.CharField(max_length=64)),
  414. ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)),
  415. ('label', models.CharField(blank=True, max_length=64)),
  416. ('description', models.CharField(blank=True, max_length=200)),
  417. ('component_id', models.PositiveBigIntegerField(blank=True, null=True)),
  418. ('part_id', models.CharField(blank=True, max_length=50)),
  419. ('serial', models.CharField(blank=True, max_length=50)),
  420. ('asset_tag', models.CharField(blank=True, max_length=50, null=True, unique=True)),
  421. ('discovered', models.BooleanField(default=False)),
  422. ('lft', models.PositiveIntegerField(editable=False)),
  423. ('rght', models.PositiveIntegerField(editable=False)),
  424. ('tree_id', models.PositiveIntegerField(db_index=True, editable=False)),
  425. ('level', models.PositiveIntegerField(editable=False)),
  426. ],
  427. options={
  428. 'verbose_name': 'inventory item',
  429. 'verbose_name_plural': 'inventory items',
  430. 'ordering': ('device__id', 'parent__id', '_name'),
  431. },
  432. bases=(models.Model, utilities.tracking.TrackingModelMixin),
  433. ),
  434. migrations.CreateModel(
  435. name='InventoryItemRole',
  436. fields=[
  437. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  438. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  439. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  440. ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
  441. ('name', models.CharField(max_length=100, unique=True)),
  442. ('slug', models.SlugField(max_length=100, unique=True)),
  443. ('description', models.CharField(blank=True, max_length=200)),
  444. ('color', utilities.fields.ColorField(default='9e9e9e', max_length=6)),
  445. ],
  446. options={
  447. 'verbose_name': 'inventory item role',
  448. 'verbose_name_plural': 'inventory item roles',
  449. 'ordering': ('name',),
  450. },
  451. ),
  452. migrations.CreateModel(
  453. name='InventoryItemTemplate',
  454. fields=[
  455. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  456. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  457. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  458. ('name', models.CharField(max_length=64)),
  459. ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)),
  460. ('label', models.CharField(blank=True, max_length=64)),
  461. ('description', models.CharField(blank=True, max_length=200)),
  462. ('component_id', models.PositiveBigIntegerField(blank=True, null=True)),
  463. ('part_id', models.CharField(blank=True, max_length=50)),
  464. ('lft', models.PositiveIntegerField(editable=False)),
  465. ('rght', models.PositiveIntegerField(editable=False)),
  466. ('tree_id', models.PositiveIntegerField(db_index=True, editable=False)),
  467. ('level', models.PositiveIntegerField(editable=False)),
  468. ],
  469. options={
  470. 'verbose_name': 'inventory item template',
  471. 'verbose_name_plural': 'inventory item templates',
  472. 'ordering': ('device_type__id', 'parent__id', '_name'),
  473. },
  474. bases=(models.Model, utilities.tracking.TrackingModelMixin),
  475. ),
  476. migrations.CreateModel(
  477. name='Location',
  478. fields=[
  479. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  480. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  481. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  482. ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
  483. ('name', models.CharField(max_length=100)),
  484. ('slug', models.SlugField(max_length=100)),
  485. ('description', models.CharField(blank=True, max_length=200)),
  486. ('status', models.CharField(default='active', max_length=50)),
  487. ('lft', models.PositiveIntegerField(editable=False)),
  488. ('rght', models.PositiveIntegerField(editable=False)),
  489. ('tree_id', models.PositiveIntegerField(db_index=True, editable=False)),
  490. ('level', models.PositiveIntegerField(editable=False)),
  491. ],
  492. options={
  493. 'verbose_name': 'location',
  494. 'verbose_name_plural': 'locations',
  495. 'ordering': ['site', 'name'],
  496. },
  497. ),
  498. migrations.CreateModel(
  499. name='Manufacturer',
  500. fields=[
  501. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  502. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  503. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  504. ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
  505. ('name', models.CharField(max_length=100, unique=True)),
  506. ('slug', models.SlugField(max_length=100, unique=True)),
  507. ('description', models.CharField(blank=True, max_length=200)),
  508. ],
  509. options={
  510. 'verbose_name': 'manufacturer',
  511. 'verbose_name_plural': 'manufacturers',
  512. 'ordering': ('name',),
  513. },
  514. ),
  515. migrations.CreateModel(
  516. name='Module',
  517. fields=[
  518. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  519. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  520. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  521. ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
  522. ('description', models.CharField(blank=True, max_length=200)),
  523. ('comments', models.TextField(blank=True)),
  524. ('local_context_data', models.JSONField(blank=True, null=True)),
  525. ('status', models.CharField(default='active', max_length=50)),
  526. ('serial', models.CharField(blank=True, max_length=50)),
  527. ('asset_tag', models.CharField(blank=True, max_length=50, null=True, unique=True)),
  528. ],
  529. options={
  530. 'verbose_name': 'module',
  531. 'verbose_name_plural': 'modules',
  532. 'ordering': ('module_bay',),
  533. },
  534. ),
  535. migrations.CreateModel(
  536. name='ModuleBay',
  537. fields=[
  538. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  539. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  540. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  541. ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
  542. ('name', models.CharField(max_length=64)),
  543. ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)),
  544. ('label', models.CharField(blank=True, max_length=64)),
  545. ('description', models.CharField(blank=True, max_length=200)),
  546. ('position', models.CharField(blank=True, max_length=30)),
  547. ],
  548. options={
  549. 'verbose_name': 'module bay',
  550. 'verbose_name_plural': 'module bays',
  551. 'ordering': ('device', '_name'),
  552. 'abstract': False,
  553. },
  554. bases=(models.Model, utilities.tracking.TrackingModelMixin),
  555. ),
  556. migrations.CreateModel(
  557. name='ModuleBayTemplate',
  558. fields=[
  559. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  560. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  561. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  562. ('name', models.CharField(max_length=64)),
  563. ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)),
  564. ('label', models.CharField(blank=True, max_length=64)),
  565. ('description', models.CharField(blank=True, max_length=200)),
  566. ('position', models.CharField(blank=True, max_length=30)),
  567. ],
  568. options={
  569. 'verbose_name': 'module bay template',
  570. 'verbose_name_plural': 'module bay templates',
  571. 'ordering': ('device_type', '_name'),
  572. 'abstract': False,
  573. },
  574. bases=(models.Model, utilities.tracking.TrackingModelMixin),
  575. ),
  576. migrations.CreateModel(
  577. name='ModuleType',
  578. fields=[
  579. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  580. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  581. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  582. ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
  583. ('description', models.CharField(blank=True, max_length=200)),
  584. ('comments', models.TextField(blank=True)),
  585. ('weight', models.DecimalField(blank=True, decimal_places=2, max_digits=8, null=True)),
  586. ('weight_unit', models.CharField(blank=True, max_length=50)),
  587. ('_abs_weight', models.PositiveBigIntegerField(blank=True, null=True)),
  588. ('model', models.CharField(max_length=100)),
  589. ('part_number', models.CharField(blank=True, max_length=50)),
  590. ],
  591. options={
  592. 'verbose_name': 'module type',
  593. 'verbose_name_plural': 'module types',
  594. 'ordering': ('manufacturer', 'model'),
  595. },
  596. ),
  597. migrations.CreateModel(
  598. name='Platform',
  599. fields=[
  600. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  601. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  602. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  603. ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
  604. ('name', models.CharField(max_length=100, unique=True)),
  605. ('slug', models.SlugField(max_length=100, unique=True)),
  606. ('description', models.CharField(blank=True, max_length=200)),
  607. ],
  608. options={
  609. 'verbose_name': 'platform',
  610. 'verbose_name_plural': 'platforms',
  611. 'ordering': ('name',),
  612. },
  613. ),
  614. migrations.CreateModel(
  615. name='PowerFeed',
  616. fields=[
  617. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  618. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  619. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  620. ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
  621. ('description', models.CharField(blank=True, max_length=200)),
  622. ('comments', models.TextField(blank=True)),
  623. ('cable_end', models.CharField(blank=True, max_length=1)),
  624. ('mark_connected', models.BooleanField(default=False)),
  625. ('name', models.CharField(max_length=100)),
  626. ('status', models.CharField(default='active', max_length=50)),
  627. ('type', models.CharField(default='primary', max_length=50)),
  628. ('supply', models.CharField(default='ac', max_length=50)),
  629. ('phase', models.CharField(default='single-phase', max_length=50)),
  630. ('voltage', models.SmallIntegerField(validators=[utilities.validators.ExclusionValidator([0])])),
  631. ('amperage', models.PositiveSmallIntegerField(validators=[django.core.validators.MinValueValidator(1)])),
  632. ('max_utilization', models.PositiveSmallIntegerField(validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(100)])),
  633. ('available_power', models.PositiveIntegerField(default=0, editable=False)),
  634. ],
  635. options={
  636. 'verbose_name': 'power feed',
  637. 'verbose_name_plural': 'power feeds',
  638. 'ordering': ['power_panel', 'name'],
  639. },
  640. ),
  641. migrations.CreateModel(
  642. name='PowerOutlet',
  643. fields=[
  644. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  645. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  646. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  647. ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
  648. ('name', models.CharField(max_length=64)),
  649. ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)),
  650. ('label', models.CharField(blank=True, max_length=64)),
  651. ('description', models.CharField(blank=True, max_length=200)),
  652. ('cable_end', models.CharField(blank=True, max_length=1)),
  653. ('mark_connected', models.BooleanField(default=False)),
  654. ('type', models.CharField(blank=True, max_length=50)),
  655. ('feed_leg', models.CharField(blank=True, max_length=50)),
  656. ],
  657. options={
  658. 'verbose_name': 'power outlet',
  659. 'verbose_name_plural': 'power outlets',
  660. 'ordering': ('device', '_name'),
  661. 'abstract': False,
  662. },
  663. bases=(models.Model, utilities.tracking.TrackingModelMixin),
  664. ),
  665. migrations.CreateModel(
  666. name='PowerOutletTemplate',
  667. fields=[
  668. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  669. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  670. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  671. ('name', models.CharField(max_length=64)),
  672. ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)),
  673. ('label', models.CharField(blank=True, max_length=64)),
  674. ('description', models.CharField(blank=True, max_length=200)),
  675. ('type', models.CharField(blank=True, max_length=50)),
  676. ('feed_leg', models.CharField(blank=True, max_length=50)),
  677. ],
  678. options={
  679. 'verbose_name': 'power outlet template',
  680. 'verbose_name_plural': 'power outlet templates',
  681. 'ordering': ('device_type', 'module_type', '_name'),
  682. 'abstract': False,
  683. },
  684. bases=(models.Model, utilities.tracking.TrackingModelMixin),
  685. ),
  686. migrations.CreateModel(
  687. name='PowerPanel',
  688. fields=[
  689. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  690. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  691. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  692. ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
  693. ('description', models.CharField(blank=True, max_length=200)),
  694. ('comments', models.TextField(blank=True)),
  695. ('name', models.CharField(max_length=100)),
  696. ],
  697. options={
  698. 'verbose_name': 'power panel',
  699. 'verbose_name_plural': 'power panels',
  700. 'ordering': ['site', 'name'],
  701. },
  702. ),
  703. migrations.CreateModel(
  704. name='PowerPort',
  705. fields=[
  706. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  707. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  708. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  709. ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
  710. ('name', models.CharField(max_length=64)),
  711. ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)),
  712. ('label', models.CharField(blank=True, max_length=64)),
  713. ('description', models.CharField(blank=True, max_length=200)),
  714. ('cable_end', models.CharField(blank=True, max_length=1)),
  715. ('mark_connected', models.BooleanField(default=False)),
  716. ('type', models.CharField(blank=True, max_length=50)),
  717. ('maximum_draw', models.PositiveIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(1)])),
  718. ('allocated_draw', models.PositiveIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(1)])),
  719. ],
  720. options={
  721. 'verbose_name': 'power port',
  722. 'verbose_name_plural': 'power ports',
  723. 'ordering': ('device', '_name'),
  724. 'abstract': False,
  725. },
  726. bases=(models.Model, utilities.tracking.TrackingModelMixin),
  727. ),
  728. migrations.CreateModel(
  729. name='PowerPortTemplate',
  730. fields=[
  731. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  732. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  733. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  734. ('name', models.CharField(max_length=64)),
  735. ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)),
  736. ('label', models.CharField(blank=True, max_length=64)),
  737. ('description', models.CharField(blank=True, max_length=200)),
  738. ('type', models.CharField(blank=True, max_length=50)),
  739. ('maximum_draw', models.PositiveIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(1)])),
  740. ('allocated_draw', models.PositiveIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(1)])),
  741. ],
  742. options={
  743. 'verbose_name': 'power port template',
  744. 'verbose_name_plural': 'power port templates',
  745. 'ordering': ('device_type', 'module_type', '_name'),
  746. 'abstract': False,
  747. },
  748. bases=(models.Model, utilities.tracking.TrackingModelMixin),
  749. ),
  750. migrations.CreateModel(
  751. name='Rack',
  752. fields=[
  753. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  754. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  755. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  756. ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
  757. ('description', models.CharField(blank=True, max_length=200)),
  758. ('comments', models.TextField(blank=True)),
  759. ('weight', models.DecimalField(blank=True, decimal_places=2, max_digits=8, null=True)),
  760. ('weight_unit', models.CharField(blank=True, max_length=50)),
  761. ('_abs_weight', models.PositiveBigIntegerField(blank=True, null=True)),
  762. ('name', models.CharField(max_length=100)),
  763. ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)),
  764. ('facility_id', models.CharField(blank=True, max_length=50, null=True)),
  765. ('status', models.CharField(default='active', max_length=50)),
  766. ('serial', models.CharField(blank=True, max_length=50)),
  767. ('asset_tag', models.CharField(blank=True, max_length=50, null=True, unique=True)),
  768. ('type', models.CharField(blank=True, max_length=50)),
  769. ('width', models.PositiveSmallIntegerField(default=19)),
  770. ('u_height', models.PositiveSmallIntegerField(default=42, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(100)])),
  771. ('starting_unit', models.PositiveSmallIntegerField(default=1, validators=[django.core.validators.MinValueValidator(1)])),
  772. ('desc_units', models.BooleanField(default=False)),
  773. ('outer_width', models.PositiveSmallIntegerField(blank=True, null=True)),
  774. ('outer_depth', models.PositiveSmallIntegerField(blank=True, null=True)),
  775. ('outer_unit', models.CharField(blank=True, max_length=50)),
  776. ('max_weight', models.PositiveIntegerField(blank=True, null=True)),
  777. ('_abs_max_weight', models.PositiveBigIntegerField(blank=True, null=True)),
  778. ('mounting_depth', models.PositiveSmallIntegerField(blank=True, null=True)),
  779. ],
  780. options={
  781. 'verbose_name': 'rack',
  782. 'verbose_name_plural': 'racks',
  783. 'ordering': ('site', 'location', '_name', 'pk'),
  784. },
  785. ),
  786. migrations.CreateModel(
  787. name='RackReservation',
  788. fields=[
  789. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  790. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  791. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  792. ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
  793. ('comments', models.TextField(blank=True)),
  794. ('units', django.contrib.postgres.fields.ArrayField(base_field=models.PositiveSmallIntegerField(), size=None)),
  795. ('description', models.CharField(max_length=200)),
  796. ],
  797. options={
  798. 'verbose_name': 'rack reservation',
  799. 'verbose_name_plural': 'rack reservations',
  800. 'ordering': ['created', 'pk'],
  801. },
  802. ),
  803. migrations.CreateModel(
  804. name='RackRole',
  805. fields=[
  806. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  807. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  808. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  809. ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
  810. ('name', models.CharField(max_length=100, unique=True)),
  811. ('slug', models.SlugField(max_length=100, unique=True)),
  812. ('description', models.CharField(blank=True, max_length=200)),
  813. ('color', utilities.fields.ColorField(default='9e9e9e', max_length=6)),
  814. ],
  815. options={
  816. 'verbose_name': 'rack role',
  817. 'verbose_name_plural': 'rack roles',
  818. 'ordering': ('name',),
  819. },
  820. ),
  821. migrations.CreateModel(
  822. name='RearPort',
  823. fields=[
  824. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  825. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  826. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  827. ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
  828. ('name', models.CharField(max_length=64)),
  829. ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)),
  830. ('label', models.CharField(blank=True, max_length=64)),
  831. ('description', models.CharField(blank=True, max_length=200)),
  832. ('cable_end', models.CharField(blank=True, max_length=1)),
  833. ('mark_connected', models.BooleanField(default=False)),
  834. ('type', models.CharField(max_length=50)),
  835. ('color', utilities.fields.ColorField(blank=True, max_length=6)),
  836. ('positions', models.PositiveSmallIntegerField(default=1, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(1024)])),
  837. ],
  838. options={
  839. 'verbose_name': 'rear port',
  840. 'verbose_name_plural': 'rear ports',
  841. 'ordering': ('device', '_name'),
  842. 'abstract': False,
  843. },
  844. bases=(models.Model, utilities.tracking.TrackingModelMixin),
  845. ),
  846. migrations.CreateModel(
  847. name='RearPortTemplate',
  848. fields=[
  849. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  850. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  851. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  852. ('name', models.CharField(max_length=64)),
  853. ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)),
  854. ('label', models.CharField(blank=True, max_length=64)),
  855. ('description', models.CharField(blank=True, max_length=200)),
  856. ('type', models.CharField(max_length=50)),
  857. ('color', utilities.fields.ColorField(blank=True, max_length=6)),
  858. ('positions', models.PositiveSmallIntegerField(default=1, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(1024)])),
  859. ],
  860. options={
  861. 'verbose_name': 'rear port template',
  862. 'verbose_name_plural': 'rear port templates',
  863. 'ordering': ('device_type', 'module_type', '_name'),
  864. 'abstract': False,
  865. },
  866. bases=(models.Model, utilities.tracking.TrackingModelMixin),
  867. ),
  868. migrations.CreateModel(
  869. name='Region',
  870. fields=[
  871. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  872. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  873. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  874. ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
  875. ('name', models.CharField(max_length=100)),
  876. ('slug', models.SlugField(max_length=100)),
  877. ('description', models.CharField(blank=True, max_length=200)),
  878. ('lft', models.PositiveIntegerField(editable=False)),
  879. ('rght', models.PositiveIntegerField(editable=False)),
  880. ('tree_id', models.PositiveIntegerField(db_index=True, editable=False)),
  881. ('level', models.PositiveIntegerField(editable=False)),
  882. ],
  883. options={
  884. 'verbose_name': 'region',
  885. 'verbose_name_plural': 'regions',
  886. },
  887. ),
  888. migrations.CreateModel(
  889. name='Site',
  890. fields=[
  891. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  892. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  893. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  894. ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
  895. ('description', models.CharField(blank=True, max_length=200)),
  896. ('comments', models.TextField(blank=True)),
  897. ('name', models.CharField(max_length=100, unique=True)),
  898. ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)),
  899. ('slug', models.SlugField(max_length=100, unique=True)),
  900. ('status', models.CharField(default='active', max_length=50)),
  901. ('facility', models.CharField(blank=True, max_length=50)),
  902. ('time_zone', timezone_field.fields.TimeZoneField(blank=True)),
  903. ('physical_address', models.CharField(blank=True, max_length=200)),
  904. ('shipping_address', models.CharField(blank=True, max_length=200)),
  905. ('latitude', models.DecimalField(blank=True, decimal_places=6, max_digits=8, null=True)),
  906. ('longitude', models.DecimalField(blank=True, decimal_places=6, max_digits=9, null=True)),
  907. ],
  908. options={
  909. 'verbose_name': 'site',
  910. 'verbose_name_plural': 'sites',
  911. 'ordering': ('_name',),
  912. },
  913. ),
  914. migrations.CreateModel(
  915. name='SiteGroup',
  916. fields=[
  917. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  918. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  919. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  920. ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
  921. ('name', models.CharField(max_length=100)),
  922. ('slug', models.SlugField(max_length=100)),
  923. ('description', models.CharField(blank=True, max_length=200)),
  924. ('lft', models.PositiveIntegerField(editable=False)),
  925. ('rght', models.PositiveIntegerField(editable=False)),
  926. ('tree_id', models.PositiveIntegerField(db_index=True, editable=False)),
  927. ('level', models.PositiveIntegerField(editable=False)),
  928. ],
  929. options={
  930. 'verbose_name': 'site group',
  931. 'verbose_name_plural': 'site groups',
  932. },
  933. ),
  934. migrations.CreateModel(
  935. name='VirtualChassis',
  936. fields=[
  937. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  938. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  939. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  940. ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
  941. ('description', models.CharField(blank=True, max_length=200)),
  942. ('comments', models.TextField(blank=True)),
  943. ('name', models.CharField(max_length=64)),
  944. ('domain', models.CharField(blank=True, max_length=30)),
  945. ('member_count', utilities.fields.CounterCacheField(default=0, editable=False, to_field='virtual_chassis', to_model='dcim.Device')),
  946. ],
  947. options={
  948. 'verbose_name': 'virtual chassis',
  949. 'verbose_name_plural': 'virtual chassis',
  950. 'ordering': ['name'],
  951. },
  952. ),
  953. migrations.CreateModel(
  954. name='VirtualDeviceContext',
  955. fields=[
  956. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  957. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  958. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  959. ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
  960. ('description', models.CharField(blank=True, max_length=200)),
  961. ('name', models.CharField(max_length=64)),
  962. ('status', models.CharField(max_length=50)),
  963. ('identifier', models.PositiveSmallIntegerField(blank=True, null=True)),
  964. ('comments', models.TextField(blank=True)),
  965. ('device', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='vdcs', to='dcim.device')),
  966. ],
  967. options={
  968. 'verbose_name': 'virtual device context',
  969. 'verbose_name_plural': 'virtual device contexts',
  970. 'ordering': ['name'],
  971. },
  972. ),
  973. ]