Module pyinventory.api.port

Functions

This function returns edited port in equipment based on its name.

Args

equipment ( Equipment ): existing equipment object
port_name : str
existing port name

new_link_properties (Dict[str, PropertyValue]) - str - link property name - PropertyValue - new value of the same type for this property

Returns

EquipmentPort object

Raises

EntityNotFoundError: when EquipmentPortDefinition.port_type_name is None, there are no properties
FailedOperationException
on operation failure

Example

location = client.get_location(location_hirerchy=[("Country", "LS_IND_Prod_Copy")])
equipment = client.get_equipment(name="indProdCpy1_AIO", location=location)
edited_port = client.edit_link_properties(
    equipment=equipment,
    port_name="Z AIO - Port 1",
    new_link_properties={"Link Property 1": 98765},
)
def edit_port_properties(client: SymphonyClient, equipment: Equipment, port_name: str, new_properties: Dict[str, Union[datetime.date, float, int, str, bool, Tuple[float, float]]]) -> EquipmentPort

This function returns edited port in equipment based on its name.

Args

equipment ( Equipment ): existing equipment object
port_name : str
existing port name
new_properties : Dict[str, PropertyValue]
Dict, where
  • str - property name
  • PropertyValue - new value of the same type for this property

Returns

EquipmentPort object

Raises

EntityNotFoundError: when EquipmentPortDefinition.port_type_name is None, there are no properties
or if there any unknown property name in properties_dict keys
FailedOperationException
on operation failure

Example

location = client.get_location(location_hirerchy=[("Country", "LS_IND_Prod_Copy")])
equipment = client.get_equipment(name="indProdCpy1_AIO", location=location)
edited_port = client.edit_port_properties(
    equipment=equipment,
    port_name="Z AIO - Port 1",
    new_properties={"Port Property 2": "test_it"},
)
def get_port(client: SymphonyClient, equipment: Equipment, port_name: str) -> EquipmentPort

This function returns port in equipment based on its name.

Args

equipment ( Equipment ): existing equipment object
port_name : str
existing port name

Returns

EquipmentPort object

Raises

EquipmentPortIsNotUniqueException
there is more than one port with this name

EntityNotFoundError: equipment does not exist or port was not found

Example

location = client.get_location(location_hirerchy=[("Country", "LS_IND_Prod_Copy")])
equipment = client.get_equipment(name="indProdCpy1_AIO", location=location)
port = client.get_port(equipment=equipment, port_name="Z AIO - Port 1")