class PhysicalRequirement(sqldb.Model):
    __tablename__ = 'physical_requirement'
    id = sqldb.Column(sqldb.Integer(), primary_key=True)
    name = sqldb.Column(sqldb.String(50))
    description = sqldb.Column(sqldb.Text())
    model = sqldb.Column(sqldb.String(50))
    vendor = sqldb.Column(sqldb.String(50))
    part_number = sqldb.Column(sqldb.String(50))
    procs = sqldb.Column(sqldb.Integer())
    ram = sqldb.Column(sqldb.Integer())
    storage = sqldb.Column(sqldb.Integer())  # GB
    storage_type = sqldb.Column(sqldb.String(50))
    rack_units = sqldb.Column(sqldb.Integer())
    hypervisor = sqldb.Column(sqldb.String(50))
    env = sqldb.Column(sqldb.String(50))
    deleted = sqldb.Column(sqldb.Boolean, default=False)

    team_id = sqldb.Column(sqldb.Integer(), sqldb.ForeignKey('team.id'))
    team = sqldb.relationship('Team',
                              backref=sqldb.backref('physical_requirement',
                                                    lazy='dynamic'))

    # Many to One Relationship with Location Table
    location_id = sqldb.Column(sqldb.Integer, sqldb.ForeignKey('location.id'))
    location = sqldb.relationship('Location',
                                  backref=sqldb.backref('bm_reqs',
                                                        lazy='dynamic'))

    def __repr__(self):
        return '<{0} {1}'.format(self.__class__.__name__, self.id)
Exemplo n.º 2
0
class Outlets(sqldb.Model):
    __tablename__ = 'outlet'
    id = sqldb.Column(sqldb.Integer, primary_key=True)
    total_count = sqldb.Column(sqldb.Integer)
    total_free = sqldb.Column(sqldb.Integer)
    deleted = sqldb.Column(sqldb.Boolean)
    last_modified_dt = sqldb.Column(sqldb.DateTime)

    rack_id = sqldb.Column(sqldb.Integer, sqldb.ForeignKey('rack.id'))
    rack = sqldb.relationship('Rack', backref=sqldb.backref('outlets', lazy='dynamic'))

    type_id = sqldb.Column(sqldb.Integer, sqldb.ForeignKey('outlet_type.id'))
    type = sqldb.relationship('OutletType', backref=sqldb.backref('outlet', lazy='dynamic'))

    def __repr__(self):
        return '<{0} name: {1}'.format(self.__class__.__name__, self.name)
Exemplo n.º 3
0
class BMHost(sqldb.Model):
    __tablename__ = 'bm_host'

    id = sqldb.Column(sqldb.Integer, primary_key=True)
    name = sqldb.Column(sqldb.String)
    model = sqldb.Column(sqldb.String)
    vendor = sqldb.Column(sqldb.String)
    part_number = sqldb.Column(sqldb.String)
    serial_number = sqldb.Column(sqldb.String)
    procs = sqldb.Column(sqldb.Integer)
    description = sqldb.Column(sqldb.String)
    sfp_type = sqldb.Column(sqldb.String)
    power_draw = sqldb.Column(sqldb.String)
    network_ports = sqldb.Column(sqldb.String)
    mgmt_ports = sqldb.Column(sqldb.String)
    group = sqldb.Column(
        sqldb.String)  # Todo: replace with a team relationship
    ram = sqldb.Column(sqldb.Integer)
    storage_capacity = sqldb.Column(sqldb.Integer)
    vm_count = sqldb.Column(sqldb.Integer)
    env = sqldb.Column(sqldb.String)  # Todo: Convert to relationship

    rack_id = sqldb.Column(sqldb.Integer, sqldb.ForeignKey('rack.id'))
    rack = sqldb.relationship('Rack',
                              backref=sqldb.backref('rus', lazy='dynamic'))

    def __repr__(self):
        return '<{0} {1}'.format(self.__class__.__name__, self.id)
class RackUnit(sqldb.Model):
    __tablename__ = 'rack_unit'
    id = sqldb.Column(sqldb.Integer, primary_key=True)
    ru_start = sqldb.Column(sqldb.Integer)
    ru_end = sqldb.Column(sqldb.Integer)
    rack_id = sqldb.Column(sqldb.Integer, sqldb.ForeignKey('rack.id'))
    rack = sqldb.relationship('Rack',
                              backref=sqldb.backref('rus', lazy='dynamic'))
    deleted = sqldb.Column(sqldb.Boolean)
    last_modified_dt = sqldb.Column(sqldb.DateTime)

    def __repr__(self):
        return '<{0} name: {1}'.format(self.__class__.__name__, self.name)
class Rack(sqldb.Model):

    __tablename__ = 'rack'

    id = sqldb.Column(sqldb.Integer, primary_key=True)
    vendor = sqldb.Column(sqldb.String)
    model = sqldb.Column(sqldb.String)
    size = sqldb.Column(sqldb.Integer)
    serial_number = sqldb.Column(sqldb.String)
    deleted = sqldb.Column(sqldb.Boolean)
    last_modified_dt = sqldb.Column(sqldb.DateTime)
    # Many to One Relationship with Location Table
    location_id = sqldb.Column(sqldb.Integer, sqldb.ForeignKey('location.id'))
    location = sqldb.relationship('Location',
                                  backref=sqldb.backref('racks',
                                                        lazy='dynamic'))
    # Many to Many with Rack Table --> PDU may power more than one rack
    pdus = sqldb.relationship('PDU',
                              secondary=join__rack_pdu,
                              backref=sqldb.backref('racks', lazy='dynamic'))

    def __repr__(self):
        return '<{0} name: {1}'.format(self.__class__.__name__, self.name)
