def get_net_with_segmentation(self, segmentation_id: int) -> dict:
     net_dict = self._neutron.list_networks(
         **{"provider:segmentation_id": segmentation_id})
     try:
         net = net_dict["networks"][0]
     except IndexError:
         emsg = f"Network with {segmentation_id} segmentation id not found"
         raise NetworkNotFoundException(emsg)
     return net
 def get_network(self, **kwargs) -> dict:
     nets = self._neutron.list_networks(**kwargs)["networks"]
     if not nets:
         raise NetworkNotFoundException(
             f"Network with kwargs {kwargs} not found.")
     elif len(nets) > 1:
         raise NetworkException(
             f"Found more than one network with kwargs {kwargs}")
     return nets[0]
def test_remove_vlan_flow_not_found(connectivity_flow, neutron, nova):
    neutron.list_networks.side_effect = NetworkNotFoundException("not found")

    connectivity_flow._remove_vlan_flow("12", "", "", "")

    nova.servers.find.assert_not_called()