Skip to content
Snippets Groups Projects
Commit 1c955609 authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Some more improvements for CSE registration related procedure

parent 192b8096
No related branches found
No related tags found
No related merge requests found
......@@ -1884,9 +1884,9 @@ module OneM2M_Functions {
// TODO To review the code (use of indexes, generation of value for certain attributes, etc..)
if(p_resourceType == int5) { //CSEBase
v_myResource.cSEBase.resourceName := "CSEBase" & int2str(v_resourceIndex);
v_myResource.cSEBase.resourceName := PX_CSE1_NAME;
v_myResource.cSEBase.resourceType := p_resourceType;
v_myResource.cSEBase.resourceID := "CSEBase" & int2str(v_resourceIndex);
v_myResource.cSEBase.resourceID := 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";
......@@ -2064,7 +2064,7 @@ module OneM2M_Functions {
tc_ac.start;
repeat;
}
[] mccPortIn.receive(mw_request(mw_retrieve(f_getLocalResourceAddress(-, e_hierarchical, e_spRelative)))) -> value v_request {
[] mccPortIn.receive(mw_request(mw_retrieve(?))) -> value v_request {
tc_ac.stop;
log(__SCOPE__&": WARNING: Unexpected RETRIEVE message received");
......@@ -2080,7 +2080,7 @@ module OneM2M_Functions {
v_response := valueof(m_responsePrimitive(int2000,v_request.primitive.requestPrimitive.requestIdentifier));
v_response.from_ := PX_CSE1_ID;
v_response.to_ := v_request.primitive.requestPrimitive.from_;
v_response.primitiveContent := vc_localResourcesList[vc_cSEBaseIndex].resource;
v_response.primitiveContent := vc_localResourcesList[v_localResourceIndex].resource;
mccPortIn.send(m_response(v_response));
}
tc_ac.start;
......@@ -2102,7 +2102,7 @@ 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_;
v_response.primitiveContent := vc_localResourcesList[vc_localRemoteCseIndex].resource;
v_response.primitiveContent := vc_localResourcesList[v_localResourceIndex].resource;
mccPortIn.send(m_response(v_response));
}
tc_ac.start;
......@@ -2602,16 +2602,16 @@ module OneM2M_Functions {
return f_resourceIdCleaner(p_contentResource.cSEBase.resourceID);
}
if(ischosen(p_contentResource.m2mServiceSubscriptionProfile)) {
return p_contentResource.m2mServiceSubscriptionProfile.resourceName;
return f_resourceIdCleaner(p_contentResource.m2mServiceSubscriptionProfile.resourceID);
}
if(ischosen(p_contentResource.node)) {
return p_contentResource.node.resourceName;
return f_resourceIdCleaner(p_contentResource.node.resourceID);
}
if(ischosen(p_contentResource.statsConfig)) {
return p_contentResource.statsConfig.resourceName;
return f_resourceIdCleaner(p_contentResource.statsConfig.resourceID);
}
if(ischosen(p_contentResource.statsCollect)) {
return p_contentResource.statsCollect.resourceName;
return f_resourceIdCleaner(p_contentResource.statsCollect.resourceID);
}
log(__SCOPE__&":WARNING: Primitive Content Kind not implemented");
......@@ -2782,30 +2782,38 @@ module OneM2M_Functions {
function f_getResourceIndex(in XSD.ID p_receivedURI) runs on CseSimu return integer {
var integer v_resourceIndex := -1;
var integer i;
var XSD.ID v_resourceName;
var XSD.ID v_resourceID;
var XSD.ID v_cleanedURI;
v_cleanedURI := f_resourceIdCleaner(p_receivedURI);
if (f_isHierarchical(p_receivedURI)) {
v_resourceName := f_resourceIdCleaner(p_receivedURI);
for(i:=0; i < lengthof(vc_resourcesList); i := i+1){
log("Hierarchical method: " & v_cleanedURI);
for(i:=0; i < lengthof(vc_localResourcesList); i := i+1){
if(match(f_getResourceName(vc_localResourcesList[i].resource), v_resourceName)){
if(match(f_getResourceName(vc_localResourcesList[i].resource), v_cleanedURI)){
v_resourceIndex := i;
break;
}
}
}
} else {
v_resourceID := f_resourceIdCleaner(p_receivedURI);
for(i:=0; i < lengthof(vc_resourcesList); i := i+1){
if(match(f_getResourceId(vc_localResourcesList[i].resource), v_resourceID)){
log("Non Hierarchical method: " & v_cleanedURI);
for(i:=0; i < lengthof(vc_localResourcesList); i := i+1){
if(match(f_getResourceId(vc_localResourcesList[i].resource), v_cleanedURI)){
v_resourceIndex := i;
break;
}
}
}
log("Resource index found: " & int2str(v_resourceIndex));
//Try CSEBase
if(v_resourceIndex == -1) {
if(match(f_getResourceName(vc_localResourcesList[vc_cSEBaseIndex].resource), v_cleanedURI)) {
v_resourceIndex := vc_cSEBaseIndex;
}
}
return v_resourceIndex;
}
......
......@@ -125,7 +125,7 @@ module OneM2M_Templates {
* @desc Base Receive RETRIEVE request primitive
* @param p_targetResourceAddress Target resource address
*/
template RequestPrimitive mw_retrieve(XSD.ID p_targetResourceAddress) := {
template RequestPrimitive mw_retrieve(template XSD.ID p_targetResourceAddress) := {
operation := int2,
to_ := p_targetResourceAddress,
from_ := ?,
......@@ -383,7 +383,7 @@ module OneM2M_Templates {
to_ := p_to,
from_ := p_from,
requestIdentifier := ?,
resourceType := ?,
resourceType := omit,
primitiveContent:= ?,
role := *,
originatingTimestamp := *,
......@@ -585,7 +585,7 @@ module OneM2M_Templates {
/**
* @desc Reception template for CREATE AEAnnc
*/
template RequestPrimitive mw_createAEAnnc(template (omit) XSD.ID p_from := omit, template (omit) XSD.ID p_to := omit, template (omit) AcpType p_accessControlPolicyIds := omit, template XSD.AnyURI p_link := ?) modifies mw_create := {
template RequestPrimitive mw_createAEAnnc(template (omit) XSD.ID p_from := omit, template (omit) XSD.ID p_to := omit, template AcpType p_accessControlPolicyIds := ?, template XSD.AnyURI p_link := ?) modifies mw_create := {
resourceType := int10002,
primitiveContent := {aEAnnc := mw_contentCreateAEAnnc({"Credential-ID:None"}, p_accessControlPolicyIds)}
};
......@@ -1280,15 +1280,15 @@ module OneM2M_Templates {
accessControlPolicyIDs := p_accessControlPolicyIds,//MA
expirationTime := ?,//MA M
link := p_link,//M
appName := omit,//OA
app_ID := omit,//OA
aE_ID := omit,//OA
pointOfAccess := omit, //OA {"http://127.0.0.1:1400/monitor"},//O //{"http://192.168.1.92:18080/notifications/AE"}, // TODO: Check this => AE PoA
ontologyRef := omit,//OA
nodeLink := omit,//OA
requestReachability := omit,//OA
contentSerialization := omit,//OA
choice := omit//NA
appName := *,//OA
app_ID := *,//OA
aE_ID := *,//OA
pointOfAccess := *, //OA {"http://127.0.0.1:1400/monitor"},//O //{"http://192.168.1.92:18080/notifications/AE"}, // TODO: Check this => AE PoA
ontologyRef := *,//OA
nodeLink := *,//OA
requestReachability := *,//OA
contentSerialization := *,//OA
choice := *//NA
};
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment