-
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.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
d412e64
commit cc4c8cd
Showing
10 changed files
with
218 additions
and
21 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
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,29 @@ | ||
// 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 cli | ||
|
||
import ( | ||
"github.com/nextmn/gnb-lite/internal/radio" | ||
"github.com/nextmn/gnb-lite/internal/session" | ||
|
||
"github.com/gin-gonic/gin" | ||
) | ||
|
||
type Cli struct { | ||
Radio *radio.Radio | ||
PduSessions *session.PduSessions | ||
} | ||
|
||
func NewCli(r *radio.Radio, p *session.PduSessions) *Cli { | ||
return &Cli{ | ||
Radio: r, | ||
PduSessions: p, | ||
} | ||
} | ||
|
||
func (cli *Cli) Register(e *gin.Engine) { | ||
e.POST("/cli/ps/handover", cli.PsHandover) | ||
} |
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,35 @@ | ||
// 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 cli | ||
|
||
import ( | ||
"net/http" | ||
"net/netip" | ||
|
||
"github.com/nextmn/json-api/jsonapi" | ||
|
||
"github.com/gin-gonic/gin" | ||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
type PsHandover struct { | ||
UeCtrl jsonapi.ControlURI `json:"ue-ctrl"` | ||
GNBTarget jsonapi.ControlURI `json:"gnb-target"` | ||
Sessions []netip.Addr `json:"sessions"` | ||
} | ||
|
||
func (cli *Cli) PsHandover(c *gin.Context) { | ||
var ps PsHandover | ||
if err := c.BindJSON(&ps); err != nil { | ||
logrus.WithError(err).Error("could not deserialize") | ||
c.JSON(http.StatusBadRequest, jsonapi.MessageWithError{Message: "could not deserialize", Error: err}) | ||
} | ||
go cli.HandlePsHandover(ps) | ||
c.Status(http.StatusNotImplemented) | ||
} | ||
|
||
func (cli *Cli) HandlePsHandover(ps PsHandover) { | ||
} |
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,31 @@ | ||
// 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 session | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/nextmn/json-api/jsonapi" | ||
"github.com/nextmn/json-api/jsonapi/n1n2" | ||
|
||
"github.com/gin-gonic/gin" | ||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
func (s *PduSessions) HandoverCommand(c *gin.Context) { | ||
var ps n1n2.HandoverCommand | ||
if err := c.BindJSON(&ps); err != nil { | ||
logrus.WithError(err).Error("could not deserialize") | ||
c.JSON(http.StatusBadRequest, jsonapi.MessageWithError{Message: "could not deserialize", Error: err}) | ||
return | ||
} | ||
go s.HandleHandoverCommand(ps) | ||
c.JSON(http.StatusAccepted, jsonapi.Message{Message: "please refer to logs for more information"}) | ||
} | ||
|
||
func (s *PduSessions) HandleHandoverCommand(n1n2.HandoverCommand) { | ||
logrus.Error("Handover Command: not implemented") | ||
} |
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,31 @@ | ||
// 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 session | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/nextmn/json-api/jsonapi" | ||
"github.com/nextmn/json-api/jsonapi/n1n2" | ||
|
||
"github.com/gin-gonic/gin" | ||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
func (s *PduSessions) HandoverConfirm(c *gin.Context) { | ||
var ps n1n2.HandoverConfirm | ||
if err := c.BindJSON(&ps); err != nil { | ||
logrus.WithError(err).Error("could not deserialize") | ||
c.JSON(http.StatusBadRequest, jsonapi.MessageWithError{Message: "could not deserialize", Error: err}) | ||
return | ||
} | ||
go s.HandleHandoverConfirm(ps) | ||
c.JSON(http.StatusAccepted, jsonapi.Message{Message: "please refer to logs for more information"}) | ||
} | ||
|
||
func (s *PduSessions) HandleHandoverConfirm(n1n2.HandoverConfirm) { | ||
logrus.Error("Handover Confirm: not implemented") | ||
} |
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,31 @@ | ||
// 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 session | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/nextmn/json-api/jsonapi" | ||
"github.com/nextmn/json-api/jsonapi/n1n2" | ||
|
||
"github.com/gin-gonic/gin" | ||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
func (s *PduSessions) HandoverNotify(c *gin.Context) { | ||
var ps n1n2.HandoverNotify | ||
if err := c.BindJSON(&ps); err != nil { | ||
logrus.WithError(err).Error("could not deserialize") | ||
c.JSON(http.StatusBadRequest, jsonapi.MessageWithError{Message: "could not deserialize", Error: err}) | ||
return | ||
} | ||
go s.HandleHandoverNotify(ps) | ||
c.JSON(http.StatusAccepted, jsonapi.Message{Message: "please refer to logs for more information"}) | ||
} | ||
|
||
func (s *PduSessions) HandleHandoverNotify(n1n2.HandoverNotify) { | ||
logrus.Error("Handover Notify: not implemented") | ||
} |
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,31 @@ | ||
// 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 session | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/nextmn/json-api/jsonapi" | ||
"github.com/nextmn/json-api/jsonapi/n1n2" | ||
|
||
"github.com/gin-gonic/gin" | ||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
func (s *PduSessions) HandoverRequest(c *gin.Context) { | ||
var ps n1n2.HandoverRequest | ||
if err := c.BindJSON(&ps); err != nil { | ||
logrus.WithError(err).Error("could not deserialize") | ||
c.JSON(http.StatusBadRequest, jsonapi.MessageWithError{Message: "could not deserialize", Error: err}) | ||
return | ||
} | ||
go s.HandleHandoverRequest(ps) | ||
c.JSON(http.StatusAccepted, jsonapi.Message{Message: "please refer to logs for more information"}) | ||
} | ||
|
||
func (s *PduSessions) HandleHandoverRequest(n1n2.HandoverRequest) { | ||
logrus.Error("Handover Request: not implemented") | ||
} |
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