Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
TST
ATS
Commits
02140513
Commit
02140513
authored
Feb 13, 2018
by
Miguel Angel Reina Ortega
Browse files
Fixing TC_CSE_REG_CRE_005 (finalized) closing
#19
Signed-off-by:
reinaortega
<
miguelangel.reinaortega@etsi.org
>
parent
239cf8c6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
134 additions
and
22 deletions
+134
-22
LibOneM2M/OneM2M_Functions.ttcn
LibOneM2M/OneM2M_Functions.ttcn
+116
-11
LibOneM2M/OneM2M_Templates.ttcn
LibOneM2M/OneM2M_Templates.ttcn
+1
-1
OneM2M_Testcases_CSE_Release_1.ttcn
OneM2M_Testcases_CSE_Release_1.ttcn
+17
-10
No files found.
LibOneM2M/OneM2M_Functions.ttcn
View file @
02140513
...
...
@@ -783,7 +783,11 @@ module OneM2M_Functions {
for
(
i
:=
lengthof
(
vc_resourcesIndexToBeDeleted
)
-
1
;
i
>=
0
;
i
:=
i
-
1
)
{
v_resourceAddress
:=
f_getResourceAddress
(
vc_resourcesIndexToBeDeleted
[
i
]);
if
(
ischosen
(
vc_resourcesList
[
vc_resourcesIndexToBeDeleted
[
i
]].
resource
.
remoteCSE
))
{
v_resourceAddress
:=
f_getResourceAddress
(
vc_resourcesIndexToBeDeleted
[
i
],
e_nonHierarchical
,
e_spRelative
);
}
else
{
v_resourceAddress
:=
f_getResourceAddress
(
vc_resourcesIndexToBeDeleted
[
i
]);
}
v_request
:=
valueof
(
m_delete
(
v_resourceAddress
,
f_getOriginator
(
vc_resourcesIndexToBeDeleted
[
i
],
false
)));
...
...
@@ -1843,7 +1847,8 @@ module OneM2M_Functions {
v_response
.
primitiveContent
.
remoteCSE
:=
vc_localResourcesList
[
vc_localRemoteCseIndex
].
resource
.
remoteCSE
;
mccPortIn
.
send
(
m_response
(
v_response
));
v_resourceIndex
:=
f_setResource
(
valueof
(
m_primitiveContentRemoteCSE
(
m_contentMyRemoteCSEResource
)),
int16
,
-
1
);
vc_remoteCseIndex
:=
f_setResource
(
valueof
(
m_primitiveContentRemoteCSE
(
m_contentMyRemoteCSEResource
)),
int16
,
-
1
);
v_resourceIndex
:=
vc_remoteCseIndex
;
v_remoteCSERegistered
:=
true
;
tc_ac
.
start
;
repeat
;
...
...
@@ -1913,7 +1918,7 @@ module OneM2M_Functions {
if
(
p_resourceType
==
int5
)
{
//CSEBase
v_myResource
.
cSEBase
.
resourceName
:=
PX_CSE1_NAME
;
v_myResource
.
cSEBase
.
resourceType
:=
p_resourceType
;
v_myResource
.
cSEBase
.
resourceID
:=
PX_CSE1_ID
;
v_myResource
.
cSEBase
.
resourceID
:=
f_resourceIdCleaner
(
PX_CSE1_ID
)
;
v_myResource
.
cSEBase
.
parentID
:=
omit
;
//Following TS-0001, it must be NULL
v_myResource
.
cSEBase
.
creationTime
:=
fx_generateTimestamp
();
v_myResource
.
cSEBase
.
creationTime
:=
"20171231T012345"
;
...
...
@@ -2013,6 +2018,106 @@ module OneM2M_Functions {
return
v_myResource
;
}
//End of function
/**
* @desc Update of a local resource (Test System simulating a CSE)
* @param p_localResourceIndex Resource index of resource to be updated
* @param p_resource Resource update
*/
function
f_cse_updateLocalResource
(
in
integer
p_localResourceIndex
,
in
PrimitiveContent
p_resource
)
runs
on
CseSimu
{
// TODO To review the code (use of indexes, generation of value for certain attributes, etc..)
if
(
ischosen
(
vc_localResourcesList
[
p_localResourceIndex
].
resource
.
remoteCSE
)
and
ischosen
(
p_resource
.
remoteCSE
))
{
//RemoteCSE
if
(
ispresent
(
p_resource
.
remoteCSE
.
accessControlPolicyIDs
))
{
vc_localResourcesList
[
p_localResourceIndex
].
resource
.
remoteCSE
.
accessControlPolicyIDs
:=
p_resource
.
remoteCSE
.
accessControlPolicyIDs
;
}
if
(
ispresent
(
p_resource
.
remoteCSE
.
expirationTime
))
{
vc_localResourcesList
[
p_localResourceIndex
].
resource
.
remoteCSE
.
expirationTime
:=
p_resource
.
remoteCSE
.
expirationTime
;
}
if
(
ispresent
(
p_resource
.
remoteCSE
.
labels
))
{
vc_localResourcesList
[
p_localResourceIndex
].
resource
.
remoteCSE
.
labels
:=
p_resource
.
remoteCSE
.
labels
;
}
if
(
ispresent
(
p_resource
.
remoteCSE
.
announceTo
))
{
vc_localResourcesList
[
p_localResourceIndex
].
resource
.
remoteCSE
.
announceTo
:=
p_resource
.
remoteCSE
.
announceTo
;
}
if
(
ispresent
(
p_resource
.
remoteCSE
.
announcedAttribute
))
{
vc_localResourcesList
[
p_localResourceIndex
].
resource
.
remoteCSE
.
announcedAttribute
:=
p_resource
.
remoteCSE
.
announcedAttribute
;
}
if
(
ispresent
(
p_resource
.
remoteCSE
.
pointOfAccess
))
{
vc_localResourcesList
[
p_localResourceIndex
].
resource
.
remoteCSE
.
pointOfAccess
:=
p_resource
.
remoteCSE
.
pointOfAccess
;
}
if
(
ispresent
(
p_resource
.
remoteCSE
.
m2M_Ext_ID
))
{
vc_localResourcesList
[
p_localResourceIndex
].
resource
.
remoteCSE
.
m2M_Ext_ID
:=
p_resource
.
remoteCSE
.
m2M_Ext_ID
;
}
if
(
ispresent
(
p_resource
.
remoteCSE
.
trigger_Recipient_ID
))
{
vc_localResourcesList
[
p_localResourceIndex
].
resource
.
remoteCSE
.
trigger_Recipient_ID
:=
p_resource
.
remoteCSE
.
trigger_Recipient_ID
;
}
if
(
ispresent
(
p_resource
.
remoteCSE
.
requestReachability
))
{
vc_localResourcesList
[
p_localResourceIndex
].
resource
.
remoteCSE
.
requestReachability
:=
p_resource
.
remoteCSE
.
requestReachability
;
}
if
(
ispresent
(
p_resource
.
remoteCSE
.
nodeLink
))
{
vc_localResourcesList
[
p_localResourceIndex
].
resource
.
remoteCSE
.
nodeLink
:=
p_resource
.
remoteCSE
.
nodeLink
;
}
}
else
if
(
ischosen
(
vc_localResourcesList
[
p_localResourceIndex
].
resource
.
container
)
and
(
ischosen
(
p_resource
.
container
)))
{
//Container
}
}
//End of function
/**
* @desc Send response to the IUT (Test System simulating a CSE)
* @param p_requestPrimtive Received request primitive
*/
function
f_cse_sendResponse
(
in
MsgIn
p_requestPrimitive
)
runs
on
CseSimu
{
var
integer
v_parentResourceIndex
:=
-
1
;
var
integer
v_localResourceIndex
:=
-
1
;
var
ResponsePrimitive
v_response
;
var
PrimitiveContent
v_localResource
;
v_parentResourceIndex
:=
f_getResourceIndex
(
p_requestPrimitive
.
primitive
.
requestPrimitive
.
to_
);
if
(
v_parentResourceIndex
==
-
1
)
{
log
(
__SCOPE__
&
": ERROR: Target resource not found"
);
v_response
:=
valueof
(
m_responsePrimitive
(
int4004
,
p_requestPrimitive
.
primitive
.
requestPrimitive
.
requestIdentifier
));
}
else
{
v_localResource
:=
f_cse_generateLocalResource
(
p_requestPrimitive
.
primitive
.
requestPrimitive
.
primitiveContent
,
v_parentResourceIndex
,
p_requestPrimitive
.
primitive
.
requestPrimitive
.
resourceType
);
v_localResourceIndex
:=
f_setLocalResource
(
v_localResource
,
p_requestPrimitive
.
primitive
.
requestPrimitive
.
resourceType
,
v_parentResourceIndex
);
v_response
:=
valueof
(
m_responsePrimitive
(
int2001
,
p_requestPrimitive
.
primitive
.
requestPrimitive
.
requestIdentifier
));
v_response
.
primitiveContent
:=
vc_localResourcesList
[
v_localResourceIndex
].
resource
;
}
v_response
.
from_
:=
PX_CSE1_ID
;
v_response
.
to_
:=
p_requestPrimitive
.
primitive
.
requestPrimitive
.
from_
;
mccPortIn
.
send
(
m_response
(
v_response
));
}
/**
* @desc Receive response from the IUT
* @param p_requestPrimtive Received request primitive
*/
function
f_cse_receiveResponse
()
runs
on
AeSimu
{
var
integer
v_localResourceIndex
:=
-
1
;
tc_ac
.
start
;
alt
{
[]
mcaPort
.
receive
(
mw_response
(
mw_responsePrimitiveOK
))
->
value
vc_response
{
tc_ac
.
stop
;
setverdict
(
pass
,
__SCOPE__
&
":INFO: Response received with positive response status code"
);
}
[]
mcaPort
.
receive
(
mw_response
(
mw_responsePrimitiveKO
))
->
value
vc_response
{
tc_ac
.
stop
;
setverdict
(
pass
,
__SCOPE__
&
":INFO: Response received with negative response status code"
);
}
[]
tc_ac
.
timeout
{
setverdict
(
inconc
,
__SCOPE__
&
":INFO: No response received"
);
}
}
}
}
//end group CseSimuFunctions
...
...
@@ -2045,11 +2150,10 @@ module OneM2M_Functions {
altstep
a_cse_cf02_cse1
()
runs
on
CseSimu
{
var
PrimitiveContent
v_localResource
;
var
integer
v
c
_localResourceIndex
:=
-
1
;
var
integer
v_localResourceIndex
:=
-
1
;
var
integer
v_parentResourceIndex
:=
-
1
;
var
MsgIn
v_request
;
var
ResponsePrimitive
v_response
;
var
integer
v_localResourceIndex
:=
-
1
;
[]
mccPortIn
.
receive
(
mw_request
(
mw_create
()))
->
value
v_request
{
log
(
__SCOPE__
&
": WARNING: Unexpected CREATE message received"
);
...
...
@@ -2061,16 +2165,16 @@ module OneM2M_Functions {
v_response
:=
valueof
(
m_responsePrimitive
(
int4004
,
v_request
.
primitive
.
requestPrimitive
.
requestIdentifier
));
}
else
{
v_localResource
:=
f_cse_generateLocalResource
(
v_request
.
primitive
.
requestPrimitive
.
primitiveContent
,
v
c_cSEBas
eIndex
,
v_request
.
primitive
.
requestPrimitive
.
resourceType
);
//TODO Get index from v_request.primitive.requestPrimitive.to_
v
c
_localResourceIndex
:=
f_setLocalResource
(
v_localResource
,
v_request
.
primitive
.
requestPrimitive
.
resourceType
,
v
c_cSEBas
eIndex
);
v_localResource
:=
f_cse_generateLocalResource
(
v_request
.
primitive
.
requestPrimitive
.
primitiveContent
,
v
_parentResourc
eIndex
,
v_request
.
primitive
.
requestPrimitive
.
resourceType
);
v_localResourceIndex
:=
f_setLocalResource
(
v_localResource
,
v_request
.
primitive
.
requestPrimitive
.
resourceType
,
v
_parentResourc
eIndex
);
v_response
:=
valueof
(
m_responsePrimitive
(
int2001
,
v_request
.
primitive
.
requestPrimitive
.
requestIdentifier
));
v_response
.
primitiveContent
:=
vc_localResourcesList
[
v
c
_localResourceIndex
].
resource
;
v_response
.
primitiveContent
:=
vc_localResourcesList
[
v_localResourceIndex
].
resource
;
}
v_response
.
from_
:=
PX_CSE1_ID
;
v_response
.
to_
:=
v_request
.
primitive
.
requestPrimitive
.
from_
;
mccPortIn
.
send
(
m_response
(
v_response
));
tc_ac
.
start
(
5
.0
);
tc_ac
.
start
(
10
.0
);
repeat
;
}
[]
mccPortIn
.
receive
(
mw_request
(
mw_retrieve
(
?
)))
->
value
v_request
{
...
...
@@ -2092,7 +2196,7 @@ module OneM2M_Functions {
v_response
.
primitiveContent
:=
vc_localResourcesList
[
v_localResourceIndex
].
resource
;
mccPortIn
.
send
(
m_response
(
v_response
));
}
tc_ac
.
start
(
5
.0
);
tc_ac
.
start
(
10
.0
);
repeat
;
}
[]
mccPortIn
.
receive
(
mw_request
(
mw_update
()))
->
value
v_request
{
...
...
@@ -2111,10 +2215,11 @@ module OneM2M_Functions {
v_response
:=
valueof
(
m_responsePrimitive
(
int2004
,
v_request
.
primitive
.
requestPrimitive
.
requestIdentifier
));
v_response
.
from_
:=
PX_CSE1_ID
;
v_response
.
to_
:=
v_request
.
primitive
.
requestPrimitive
.
from_
;
f_cse_updateLocalResource
(
v_localResourceIndex
,
v_request
.
primitive
.
requestPrimitive
.
primitiveContent
);
v_response
.
primitiveContent
:=
vc_localResourcesList
[
v_localResourceIndex
].
resource
;
mccPortIn
.
send
(
m_response
(
v_response
));
}
tc_ac
.
start
(
5
.0
);
tc_ac
.
start
(
10
.0
);
repeat
;
}
[]
mccPortIn
.
receive
(
mw_request
(
?
)){
...
...
LibOneM2M/OneM2M_Templates.ttcn
View file @
02140513
...
...
@@ -2866,7 +2866,7 @@ module OneM2M_Templates {
resourceType
:=
int16
,
//M
resourceID
:=
PX_CSE1_RESOURCE_ID
,
//M
pointOfAccess
:=
{
PX_CSE1_ADDRESS
},
//O
cSEBase
:=
PX_CSE1_NAME
,
//M
cSEBase
:=
PX_CSE1_ID
&
"/"
&
PX_CSE1_NAME
,
//M
cSE_ID
:=
PX_CSE1_ID
,
//M
requestReachability
:=
true
//M
};
...
...
OneM2M_Testcases_CSE_Release_1.ttcn
View file @
02140513
...
...
@@ -562,9 +562,11 @@ module OneM2M_Testcases_CSE_Release_1 {
*/
testcase
TC_CSE_REG_CRE_005
()
runs
on
InCseSimu
system
CseSystem
{
var
template
RequestPrimitive
v_request
;
var
MsgIn
v_request
;
var
template
RequestPrimitive
v_requestPrimitive
;
var
integer
v_cseBaseIndex
:=
-
1
;
var
ResourceType
v_resourceType
:=
int2
;
var
boolean
v_handleResponses
:=
false
;
//Test control
...
...
@@ -578,32 +580,37 @@ module OneM2M_Testcases_CSE_Release_1 {
vc_ae1
.
start
(
f_cse_sendCreateRequestPrimitive
(
int2
,
m_createAe
(
PX_APP_ID
,
-
,
"S"
,
omit
)));
vc_ae1
.
done
;
v_request
:=
mw_createAEAnnc
(
PX_CSE_ID
&
"/S"
,
-
,
-
,
-
);
v_request
.
primitiveContent
.
aEAnnc
.
app_ID
:=
PX_APP_ID
;
v_request
Primitive
:=
mw_createAEAnnc
(
PX_CSE_ID
&
"/S"
,
-
,
-
,
-
);
v_request
Primitive
.
primitiveContent
.
aEAnnc
.
app_ID
:=
PX_APP_ID
;
tc_ac
.
start
;
alt
{
[]
mccPortIn
.
receive
(
mw_request
(
v_request
))
{
[]
mccPortIn
.
receive
(
mw_request
(
v_request
Primitive
))
->
value
v_request
{
tc_ac
.
stop
;
setverdict
(
pass
,
__SCOPE__
&
": AE creation redirected."
);
v_handleResponses
:=
true
;
}
[]
mccPortIn
.
receive
(
mw_request
(
mw_createAEAnnc
())){
[]
mccPortIn
.
receive
(
mw_request
(
mw_createAEAnnc
()))
->
value
v_request
{
tc_ac
.
stop
;
setverdict
(
fail
,
__SCOPE__
&
": AE creation redirected but wrong parameters"
);
v_handleResponses
:=
true
;
}
[]
mccPortIn
.
receive
(
mw_request
(
?
)){
[]
mccPortIn
.
receive
(
mw_request
(
?
))
->
value
v_request
{
tc_ac
.
stop
;
setverdict
(
fail
,
__SCOPE__
&
": Unexpected message received"
);
v_handleResponses
:=
true
;
}
[]
tc_ac
.
timeout
{
setverdict
(
fail
,
__SCOPE__
&
": No answer while creating AE"
);
}
}
/*vc_cse1.start(f_cse_receiveCreateRequest(mw_createAEAnnc(-, -, -)));
vc_cse1.done;*/
// Postamble
if
(
v_handleResponses
)
{
vc_ae1
.
start
(
f_cse_receiveResponse
());
f_cse_sendResponse
(
v_request
);
vc_ae1
.
done
;
}
f_cse_postamble_deleteResourcesCSE
();
// Tear down
...
...
Miguel Angel Reina Ortega
@reinaortega
mentioned in issue
#19 (closed)
·
Mar 09, 2018
mentioned in issue
#19 (closed)
mentioned in issue #19
Toggle commit list
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