# 陳毅 - 讀書會 - 21/09/11
:::info
- [x] 閱讀 Netmanias-21-EMM Procedure - 10 & 11. Move to Another City and Attach
:::
## Introduction
若 UE 嘗試執行換手或是 Cell Reselection 找不到鄰近小區時,訊號強度會漸漸變弱直到 UE Detach。等到 UE 再次進入 LTE 網路的覆蓋範圍,它會透過 Cell Reselection 再次執行 Initial attach 連線到網路。
本文件討論兩種 Case:
- “Move to Another City” (EMM Case 10)
- “Initial Attach in Another City” (EMM Case 11)

在這兩個 Case 中,我們假設電信商的狀態如下:
- 服務多個城市
- 僅提供 4G LTE 服務
- 每個城市都有獨立的 MME, S-GW, P-GW
- 僅有一個城市有安裝 HSS, PCRF, SPR
- 所有的 MME 通過 S10 Interface 相連
上圖僅顯示 City 1 與 City 2,且使用者利用汽車進行移動。
- 在 Case 10 中,UE 因為離開 City 1 而 Detach (原本 UE 的狀態為 Connected/Idle State,Detach 後轉為 Detach State)。
- 在 Case 11 中,UE 進入到了 LTE 網路的覆蓋範圍而重新發起 attach request。
- 由於 Old MME 保存了 UE 的上下文,UE 在執行 Initial attach 連接網路時會使用 Old MME 分配的 GUTI 作為 UE ID。
## EMM Case 10. Move to Another City
### Moving in Connected State
如下圖所示,我們可以看到 UE 離開 City 1 的覆蓋範圍後執行 Detach 的過程:

#### 1. [UE -> eNB] Measurement Report
當 UE 離開 City 1,訊號強度變得衰弱,因此,觸發了 A2 Event,UE 會發送 **Measurement Report** message 給 eNB,通知它 Serving Cell 的訊號強度。
#### 2. [eNB] No Neighbor Cell to Hand Over to
eNB 找不到其他鄰近小區供 UE 連線
#### 3. [eNB -> MME] Error Indication
由於逐漸惡化的通訊品質,eNB 透過發送 **Error Indication (Cause=Failure in the Radio Interface)** message 通知 MME 傳出失敗。
> 如果 eNB 發現難以與 UE 維持最低的品質需求,會發送 **UE Context Release Request** message 給 MME。
#### 4. MME-initiated Detach
MME 透過發送 **Detach Request** message 給 UE 執行 Detach 流程,MME 會保存 UE 的 GUTI 以及 NAS Security Context、終止 EPS Session、釋放 S1 Signaling。而 UE 會保 存 GUTI 以及 NAS Security、刪除 EPS bearer context。
(雙方都會轉換至 Detach State)
### Moving in Idle State
UE 會在 Idle State 的狀況下定期發送 TAU 以回報當前的地理位置,這樣可以讓 EPC 收到 UE 的封包時進行 Paging 以重啟雙方的連線。
為了這個目的,MME 會有:
- TAU timer (T3412)
會透過 **Attach Accept** message 轉發到 UE,或是在 UE 進行 TAU 時透過 **TAU Accept** message 傳達給 UE。
一般來說,TAU Timer 的預設值為 54 分鐘,若 MME 將其設定為 `0`,UE 會停用該計時器以及 periodic TAU。
:::info
The TAU timer in UE is activated when the UE transits from Connected state (**EMM-Registered, ECM-Connected, RRC-Connected**) to Idle state (**EMM-Registered, ECM-Idle, RRC-Idle**).
:::

- mobile reachable timer
用於確認 UE 的可達性,其值為 T3412 + 4 分鐘,從 ECM Connection 釋放後開始計時 (e.g. if UE transits to Idle state),並從 new ECM Connection 建立後停止計時 (e.g. if UE sends a TAU Request message to MME)。

- implicit detach timer
當 UE 發送 NAS Security 並建立 ECM 連線後,implicit detach timer 會停止計時。
如果 MME 在 timer 過期前無法取得 UE 的位置,我們可以相信 UE 已經不在 LTE 網路的覆蓋範圍,因此,就能夠執行 Detach (也刪除了 UE Context)。
下圖顯示 UE 如何 Detach 它原本攀爬的服務小區:

