Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor #1

Merged
merged 5 commits into from
Jun 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,24 @@ Still a Work In Progress. API may change before v1.0.0.
- PFCP Sessions handling (currently only PFCP Session establishment procedure is supported)

## Getting started
### Server (UPF)
### UPF

```golang
upNode := NewPFCPServerEntity(upAddress)
upNode := NewPFCPEntityUP(UPFADDR)
upNode.Start()
// Access list of associations
associations := upNode.GetPFCPAssociations()
// Access list of sessions
sessions := upNode.GetPFCPSessions()
```

### Client (SMF)
### SMF

```golang
cpNode := NewPFCPClientEntity(cpAddress)
cpNode := NewPFCPEntityCP(SMFADDR)
cpNode.Start()
peer, _ := NewPFCPPeer(cpNode, pfcputils.CreateNodeID(nodeID)
a, _ := cpNode.NewPFCPAssociation(peer)
a.NewPFCPSession(cpNode.GetNextRemoteSessionID(), pdrs, fars)
association, _ := cpNode.NewEstablishedAssociation(pfcputils.CreateNodeID(UPFADDR))
session, _ := a.CreateSession(pdrs, fars)

```

Expand Down
167 changes: 0 additions & 167 deletions association.go

This file was deleted.

19 changes: 19 additions & 0 deletions pfcp/api/association_interface.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright 2022 Louis Royer and the go-pfcp-networking 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 api

import (
pfcprule "github.com/louisroyer/go-pfcp-networking/pfcprules"
"github.com/wmnsk/go-pfcp/ie"
)

type SEID = uint64
type PFCPAssociationInterface interface {
PFCPPeerInterface
SetupInitiatedByCP() error
GetNextSEID() SEID
CreateSession(remoteFseid *ie.IE, pdrs pfcprule.PDRs, fars pfcprule.FARs) (session PFCPSessionInterface, err error)
}
26 changes: 26 additions & 0 deletions pfcp/api/entity_interface.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright 2022 Louis Royer and the go-pfcp-networking 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 api

import (
"net"

"github.com/wmnsk/go-pfcp/ie"
)

type PFCPEntityInterface interface {
IsUserPlane() bool
IsControlPlane() bool
NodeID() *ie.IE
RecoveryTimeStamp() *ie.IE
NewEstablishedPFCPAssociation(nodeID *ie.IE) (association PFCPAssociationInterface, err error)
RemovePFCPAssociation(association PFCPAssociationInterface) error
GetPFCPAssociation(nid string) (association PFCPAssociationInterface, err error)
//GetLocalSessions() PFCPSessionMapSEID
SendTo(msg []byte, dst net.Addr) error
GetPFCPSessions() []PFCPSessionInterface
AddEstablishedPFCPSession(session PFCPSessionInterface) error
}
23 changes: 23 additions & 0 deletions pfcp/api/peer_interface.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright 2022 Louis Royer and the go-pfcp-networking 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 api

import (
"github.com/wmnsk/go-pfcp/ie"
"github.com/wmnsk/go-pfcp/message"
)

type PFCPPeerInterface interface {
IsRunning() bool
Close() error
Send(msg message.Message) (m message.Message, err error)
IsAlive() (res bool, err error)
NodeID() *ie.IE
IsUserPlane() bool
IsControlPlane() bool
LocalEntity() PFCPEntityInterface
NewEstablishedPFCPAssociation() (PFCPAssociationInterface, error)
}
27 changes: 27 additions & 0 deletions pfcp/api/session_interface.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright 2022 Louis Royer and the go-pfcp-networking 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 api

import (
"net"

pfcprule "github.com/louisroyer/go-pfcp-networking/pfcprules"
"github.com/wmnsk/go-pfcp/ie"
)

type PFCPSessionInterface interface {
LocalFSEID() *ie.IE
LocalSEID() (SEID, error)
LocalIPAddress() (net.IP, error)
RemoteFSEID() *ie.IE
RemoteSEID() (SEID, error)
RemoteIPAddress() (net.IP, error)
GetPDRs() pfcprule.PDRs
GetFAR(farid uint32) (*pfcprule.FAR, error)
AddPDRsFARs(pdrs pfcprule.PDRMap, fars pfcprule.FARMap)
// SetRemoteFSEID(FSEID *ie.IE)
Setup() error
}
Loading