Some more improvements for CSE registration related procedure

Signed-off-by: Miguel Angel Reina Ortega's avatarreinaortega <miguelangel.reinaortega@etsi.org>
parent 192b8096
...@@ -1884,9 +1884,9 @@ module OneM2M_Functions { ...@@ -1884,9 +1884,9 @@ module OneM2M_Functions {
// TODO To review the code (use of indexes, generation of value for certain attributes, etc..) // TODO To review the code (use of indexes, generation of value for certain attributes, etc..)
if(p_resourceType == int5) { //CSEBase 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.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.parentID := omit; //Following TS-0001, it must be NULL
v_myResource.cSEBase.creationTime := fx_generateTimestamp(); v_myResource.cSEBase.creationTime := fx_generateTimestamp();
v_myResource.cSEBase.creationTime := "20171231T012345"; v_myResource.cSEBase.creationTime := "20171231T012345";
...@@ -2064,7 +2064,7 @@ module OneM2M_Functions { ...@@ -2064,7 +2064,7 @@ module OneM2M_Functions {
tc_ac.start; tc_ac.start;
repeat; 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; tc_ac.stop;
log(__SCOPE__&": WARNING: Unexpected RETRIEVE message received"); log(__SCOPE__&": WARNING: Unexpected RETRIEVE message received");
...@@ -2080,7 +2080,7 @@ module OneM2M_Functions { ...@@ -2080,7 +2080,7 @@ module OneM2M_Functions {
v_response := valueof(m_responsePrimitive(int2000,v_request.primitive.requestPrimitive.requestIdentifier)); v_response := valueof(m_responsePrimitive(int2000,v_request.primitive.requestPrimitive.requestIdentifier));
v_response.from_ := PX_CSE1_ID; v_response.from_ := PX_CSE1_ID;
v_response.to_ := v_request.primitive.requestPrimitive.from_; 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)); mccPortIn.send(m_response(v_response));
} }
tc_ac.start; tc_ac.start;
...@@ -2102,7 +2102,7 @@ module OneM2M_Functions { ...@@ -2102,7 +2102,7 @@ module OneM2M_Functions {
v_response := valueof(m_responsePrimitive(int2004,v_request.primitive.requestPrimitive.requestIdentifier)); v_response := valueof(m_responsePrimitive(int2004,v_request.primitive.requestPrimitive.requestIdentifier));
v_response.from_ := PX_CSE1_ID; v_response.from_ := PX_CSE1_ID;
v_response.to_ := v_request.primitive.requestPrimitive.from_; 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)); mccPortIn.send(m_response(v_response));
} }
tc_ac.start; tc_ac.start;
...@@ -2602,16 +2602,16 @@ module OneM2M_Functions { ...@@ -2602,16 +2602,16 @@ module OneM2M_Functions {
return f_resourceIdCleaner(p_contentResource.cSEBase.resourceID); return f_resourceIdCleaner(p_contentResource.cSEBase.resourceID);
} }
if(ischosen(p_contentResource.m2mServiceSubscriptionProfile)) { if(ischosen(p_contentResource.m2mServiceSubscriptionProfile)) {
return p_contentResource.m2mServiceSubscriptionProfile.resourceName; return f_resourceIdCleaner(p_contentResource.m2mServiceSubscriptionProfile.resourceID);
} }
if(ischosen(p_contentResource.node)) { if(ischosen(p_contentResource.node)) {
return p_contentResource.node.resourceName; return f_resourceIdCleaner(p_contentResource.node.resourceID);
} }
if(ischosen(p_contentResource.statsConfig)) { if(ischosen(p_contentResource.statsConfig)) {
return p_contentResource.statsConfig.resourceName; return f_resourceIdCleaner(p_contentResource.statsConfig.resourceID);
} }
if(ischosen(p_contentResource.statsCollect)) { 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"); log(__SCOPE__&":WARNING: Primitive Content Kind not implemented");
...@@ -2782,30 +2782,38 @@ module OneM2M_Functions { ...@@ -2782,30 +2782,38 @@ module OneM2M_Functions {
function f_getResourceIndex(in XSD.ID p_receivedURI) runs on CseSimu return integer { function f_getResourceIndex(in XSD.ID p_receivedURI) runs on CseSimu return integer {
var integer v_resourceIndex := -1; var integer v_resourceIndex := -1;
var integer i; var integer i;
var XSD.ID v_resourceName; var XSD.ID v_cleanedURI;
var XSD.ID v_resourceID;
v_cleanedURI := f_resourceIdCleaner(p_receivedURI);
if (f_isHierarchical(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; v_resourceIndex := i;
break; break;
} }
} }
} else { } else {
v_resourceID := f_resourceIdCleaner(p_receivedURI);
for(i:=0; i < lengthof(vc_resourcesList); i := i+1){ log("Non Hierarchical method: " & v_cleanedURI);
if(match(f_getResourceId(vc_localResourcesList[i].resource), v_resourceID)){ for(i:=0; i < lengthof(vc_localResourcesList); i := i+1){
if(match(f_getResourceId(vc_localResourcesList[i].resource), v_cleanedURI)){
v_resourceIndex := i; v_resourceIndex := i;
break; 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; return v_resourceIndex;
} }
......
...@@ -125,7 +125,7 @@ module OneM2M_Templates { ...@@ -125,7 +125,7 @@ module OneM2M_Templates {
* @desc Base Receive RETRIEVE request primitive * @desc Base Receive RETRIEVE request primitive
* @param p_targetResourceAddress Target resource address * @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, operation := int2,
to_ := p_targetResourceAddress, to_ := p_targetResourceAddress,
from_ := ?, from_ := ?,
...@@ -383,7 +383,7 @@ module OneM2M_Templates { ...@@ -383,7 +383,7 @@ module OneM2M_Templates {
to_ := p_to, to_ := p_to,
from_ := p_from, from_ := p_from,
requestIdentifier := ?, requestIdentifier := ?,
resourceType := ?, resourceType := omit,
primitiveContent:= ?, primitiveContent:= ?,
role := *, role := *,
originatingTimestamp := *, originatingTimestamp := *,
...@@ -585,7 +585,7 @@ module OneM2M_Templates { ...@@ -585,7 +585,7 @@ module OneM2M_Templates {
/** /**
* @desc Reception template for CREATE AEAnnc * @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, resourceType := int10002,
primitiveContent := {aEAnnc := mw_contentCreateAEAnnc({"Credential-ID:None"}, p_accessControlPolicyIds)} primitiveContent := {aEAnnc := mw_contentCreateAEAnnc({"Credential-ID:None"}, p_accessControlPolicyIds)}
}; };
...@@ -1280,15 +1280,15 @@ module OneM2M_Templates { ...@@ -1280,15 +1280,15 @@ module OneM2M_Templates {
accessControlPolicyIDs := p_accessControlPolicyIds,//MA accessControlPolicyIDs := p_accessControlPolicyIds,//MA
expirationTime := ?,//MA M expirationTime := ?,//MA M
link := p_link,//M link := p_link,//M
appName := omit,//OA appName := *,//OA
app_ID := omit,//OA app_ID := *,//OA
aE_ID := omit,//OA aE_ID := *,//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 pointOfAccess := *, //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 ontologyRef := *,//OA
nodeLink := omit,//OA nodeLink := *,//OA
requestReachability := omit,//OA requestReachability := *,//OA
contentSerialization := omit,//OA contentSerialization := *,//OA
choice := omit//NA choice := *//NA
}; };
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment