neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/31430 )
Change subject: add design charts for new context map FSMs ......................................................................
add design charts for new context map FSMs
Planning new connection-oriented RUA and SCCP FSMs to - conquer confusion about hnbgw_context_map release behavior, and - eradicate SCCP connection leaks.
Related: SYS#6297 Change-Id: I661bf65d79972a732c52732934095e8bfcd99694 --- M configure.ac M doc/Makefile.am A doc/charts/Makefile.am A doc/charts/hnbgw_context_map.msc A doc/charts/hnbgw_context_map_fsm.dot 5 files changed, 213 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/30/31430/1
diff --git a/configure.ac b/configure.ac index 2027e9e..c23a90d 100644 --- a/configure.ac +++ b/configure.ac @@ -233,6 +233,7 @@ doc/Makefile doc/examples/Makefile doc/manuals/Makefile + doc/charts/Makefile contrib/Makefile contrib/systemd/Makefile contrib/osmo-hnbgw.spec diff --git a/doc/Makefile.am b/doc/Makefile.am index 15f36b7..66103ba 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,4 +1,5 @@ SUBDIRS = \ examples \ manuals \ + charts \ $(NULL) diff --git a/doc/charts/Makefile.am b/doc/charts/Makefile.am new file mode 100644 index 0000000..52b111f --- /dev/null +++ b/doc/charts/Makefile.am @@ -0,0 +1,19 @@ +msc: \ + $(builddir)/hnbgw_context_map.png \ + $(NULL) + +dot: \ + $(builddir)/hnbgw_context_map_fsm.png \ + $(NULL) + +$(builddir)/%.png: $(srcdir)/%.msc + mscgen -T png -o $@ $< + +$(builddir)/%.png: $(srcdir)/%.dot + dot -Tpng $< > $@ + +.PHONY: poll +# remember current dir: in case the build process removes and recreates the dir, re-enter the new dir +W := "$(PWD)" +poll: + while true; do $(MAKE) -C $W msc dot; sleep 1; done diff --git a/doc/charts/hnbgw_context_map.msc b/doc/charts/hnbgw_context_map.msc new file mode 100644 index 0000000..8f8a1b8 --- /dev/null +++ b/doc/charts/hnbgw_context_map.msc @@ -0,0 +1,116 @@ +msc { + hscale="2"; + hnb[label="HNB"],rua[label="OsmoHNBGW\nRUA FSM / HNBAP"],sccp[label="OsmoHNBGW\nSCCP FSM"],cn[label="CN"]; + + hnb <=> rua [label="RANAP/RUA\n(Iuh)"]; + rua <=> sccp [label="FSM events"]; + sccp <=> cn [label="RANAP/SCCP/M3UA\n(IuCS, IuPS)"]; + + ...; + ...; + ...; + --- [label="connection-less messages"]; + hnb => rua [label="id-DirectTransfer"]; + rua note rua [label="TODO: transparently transmit to CN?"]; + hnb <= rua [label="id-DirectTransfer\nACK"]; + ...; + sccp <= cn [label="SCCP Unit Data"]; + sccp note sccp [label="TODO: transparently transmit to HNB?"]; + sccp => cn [label="SCCP Unit Data\nACK"]; + + ...; + ...; + --- [label="Create a new context map (always from HNB)"]; + hnb => rua [label="RUA id-Connect\nRANAP id-InitialUE-Message\nDTAP Location Updating Request"]; + rua rbox sccp [label="hnbgw_context_map_alloc()"]; + rua abox rua [label="MAP_RUA_ST_INIT"]; + sccp abox sccp [label="MAP_SCCP_ST_INIT"]; + rua rbox rua [label="map_rua_id_connect(ranap_msg)"]; + rua abox rua [label="MAP_RUA_ST_CONNECTED"]; + rua => sccp [label="MAP_SCCP_EV_TX_RANAP_MSG\ndata = ranap_msg"]; + sccp abox sccp [label="MAP_SCCP_ST_WAIT_CC"]; + sccp => cn [label="SCCP Connection Request\nRANAP id-InitialUE-Message\nDTAP Location Updating Request"]; + ...; + sccp <= cn [label="SCCP Connection Confirm"]; + sccp abox sccp [label="MAP_SCCP_ST_CONNECTED"]; + --- [label="if SCCP CC with payload"]; + rua <= sccp [label="MAP_RUA_EV_TX_RANAP_MSG\ndata = ranap_msg"]; + hnb <= rua [label="RUA id-DirectTransfer"]; + + ...; + ...; + --- [label="Layer 3 communication"]; + sccp <= cn [label="SCCP Data Form 1"]; + rua <= sccp [label="MAP_RUA_EV_TX_RANAP_MSG\ndata = ranap_msg"]; + hnb <= rua [label="RUA id-DirectTransfer"]; + ...; + hnb => rua [label="RUA id-DirectTransfer"]; + rua => sccp [label="MAP_SCCP_EV_TX_RANAP_MSG\ndata = ranap_msg"]; + sccp => cn [label="SCCP Data Form 1"]; + + ...; + ...; + --- [label="Usual release"]; + sccp <= cn [label="SCCP Data Form 1\nIu-ReleaseCommand"]; + rua <= sccp [label="MAP_RUA_EV_TX_RANAP_MSG\ndata = ranap_msg"]; + hnb <= rua [label="RUA id-DirectTransfer\nIu-ReleaseCommand"]; + ...; + hnb => rua [label="RUA id-Disconnect\nIu-ReleaseComplete"]; + rua rbox rua [label="MAP_RUA_EV_RX_ID_DISCONNECT"]; + rua abox rua [label="MAP_RUA_ST_DISCONNECTED"]; + rua => sccp [label="MAP_SCCP_EV_RUA_DISC\ndata = ranap_msg"]; + sccp => cn [label="SCCP Data Form 1\nIu-ReleaseComplete\nNOT 'SCCP Released'! See 3GPP TS 48.006 9.2"]; + sccp abox sccp [label="MAP_SCCP_ST_WAIT_RLSD"]; + ...; + sccp <= cn [label="SCCP Released"]; + sccp abox sccp [label="MAP_SCCP_ST_DISCONNECTED"]; + rua rbox sccp [label="map_check_released()"]; + rua rbox sccp [label="hnbgw_context_map_free()"]; + + ...; + ...; + --- [label="Ungraceful release from CN"]; + sccp <= cn [label="SCCP Released"]; + sccp => cn [label="SCCP Release Complete\n(implicit by libosmo-sigtran)"]; + sccp rbox sccp [label="MAP_SCCP_EV_RX_RELEASED"]; + --- [label="or"]; + sccp x- cn [label="link loss"]; + sccp rbox sccp [label="MAP_SCCP_EV_CN_LINK_LOST"]; + ---; + sccp abox sccp [label="MAP_SCCP_ST_DISCONNECTED"]; + rua <= sccp [label="MAP_RUA_EV_SCCP_DISC"]; + hnb <= rua [label="RUA id-Disconnect"]; + rua abox rua [label="MAP_RUA_ST_DISCONNECTED"]; + rua rbox sccp [label="map_check_released()"]; + rua rbox sccp [label="hnbgw_context_map_free()"]; + + ...; + ...; + --- [label="Ungraceful release from HNB"]; + hnb -x rua [label="link loss"]; + rua rbox rua [label="MAP_RUA_EV_HNB_LINK_LOST"]; + rua => sccp [label="MAP_SCCP_EV_PLEASE_DISCONNECT"]; + sccp => cn [label="SCCP Released"]; + sccp abox sccp [label="MAP_SCCP_ST_DISCONNECTED"]; + rua abox rua [label="MAP_RUA_ST_DISCONNECTED"]; + rua rbox sccp [label="map_check_released()"]; + rua rbox sccp [label="hnbgw_context_map_free()"]; + + ...; + ...; + --- [label="Ungraceful release from HNB De-Register"]; + hnb => rua [label="HNBAP HNB De-Register"]; + --- [label="or"]; + hnb => rua [label="HNBAP HNB Register\n(HNB restarted)"]; + ---; + rua rbox rua [label="MAP_RUA_EV_PLEASE_DISCONNECT"]; + hnb <= rua [label="RUA id-Disconnect\nTODO: does it make sense to id-Disconnect when HNB is/was gone?"]; + rua abox rua [label="MAP_RUA_ST_DISCONNECTED"]; + rua => sccp [label="MAP_SCCP_EV_RUA_DISC\nfrom map_rua_disconnected_onenter()"]; + sccp abox sccp [label="MAP_SCCP_ST_WAIT_RLSD"]; + rua => sccp [label="MAP_SCCP_EV_PLEASE_DISCONNECT\nto skip waiting for SCCP Released from CN"]; + sccp => cn [label="SCCP Released"]; + sccp abox sccp [label="MAP_SCCP_ST_DISCONNECTED"]; + rua rbox sccp [label="map_check_released()"]; + rua rbox sccp [label="hnbgw_context_map_free()"]; +} diff --git a/doc/charts/hnbgw_context_map_fsm.dot b/doc/charts/hnbgw_context_map_fsm.dot new file mode 100644 index 0000000..8303867 --- /dev/null +++ b/doc/charts/hnbgw_context_map_fsm.dot @@ -0,0 +1,62 @@ +digraph G { +rankdir=TB +labelloc=t +label="hnb_context_map\nRUA and SCCP FSMs" + +HNB_connect [label="HNB",shape=box3d] +rua_to_scu_connect [label="rua_to_scu()",shape=box] +HNB_DT [label="HNB",shape=box3d] +rua_to_scu_DT [label="rua_to_scu()",shape=box] +HNB_DT2 [label="HNB",shape=box3d] +HNB_disconnect [label="HNB",shape=box3d] +rua_to_scu_disconnect [label="rua_to_scu()",shape=box] +CN [shape=box3d] +CN2 [label="CN",shape=box3d] +CN3 [label="CN",shape=box3d] +CN4 [label="CN",shape=box3d] + +HNB_connect -> rua_to_scu_connect [label="RUA id-Connect",style=dotted] +rua_to_scu_connect -> create [label="(1)",style=dotted] +create [label="hnbgw_context_map_alloc()",shape=box] +create -> {RUA_INIT,SCCP_INIT} [label="(1)",style="dashed,bold"] + +rua_to_scu_connect -> RUA_CONNECTED [label="(2)\nMAP_RUA_EV_RX_ID_CONNECT",style=dashed] +RUA_CONNECTED -> SCCP_WAIT_CC [label="(2)\nMAP_SCCP_EV_TX_RANAP_MSG",style=dashed] + +RUA_INIT -> RUA_CONNECTED -> RUA_DISCONNECTED [style=bold] + +SCCP_INIT -> SCCP_WAIT_CC -> SCCP_CONNECTED -> SCCP_WAIT_RLSD -> SCCP_DISCONNECTED [style=bold] +SCCP_CONNECTED -> SCCP_DISCONNECTED [label="SCCP RLSD"] + +SCCP_WAIT_CC -> CN [label="(2) SCCP CR",style=dotted] +CN -> SCCP_CONNECTED [label="(3) SCCP CC",style=dashed] + +CN4 -> SCCP_CONNECTED [label="(4) SCCP\nData Form 1",style=dotted] +SCCP_CONNECTED -> RUA_CONNECTED [label="(4)\nMAP_RUA_EV_TX_RANAP_MSG",style=dotted] +RUA_CONNECTED -> HNB_DT2 [label="(4)\nRUA id-DirectTransfer",style=dotted] + +HNB_DT -> rua_to_scu_DT [label="(5)\nRUA id-DirectTransfer",style=dotted] +rua_to_scu_DT -> RUA_CONNECTED [label="(5)\nMAP_RUA_EV_RX_ID_DIRECT_TRANSFER",style=dotted] +RUA_CONNECTED -> SCCP_CONNECTED [label="(5)\nMAP_SCCP_EV_TX_RANAP_MSG",style=dotted] +SCCP_CONNECTED -> CN3 [label="(5) SCCP\nData Form 1",style=dotted] + +HNB_disconnect -> rua_to_scu_disconnect [label="(6) RUA Id-Disconnect",style=dotted] +rua_to_scu_disconnect -> RUA_DISCONNECTED [label="(6) MAP_RUA_EV_RX_ID_DISCONNECT",style=dashed] +RUA_DISCONNECTED -> SCCP_WAIT_RLSD [label="(6) MAP_SCCP_EV_RUA_DISC",style=dashed] + +CN2 -> SCCP_DISCONNECTED [label="(7) SCCP RLSD",style=dashed] + +{RUA_DISCONNECTED,SCCP_DISCONNECTED} -> release [label="onenter",style="dotted,bold"] +release [label="map_check_released()",shape=box] +release -> terminate [label="when both RUA and\nSCCP disconnected",style=dotted] +terminate [label="hnbgw_context_map_free()",shape=octagon] + +subgraph cluster_legend { + label="" + style=invisible + A, B, C, D [style=invisible] + A -> B [label="event without\nstate change",style=dotted] + C -> D [label="event changes\nstate to...",style=dashed] +} + +}