def handle_flow_mod_error(self, event): """Handle flow mod errors related to an EVC.""" flow = event.content["flow"] command = event.content.get("error_command") if command != "add": return evc = self.circuits.get(EVC.get_id_from_cookie(flow.cookie)) if evc: evc.remove_current_flows()
def test_get_id_from_cookie(): """Test get_id_from_cookie.""" attributes = { "controller": get_controller_mock(), "name": "circuit_name", "enable": True, "uni_a": get_uni_mocked(is_valid=True), "uni_z": get_uni_mocked(is_valid=True) } evc = EVC(**attributes) evc_id = evc.id assert evc_id assert evc.get_id_from_cookie(evc.get_cookie()) == evc_id
def test_get_id_from_cookie_with_leading_zeros(): """Test get_id_from_cookie with leading zeros.""" attributes = { "controller": get_controller_mock(), "name": "circuit_name", "enable": True, "uni_a": get_uni_mocked(is_valid=True), "uni_z": get_uni_mocked(is_valid=True) } evc = EVC(**attributes) evc_id = "0a2d672d99ff41" # pylint: disable=protected-access evc._id = evc_id # pylint: enable=protected-access assert EVC.get_id_from_cookie(evc.get_cookie()) == evc_id