#### 1. [MME] TAU Timer (T3412) Expiry
TAU Timer 過期且 MME 沒有收到來自 UE 的 **TAU Request** message,必須檢查 UE 的可達性。
#### 2. [MME] Mobile Reachability Timer Expiry
當 Mobile Reachability Timer 過期,MME 可以相信 UE 已經離開網路的服務範圍,這時 MME 會有以下行為:
- clears the PPF flag
- starts the implicit detach timer
此時,為 UE 分配的資源,如:
- EPS Bearer
- Security Context
仍會被保留,但 MME 不會尋呼 (Page) UE。
#### 3. [MME] Mobile Implicit Timer Expiry
當 Mobile Implicit Timer 到期,MME 可以確定 UE 已經遠遠脫離網路服務範圍,此時便會執行隱式的 Detach。
#### 4. [eNB, MME, S-GW, P-GW, PCRF] UE Detached
The MME initiates an implicit detach procedure. This procedure is the same as the “MME-initiated Implicit Detach procedure” explained in the previous document. The allocated resources and context of the UE are deleted.
## EMM Case 11. Initial Attach in Another City
當 UE 移動到 City2 的覆蓋範圍,UE 會選擇一個 Cell 執行 initial attach,以將 Detach state 轉為 Connected State。
下圖為 initial attach 的種類以及參與流程的 function blocks。
這裡的 Initial Attach 與 **Attach Case 5: Known UE, MME Changed** 相同,舊的 UE 會保存 Old GUTI 以及 NAS security context,而 UE 會使用這些資料對 New MME 執行 initial attach。
:::info
The UE sends an Attach Request message by using the Old GUTI instead of IMSI as its ID. The message is sent integrity protected with the NAS integrity key (KNASint). The new MME (New MME) forwards the message to the old MME (Old MME) so that it can run an integrity check.
:::
如果完整性檢查在 Old MME 這邊檢查失敗,會發送 error message 通知新的 MME,讓後者從 UE 端獲取 IMSI 並重新執行 userA authentication, NAS security setup, location update 以及建立 EPS session。

下圖說明 UE 如何執行 initial attch (使用 Old GUTI)以連結到 New MME:

#### 1. [UE, eNB] Establishing RRC Connection
當進入到 City2,UE 開始偵測 LTE 訊號並選擇一個小區建立 RRC Connection。
#### 2. [UE, New MME] Requesting Initial Attach to New MME using Old GUTI
UE 發送 **Attach Request**,其參數包含:
- Old GUTI
- Last Visited TAI
- $KSI_{ASME}$
- NAS-MAC
給 MME2,該請求會進行完整性保護且通過 radio interface 上的 **RRC Connection Setup Complete** message 以及 S1 interface 上的 **Initial UE Message (ECGI, TAI)**。
#### 3. [New MME] Identifying Old MME
MME2 透過收到的訊息識別出 Old MME,若 Old GUTI 經檢查後確認仍然有效,MME 2 會通過 S10 Interface 與 Old MME 連線以取得 Old MME 保存的 UE context。
#### 4. - 6. [Old MME, New MME] Obtaining UE Context from Old MME
4\. New MME 發送 **Identification Request (Old GUTI, Complete {Attach Request} message from UE) message** 給 Old MME。
5\. Old MME 收到訊息後,經由檢查 GUTI 可以得知該 GUTI 是自己分配的,這時 Old MME 會對收到的 **Attach Request** message 執行完整性檢查。
6\. 若檢查正確,Old MME 會透過發送 **Identification Response (IMSI, UE-AMBR, UE Security Context (KASME, KSIASME, Unused AVs,
NAS Keys, etc))** message 向 New MME 提供 UE Context。
#### 7. - 10. [Old MME, New MME, HSS] Location Information Updated at New MME, and Deleted at Old MME
7\. 此刻,New MME 持有有效的 UE Context,New MME 會向 HSS 發送 ** Update Location Request (IMSI, MME ID=MME2)** message 以將 UE 註冊到該網路中,HSS 會順便更新 UE 的地理位置。
8\. HSS 向 MME 1 發送 **Cancel Location Request (IMSI)** message 要求後者刪除 UE 的上下文。
9\. MME 1 透過發送 **Cancel Location Response (IMSI)** message 通知 HSS 它乖乖照做了(?)
10\. HHS 透過發送 **Update Location Answer (IMSI, APN, Subscribed Profile (QCI, ARP, APN-AMBR (UL/DL), UE-AMBR (UL/DL))** message 提供給 MME 2 使用者的訂閱資料,主要包含了 QoS Info,這樣一來,MME 2 便可以建立 EPS Session。
#### [New MME] Establishing EPS Session
MME2 establishes an EPS session by using the UE context received from MME1, and the subscription profile received from the HSS. The establishment procedure at this time is the same as the “EPS Session Establishment procedure” explained in the previous document.
## EPS Entity Information
