Module pyinventory.api.equipment_type

Functions

def add_equipment_type(client: SymphonyClient, name: str, category: str, properties: Sequence[Tuple[str, str, Union[datetime.date, float, int, str, bool, Tuple[float, float], NoneType], Union[bool, NoneType]]], ports_dict: Dict[str, str], position_list: List[str]) -> EquipmentType

This function creates new equipment type.

Args

name : str
equipment type name
category : str
category name

properties (Sequence[Tuple[str, str, Optional[PropertyValue], Optional[bool]]]): - str - type name - str - enum["string", "int", "bool", "float", "date", "enum", "range", "email", "gps_location", "equipment", "location", "service", "datetime_local"] - PropertyValue - default property value - bool - fixed value flag

ports_dict : Dict[str, str]
dictionary of port name to port type name
  • str - port name
  • str - port type name
position_list : List[str]
list of positions names

Returns

EquipmentType object

Raises

FailedOperationException
internal inventory error

Example

e_type = client.add_equipment_type(
    name="Tp-Link T1600G",
    category="Router",
    properties=[("IP", "string", None, True)],
    ports_dict={"Port 1": "eth port", "port 2": "eth port"},
    position_list=[],
)
def copy_equipment_type(client: SymphonyClient, curr_equipment_type_name: str, new_equipment_type_name: str) -> EquipmentType

Copy existing equipment type.

Args

curr_equipment_type_name : str
existing equipment type name
new_equipment_type_name : str
new equipment type name

Returns

EquipmentType object

Raises

FailedOperationException
internal inventory error

Example

e_type = client.copy_equipment_type(
    curr_equipment_type_name="Card",
    new_equipment_type_name="External_Card",
)
def delete_equipment_type_with_equipments(client: SymphonyClient, equipment_type: EquipmentType) -> NoneType

Delete equipment type with existing equipments.

Args

equipment_type ( EquipmentType ): equipment type object

Raises

EntityNotFoundError: if equipment_type does not exist

Example

equipment_type = client.get_or_create_equipment_type(
    name="Tp-Link T1600G",
    category="Router",
    properties=[("IP", "string", None, True)],
    ports_dict={"Port 1": "eth port", "port 2": "eth port"},
    position_list=[],
)
client.delete_equipment_type_with_equipments(equipment_type=equipment_type)
def edit_equipment_type(client: SymphonyClient, name: str, new_positions_list: List[str], new_ports_dict: Dict[str, str]) -> EquipmentType

Edit existing equipment type.

Args

name : str
equipment type name
new_positions_list : List[str]
new position list
new_ports_dict : Dict[str, str]
dictionary of port name to port type name
  • str - port name
  • str - port type name

Returns

EquipmentType object

Raises

FailedOperationException
internal inventory error

Example

edited_equipment = client.edit_equipment_type(
    name="Card",
    new_positions_list=[],
    new_ports_dict={"Port 5": "Z Cards Only (LS - DND)"}
)
def edit_equipment_type_property_type(client: SymphonyClient, equipment_type_name: str, property_type_id: str, new_property_definition: PropertyDefinition) -> EquipmentType

Edit specific property type on specific equipment type.

Args

equipment_type_name : str
existing equipment type name
property_type_name : str
existing property type name

new_property_definition ( PropertyDefinition ): new property definition

Returns

EquipmentType

Raises

EntityNotFoundError: if property type name is not found
FailedOperationException
internal inventory error

Example

e_type = client.edit_equipment_type_property_type_name(
    equipment_type_name="Card",
    property_type_name="contact",
    new_name="contact information",
)
def get_equipment_type_property_type(client: SymphonyClient, equipment_type_name: str, property_type_id: str) -> PropertyTypeFragment

Get property type by ID on specific equipment type.

Args

equipment_type_name : str
existing equipment type name
property_type_id : str
property type ID

Returns

PropertyTypeFragment object

Raises

EntityNotFoundError: property type with id=property_type_id is not found

Example

property_type = client.get_equipment_type_property_type(
    equipment_type_name="Card",
    property_type_id="12345",
)
def get_equipment_type_property_type_by_external_id(client: SymphonyClient, equipment_type_name: str, property_type_external_id: str) -> PropertyTypeFragment

Get property type by external ID on specific equipment type.

Args

equipment_type_name : str
existing equipment type name
property_type_external_id : str
property type external ID

Returns

PropertyTypeFragment object

Raises

EntityNotFoundError: property type with external_id=property_type_external_id is not found

Example

property_type = client.get_equipment_type_property_type_by_external_id(
    equipment_type_name="Card",
    property_type_external_id="12345",
)
def get_or_create_equipment_type(client: SymphonyClient, name: str, category: str, properties: Sequence[Tuple[str, str, Union[datetime.date, float, int, str, bool, Tuple[float, float], NoneType], Union[bool, NoneType]]], ports_dict: Dict[str, str], position_list: List[str]) -> EquipmentType

This function checks equipment type existence, in case it is not found, creates one.

Args

name : str
equipment name
category : str
category name

properties (Sequence[Tuple[str, str, Optional[PropertyValue], Optional[bool]]]): - str - type name - str - enum["string", "int", "bool", "float", "date", "enum", "range", "email", "gps_location", "equipment", "location", "service", "datetime_local"] - PropertyValue - default property value - bool - fixed value flag

ports_dict : Dict[str, str]
dict of property name to property value
  • str - port name
  • str - port type name
position_list : List[str]
list of positions names

Returns

EquipmentType object

Raises

FailedOperationException
internal inventory error

Example

e_type = client.get_or_create_equipment_type(
    name="Tp-Link T1600G",
    category="Router",
    properties=[("IP", "string", None, True)],
    ports_dict={"Port 1": "eth port", "port 2": "eth port"},
    position_list=[],
)