-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add n1n2 api for Handover; close #23
- Loading branch information
1 parent
391cb79
commit a36ba0a
Showing
12 changed files
with
211 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2024 Louis Royer and the NextMN contributors. All rights reserved. | ||
// Use of this source code is governed by a MIT-style license that can be | ||
// found in the LICENSE file. | ||
// SPDX-License-Identifier: MIT | ||
|
||
package jsonapi | ||
|
||
import "net/netip" | ||
|
||
type Fteid struct { | ||
Addr netip.Addr `json:"addr"` | ||
Teid uint32 `json:"teid"` | ||
} | ||
|
||
func NewFteid(addr netip.Addr, teid uint32) *Fteid { | ||
return &Fteid{ | ||
Addr: addr, | ||
Teid: teid, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2024 Louis Royer and the NextMN contributors. All rights reserved. | ||
// Use of this source code is governed by a MIT-style license that can be | ||
// found in the LICENSE file. | ||
// SPDX-License-Identifier: MIT | ||
|
||
package n1n2 | ||
|
||
import ( | ||
"github.com/nextmn/json-api/jsonapi" | ||
) | ||
|
||
// HandoverCommand is sent by the CP to the source gNB to start the execution of handover, and forwarded to the UE | ||
type HandoverCommand struct { | ||
// Header | ||
UeCtrl jsonapi.ControlURI `json:"ue-ctrl"` | ||
Cp jsonapi.ControlURI `json:"cp"` | ||
SourceGnb jsonapi.ControlURI `json:"source-gnb"` | ||
|
||
// Handover Command | ||
Sessions []Session `json:"sessions"` // contains new ForwardDownlinkFteid | ||
TargetGnb jsonapi.ControlURI `json:"target-gnb"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2024 Louis Royer and the NextMN contributors. All rights reserved. | ||
// Use of this source code is governed by a MIT-style license that can be | ||
// found in the LICENSE file. | ||
// SPDX-License-Identifier: MIT | ||
|
||
package n1n2 | ||
|
||
import ( | ||
"github.com/nextmn/json-api/jsonapi" | ||
) | ||
|
||
// HandoverConfirm is send by the target UE to the target gNB after the UE is synchronized to the new cell | ||
type HandoverConfirm struct { | ||
// Header | ||
UeCtrl jsonapi.ControlURI `json:"ue-ctrl"` | ||
Cp jsonapi.ControlURI `json:"cp"` | ||
|
||
// Handover Confirm | ||
Sessions []Session `json:"sessions"` | ||
SourceGnb jsonapi.ControlURI `json:"source-gnb"` | ||
TargetGnb jsonapi.ControlURI `json:"target-gnb"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2024 Louis Royer and the NextMN contributors. All rights reserved. | ||
// Use of this source code is governed by a MIT-style license that can be | ||
// found in the LICENSE file. | ||
// SPDX-License-Identifier: MIT | ||
|
||
package n1n2 | ||
|
||
import ( | ||
"github.com/nextmn/json-api/jsonapi" | ||
) | ||
|
||
// HandoverNotify is send by the target gNB to the CP after handover have been confirmed by the UE | ||
type HandoverNotify struct { | ||
// Header | ||
UeCtrl jsonapi.ControlURI `json:"ue-ctrl"` | ||
Cp jsonapi.ControlURI `json:"cp"` | ||
TargetGnb jsonapi.ControlURI `json:"target-gnb"` | ||
|
||
// Handover Notify | ||
Sessions []Session `json:"sessions"` | ||
SourceGnb jsonapi.ControlURI `json:"source-gnb"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2024 Louis Royer and the NextMN contributors. All rights reserved. | ||
// Use of this source code is governed by a MIT-style license that can be | ||
// found in the LICENSE file. | ||
// SPDX-License-Identifier: MIT | ||
|
||
package n1n2 | ||
|
||
import ( | ||
"github.com/nextmn/json-api/jsonapi" | ||
) | ||
|
||
// HandoverRequest is send by the CP to the target gNB during the handover preparation phase | ||
type HandoverRequest struct { | ||
// Header | ||
UeCtrl jsonapi.ControlURI `json:"ue-ctrl"` | ||
Cp jsonapi.ControlURI `json:"cp"` | ||
TargetgNB jsonapi.ControlURI `json:"target-gnb"` | ||
|
||
// Handover Request | ||
SourcegNB jsonapi.ControlURI `json:"source-gnb"` | ||
Sessions []Session `json:"sessions"` // contains new UL FTeid | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2024 Louis Royer and the NextMN contributors. All rights reserved. | ||
// Use of this source code is governed by a MIT-style license that can be | ||
// found in the LICENSE file. | ||
// SPDX-License-Identifier: MIT | ||
|
||
package n1n2 | ||
|
||
import ( | ||
"github.com/nextmn/json-api/jsonapi" | ||
) | ||
|
||
// HandoverRequestAck is send by the target gNB to the CP in response to an HandoverRequest | ||
type HandoverRequestAck struct { | ||
// Header | ||
Cp jsonapi.ControlURI `json:"cp"` | ||
TargetgNB jsonapi.ControlURI `json:"target-gnb"` | ||
|
||
// Handover Request Ack | ||
SourcegNB jsonapi.ControlURI `json:"source-gnb"` | ||
UeCtrl jsonapi.ControlURI `json:"ue-ctrl"` | ||
Sessions []Session `json:"sessions"` // contains new DL FTeid | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2024 Louis Royer and the NextMN contributors. All rights reserved. | ||
// Use of this source code is governed by a MIT-style license that can be | ||
// found in the LICENSE file. | ||
// SPDX-License-Identifier: MIT | ||
|
||
package n1n2 | ||
|
||
import ( | ||
"github.com/nextmn/json-api/jsonapi" | ||
) | ||
|
||
// HandoverRequired is send by the source gNB to the CP to start the handover preparation phase | ||
type HandoverRequired struct { | ||
// Header | ||
SourcegNB jsonapi.ControlURI `json:"source-gnb"` | ||
Cp jsonapi.ControlURI `json:"cp"` | ||
|
||
// Handover Required content | ||
Ue jsonapi.ControlURI `json:"ue"` | ||
Sessions []Session `json:"sessions"` // list of all pdu sessions of the UE to be moved | ||
TargetgNB jsonapi.ControlURI `json:"target-gnb"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright 2024 Louis Royer and the NextMN contributors. All rights reserved. | ||
// Use of this source code is governed by a MIT-style license that can be | ||
// found in the LICENSE file. | ||
// SPDX-License-Identifier: MIT | ||
|
||
package n1n2 | ||
|
||
import ( | ||
"net/netip" | ||
|
||
"github.com/nextmn/json-api/jsonapi" | ||
) | ||
|
||
type Session struct { | ||
Addr netip.Addr `json:"ue-addr"` | ||
Dnn string `json:"dnn"` | ||
UplinkFteid *jsonapi.Fteid `json:"uplink-fteid,omitempty"` | ||
DownlinkFteid *jsonapi.Fteid `json:"downlink-fteid,omitempty"` | ||
|
||
// when ForwardDownlinkFteid is not empty, | ||
// PDUs received on DownlinkFteid must be forwarded to it | ||
ForwardDownlinkFteid *jsonapi.Fteid `json:"forward-fteid,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright 2024 Louis Royer and the NextMN contributors. All rights reserved. | ||
// Use of this source code is governed by a MIT-style license that can be | ||
// found in the LICENSE file. | ||
// SPDX-License-Identifier: MIT | ||
|
||
package n1n2_test | ||
|
||
import ( | ||
"encoding/json" | ||
"testing" | ||
|
||
"github.com/nextmn/json-api/jsonapi/n1n2" | ||
) | ||
|
||
func TestSession(t *testing.T) { | ||
s := &n1n2.Session{} | ||
if err := json.Unmarshal([]byte("{\"ue-addr\": \"127.0.0.1\", \"uplink-fteid\": {\"addr\": \"127.0.0.2\", \"teid\": 80}}"), s); err != nil { | ||
t.Errorf("Session with only uplink FTeid could not be unmarshaled") | ||
} | ||
|
||
if s.DownlinkFteid != nil { | ||
t.Errorf("Downlink Fteid was not defined but is not nil") | ||
} | ||
if s.UplinkFteid == nil { | ||
t.Errorf("Uplink Fteid was defined but is nil") | ||
} | ||
|
||
} |