Skip to content

Instantly share code, notes, and snippets.

@eprueves
Created August 2, 2019 06:09
Show Gist options
  • Save eprueves/0bff0022e9d270b5fa9997ea7b2d1c0b to your computer and use it in GitHub Desktop.
Save eprueves/0bff0022e9d270b5fa9997ea7b2d1c0b to your computer and use it in GitHub Desktop.
test and datapoint DB models
class Test(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
agent = models.ForeignKey(AgentProfile, null=False, on_delete=models.CASCADE)
ip_address = models.GenericIPAddressField(null=False, protocol='IPv4') # ip address of agent when test was conducted
test_type = models.CharField(null=False, max_length=10, choices=choices.test_type_choices)
date_created = models.DateTimeField(auto_now_add=True)
network_connection = models.CharField(max_length=10, choices=choices.network_choices, default='unknown')
pcap = models.CharField(max_length=100, null=True)
lat = models.DecimalField(max_digits=10, decimal_places=7, default=16.647322)
long = models.DecimalField(max_digits=10, decimal_places=7, default=121.071959)
mode = models.CharField(null=False, max_length=10, choices=choices.test_mode_choices, default='unknown')
class DataPoint(models.Model):
"""Model for a data point which is acquired by the test client against a test server"""
date_tested = models.DateTimeField()
test_id = models.ForeignKey(Test, null=False, on_delete=models.CASCADE)
direction = models.CharField(null=False, max_length=10, choices=choices.direction_choices, default='unknown')
server = models.ForeignKey(Server, null=False, on_delete=models.CASCADE)
path_mtu = models.IntegerField(null=True)
baseline_rtt = models.FloatField(null=True) # in ms
bottleneck_bw = models.FloatField(null=True) # in Mbps
bdp = models.FloatField(null=True) # in bits
min_rwnd = models.FloatField(null=True) # in Kbytes
ave_tcp_tput = models.FloatField(null=True) # in Mbps
ideal_tcp_tput = models.FloatField(null=True) # in Mbps
actual_transfer_time = models.FloatField(null=True) # in secs
ideal_transfer_time = models.FloatField(null=True) # in Mbps
tcp_ttr = models.FloatField(null=True) # unitless
trans_bytes = models.FloatField(null=True) # in bytes
retrans_bytes = models.FloatField(null=True) # in bytes
tcp_eff = models.FloatField(null=True) # in %
ave_rtt = models.FloatField(null=True) # in ms
buffer_delay = models.FloatField(null=True) # in %
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment