# 陳毅 - 讀書會 - 21/08/04
:::info
- [x] 閱讀 Netmanias-10-EMM Procedure 1. Initial Attach - Part 1
:::
## Case of Initial Attach
> UE ID acquisition and EPS session establishment procedures are required in all types of initial attach.


當 Initial Attach 發起, EPS 會用這個機制區分出不同的 Case :
- UE ID 的類型
- 目標是哪一個 MME
- 是否有 [UE Context](http://www.readhere.cn/page.php?id=1742) 存在於任何一個 MME
### Unknown UE
下圖描繪了 Unknown UE 發起 Attach Request 的實際案例:

#### Attach Case1: When a UE is attaching using an IMSI
當 UE 和 MME 都沒有最後的 UE Context 時,流程如下:
1. A UE sends an MME an **Attach Request** message using its IMSI as a UE ID.
2. The MME, assuming it doesn’t know the UE (because an IMSI was sent), initiates procedures for authentication and NAS security setup.
3. The MME sends a location update message to HSS, informing the HSS that the UE is registered with it, and downloads the subscription information of the user from the HSS.
#### Attach Case 2: When a UE is attaching to the MME that it has attached to last time (New MME = Old MME), but the MME doesn’t have the valid Last UE Context of the UE
1. UE 使用舊有的 GUTI 作為 UE ID 向 New MME 發起 Attach Request ,此時, Attach Request message 會使用 NAS integrity key 進行完整性加密保護。
2. 因為 GUTI 包含了 GUMMEI ,所以 New MME 知道該請求是來自自己 ,這時 New MME 去檢查卻沒有發現有效的 UE Context。
3. MME 傳送 **Identity Request** 要求取得 IMSI。
4. UE 傳送 **Identity Response**。
5. 參考 Case 1。
#### Attach Case 3: When a UE is attaching to a new MME that it has never attached to before (New MME ≠ Old MME), and the MME doesn’t have the valid Last UE Context of the UE
1. UE 使用舊有的 GUTI 作為 UE ID 向 New MME 發起 Attach Request ,此時, Attach Request message 會使用 NAS integrity key 進行完整性加密保護。
2. 透過 Old GUTI , New MME 知道這個 GUTI 是由其他 MME 指派的。
3. New MME 向 Old MME 發送 **Identification Request** 已取得 UE Context。
4. Old MME 檢查後沒有發現有效的 UE Context。
5. Old MME 向 New MME 發送 **Identification Response** ,通知他沒有找到 UE Context。
做到這邊,情況就與 Case 2 相同,所以會接續 Case 2 的步驟 3 到步驟 5。
### Known UE

#### Attach Case 4: When a UE is attaching to the MME that it has attached last time (New MME = Old MME), and the MME has the valid Last UE Context of the UE
當 UE 仍保有最近一次的 Attach information 且 MME 保有 Valid UE Context ,實際的流程就會像是:
1. UE 使用舊有的 GUTI 作為 UE ID 向 MME 發送 Attach Request ,此時, Attach Request message 會使用 NAS integrity key 進行完整性加密保護。
2. 因為 GUTI 包含了 GUMMEI ,所以 New MME 知道該請求是來自自己 ,並檢查到有效的 UE Context。
3. MME 進行完整性檢查:
- 如果成功,可省略鑑權與 NAS security setup
- 否則需要使用 IMSI 從頭來過。
#### Attach Case 5: When a UE is attaching to a new MME that it has not attached to before (New MME ≠ Old MME), and the Old MME has the valid Last UE Context of the UE
1. UE 使用舊有的 GUTI 作為 UE ID 向 New MME 發起 Attach Request ,此時, Attach Request message 會使用 NAS integrity key 進行完整性加密保護。
2. 透過 Old GUTI , New MME 知道這個 GUTI 是由其他 MME 指派的。
3. New MME 向 Old MME 發送 **Identification Request** 已取得 UE Context。
4. Old MME 檢查後發現有效的 UE Context。
5. Old MME 對 Attach Request message 進行完整性檢查。
6. 將結果以 **Identification Response** 傳遞給 New MME:
- 如果完整性檢查失敗,內容為 error causes。
- 如果通過,內容為 UE Context。
若完整性檢查失敗,情況就與 Case 3 相同,相對的,如果成功, LTE Authentication 與 NAS security setup 的程序都可以被跳過。
## Simplified Call Flow in Each Case
