def test_service_created(self) -> None: service = add_service( client=self.client, name="Room 201 Internet Access", external_id="S3232", service_type="Internet Access", customer=None, properties_dict={"Address Family": "v4"}, ) fetch_service = get_service(client=self.client, id=service.id) self.assertEqual(service, fetch_service)
def setUp(self) -> None: super().setUp() self.service_type = add_service_type( client=self.client, name="Internet Access", has_customer=True, properties=[ PropertyDefinition( property_name="Service Package", property_kind=PropertyKind.string, default_raw_value="Public 5G", is_fixed=False, ), PropertyDefinition( property_name="Address Family", property_kind=PropertyKind.string, default_raw_value=None, is_fixed=False, ), ], endpoint_definitions=[], ) self.service = add_service( client=self.client, name="Room 201 Internet Access", external_id="S3232", service_type=self.service_type.name, customer=None, properties_dict={"Address Family": "v4"}, ) self.customer = add_customer(client=self.client, name="Donald", external_id="S322") self.service_with_customer = add_service( client=self.client, name="Room 202 Internet Access", external_id="S32325", service_type=self.service_type.name, customer=self.customer, properties_dict={"Address Family": "v4"}, )
def test_service_created(self) -> None: service = add_service( self.client, "Room 201 Internet Access", "S3232", "Internet Access", None, {"Address Family": "v4"}, [], ) fetch_service = get_service(self.client, service.id) self.assertEqual(service, fetch_service)
def test_service_with_customer_created(self) -> None: customer = add_customer(self.client, "Donald", "S322") service = add_service( self.client, name="Room 201 Internet Access", external_id=None, service_type="Internet Access", customer=customer, properties_dict={}, links=[], ) self.assertEqual(customer, service.customer)
def test_service_with_topology_created(self) -> None: location = add_location( self.client, [("Room", "Room 201")], {"Contact": "*****@*****.**"}, 10, 20 ) router1 = add_equipment( self.client, "TPLinkRouter1", "Tp-Link T1600G", location, {"IP": "192.688.0.1"}, ) router2 = add_equipment( self.client, "TPLinkRouter2", "Tp-Link T1600G", location, {"IP": "192.688.0.2"}, ) router3 = add_equipment( self.client, "TPLinkRouter3", "Tp-Link T1600G", location, {"IP": "192.688.0.3"}, ) link1 = add_link(self.client, router1, "Port 1", router2, "Port 1") link2 = add_link(self.client, router2, "Port 2", router3, "Port 1") endpoint_port = get_port(self.client, router1, "Port 2") service = add_service( self.client, name="Room 201 Internet Access", external_id="S3232", service_type="Internet Access", customer=None, properties_dict={"Address Family": "v4"}, links=[link1, link2], ) add_service_endpoint( self.client, service, endpoint_port, ServiceEndpointRole.CONSUMER ) service = get_service(self.client, service.id) self.assertEqual([endpoint_port.id], [e.port.id for e in service.endpoints]) self.assertEqual([link1.id, link2.id], [s.id for s in service.links])
def setUp(self) -> None: super().setUp() self.service_type = add_service_type( client=self.client, name="Internet Access", has_customer=True, properties=[ PropertyDefinition( property_name="Service Package", property_kind=PropertyKind.string, default_value=None, is_fixed=False, ) ], ) self.service = add_service( client=self.client, name="Room 201 Internet Access", external_id="S3232", service_type=self.service_type.name, customer=None, properties_dict={"Service Package": "Public 5G"}, )
def test_service_with_topology_created(self) -> None: location = add_location( client=self.client, location_hirerchy=[("Room", "Room 201")], properties_dict={"Contact": "*****@*****.**"}, lat=10, long=20, ) router1 = add_equipment( client=self.client, name="TPLinkRouter1", equipment_type="Tp-Link T1600G", location=location, properties_dict={"IP": "192.688.0.1"}, ) router2 = add_equipment( client=self.client, name="TPLinkRouter2", equipment_type="Tp-Link T1600G", location=location, properties_dict={"IP": "192.688.0.2"}, ) router3 = add_equipment( client=self.client, name="TPLinkRouter3", equipment_type="Tp-Link T1600G", location=location, properties_dict={"IP": "192.688.0.3"}, ) link1 = add_link( client=self.client, equipment_a=router1, port_name_a="Port 1", equipment_b=router2, port_name_b="Port 1", ) link2 = add_link( client=self.client, equipment_a=router2, port_name_a="Port 2", equipment_b=router3, port_name_b="Port 1", ) endpoint_port = get_port(client=self.client, equipment=router1, port_name="Port 2") service = add_service( self.client, name="Room 201 Internet Access", external_id="S3232", service_type="Internet Access", customer=None, properties_dict={"Address Family": "v4"}, links=[link1, link2], ) # TODO add service_endpoint_type api add_service_endpoint(client=self.client, service=service, port=endpoint_port) service = get_service(client=self.client, id=service.id if service is not None else "") ports = [e.port for e in service.endpoints] self.assertEqual([endpoint_port.id], [p.id if p is not None else None for p in ports]) self.assertEqual([link1.id, link2.id], [s.id for s in service.links])