Exemplo n.º 6
0
class Circuit(sqldb.Model):
    __tablename__ = 'circuit'
    id = sqldb.Column(sqldb.Integer, primary_key=True)
    amperage = sqldb.Column(sqldb.Integer)
    voltage = sqldb.Column(sqldb.Integer)
    power_rating = sqldb.Column(sqldb.Integer)
    deleted = sqldb.Column(sqldb.Boolean)
    last_modified_dt = sqldb.Column(sqldb.DateTime)

    rack_id = sqldb.Column(sqldb.Integer, sqldb.ForeignKey('rack.id'))
    rack = sqldb.relationship('Rack',
                              backref=sqldb.backref('rus', lazy='dynamic'))

    def __repr__(self):
        return '<{0} name: {1}>'.format(self.__class__.__name__, self.name)
Exemplo n.º 7
0
class PDU(sqldb.Model):
    __tablename__ = 'pdu'
    id = sqldb.Column(sqldb.Integer, primary_key=True)
    name = sqldb.Column(sqldb.String, nullable=False)
    vendor = sqldb.Column(sqldb.String)
    total_count = sqldb.Column(sqldb.Integer)
    total_free = sqldb.Column(sqldb.Integer)
    deleted = sqldb.Column(sqldb.Boolean)
    last_modified_dt = sqldb.Column(sqldb.DateTime)

    type_id = sqldb.Column(sqldb.Integer, sqldb.ForeignKey('outlet_type.id'))
    type = sqldb.relationship('OutletType',
                              backref=sqldb.backref('outlet_type',
                                                    lazy='dynamic'))

    def __repr__(self):
        return '<{0} name: {1}'.format(self.__class__.__name__, self.name)
Exemplo n.º 8
0
class Firewall(sqldb.Model):
    __tablename__ = 'firewall'

    id = sqldb.Column(sqldb.Integer, primary_key=True)
    hostname = sqldb.Column(sqldb.String)
    model = sqldb.Column(sqldb.String)
    vendor = sqldb.Column(sqldb.String)
    part_number = sqldb.Column(sqldb.String)
    serial_number = sqldb.Column(sqldb.String)
    description = sqldb.Column(sqldb.String)
    env = sqldb.Column(sqldb.String)  # Todo: Convert to relationship

    rack_id = sqldb.Column(sqldb.Integer, sqldb.ForeignKey('rack.id'))
    rack = sqldb.relationship('Rack',
                              backref=sqldb.backref('rus', lazy='dynamic'))

    def __repr__(self):
        return '<{0} {1}'.format(self.__class__.__name__, self.id)
class License(sqldb.Model):
    id = sqldb.Column(sqldb.Integer, primary_key=True)
    vendor = sqldb.Column(sqldb.String)  # Data Center name or label
    model = sqldb.Column(sqldb.String)
    name = sqldb.Column(sqldb.String)
    type = sqldb.Column(sqldb.String)
    quantity = sqldb.Column(sqldb.String)
    in_use = sqldb.Column(sqldb.String)
    expiration_dt = sqldb.Column(sqldb.DateTime)
    deleted = sqldb.Column(sqldb.Boolean)
    last_modified_dt = sqldb.Column(sqldb.DateTime)
    # Many to One Relationship with Location Table
    location_id = sqldb.Column(sqldb.Integer, sqldb.ForeignKey('location.id'))
    location = sqldb.relationship('Location',
                                  backref=sqldb.backref('licenses',
                                                        lazy='dynamic'))

    def __repr__(self):
        return '<{0} name: {1}>'.format(self.__class__.__name__, self.name)
Exemplo n.º 10
0
class Wireless(sqldb.Model):
    __tablename__ = 'wireless'

    id = sqldb.Column(sqldb.Integer, primary_key=True)
    hostname = sqldb.Column(sqldb.String(70))
    model = sqldb.Column(sqldb.String(70))
    vendor = sqldb.Column(sqldb.String(70))
    part_number = sqldb.Column(sqldb.String(50))
    serial_number = sqldb.Column(sqldb.String(70))
    description = sqldb.Column(sqldb.Text())
    env = sqldb.Column(sqldb.String(70))  # Todo: Convert to relationship
    device_type = sqldb.Column(sqldb.String(70))

    rack_id = sqldb.Column(sqldb.Integer, sqldb.ForeignKey('rack.id'))
    rack = sqldb.relationship('Rack',
                              backref=sqldb.backref('rus', lazy='dynamic'))

    def __repr__(self):
        return '<{0} {1}'.format(self.__class__.__name__, self.id)
Exemplo n.º 11
0
class VM(sqldb.Model):

    __tablename__ = 'vm'

    id = sqldb.Column(sqldb.Integer, primary_key=True)
    hostname = sqldb.Column(sqldb.String)  # Data Center name or label
    vcpu = sqldb.Column(sqldb.Integer)
    ram = sqldb.Column(sqldb.Integer)
    group = sqldb.Column(sqldb.String)
    storage = sqldb.Column(sqldb.Integer)
    vmunit = sqldb.Column(sqldb.Integer)
    role = sqldb.Column(sqldb.String)
    environment = sqldb.Column(sqldb.String)
    cluster = sqldb.Column(sqldb.String)
    deleted = sqldb.Column(sqldb.Boolean)
    last_modified_dt = sqldb.Column(sqldb.DateTime)
    # Many to One Relationship with Location Table
    location_id = sqldb.Column(sqldb.Integer, sqldb.ForeignKey('location.id'))
    location = sqldb.relationship('Location',
                                  backref=sqldb.backref('vms', lazy='dynamic'))

    def __repr__(self):
        return '<{0} name: {1}'.format(self.__class__.__name__, self.name)