|
@@ -18,122 +18,113 @@
|
|
|
# Django Conntrackt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
#
|
|
|
|
|
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
import datetime
|
|
|
from south.db import db
|
|
|
from south.v2 import SchemaMigration
|
|
|
from django.db import models
|
|
|
|
|
|
|
|
|
class Migration(SchemaMigration):
|
|
|
|
|
|
def forwards(self, orm):
|
|
|
# Adding model 'Project'
|
|
|
db.create_table('conntrackt_project', (
|
|
|
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
|
|
('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
|
|
|
('description', self.gf('django.db.models.fields.TextField')(blank=True)),
|
|
|
))
|
|
|
db.send_create_signal('conntrackt', ['Project'])
|
|
|
|
|
|
# Adding model 'Location'
|
|
|
db.create_table('conntrackt_location', (
|
|
|
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
|
|
('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
|
|
|
('description', self.gf('django.db.models.fields.TextField')(blank=True)),
|
|
|
))
|
|
|
db.send_create_signal('conntrackt', ['Location'])
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
# Adding model 'Entity'
|
|
|
db.create_table('conntrackt_entity', (
|
|
|
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
|
|
('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
|
|
|
('description', self.gf('django.db.models.fields.TextField')(blank=True)),
|
|
|
('project', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['conntrackt.Project'])),
|
|
|
('location', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['conntrackt.Location'])),
|
|
|
))
|
|
|
db.send_create_signal('conntrackt', ['Entity'])
|
|
|
|
|
|
# Adding model 'Interface'
|
|
|
db.create_table('conntrackt_interface', (
|
|
|
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
|
|
('name', self.gf('django.db.models.fields.CharField')(default='eth0', max_length=100)),
|
|
|
('description', self.gf('django.db.models.fields.TextField')(default='Main network interface.', blank=True)),
|
|
|
('entity', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['conntrackt.Entity'])),
|
|
|
('address', self.gf('django.db.models.fields.IPAddressField')(max_length=15)),
|
|
|
('netmask', self.gf('django.db.models.fields.IPAddressField')(default='255.255.255.255', max_length=15)),
|
|
|
))
|
|
|
db.send_create_signal('conntrackt', ['Interface'])
|
|
|
|
|
|
# Adding model 'Communication'
|
|
|
db.create_table('conntrackt_communication', (
|
|
|
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
|
|
('source', self.gf('django.db.models.fields.related.ForeignKey')(related_name='source_set', to=orm['conntrackt.Interface'])),
|
|
|
('destination', self.gf('django.db.models.fields.related.ForeignKey')(related_name='destination_set', to=orm['conntrackt.Interface'])),
|
|
|
('protocol', self.gf('django.db.models.fields.CharField')(max_length=10)),
|
|
|
('port', self.gf('django.db.models.fields.IntegerField')(default=0)),
|
|
|
('description', self.gf('django.db.models.fields.TextField')(blank=True)),
|
|
|
))
|
|
|
db.send_create_signal('conntrackt', ['Communication'])
|
|
|
from django.db import models, migrations
|
|
|
import conntrackt.models
|
|
|
|
|
|
|
|
|
def backwards(self, orm):
|
|
|
# Deleting model 'Project'
|
|
|
db.delete_table('conntrackt_project')
|
|
|
|
|
|
# Deleting model 'Location'
|
|
|
db.delete_table('conntrackt_location')
|
|
|
class Migration(migrations.Migration):
|
|
|
|
|
|
# Deleting model 'Entity'
|
|
|
db.delete_table('conntrackt_entity')
|
|
|
|
|
|
# Deleting model 'Interface'
|
|
|
db.delete_table('conntrackt_interface')
|
|
|
|
|
|
# Deleting model 'Communication'
|
|
|
db.delete_table('conntrackt_communication')
|
|
|
|
|
|
dependencies = [
|
|
|
]
|
|
|
|
|
|
models = {
|
|
|
'conntrackt.communication': {
|
|
|
'Meta': {'object_name': 'Communication'},
|
|
|
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
|
|
|
'destination': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'destination_set'", 'to': "orm['conntrackt.Interface']"}),
|
|
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
|
|
'port': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
|
|
'protocol': ('django.db.models.fields.CharField', [], {'max_length': '10'}),
|
|
|
'source': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'source_set'", 'to': "orm['conntrackt.Interface']"})
|
|
|
},
|
|
|
'conntrackt.entity': {
|
|
|
'Meta': {'object_name': 'Entity'},
|
|
|
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
|
|
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
|
|
'location': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['conntrackt.Location']"}),
|
|
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
|
|
'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['conntrackt.Project']"})
|
|
|
},
|
|
|
'conntrackt.interface': {
|
|
|
'Meta': {'object_name': 'Interface'},
|
|
|
'address': ('django.db.models.fields.IPAddressField', [], {'max_length': '15'}),
|
|
|
'description': ('django.db.models.fields.TextField', [], {'default': "'Main network interface.'", 'blank': 'True'}),
|
|
|
'entity': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['conntrackt.Entity']"}),
|
|
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
|
|
'name': ('django.db.models.fields.CharField', [], {'default': "'eth0'", 'max_length': '100'}),
|
|
|
'netmask': ('django.db.models.fields.IPAddressField', [], {'default': "'255.255.255.255'", 'max_length': '15'})
|
|
|
},
|
|
|
'conntrackt.location': {
|
|
|
'Meta': {'object_name': 'Location'},
|
|
|
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
|
|
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
|
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
|
|
|
},
|
|
|
'conntrackt.project': {
|
|
|
'Meta': {'object_name': 'Project'},
|
|
|
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
|
|
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
|
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
|
|
|
}
|
|
|
}
|
|
|
|
|
|
complete_apps = ['conntrackt']
|
|
\ No newline at end of file
|
|
|
operations = [
|
|
|
migrations.CreateModel(
|
|
|
name='Communication',
|
|
|
fields=[
|
|
|
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
|
|
('protocol', models.CharField(max_length=10, choices=[(b'TCP', b'TCP'), (b'UDP', b'UDP'), (b'ICMP', b'ICMP')])),
|
|
|
('port', models.IntegerField(default=0)),
|
|
|
('description', models.TextField(blank=True)),
|
|
|
],
|
|
|
options={
|
|
|
},
|
|
|
bases=(conntrackt.models.RelatedCollectorMixin, models.Model),
|
|
|
),
|
|
|
migrations.CreateModel(
|
|
|
name='Entity',
|
|
|
fields=[
|
|
|
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
|
|
('name', models.CharField(max_length=100)),
|
|
|
('description', models.TextField(blank=True)),
|
|
|
],
|
|
|
options={
|
|
|
'verbose_name_plural': 'entities',
|
|
|
},
|
|
|
bases=(conntrackt.models.RelatedCollectorMixin, models.Model),
|
|
|
),
|
|
|
migrations.CreateModel(
|
|
|
name='Interface',
|
|
|
fields=[
|
|
|
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
|
|
('name', models.CharField(default=b'eth0', max_length=100)),
|
|
|
('description', models.TextField(default=b'Main network interface.', blank=True)),
|
|
|
('address', models.IPAddressField()),
|
|
|
('netmask', models.IPAddressField(default=b'255.255.255.255')),
|
|
|
('entity', models.ForeignKey(to='conntrackt.Entity')),
|
|
|
],
|
|
|
options={
|
|
|
},
|
|
|
bases=(conntrackt.models.RelatedCollectorMixin, models.Model),
|
|
|
),
|
|
|
migrations.CreateModel(
|
|
|
name='Location',
|
|
|
fields=[
|
|
|
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
|
|
('name', models.CharField(unique=True, max_length=100)),
|
|
|
('description', models.TextField(blank=True)),
|
|
|
],
|
|
|
options={
|
|
|
},
|
|
|
bases=(conntrackt.models.RelatedCollectorMixin, models.Model),
|
|
|
),
|
|
|
migrations.CreateModel(
|
|
|
name='Project',
|
|
|
fields=[
|
|
|
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
|
|
('name', models.CharField(unique=True, max_length=100)),
|
|
|
('description', models.TextField(blank=True)),
|
|
|
],
|
|
|
options={
|
|
|
'permissions': (('view', 'Can view information'),),
|
|
|
},
|
|
|
bases=(conntrackt.models.RelatedCollectorMixin, models.Model),
|
|
|
),
|
|
|
migrations.AlterUniqueTogether(
|
|
|
name='interface',
|
|
|
unique_together=set([('name', 'entity'), ('entity', 'address', 'netmask')]),
|
|
|
),
|
|
|
migrations.AddField(
|
|
|
model_name='entity',
|
|
|
name='location',
|
|
|
field=models.ForeignKey(to='conntrackt.Location'),
|
|
|
preserve_default=True,
|
|
|
),
|
|
|
migrations.AddField(
|
|
|
model_name='entity',
|
|
|
name='project',
|
|
|
field=models.ForeignKey(to='conntrackt.Project'),
|
|
|
preserve_default=True,
|
|
|
),
|
|
|
migrations.AlterUniqueTogether(
|
|
|
name='entity',
|
|
|
unique_together=set([('name', 'project')]),
|
|
|
),
|
|
|
migrations.AddField(
|
|
|
model_name='communication',
|
|
|
name='destination',
|
|
|
field=models.ForeignKey(related_name='destination_set', to='conntrackt.Interface'),
|
|
|
preserve_default=True,
|
|
|
),
|
|
|
migrations.AddField(
|
|
|
model_name='communication',
|
|
|
name='source',
|
|
|
field=models.ForeignKey(related_name='source_set', to='conntrackt.Interface'),
|
|
|
preserve_default=True,
|
|
|
),
|
|
|
migrations.AlterUniqueTogether(
|
|
|
name='communication',
|
|
|
unique_together=set([('source', 'destination', 'protocol', 'port')]),
|
|
|
),
|
|
|
]
|