-
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
a64418a
commit 8c8aa22
Showing
11 changed files
with
138 additions
and
20 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
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
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
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") | ||
} | ||
|
||
} |