///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2000-2021 Ericsson Telecom AB
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v2.0
// which accompanies this distribution, and is available at
// https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
///////////////////////////////////////////////////////////////////////////////
/* state machine of PTCs as seen by the MC */

digraph state_mach_ptc_mc {
  // states
  node [fontsize=16];
  // start state (invisible)
  START [style=invis];

  // states of both alive and non-alive PTCs
  node[shape=box,style="filled,rounded"];
  TC_INITIAL;
  TC_IDLE;
  PTC_FUNCTION;
  PTC_STOPPING_KILLING;
  PTC_KILLING;
  TC_EXITING;
  TC_EXITED;

  // states of alive PTCs
  node[shape=box,style=rounded];
  PTC_STARTING;
  TC_STOPPING;
  PTC_STOPPED;

  // edges for both alive and non-alive PTCs
  edge [fontsize=12];
  START -> TC_INITIAL [arrowtail=odot,label="CREATE_REQ/\nCREATE_PTC"];
  TC_INITIAL -> TC_INITIAL [label="CREATE_NAK/\nCREATE_PTC"];
  TC_INITIAL -> TC_IDLE [label="PTC_CREATED/\nCREATE_ACK"];
  TC_INITIAL -> PTC_KILLING [label="PTC_CREATED/\nKILL"];
  TC_IDLE -> PTC_FUNCTION [label="START_REQ/\nSTART, START_ACK"];
  TC_IDLE -> PTC_KILLING [label="KILL_REQ/\nKILL"];
  PTC_FUNCTION -> PTC_STOPPING_KILLING [label="KILL_REQ/\nKILL"];
  PTC_FUNCTION -> TC_EXITING [label="STOPPED_KILLED/\nCOMPONENT_STATUS"];
  PTC_STOPPING_KILLING -> PTC_STOPPING_KILLING [label="KILL_REQ/\n-"];
  PTC_STOPPING_KILLING -> TC_EXITING [label="STOPPED_KILLED/\nCOMPONENT_STATUS,\nSTOP_ACK, KILL_ACK"];
  PTC_KILLING -> PTC_KILLING [label="KILL_REQ/\n-"];
  PTC_KILLING -> TC_EXITING [label="KILLED/\nCOMPONENT_STATUS,\nKILL_ACK"];
  TC_EXITING -> TC_EXITING [label="KILL_REQ/\nKILL_ACK"];
  TC_EXITING -> TC_EXITED [label="control connection closed/\n-"];
  TC_EXITED -> TC_EXITED [label="KILL_REQ/\nKILL_ACK"];

  // edges fior alive PTCs
  edge [fontsize=12,style=dashed];
  TC_IDLE -> TC_IDLE [label="STOP_REQ/\nSTOP_ACK"];
  PTC_FUNCTION -> TC_STOPPING [label="STOP_REQ/\nSTOP"];
  PTC_FUNCTION -> PTC_STOPPED [label="STOPPED/\nCOMPONENT_STATUS"];
  PTC_STOPPING_KILLING -> PTC_STOPPING_KILLING [label="STOP_REQ/\n-"];
  PTC_STOPPING_KILLING -> PTC_KILLING [label="STOPPED/\nCOMPONENT_STATUS,\nSTOP_ACK"];
  PTC_KILLING -> PTC_KILLING [label="STOP_REQ/\nSTOP_ACK"];
  TC_EXITING -> TC_EXITING [label="STOP_REQ/\nSTOP_ACK"];
  TC_EXITED -> TC_EXITED [label="STOP_REQ/\nSTOP_ACK"];
  PTC_STARTING -> PTC_FUNCTION [label="CANCEL_DONE_ACK/\nSTART,\nSTART_ACK"];
  PTC_STARTING -> PTC_STARTING [label="STOP_REQ/\nERROR"];
  PTC_STARTING -> PTC_STARTING [label="KILL_REQ/\nERROR"];
  TC_STOPPING -> PTC_STOPPING_KILLING [label="KILL_REQ/\nKILL"];
  TC_STOPPING -> TC_STOPPING [label="STOP_REQ/\n-"];
  TC_STOPPING -> PTC_STOPPED [label="STOPPED/\nCOMPONENT_STATUS,\nSTOP_ACK"];
  PTC_STOPPED -> PTC_KILLING [label="KILL_REQ/\nKILL"];
  PTC_STOPPED -> PTC_FUNCTION [label="START_REQ/\nSTART,\nSTART_ACK"];
  PTC_STOPPED -> PTC_STARTING [label="START_REQ/\nCANCEL_DONE"];
  PTC_STOPPED -> PTC_STOPPED [label="STOP_REQ/\nSTOP_ACK"];
  PTC_STOPPED -> TC_EXITING [label="KILLED/\nCOMPONENT_STATUS"];
}
