示例#1
0
class Vlans(db.Model):
    __tablename__ = 'vlans'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(50), unique=True)
    vlanid = db.Column(db.String(50), unique=True)
    switch1_24_ports = db.relationship('Switch1_24_port',
                                       backref='sw124vlansbackref',
                                       lazy='dynamic')
    switch2_24_ports = db.relationship('Switch2_24_port',
                                       backref='sw224vlansbackref',
                                       lazy='dynamic')
    switch1_48_ports = db.relationship('Switch1_48_port',
                                       backref='sw148vlansbackref',
                                       lazy='dynamic')
    switch2_48_ports = db.relationship('Switch1_48_port',
                                       backref='sw248vlansbackref',
                                       lazy='dynamic')
    subnets = db.relationship('Subnets',
                              backref='subnetsvlansbackref',
                              lazy='dynamic')

    def __init__(self, name=None, vlanid=None):
        self.name = name
        self.vlanid = vlanid

    def __repr__(self):
        return '<Vlans %r>' % (self.name)
示例#2
0
class Port_channels_fw1(db.Model):
    __tablename__ = 'port_channels_fw1'
    id = db.Column(db.Integer, primary_key=True)
    vlan = db.Column(db.String(20))
    name = db.Column(db.String(20))
    seclvl = db.Column(db.String(10))
    subnet = db.Column(db.String(10))
    enabled = db.Column(db.Boolean())
    mode = db.Column(db.String(10))
    #    group = db.Column(db.String(10))
    interfaces = db.relationship('Firewall1_interfaces',
                                 backref='interfaces',
                                 lazy='dynamic')

    def __init__(self,
                 vlan=None,
                 name=None,
                 seclvl=None,
                 subnet=None,
                 enabled=None,
                 mode=None,
                 group=None):
        self.vlan = vlan
        self.name = name
        self.seclvl = seclvl
        self.subnet = subnet
        self.enabled = enabled
        self.mode = mode
        self.group = group

    def __repr__(self):
        return '%r' % (self.id)
示例#3
0
class Switches(db.Model):
    __tablename__ = 'switches'
    id = db.Column(db.Integer, primary_key=True)
    hostname = db.Column(db.String(50), unique=True)
    ipaddress = db.Column(db.String(50), unique=True)
    subnet = db.Column(db.String(50))
    gateway = db.Column(db.String(50))
    mgmtvlan = db.Column(db.String(50))
    portnr = db.Column(db.String(2))
    porttype = db.Column(db.String(15))
    customer_sw = db.relationship('Customer_sw',
                                  backref='customerswbackref',
                                  lazy='dynamic')

    def __init__(self,
                 hostname=None,
                 ipaddress=None,
                 subnet=None,
                 gateway=None,
                 mgmtvlan=None,
                 portnr=None,
                 porttype=None):
        self.hostname = hostname
        self.ipaddress = ipaddress
        self.subnet = subnet
        self.gateway = gateway
        self.mgmtvlan = mgmtvlan
        self.portnr = portnr
        self.porttype = porttype

    def __repr__(self):
        return '<Switches %r>' % (self.hostname)
示例#4
0
class System_vm_profiles(db.Model):
    __tablename__ = 'system_vm_profiles'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(15), unique=True)
    mac = db.Column(db.String(10))
    #    salt_mac = db.Column(db.Integer, db.ForeignKey('saltstack_pxe_nodes.id'))
    salt_id = db.relationship('Saltstack_pxe_nodes',
                              backref='saltvmbackref',
                              lazy='dynamic')

    #    def __init__(self, name=None, mac=None):
    def __init__(self, name=None, mac=None):
        self.name = name
        self.mac = mac

    def __repr__(self):
        return str('%s') % (self.name)
示例#5
0
class User(db.Model, UserMixin):
    id = db.Column(db.Integer, primary_key=True)
    email = db.Column(db.String(255), unique=True)
    username = db.Column(db.String(255))
    password = db.Column(db.String(255))
    last_login_at = db.Column(db.DateTime())
    current_login_at = db.Column(db.DateTime())
    last_login_ip = db.Column(db.String(100))
    current_login_ip = db.Column(db.String(100))
    login_count = db.Column(db.Integer)
    active = db.Column(db.Boolean())
    confirmed_at = db.Column(db.DateTime())
    profile_pic = db.Column(db.String(100))
    roles = db.relationship('Role',
                            secondary=roles_users,
                            backref=db.backref('users', lazy='dynamic'))

    def __init__(self,
                 email=None,
                 username=None,
                 password=None,
                 last_login_at=None,
                 current_login_at=None,
                 last_login_ip=None,
                 current_login_ip=None,
                 login_count=None,
                 active=None,
                 confirmed_at=None,
                 profile_pic=None,
                 roles=None):
        self.email = email
        self.username = username
        self.password = password
        self.last_login_at = last_login_at
        self.current_login_at = current_login_at
        self.last_login_ip = last_login_ip
        self.current_login_ip = current_login_ip
        self.login_count = login_count
        self.active = active
        self.confirmed_at = confirmed_at
        self.profile_pic = profile_pic
        self.roles = roles

    def is_authenticated(self):
        return True

    def is_active(self):
        return True

    def is_anonymous(self):
        return False

    def get_id(self):
        return unicode(self.id)

    def set_password():
        pass

    def check_password():
        pass

    def __repr__(self):
        return '<User %r>' % (self.username)