Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
UERANSIM
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
UERANSIM
Commits
83a0128f
Commit
83a0128f
authored
Mar 30, 2021
by
aligungr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UE initiated PDU session release impl.
parent
06570837
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
84 additions
and
9 deletions
+84
-9
src/app/cli_cmd.cpp
src/app/cli_cmd.cpp
+32
-5
src/app/cli_cmd.hpp
src/app/cli_cmd.hpp
+7
-0
src/ue/app/cmd_handler.cpp
src/ue/app/cmd_handler.cpp
+11
-0
src/ue/sm/release.cpp
src/ue/sm/release.cpp
+10
-3
src/ue/sm/sm.hpp
src/ue/sm/sm.hpp
+4
-1
src/utils/common.cpp
src/utils/common.cpp
+18
-0
src/utils/common.hpp
src/utils/common.hpp
+2
-0
No files found.
src/app/cli_cmd.cpp
View file @
83a0128f
...
...
@@ -82,7 +82,9 @@ static std::map<std::string, std::string> g_ueCmdToDescription = {
{
"info"
,
"Show some information about the UE"
},
{
"status"
,
"Show some status information about the UE"
},
{
"timers"
,
"Dump current status of the timers in the UE"
},
{
"deregister"
,
"Perform de-registration by the UE"
},
{
"deregister"
,
"Perform a de-registration by the UE"
},
{
"ps-release"
,
"Trigger a PDU session release procedure"
},
{
"ps-release-all"
,
"Trigger PDU session release procedures for all active sessions"
},
};
static
std
::
map
<
std
::
string
,
std
::
string
>
g_ueCmdToUsage
=
{
...
...
@@ -90,13 +92,13 @@ static std::map<std::string, std::string> g_ueCmdToUsage = {
{
"status"
,
""
},
{
"timers"
,
""
},
{
"deregister"
,
"<normal|disable-5g|switch-off|remove-sim>"
},
{
"ps-release"
,
"<pdu-session-id>..."
},
{
"ps-release-all"
,
""
},
};
static
std
::
map
<
std
::
string
,
bool
>
g_ueCmdToHelpIfEmpty
=
{
{
"info"
,
false
},
{
"status"
,
false
},
{
"timers"
,
false
},
{
"deregister"
,
true
},
{
"info"
,
false
},
{
"status"
,
false
},
{
"timers"
,
false
},
{
"deregister"
,
true
},
{
"ps-release"
,
true
},
{
"ps-release-all"
,
false
},
};
std
::
unique_ptr
<
GnbCliCommand
>
ParseGnbCliCommand
(
std
::
vector
<
std
::
string
>
&&
tokens
,
std
::
string
&
error
,
...
...
@@ -245,6 +247,31 @@ std::unique_ptr<UeCliCommand> ParseUeCliCommand(std::vector<std::string> &&token
"
\"
remove-sim
\"
"
)
return
cmd
;
}
else
if
(
subCmd
==
"ps-release"
)
{
auto
cmd
=
std
::
make_unique
<
UeCliCommand
>
(
UeCliCommand
::
PS_RELEASE
);
if
(
options
.
positionalCount
()
==
0
)
CMD_ERR
(
"At least one PDU session ID is expected"
)
if
(
options
.
positionalCount
()
>
15
)
CMD_ERR
(
"Too many PDU session IDs"
)
cmd
->
psCount
=
options
.
positionalCount
();
for
(
int
i
=
0
;
i
<
cmd
->
psCount
;
i
++
)
{
int
n
=
0
;
if
(
!
utils
::
TryParseInt
(
options
.
getPositional
(
i
),
n
))
CMD_ERR
(
"Invalid PDU session ID value"
)
if
(
n
<=
0
)
CMD_ERR
(
"PDU session IDs must be positive integer"
)
if
(
n
>
15
)
CMD_ERR
(
"PDU session IDs cannot be greater than 15"
)
cmd
->
psIds
[
i
]
=
static_cast
<
int8_t
>
(
n
);
}
return
cmd
;
}
else
if
(
subCmd
==
"ps-release-all"
)
{
return
std
::
make_unique
<
UeCliCommand
>
(
UeCliCommand
::
PS_RELEASE_ALL
);
}
return
nullptr
;
}
...
...
src/app/cli_cmd.hpp
View file @
83a0128f
...
...
@@ -12,6 +12,7 @@
#include <string>
#include <utils/common_types.hpp>
#include <vector>
#include <array>
namespace
app
{
...
...
@@ -44,11 +45,17 @@ struct UeCliCommand
STATUS
,
TIMERS
,
DE_REGISTER
,
PS_RELEASE
,
PS_RELEASE_ALL
}
present
;
// DE_REGISTER
EDeregCause
deregCause
{};
// PS_RELEASE
std
::
array
<
int8_t
,
16
>
psIds
{};
int
psCount
{};
explicit
UeCliCommand
(
PR
present
)
:
present
(
present
)
{
}
...
...
src/ue/app/cmd_handler.cpp
View file @
83a0128f
...
...
@@ -129,6 +129,17 @@ void UeCmdHandler::handleCmdImpl(NwUeCliCommand &msg)
sendResult
(
msg
.
address
,
"De-registration procedure triggered. UE device will be switched off."
);
break
;
}
case
app
:
:
UeCliCommand
::
PS_RELEASE
:
{
for
(
int
i
=
0
;
i
<
msg
.
cmd
->
psCount
;
i
++
)
m_base
->
nasTask
->
sm
->
sendReleaseRequest
(
static_cast
<
int
>
(
msg
.
cmd
->
psIds
[
i
])
%
16
);
sendResult
(
msg
.
address
,
"PDU session release procedure(s) triggered"
);
break
;
}
case
app
:
:
UeCliCommand
::
PS_RELEASE_ALL
:
{
m_base
->
nasTask
->
sm
->
sendReleaseRequestForAll
();
sendResult
(
msg
.
address
,
"PDU session release procedure(s) triggered"
);
break
;
}
}
}
...
...
src/ue/sm/release.cpp
View file @
83a0128f
...
...
@@ -18,16 +18,16 @@ namespace nr::ue
void
NasSm
::
sendReleaseRequest
(
int
psi
)
{
m_logger
->
debug
(
"Sending PDU Session Release Request"
);
/* Control the PDU session state */
auto
&
ps
=
m_pduSessions
[
psi
];
if
(
ps
->
psState
!=
EPsState
::
ACTIVE
)
{
m_logger
->
warn
(
"PDU session release procedure could not start: PS[%d] is not active"
,
psi
);
m_logger
->
warn
(
"PDU session release procedure could not start: PS[%d] is not active
already
"
,
psi
);
return
;
}
m_logger
->
debug
(
"Sending PDU Session Release Request for PSI[%d]"
,
psi
);
/* Allocate PTI */
int
pti
=
allocateProcedureTransactionId
();
if
(
pti
==
0
)
...
...
@@ -51,6 +51,13 @@ void NasSm::sendReleaseRequest(int psi)
sendSmMessage
(
psi
,
*
pt
.
message
);
}
void
NasSm
::
sendReleaseRequestForAll
()
{
for
(
auto
&
ps
:
m_pduSessions
)
if
(
ps
->
psState
==
EPsState
::
ACTIVE
)
sendReleaseRequest
(
ps
->
psi
);
}
void
NasSm
::
receiveReleaseReject
(
const
nas
::
PduSessionReleaseReject
&
msg
)
{
auto
cause
=
msg
.
smCause
.
value
;
...
...
src/ue/sm/sm.hpp
View file @
83a0128f
...
...
@@ -50,6 +50,10 @@ class NasSm
void
localReleaseAllSessions
();
bool
anyEmergencySession
();
/* Session Release */
void
sendReleaseRequest
(
int
psi
);
void
sendReleaseRequestForAll
();
private:
/* Transport */
void
sendSmMessage
(
int
psi
,
const
nas
::
SmMessage
&
msg
);
...
...
@@ -69,7 +73,6 @@ class NasSm
void
receiveEstablishmentRoutingFailure
(
const
nas
::
PduSessionEstablishmentRequest
&
msg
);
/* Session Release */
void
sendReleaseRequest
(
int
psi
);
void
receiveReleaseReject
(
const
nas
::
PduSessionReleaseReject
&
msg
);
/* Timer */
...
...
src/utils/common.cpp
View file @
83a0128f
...
...
@@ -317,3 +317,21 @@ void utils::Trim(std::stringstream &s)
Trim
(
str
);
s
.
str
(
str
);
}
bool
utils
::
TryParseInt
(
const
std
::
string
&
str
,
int
&
output
)
{
return
TryParseInt
(
str
.
c_str
(),
output
);
}
bool
utils
::
TryParseInt
(
const
char
*
str
,
int
&
output
)
{
try
{
output
=
std
::
stoi
(
str
);
return
true
;
}
catch
(...)
{
return
false
;
}
}
src/utils/common.hpp
View file @
83a0128f
...
...
@@ -31,6 +31,8 @@ TimeStamp CurrentTimeStamp();
int
NextId
();
int
ParseInt
(
const
std
::
string
&
str
);
int
ParseInt
(
const
char
*
str
);
bool
TryParseInt
(
const
std
::
string
&
str
,
int
&
output
);
bool
TryParseInt
(
const
char
*
str
,
int
&
output
);
uint64_t
Random64
();
void
Sleep
(
int
ms
);
bool
IsRoot
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment