Skip to content

Instantly share code, notes, and snippets.

@michaelrice
Created January 12, 2016 21:11
Show Gist options
  • Save michaelrice/530ed57adf95909e06ac to your computer and use it in GitHub Desktop.
Save michaelrice/530ed57adf95909e06ac to your computer and use it in GitHub Desktop.
class ServerDataModel(Base):
__tablename__ = 'ServerData'
id = Column(Integer, primary_key=True)
server_number = Column(Integer, unique=True, nullable=False)
primary_ip = Column(String(15), nullable=False)
primary_gw = Column(String(15), nullable=False)
primary_nm = Column(String(15), nullable=False)
primary_mac = Column(String(20), nullable=False)
drac_ip = Column(String(15), nullable=True)
drac_gw = Column(String(15), nullable=True)
drac_nm = Column(String(15), nullable=True)
hostname = Column(String(255), nullable=False)
dns_domain_name = Column(String(255), default="rpc.local")
dns_server_primary = Column(String(15), nullable=False)
dns_server_secondary = Column(String(15), nullable=True)
dns_server_tertiary = Column(String(15), nullable=True)
bootstrapped = Column(Boolean, nullable=False)
boot_os = Column(String(255), nullable=False)
boot_os_version = Column(String(64), nullable=False)
boot_profile = Column(String(128), nullable=False)
boot_status = Column(String(128), nullable=False)
operational_status = Column(String(255), nullable=False)
ntp_server = Column(String(128), nullable=False)
switches = relationship("SwitchInfo", backref="ServerData")
provision_zone = relationship("ProvisionZone")
class ProvisionZone(Base):
__tablename__ = "ProvisionZone"
id = Column(Integer, primary_key=True)
zone_name = Column(String(128), unique=True, nullable=False)
provision_img_host = Column(String(128), nullable=False)
provision_mirror_host = Column(String(128), nullable=False)
class SwitchInfo(Base):
__tablename__ = "SwitchInfo"
id = Column(Integer, primary_key=True)
switch_name = Column(String(255), nullable=False)
switch_port = Column(String(255), nullable=False)
server_number = Column(Integer, ForeignKey("ServerData.server_number"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment