Example #1
0
void
isis_circuit_is_type_set (struct isis_circuit *circuit, int newtype)
{
  if (circuit->state != C_STATE_UP)
  {
    circuit->is_type = newtype;
    return;
  }

  if (isis->debugs & DEBUG_EVENTS)
    zlog_debug ("ISIS-Evt (%s) circuit type change %s -> %s",
	       circuit->area->area_tag,
	       circuit_t2string (circuit->is_type),
	       circuit_t2string (newtype));

  if (circuit->is_type == newtype)
    return;			/* No change */

  if (!(newtype & circuit->area->is_type))
    {
      zlog_err ("ISIS-Evt (%s) circuit type change - invalid level %s because"
		" area is %s", circuit->area->area_tag,
		circuit_t2string (newtype),
		circuit_t2string (circuit->area->is_type));
      return;
    }

  if (! circuit->is_passive)
    {
      switch (circuit->is_type)
        {
        case IS_LEVEL_1:
          if (newtype == IS_LEVEL_2)
            circuit_resign_level (circuit, 1);
          circuit_commence_level (circuit, 2);
          break;
        case IS_LEVEL_1_AND_2:
          if (newtype == IS_LEVEL_1)
            circuit_resign_level (circuit, 2);
          else
            circuit_resign_level (circuit, 1);
          break;
        case IS_LEVEL_2:
          if (newtype == IS_LEVEL_1)
            circuit_resign_level (circuit, 2);
          circuit_commence_level (circuit, 1);
          break;
        default:
          break;
        }
    }

  circuit->is_type = newtype;
  lsp_regenerate_schedule (circuit->area, IS_LEVEL_1 | IS_LEVEL_2, 0);

  return;
}
Example #2
0
void
isis_event_circuit_type_change (struct isis_circuit *circuit, int newtype)
{

  Log(LOG_DEBUG, "DEBUG (default/core/ISIS ): ISIS-Evt (%s) circuit type change %s -> %s\n",
	       circuit->area->area_tag,
	       circuit_t2string (circuit->circuit_is_type),
	       circuit_t2string (newtype));

  if (circuit->circuit_is_type == newtype)
    return;			/* No change */

  if (!(newtype & circuit->area->is_type))
    {
      Log(LOG_ERR, "ERROR (default/core/ISIS ): ISIS-Evt (%s) circuit type change - invalid level %s because area is %s\n",
		circuit->area->area_tag,
		circuit_t2string (newtype),
		circuit_t2string (circuit->area->is_type));
      return;
    }

  switch (circuit->circuit_is_type)
    {
    case IS_LEVEL_1:
      if (newtype == IS_LEVEL_2)
	circuit_resign_level (circuit, 1);
      circuit_commence_level (circuit, 2);
      break;
    case IS_LEVEL_1_AND_2:
      if (newtype == IS_LEVEL_1)
	circuit_resign_level (circuit, 2);
      else
	circuit_resign_level (circuit, 1);
      break;
    case IS_LEVEL_2:
      if (newtype == IS_LEVEL_1)
	circuit_resign_level (circuit, 2);
      circuit_commence_level (circuit, 1);
      break;
    default:
      break;
    }

  circuit->circuit_is_type = newtype;
  lsp_regenerate_schedule (circuit->area);

  return;
}