-
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.
- Loading branch information
1 parent
9c4fb6c
commit 3029c9b
Showing
30 changed files
with
271 additions
and
65 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
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 |
---|---|---|
@@ -1,10 +1,42 @@ | ||
// Copyright 2024 Louis Royer and the NextMN-json-api contributors. All rights reserved. | ||
// 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 ( | ||
"encoding/json" | ||
"fmt" | ||
) | ||
|
||
type MessageWithError struct { | ||
Message string | ||
Error error | ||
Message string `json:"message"` | ||
Error error `json:"error"` | ||
} | ||
|
||
func (u *MessageWithError) UnmarshalJSON(data []byte) error { | ||
a := make(map[string]string) | ||
err := json.Unmarshal(data, a) | ||
if err != nil { | ||
return err | ||
} | ||
msg, ok := a["message"] | ||
if !ok { | ||
return fmt.Errorf("Missing key `message` while unmarshaling MessageWithError") | ||
} | ||
u.Message = msg | ||
e, ok := a["error"] | ||
if !ok { | ||
return fmt.Errorf("Missing key `error` while unmarshaling MessageWithError") | ||
} | ||
u.Error = fmt.Errorf(e) | ||
return nil | ||
} | ||
|
||
func (u MessageWithError) MarshalJSON() ([]byte, error) { | ||
return json.Marshal(map[string]string{ | ||
"message": u.Message, | ||
"error": u.Error.Error(), | ||
}) | ||
} |
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,18 @@ | ||
// 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" | ||
) | ||
|
||
// RadioPeerMsg is used to discover UEs/gNBs "radio" peers. | ||
type RadioPeerMsg struct { | ||
Control jsonapi.ControlURI `json:"control"` | ||
Data netip.AddrPort `json:"data"` | ||
} |
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,7 @@ | ||
// 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 allow to simulate N1/N2 interface using a REST API. | ||
package n1n2 |
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 ( | ||
"net/netip" | ||
|
||
"github.com/nextmn/json-api/jsonapi" | ||
) | ||
|
||
// N2PduSessionReqMsg is sent by the CP to the gNB to establish a PDU Session. | ||
type N2PduSessionReqMsg struct { | ||
Cp jsonapi.ControlURI `json:"cp"` | ||
UeInfo PduSessionEstabAcceptMsg `json:"ue-info"` // information to forward to the UE | ||
|
||
// Uplink FTEID: the gNB will establish an Uplink GTP Tunnel using the following | ||
Upf netip.Addr `json:"upf"` | ||
UplinkTeid uint32 `json:"uplink-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,17 @@ | ||
// 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" | ||
|
||
// N2PduSessionRespMsg is sent to the CP by the gNB as a response of N2PduSessionReqMsg. | ||
type N2PduSessionRespMsg struct { | ||
UeInfo PduSessionEstabAcceptMsg `json:"ue-info"` // used to identify the PDU Session | ||
|
||
// Downlink FTEID: the CP will use this to configure a downlink GTP Tunnel in Upf-i | ||
DownlinkTeid uint32 `json:"downlink-teid"` | ||
Gnb netip.Addr `json:"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,15 @@ | ||
// 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" | ||
|
||
// PduSessionEstabAcceptMsg is sent to the UE by the gNB | ||
// when the PDU Session establishment is accepted. | ||
type PduSessionEstabAcceptMsg struct { | ||
Header PduSessionEstabReqMsg `json:"header"` // copy of the PDU Session Establishment Request Message | ||
Addr netip.Addr `json:"address"` // IP Address attributed to the UE for this PDU Session | ||
} |
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,16 @@ | ||
// 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" | ||
|
||
// PduSessionEstabReqMessage is sent by the UE to the gNB (then forwarded by the gNB to the CP) | ||
// to start the PDU Session Establishment Procedure. | ||
type PduSessionEstabReqMsg struct { | ||
Ue jsonapi.ControlURI `json:"ue"` | ||
Gnb jsonapi.ControlURI `json:"gnb"` | ||
Dnn string `json:"dnn"` | ||
} |
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,7 @@ | ||
// 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 n4tosrv6 allow to translate PFCP Rules into SRv6. | ||
package n4tosrv6 |
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
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,16 @@ | ||
// 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 n4tosrv6 | ||
|
||
import ( | ||
"github.com/nextmn/json-api/jsonapi" | ||
) | ||
|
||
type Router struct { | ||
Control jsonapi.ControlURI `json:"control"` // url used for control | ||
Locator Locator `json:"locator"` // locator (ipv6 prefix) | ||
Backbone BackboneIP `json:"backbone"` // data plane backbone ipv6 address | ||
} |
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
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 was deleted.
Oops, something went wrong.
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
Oops, something went wrong.