def test_service_type_edited(self) -> None: new_name = "New Service Package" new_properties = {"Service Package": "Public 5G"} edited_service_type = edit_service_type( client=self.client, service_type=self.service_type, new_name=new_name, new_properties=new_properties, ) self.assertEqual(edited_service_type.name, new_name) self.assertEqual(len(edited_service_type.property_types), 1) self.assertEqual(edited_service_type.property_types[0].stringValue, "Public 5G")
def test_service_type_edited(self) -> None: equipment_type = add_equipment_type( client=self.client, name="Tp-Link T1600G", category="Router", properties=[ PropertyDefinition( property_name="IP", property_kind=PropertyKind.string, default_raw_value=None, is_fixed=False, ) ], ports_dict={}, position_list=[], ) new_name = "New Service Package" new_properties = {"Service Package": "Public 5G"} endpoint_definitions = SERVICE_TYPES[ self.service_type.name].endpoint_definitions self.assertFalse(endpoint_definitions) edited_service_type = edit_service_type( client=self.client, service_type=self.service_type, new_name=new_name, new_properties=new_properties, new_endpoints=[ ServiceEndpointDefinition( id=None, name="EndpointDefinition", role="CPE", endpoint_definition_index=0, equipment_type_id=equipment_type.id, ) ], ) endpoint_definitions = SERVICE_TYPES[ edited_service_type.name].endpoint_definitions self.assertEqual(len(endpoint_definitions), 1) self.assertEqual(edited_service_type.name, new_name) self.assertEqual(len(edited_service_type.property_types), 1) self.assertEqual( edited_service_type.property_types[0].default_raw_value, "Public 5G")
def test_service_endpoint_added(self) -> None: add_equipment_port_type( self.client, name="port type 1", properties=[ PropertyDefinition( property_name="port property", property_kind=PropertyKind.string, default_raw_value="port property value", is_fixed=False, ) ], link_properties=[ PropertyDefinition( property_name="link property", property_kind=PropertyKind.string, default_raw_value="link property value", is_fixed=False, ) ], ) add_location_type( client=self.client, name="Room", properties=[ PropertyDefinition( property_name="Contact", property_kind=PropertyKind.email, default_raw_value=None, is_fixed=False, ) ], ) location = add_location( client=self.client, location_hirerchy=[("Room", "Room 201")], properties_dict={"Contact": "*****@*****.**"}, lat=10, long=20, ) equipment_type = add_equipment_type( client=self.client, name="Tp-Link T1600G", category="Router", properties=[ PropertyDefinition( property_name="IP", property_kind=PropertyKind.string, default_raw_value=None, is_fixed=False, ) ], ports_dict={ "Port 1": "port type 1", "Port 2": "port type 1" }, position_list=[], ) router1 = add_equipment( client=self.client, name="TPLinkRouter1", equipment_type=equipment_type.name, location=location, properties_dict={"IP": "192.688.0.1"}, ) edit_service_type( client=self.client, service_type=self.service_type, new_endpoints=[ ServiceEndpointDefinition( id=None, name="EndpointDefinition", role="CPE", endpoint_definition_index=0, equipment_type_id=equipment_type.id, ) ], ) endpoint_definitions = SERVICE_TYPES[ self.service_type.name].endpoint_definitions endpoints = get_service_endpoints(client=self.client, service_id=self.service.id) self.assertFalse(endpoints) endpoint_definition_id = endpoint_definitions[0].id assert (endpoint_definition_id is not None ), f"service type {self.service_type.name} has no endpoints" add_service_endpoint( client=self.client, service=self.service, equipment_id=router1.id, endpoint_definition_id=endpoint_definition_id, ) endpoints = get_service_endpoints(client=self.client, service_id=self.service.id) self.assertEqual(len(endpoints), 1)