update
This commit is contained in:
62
backend/models/idrac_server.py
Normal file
62
backend/models/idrac_server.py
Normal file
@@ -0,0 +1,62 @@
|
||||
"""
|
||||
Dell iDRAC 서버 관리 모델
|
||||
backend/models/idrac_server.py
|
||||
"""
|
||||
|
||||
from backend.models.user import db
|
||||
from datetime import datetime
|
||||
from sqlalchemy import Column, Integer, String, DateTime, Boolean
|
||||
|
||||
|
||||
class IdracServer(db.Model):
|
||||
"""iDRAC 서버 정보 모델"""
|
||||
__tablename__ = 'idrac_servers'
|
||||
|
||||
id = Column(Integer, primary_key=True)
|
||||
name = Column(String(100), nullable=False) # 서버명
|
||||
ip_address = Column(String(50), nullable=False, unique=True) # iDRAC IP
|
||||
username = Column(String(50), default='root') # iDRAC 사용자명
|
||||
password = Column(String(200), nullable=False) # 비밀번호 (암호화 권장)
|
||||
|
||||
# 분류 정보
|
||||
group_name = Column(String(100)) # 그룹명 (고객사, 프로젝트명)
|
||||
location = Column(String(100)) # 위치
|
||||
model = Column(String(100)) # 서버 모델
|
||||
|
||||
# 상태 정보
|
||||
status = Column(String(20), default='registered') # registered, online, offline, updating
|
||||
last_connected = Column(DateTime) # 마지막 연결 시간
|
||||
last_updated = Column(DateTime) # 마지막 업데이트 시간
|
||||
|
||||
# 펌웨어 정보
|
||||
current_bios = Column(String(50)) # 현재 BIOS 버전
|
||||
target_bios = Column(String(50)) # 목표 BIOS 버전
|
||||
|
||||
# 메타 정보
|
||||
notes = Column(String(500)) # 비고
|
||||
is_active = Column(Boolean, default=True) # 활성화 여부
|
||||
created_at = Column(DateTime, default=datetime.utcnow)
|
||||
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
||||
|
||||
def to_dict(self):
|
||||
"""딕셔너리로 변환"""
|
||||
return {
|
||||
'id': self.id,
|
||||
'name': self.name,
|
||||
'ip_address': self.ip_address,
|
||||
'username': self.username,
|
||||
'group_name': self.group_name,
|
||||
'location': self.location,
|
||||
'model': self.model,
|
||||
'status': self.status,
|
||||
'last_connected': self.last_connected.isoformat() if self.last_connected else None,
|
||||
'last_updated': self.last_updated.isoformat() if self.last_updated else None,
|
||||
'current_bios': self.current_bios,
|
||||
'target_bios': self.target_bios,
|
||||
'notes': self.notes,
|
||||
'is_active': self.is_active,
|
||||
'created_at': self.created_at.isoformat() if self.created_at else None
|
||||
}
|
||||
|
||||
def __repr__(self):
|
||||
return f'<IdracServer {self.name} ({self.ip_address})>'
|
||||
Reference in New Issue
Block a user