Demo entry 6662879

接口数据接口

   

Submitted by anonymous on Nov 28, 2017 at 09:44
Language: Python. Code size: 2.6 kB.

    # Create your models here.  
    class Interface(models.Model):  
        host = models.ForeignKey(  
                                    Host,  
                                    on_delete=models.PROTECT,  
                                    )  
        name = models.CharField(max_length=16, validators=[validate_name], default="unknown")  
        type = models.ForeignKey(  
                                    InterfaceType,  
                                    on_delete=models.PROTECT,  
                                    related_name="interface_type"  
                                    )  
        subtype = models.CharField(max_length=20, default="", blank=True)  
        mode = models.CharField(max_length=20, default="", blank=True)  
        primary_ip = models.CharField(max_length=20, default="", blank=True)  
        mac = models.CharField(max_length=20, default="", blank=True)  
        parent = models.BigIntegerField(default=0)  
        speed = models.BigIntegerField(default=1000)  
        mtu = models.BigIntegerField(default=1500)  
        vlan = models.BigIntegerField(default=1, validators=[validate_vlan])  
        trunk = models.CharField(max_length=20, validators=[validate_trunk], default="", blank=True)  
        tunnel_id = models.BigIntegerField(default=1, validators=[validate_tunnel_id])  
        local_ip = models.GenericIPAddressField(protocol='IPv4', default="", null=True)  
        remote_ip = models.GenericIPAddressField(protocol='IPv4', default="", null=True)  
        status = models.CharField(max_length=20, default="up")  
        switch = models.ForeignKey(  
                                    Switch,  
                                    on_delete=models.PROTECT,  
                                     blank=True,  
                                     null=True,  
                                     related_name="interface_switch"  
                                       
                                    )  
        network = models.ForeignKey(  
                                    Network,  
                                    on_delete=models.PROTECT,  
                                     blank=True,  
                                     null=True,  
                                     related_name="interface_network"  
                                    )  
        # port =  models.BigIntegerField(default=0)  
        class Meta:  
            # managed = False  
            db_table = 'interface'  
            app_label = 'network'  

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).