Initial Commit
This commit is contained in:
0
api/app/models/nutanix/core/__init__.py
Normal file
0
api/app/models/nutanix/core/__init__.py
Normal file
40
api/app/models/nutanix/core/pcentral.py
Normal file
40
api/app/models/nutanix/core/pcentral.py
Normal file
@@ -0,0 +1,40 @@
|
||||
from sqlalchemy import (
|
||||
Column,
|
||||
String,
|
||||
Integer,
|
||||
ForeignKey
|
||||
)
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from models.common.base import BaseModel
|
||||
|
||||
|
||||
class pcentral(BaseModel):
|
||||
"""
|
||||
description: Nutanix prism central model
|
||||
"""
|
||||
__tablename__ = "tnc_pcentrals"
|
||||
_s_collection_name = "pcentrals"
|
||||
_s_class_name = "pcentral"
|
||||
|
||||
id = Column(Integer, primary_key=True, autoincrement=True, index=True)
|
||||
name = Column(String(32), unique=True, index=True, nullable=False)
|
||||
hostname = Column(String(64), unique=True, index=True, nullable=True)
|
||||
ncc_version = Column(String(16), index=True, nullable=False)
|
||||
aos_version = Column(String(16), index=True, nullable=False)
|
||||
|
||||
contour_id = Column(Integer, ForeignKey("tcc_contours.id"))
|
||||
contour = relationship("contour", back_populates="pcentral")
|
||||
|
||||
npcreport = relationship(
|
||||
"npcreport",
|
||||
backref="pcentral",
|
||||
cascade="save-update, delete",
|
||||
lazy="dynamic"
|
||||
)
|
||||
pelement = relationship(
|
||||
"pelement",
|
||||
backref="pcentral",
|
||||
cascade="save-update, delete",
|
||||
lazy="dynamic"
|
||||
)
|
||||
52
api/app/models/nutanix/core/pelement.py
Normal file
52
api/app/models/nutanix/core/pelement.py
Normal file
@@ -0,0 +1,52 @@
|
||||
from sqlalchemy import (
|
||||
Column,
|
||||
String,
|
||||
Integer,
|
||||
ForeignKey
|
||||
)
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from models.common.base import BaseModel
|
||||
|
||||
|
||||
class pelement(BaseModel):
|
||||
"""
|
||||
description: Nutanix prism element model
|
||||
"""
|
||||
__tablename__ = "tnc_pelement"
|
||||
_s_collection_name = "pelements"
|
||||
_s_class_name = "pelement"
|
||||
|
||||
id = Column(Integer, primary_key=True, autoincrement=True, index=True)
|
||||
ip = Column(String(15), unique=True, nullable=False)
|
||||
name = Column(String(32), unique=True, nullable=False)
|
||||
hostname = Column(String(64), unique=True, nullable=True)
|
||||
description = Column(String(64), unique=False, nullable=False)
|
||||
ncc_version = Column(String(16), index=True, nullable=False)
|
||||
aos_version = Column(String(16), index=True, nullable=False)
|
||||
cpu_decomiss = Column(Integer, nullable=True)
|
||||
|
||||
pcentral_id = Column(Integer, ForeignKey("tnc_pcentrals.id"))
|
||||
environment_id = Column(Integer, ForeignKey("tcc_environments.id"))
|
||||
|
||||
environment = relationship("environment", back_populates="pelement")
|
||||
pelement = relationship(
|
||||
"npereport",
|
||||
backref="pelement",
|
||||
cascade="save-update, delete",
|
||||
lazy="dynamic"
|
||||
)
|
||||
maintenance = relationship(
|
||||
"nmreport",
|
||||
backref="pelement",
|
||||
cascade="save-update, delete",
|
||||
lazy="dynamic"
|
||||
)
|
||||
|
||||
def to_dict(self):
|
||||
result = BaseModel.to_dict(self)
|
||||
|
||||
if (result['hostname'] is None):
|
||||
result['hostname'] = result['hostname']
|
||||
|
||||
return result
|
||||
Reference in New Issue
Block a user