Fix integration tests for iotdm project 72/50172/34
authormiroslav.kovac <miroslav.kovac@pantheon.tech>
Wed, 4 Jan 2017 14:05:29 +0000 (15:05 +0100)
committerVratko Polák <vrpolak@cisco.com>
Tue, 24 Jan 2017 09:21:33 +0000 (09:21 +0000)
Change-Id: Id6530d66a2066802b219d1608af3d7179ff6846d
Signed-off-by: miroslav.kovac <miroslav.kovac@pantheon.tech>
12 files changed:
csit/libraries/SubStrings.robot [new file with mode: 0644]
csit/libraries/ciotdm.py
csit/libraries/criotdm.py
csit/suites/iotdm/basic/010_PrimitveParameters.robot [moved from csit/suites/iotdm/basic/080_FilterCriteriaTest.robot with 73% similarity]
csit/suites/iotdm/basic/010_Restconf_OK.robot [deleted file]
csit/suites/iotdm/basic/021_ResourceAttributesContainer.robot [moved from csit/suites/iotdm/basic/050_ContainerAttributeTest.robot with 75% similarity]
csit/suites/iotdm/basic/022_ResourceAttributesContentInstance.robot [moved from csit/suites/iotdm/basic/060_ConInAttributeTest.robot with 91% similarity]
csit/suites/iotdm/basic/023_ResourceAttributesAE.robot [moved from csit/suites/iotdm/basic/040_AEAttributeTest.robot with 66% similarity]
csit/suites/iotdm/basic/024_ResourceAttributesACP.robot [moved from csit/suites/iotdm/basic/090_AccessControlPolicyTest.robot with 87% similarity]
csit/suites/iotdm/basic/025_ResourceAttributesNode.robot [moved from csit/suites/iotdm/basic/100_NodeTest.robot with 65% similarity]
csit/suites/iotdm/basic/091_ResourceHierarchyDelete.robot [moved from csit/suites/iotdm/basic/070_DeleteTest.robot with 99% similarity]
csit/suites/iotdm/basic/092_ResourceHierarchyAE_CNT_CIN.robot [moved from csit/suites/iotdm/basic/030_LayerTest.robot with 91% similarity]

diff --git a/csit/libraries/SubStrings.robot b/csit/libraries/SubStrings.robot
new file mode 100644 (file)
index 0000000..ef291b1
--- /dev/null
@@ -0,0 +1,15 @@
+*** Settings ***
+Documentation     Utility keywords for verification of substring occurrence
+
+*** Keywords ***
+Should Contain All Sub Strings
+    [Arguments]    ${attr}    @{checked}
+    [Documentation]    Passes if ${attr} includes all substrings from @{checked}, fails otherwise
+    : FOR    ${item}    IN    @{checked}
+    \    Should Contain    ${attr}    ${item}
+
+Should Not Contain Any Sub Strings
+    [Arguments]    ${attr}    @{checked}
+    [Documentation]    Fails if ${attr} includes at least one substring from @{checked}, passes otherwise
+    : FOR    ${item}    IN    @{checked}
+    \    Should Not Contain    ${attr}    ${item}
index 6f56bf936b9157f81cb6642aaff536f6e57dfad8..a513360c288b622f29e5436a4b1afe541d521969 100644 (file)
@@ -65,13 +65,13 @@ nod_payload = '''
 '''
 
 resources = {"m2m:ae", "m2m:cnt", "m2m:cin", "m2m:sub",
-             "m2m:acp", "m2m:nod", "m2m:grp"}
+             "m2m:acp", "m2m:nod", "m2m:grp", "m2m:cb", "ch"}
 
 payload_map = {1: acp_payload, 2: ae_payload, 3: con_payload,
                4: cin_payload, 14: nod_payload, 23: sub_payload}
 
 
-def find_key(response, key):
+def find_key(response, key, first=None):
     """Deserialize response, return value for key or None."""
     dic = response.json()
     key1 = list(dic.keys())
@@ -79,7 +79,20 @@ def find_key(response, key):
         raise ValueError("The response should be json object")
     if key1[0] not in resources:
         raise ValueError("The resource is not recognized")
-    return dic.get(key1[0], None).get(key, None)
+    if first is True:
+        return dic.get(key1[0], None)
+    else:
+        return dic.get(key1[0], None).get(key, None)
+
+
+def childResource(response):
+    """Return child resources from the response."""
+    return find_key(response, "ch")
+
+
+def childResourceFirst(response):
+    """Return child resources from the response."""
+    return find_key(response, "ch", True)
 
 
 def name(response):
@@ -92,6 +105,11 @@ def lastModifiedTime(response):
     return find_key(response, "lt")
 
 
+def stateTag(response):
+    """Return the state tag from the response."""
+    return find_key(response, "st")
+
+
 def resid(response):
     """Return the resource id in the response."""
     return find_key(response, "ri")
@@ -112,6 +130,26 @@ def restype(response):
     return find_key(response, "rty")
 
 
+def currentNumberOfInstances(response):
+    """Return current number of instances from the response."""
+    return find_key(response, "cni")
+
+
+def currentByteSize(response):
+    """Return current byte size from the response."""
+    return find_key(response, "cbs")
+
+
+def maxNumberOfInstances(response):
+    """Return max number of instances from the response."""
+    return find_key(response, "mni")
+
+
+def maxByteSize(response):
+    """Return max byte size from the response."""
+    return find_key(response, "mbs")
+
+
 def status(response):
     """Return the protocol status code in the response."""
     try:
@@ -161,7 +199,7 @@ class connect:
             # and until a proper defaulting initializer is in place
             # are hard-coded.
             'content-type': 'application/vnd.onem2m-res+json',
-            'X-M2M-Origin': '//localhost:10000',
+            'X-M2M-Origin': 'iotdm-robot-tests',
             'X-M2M-RI': '12345',
             'X-M2M-OT': 'NOW'
         }
index 85bb13719a41ffb35f839d2477ea016a506fd700..05ede4f7a2a2ba02665f404448f46a55b5d11c4a 100644 (file)
@@ -82,11 +82,26 @@ def delete_resource_with_command(connection, resid, command):
     return connection.response
 
 
+def child_resource(response):
+    """Return child resource."""
+    return ciotdm.childResource(response)
+
+
+def child_resource_first(response):
+    """Return child resource on top of dictionary."""
+    return ciotdm.childResourceFirst(response)
+
+
 def resid(response):
     """Return resource ID."""
     return ciotdm.resid(response)
 
 
+def parent_id(response):
+    """Return parent ID."""
+    return ciotdm.parent(response)
+
+
 def name(response):
     """Return resourceName."""
     resource_name = ciotdm.name(response)
@@ -105,6 +120,36 @@ def last_modified_time(response):
     return ciotdm.lastModifiedTime(response)
 
 
+def state_tag(response):
+    """Return resource state tag."""
+    return ciotdm.stateTag(response)
+
+
+def current_number_of_instances(response):
+    """Return current number of instances."""
+    return ciotdm.currentNumberOfInstances(response)
+
+
+def current_byte_size(response):
+    """Return current byte size."""
+    return ciotdm.currentByteSize(response)
+
+
+def max_number_of_instances(response):
+    """Return max number of instances."""
+    return ciotdm.maxNumberOfInstances(response)
+
+
+def content(response):
+    """Return content child from response."""
+    return ciotdm.content(response)
+
+
+def max_byte_size(response):
+    """Return max byte size."""
+    return ciotdm.maxByteSize(response)
+
+
 def status_code(response):
     """Return resource status_code."""
     return response.status_code
similarity index 73%
rename from csit/suites/iotdm/basic/080_FilterCriteriaTest.robot
rename to csit/suites/iotdm/basic/010_PrimitveParameters.robot
index 9a2050269820e2da6de3757ce3e665b90defed2a..eb20f246ad9f5f18c8a08d918b0b1e4644cb7218 100644 (file)
@@ -1,6 +1,8 @@
 *** Settings ***
+Documentation     Testing of request and response primitives parameters
 Suite Setup       Connect And Create The Tree
 Suite Teardown    Kill The Tree    ${ODL_SYSTEM_IP}    InCSE1    admin    admin
+Resource          ../../../libraries/SubStrings.robot
 Library           ../../../libraries/criotdm.py
 Library           Collections
 
@@ -78,72 +80,108 @@ Set Suite Variable
     \    Should Start with    ${error}    Cannot delete this resource [400]
     \    Should Contain    ${error}    rcn
 
-Delete the tree
-    Kill The Tree    ${ODL_SYSTEM_IP}    InCSE1    admin    admin
-    #==================================================
-    #    FilterCriteria Test
-    #==================================================
-
-Create the tree
-    Connect And Create The Tree
-
 1. createdBefore
-    ${r} =    Retrieve Resource With Command    ${iserver}    InCSE1/AE1    rcn=4&crb=20160612T033748Z
-    ${count} =    Get Length    ${r.json()['m2m:ae']['ch']}
+    # need to sleep at least one second becase we are checking if resource was created before resource time and if
+    # this test and test before was created in the same second then this test will fail.
+    Sleep    1
+    # time format is specified in TS0004 specification at http://onem2m.org/technical/published-documents page 35
+    # DateTime string using 'Basic Format' specified in ISO8601 [27]. Time zone shall be interpreted as UTC timezone.
+    ${cty} =    Get Time    year    UTC
+    ${ctm} =    Get Time    month    UTC
+    ${ctd} =    Get Time    day    UTC
+    ${cth} =    Get Time    hour    UTC
+    ${ctmin} =    Get Time    min    UTC
+    ${ctsec} =    Get Time    sec    UTC
+    Set Suite Variable    ${ts}    ${cty}${ctm}${ctd}T${cth}${ctmin}${ctsec}
+    ${r} =    Retrieve Resource With Command    ${iserver}    InCSE1/AE1    rcn=4&crb=${ts}
+    Log    ${r.text}
+    ${rs} =    Child Resource    ${r}
+    ${count} =    Get Length    ${rs}
     Should Be Equal As Integers    ${count}    2
+    Should Contain All Sub Strings    '${rs}'    Container2    Container1
 
 2. createdAfter
-    ${r} =    Retrieve Resource With Command    ${iserver}    InCSE1/AE1    rcn=4&cra=20150612T033748Z
-    ${count} =    Get Length    ${r.json()['m2m:ae']['ch']}
+    ${r} =    Retrieve Resource With Command    ${iserver}    InCSE1/AE1    rcn=4&cra=20150612T033748
+    Log    ${r.text}
+    ${rs} =    Child Resource    ${r}
+    ${count} =    Get Length    ${rs}
     Should Be Equal As Integers    ${count}    2
+    Should Contain All Sub Strings    '${rs}'    Container2    Container1
 
 3. modifiedSince
-    ${r} =    Retrieve Resource With Command    ${iserver}    InCSE1/AE1    rcn=4&ms=20150612T033748Z
-    ${count} =    Get Length    ${r.json()['m2m:ae']['ch']}
+    ${r} =    Retrieve Resource With Command    ${iserver}    InCSE1/AE1    rcn=4&ms=20150612T033748
+    Log    ${r.text}
+    ${rs} =    Child Resource    ${r}
+    ${count} =    Get Length    ${rs}
     Should Be Equal As Integers    ${count}    2
+    Should Contain All Sub Strings    '${rs}'    Container2    Container1
 
 4. unmodifiedSince
-    ${r} =    Retrieve Resource With Command    ${iserver}    InCSE1/AE1    rcn=4&us=20160612T033748Z
-    ${count} =    Get Length    ${r.json()['m2m:ae']['ch']}
+    ${r} =    Retrieve Resource With Command    ${iserver}    InCSE1/AE1    rcn=4&us=${ts}
+    Log    ${r.text}
+    ${rs} =    Child Resource    ${r}
+    ${count} =    Get Length    ${rs}
     Should Be Equal As Integers    ${count}    2
+    Should Contain All Sub Strings    '${rs}'    Container2    Container1
 
 5. stateTagSmaller
     ${r} =    Retrieve Resource With Command    ${iserver}    InCSE1/Container3    rcn=4&sts=3
-    ${count} =    Get Length    ${r.json()['ch']}
+    Log    ${r.text}
+    ${rs} =    Child Resource First    ${r}
+    ${count} =    Get Length    ${rs}
     Should Be Equal As Integers    ${count}    5
+    Should Contain All Sub Strings    '${rs}'    Container7    Container8    Container9    conIn3    conIn4
 
 6. stateTagBigger
     ${r} =    Retrieve Resource With Command    ${iserver}    InCSE1/Container3    rcn=4&stb=1
-    ${count} =    Get Length    ${r.json()['m2m:cnt']['ch']}
+    Log    ${r.text}
+    ${rs} =    Child Resource    ${r}
+    ${count} =    Get Length    ${rs}
     Should Be Equal As Integers    ${count}    2
+    Should Contain All Sub Strings    '${rs}'    conIn5    conIn4
     # 7. expireBefore
     # 8. expireAfter
 
 9. labels
     ${r} =    Retrieve Resource With Command    ${iserver}    InCSE1/Container3    rcn=4&sts=3&lbl=contentInstanceUnderContainerContainer
-    ${count} =    Get Length    ${r.json()['ch']}
+    Log    ${r.text}
+    ${rs} =    Child Resource First    ${r}
+    ${count} =    Get Length    ${rs}
     Should Be Equal As Integers    ${count}    2
+    Should Contain All Sub Strings    '${rs}'    conIn3    conIn4
     # 2 labels test
 
 10. resourceType
     ${r} =    Retrieve Resource With Command    ${iserver}    InCSE1    rcn=4&rty=3
-    ${count} =    Get Length    ${r.json()['ch']}
+    Log    ${r.text}
+    ${rs} =    Child Resource First    ${r}
+    ${count} =    Get Length    ${rs}
     Should Be Equal As Integers    ${count}    3
+    Should Contain All Sub Strings    '${rs}'    Container3    Container4    Container5
 
 11. sizeAbove
     ${r} =    Retrieve Resource With Command    ${iserver}    InCSE1    rcn=4&rty=3&sza=5
-    ${count} =    Get Length    ${r.json()['ch']}
+    Log    ${r.text}
+    ${rs} =    Child Resource First    ${r}
+    ${count} =    Get Length    ${rs}
     Should Be Equal As Integers    ${count}    2
+    Should Contain All Sub Strings    '${rs}'    Container3    Container4
 
 12. sizeBelow
     ${r} =    Retrieve Resource With Command    ${iserver}    InCSE1    rcn=4&rty=3&szb=5
-    ${count} =    Get Length    ${r.json()['ch']}
+    Log    ${r.text}
+    ${rs} =    Child Resource First    ${r}
+    ${count} =    Get Length    ${rs}
     Should Be Equal As Integers    ${count}    1
+    Should Contain All Sub Strings    '${rs}'    Container5
 
 2.1 And Test - labels
     ${r} =    Retrieve Resource With Command    ${iserver}    InCSE1    fu=1&rcn=4&sts=4&lbl=contentInstanceUnderContainerContainer&lbl=underCSE
+    Log    ${r.text}
     ${count} =    Get Length    ${r.json()}
     Should Be Equal As Integers    ${count}    6
+    Should Contain All Sub Strings    ${r.text}    Container3    Container4    Container5    conIn3    conIn4
+    ...    conIn5
 
 *** Keywords ***
 Connect And Create The Tree
diff --git a/csit/suites/iotdm/basic/010_Restconf_OK.robot b/csit/suites/iotdm/basic/010_Restconf_OK.robot
deleted file mode 100644 (file)
index ed20cf5..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-*** Settings ***
-Documentation     Test suite to verify Restconf is OK
-Suite Setup       Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
-Suite Teardown    Delete All Sessions
-Library           RequestsLibrary
-Library           ../../../libraries/Common.py
-Variables         ../../../variables/Variables.py
-Resource          ../../../libraries/Utils.robot
-
-*** Variables ***
-${REST_CONTEXT}    /restconf/modules
-
-*** Test Cases ***
-Get Controller Modules
-    [Documentation]    Get the controller modules via Restconf
-    ${resp}    RequestsLibrary.Get Request    session    ${REST_CONTEXT}
-    Log    ${resp.content}
-    Should Be Equal As Strings    ${resp.status_code}    200
-    Should Contain    ${resp.content}    ietf-restconf
similarity index 75%
rename from csit/suites/iotdm/basic/050_ContainerAttributeTest.robot
rename to csit/suites/iotdm/basic/021_ResourceAttributesContainer.robot
index 16eba2eaec7660c8ad1efff13ce17dfbc0f6f602..ad2a3959c77c516fae0a81d17ff6225f6cd0b032 100644 (file)
@@ -1,5 +1,7 @@
 *** Settings ***
+Documentation     Tests for Container resource attributes
 Suite Teardown    Kill The Tree    ${ODL_SYSTEM_IP}    InCSE1    admin    admin
+Resource          ../../../libraries/SubStrings.robot
 Library           ../../../libraries/criotdm.py
 Library           Collections
 
@@ -24,15 +26,14 @@ Set Suite Variable
 1.1 After Created, test whether all the mandatory attribtues are exist.
     [Documentation]    After Created, test whether all the mandatory attribtues are exist.
     ${attr} =    Set Variable    "rn":"Container1"
-    ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}
+    ${r}=    Create Resource With Command    ${iserver}    InCSE1    ${rt_container}    rcn=3    ${attr}
     ${container} =    Location    ${r}
     ${status_code} =    Status Code    ${r}
     Should Be Equal As Integers    ${status_code}    201
     ${text} =    Text    ${r}
-    Should Contain    ${text}    "ri":    "rn":    "cni"
-    Should Contain    ${text}    "lt":    "pi":    "st":
-    Should Contain    ${text}    "ct":    "ty":3    "cbs"
-    Should Not Contain    S{text}    "lbl"    "creator"    "or"
+    Should Contain All Sub Strings    ${text}    "ri":    "rn":    "cni"    "lt":    "pi":
+    ...    "st":    "ct":    "ty":3    "cbs"
+    Should Not Contain Any Sub Strings    ${text}    "lbl"    "creator"    "or"
     #==================================================
     #    Container Optional Attribute Test (Allowed)
     #==================================================
@@ -140,7 +141,7 @@ Delete the Container2-2.3
     ${attr} =    Set Variable    "lbl":["label1"]
     ${r} =    update Resource    ${iserver}    InCSE1/Container1    ${rt_container}    ${attr}
     ${text} =    Check Response and Retrieve Resource For Update    ${r}    InCSE1/Container1
-    Should Contain    ${text}    lbl    label1
+    Should Contain All Sub Strings    ${text}    lbl    label1
 
 2.42 labels can be modified (1-1)
     [Documentation]    labels can be modified (1-1)
@@ -148,51 +149,46 @@ Delete the Container2-2.3
     ${r} =    update Resource    ${iserver}    InCSE1/Container1    ${rt_container}    ${attr}
     ${text} =    Check Response and Retrieve Resource For Update    ${r}    InCSE1/Container1
     Should Not Contain    ${text}    label1
-    Should Contain    ${text}    lbl    label2
+    Should Contain All Sub Strings    ${text}    lbl    label2
 
 2.43 if set to null, labels should be deleted(1-0)
     [Documentation]    if set to null, labels should be deleted(1-0)
     ${attr} =    Set Variable    "lbl":null
     ${r} =    update Resource    ${iserver}    InCSE1/Container1    ${rt_container}    ${attr}
     ${text} =    Check Response and Retrieve Resource For Update    ${r}    InCSE1/Container1
-    Should Not Contain    ${text}    lbl    label1    label2
+    Should Not Contain Any Sub Strings    ${text}    lbl    label1    label2
 
 2.44 labels can be created through update (0-n)
     [Documentation]    labels can be created through update (0-n)
     ${attr} =    Set Variable    "lbl":["label3","label4","label5"]
     ${r} =    update Resource    ${iserver}    InCSE1/Container1    ${rt_container}    ${attr}
     ${text} =    Check Response and Retrieve Resource For Update    ${r}    InCSE1/Container1
-    Should Contain    ${text}    lbl    label3    label4
-    Should Contain    ${text}    label5
+    Should Contain All Sub Strings    ${text}    lbl    label3    label4    label5
 
 2.45 labels can be modified (n-n)(across)
     [Documentation]    labels can be modified (n-n)(across)
     ${attr} =    Set Variable    "lbl":["label4","label5","label6"]
     ${r} =    update Resource    ${iserver}    InCSE1/Container1    ${rt_container}    ${attr}
     ${text} =    Check Response and Retrieve Resource For Update    ${r}    InCSE1/Container1
-    Should Not Contain    ${text}    label1    label2    label3
-    Should Contain    ${text}    lbl    label4    label5
-    Should Contain    ${text}    label6
+    Should Not Contain Any Sub Strings    ${text}    label1    label2    label3
+    Should Contain All Sub Strings    ${text}    lbl    label4    label5    label6
 
 2.46 labels can be modified (n-n)(not across)
     [Documentation]    labels can be modified (n-n)(not across)
     ${attr} =    Set Variable    "lbl":["label7","label8","label9"]
     ${r} =    update Resource    ${iserver}    InCSE1/Container1    ${rt_container}    ${attr}
     ${text} =    Check Response and Retrieve Resource For Update    ${r}    InCSE1/Container1
-    Should Not Contain    ${text}    label1    label2    label3
-    Should Not Contain    ${text}    label6    label4    label5
-    Should Contain    ${text}    lbl    label7    label8
-    Should Contain    ${text}    label9
+    Should Not Contain Any Sub Strings    ${text}    label1    label2    label3    label4    label5
+    ...    label6
+    Should Contain All Sub Strings    ${text}    lbl    label7    label8    label9
 
 2.47 if set to null, labels should be deleted(n-0)
     [Documentation]    if set to null, labels should be deleted(n-0)
     ${attr} =    Set Variable    "lbl":null
     ${r} =    update Resource    ${iserver}    InCSE1/Container1    ${rt_container}    ${attr}
     ${text} =    Check Response and Retrieve Resource For Update    ${r}    InCSE1/Container1
-    Should Not Contain    ${text}    label1    label2    label3
-    Should Not Contain    ${text}    label6    label4    label5
-    Should Not Contain    ${text}    label7    label8    label9
-    Should Not Contain    ${text}    lbl
+    Should Not Contain Any Sub Strings    ${text}    label1    label2    label3    label4    label5
+    ...    label6    label7    label8    label9    lbl
     #======================================================
     #    Container Disturbing Attribute Test, Not Allowed Update
     #======================================================
@@ -201,32 +197,32 @@ Delete the Container2-2.3
 3.11 Mulitiple maxNrofInstance should return error
     [Documentation]    Mulitiple maxNrofInstance should return error
     ${attr} =    Set Variable    "mni":33,"mni":33
-    ${error} =    Cannot Create Container Error    ${attr}
-    Should Contain    ${error}    Duplicate key    mni
+    ${error} =    Create Container Expect Cannot Create Error    ${attr}
+    Should Contain All Sub Strings    ${error}    Duplicate key    mni
 
 3.12 Mulitiple maxByteSize should return error
     [Documentation]    Mulitiple maxByteSize should return error
     ${attr} =    Set Variable    "mbs":44,"mbs":44
-    ${error} =    Cannot Create Container Error    ${attr}
-    Should Contain    ${error}    Duplicate key    mbs
+    ${error} =    Create Container Expect Cannot Create Error    ${attr}
+    Should Contain All Sub Strings    ${error}    Duplicate key    mbs
 
 3.13 Multiple creator should return error
     [Documentation]    Multiple creator should return error
     ${attr} =    Set Variable    "cr":null,"cr":null
-    ${error} =    Cannot Create Container Error    ${attr}
-    Should Contain    ${error}    Duplicate key    cr
+    ${error} =    Create Container Expect Cannot Create Error    ${attr}
+    Should Contain All Sub Strings    ${error}    Duplicate key    cr
 
 3.14 Multiple ontologyRef should return error
     [Documentation]    Multiple ontologyRef should return error
     ${attr} =    Set Variable    "or":"http://cisco.com","or":"http://cisco.com"
-    ${error} =    Cannot Create Container Error    ${attr}
-    Should Contain    ${error}    Duplicate key    or
+    ${error} =    Create Container Expect Cannot Create Error    ${attr}
+    Should Contain All Sub Strings    ${error}    Duplicate key    or
 
 3.14 Multiple label attribute should return error(multiple array)
     [Documentation]    Multiple label attribute should return error(multiple array)
     ${attr} =    Set Variable    "lbl":["ODL1"], "lbl":["dsdsd"]
-    ${error} =    Cannot Create Container Error    ${attr}
-    Should Contain    ${error}    Duplicate key    lbl
+    ${error} =    Create Container Expect Cannot Create Error    ${attr}
+    Should Contain All Sub Strings    ${error}    Duplicate key    lbl
     #    3.2 Input of Integer using String should return error    [Should checked by wenxin]
     #------------------------------------------------------
     # using non-valid attribute to update then expect error
@@ -234,74 +230,74 @@ Delete the Container2-2.3
 3.31 resourceType cannot be update.
     [Documentation]    when update resourceType, expect error
     ${attr} =    Set Variable    "ty":2
-    ${error} =    Cannot Update Container Error    ${attr}
-    Should Contain    ${error}    error
+    ${error} =    Update Container Expect Cannot Update Error    ${attr}
+    Should Contain    ${error}    "error":"CONTENT(pc) attribute not recognized: ty"    Error response is not correct
 
-3.32 resoureceID cannot be update.
+3.32 resourceID cannot be update.
     [Documentation]    update resoureceID then expect error
     ${attr} =    Set Variable    "ri":"aaa"
-    ${error} =    Cannot Update Container Error    ${attr}
-    Should Contain    ${error}    error    ri
+    ${error} =    Update Container Expect Cannot Update Error    ${attr}
+    Should Contain    ${error}    "error":"CONTENT(pc) attribute not recognized: ri"    Error response is not correct
 
-3.33 resouceNme cannot be update.(write once)
+3.33 resouceName cannot be update.(write once)
     [Documentation]    update resourceName and expect error
     ${attr} =    Set Variable    "rn":"aaa"
-    ${error} =    Cannot Update Container Error    ${attr}
-    Should Contain    ${error}    error    rn
+    ${error} =    Update Container Expect Cannot Update Error    ${attr}
+    Should Contain    ${error}    "error":"Resource Name cannot be updated: InCSE1/Container1/aaa"    Error response is not correct
 
 3.34 parentID cannot be update.
     [Documentation]    update parentID and expect error
     ${attr} =    Set Variable    "pi":"aaa"
-    ${error} =    Cannot Update Container Error    ${attr}
-    Should Contain    ${error}    error    pi
+    ${error} =    Update Container Expect Cannot Update Error    ${attr}
+    Should Contain    ${error}    "error":"CONTENT(pc) attribute not recognized: pi"    Error response is not correct
 
 3.35 createTime cannot be update.
     [Documentation]    update createTime and expect error
     ${attr} =    Set Variable    "ct":"aaa"
-    ${error} =    Cannot Update Container Error    ${attr}
-    Should Contain    ${error}    error    ct
+    ${error} =    Update Container Expect Cannot Update Error    ${attr}
+    Should Contain    ${error}    "error":"CONTENT(pc) attribute not recognized: ct"    Error response is not correct
 
 3.36 curerntByteSize cannot be update --- Special, cannot be modified by the user
     [Documentation]    update currentByteSize and expect error
     ${attr} =    Set Variable    "cbs":123
-    ${error} =    Cannot Update Container Error    ${attr}
-    Should Contain    ${error}    error    api
+    ${error} =    Update Container Expect Cannot Update Error    ${attr}
+    Should Contain    ${error}    "error":"cbs: read-only parameter"    Error response is not correct
 
 3.37 currentNrofInstance cannot be updated --- Special, cannot be modified by the user
     [Documentation]    update cni and expect error
     ${attr} =    Set Variable    "cni":3
-    ${error} =    Cannot Update Container Error    ${attr}
-    Should Contain    ${error}    error    aei
+    ${error} =    Update Container Expect Cannot Update Error    ${attr}
+    Should Contain    ${error}    "error":"cni: read-only parameter"    Error response is not correct
 
 3.38 LastMoifiedTime --- Special, cannot be modified by the user
     [Documentation]    update lt and expect error
     ${attr} =    Set Variable    "lt":"aaa"
-    ${error} =    Cannot Update Container Error    ${attr}
-    Should Contain    ${error}    error    lt
+    ${error} =    Update Container Expect Cannot Update Error    ${attr}
+    Should Contain    ${error}    "error":"CONTENT(pc) attribute not recognized: lt"    Error response is not correct
 
 3.39 stateTag --- Special, cannot be modified by the user
     [Documentation]    update st and expect error
     ${attr} =    Set Variable    "st":3
-    ${error} =    Cannot Update Container Error    ${attr}
-    Should Contain    ${error}    error    st
+    ${error} =    Update Container Expect Cannot Update Error    ${attr}
+    Should Contain    ${error}    "error":"st: read-only parameter"    Error response is not correct
 
 3.310 creator -- cannot be modified
     [Documentation]    update cr and expect error
     ${attr} =    Set Variable    "cr":null
-    ${error} =    Cannot Update Container Error    ${attr}
-    Should Contain    ${error}    error    cr
+    ${error} =    Update Container Expect Cannot Update Error    ${attr}
+    Should Contain    ${error}    "error":"CREATOR cannot be updated"    Error response is not correct
 
 3.41 Using AE's M attribute to create
     [Documentation]    use AE attribtue to create Container then expect error
     ${attr} =    Set Variable    "api":"ODL","aei":"ODL"
-    ${error} =    Cannot Update Container Error    ${attr}
-    Should Contain    ${error}    CONTENT(pc)
+    ${error} =    Update Container Expect Cannot Update Error    ${attr}
+    Should Contain    ${error}    "error":"CONTENT(pc) attribute not recognized: aei"    Error response is not correct
 
 3.42 Using ContentInstance's M attribute to create
     [Documentation]    use contentInstance attribtue to create Container then expect error
     ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"101"
-    ${error} =    Cannot Update Container Error    ${attr}
-    Should Contain    ${error}    CONTENT(pc)
+    ${error} =    Update Container Expect Cannot Update Error    ${attr}
+    Should Contain    ${error}    "error":"CONTENT(pc) attribute not recognized: con"    Error response is not correct
     #==================================================
     #    Functional Attribute Test
     #==================================================
@@ -317,39 +313,40 @@ Delete the Container2-2.3
     # 10. childresource
     #-------------- 1.    lastModifiedTime    -----------
 
-4.11 if updated seccessfully, lastModifiedTime must be modified.
+4.11 if updated seccessfully, last modified time must be modified.
     [Documentation]    if updated seccessfully, lastModifiedTime must be modified.
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container1
-    ${lt1} =    LastModifiedTime    ${oldr}
+    ${lt1} =    Last Modified Time    ${oldr}
     ${attr} =    Set Variable    "lbl":["aaa"]
     Sleep    1s
     # We know Beryllium is going to be get rid of all sleep.
     # But as lastModifiedTime has precision in seconds,
     # we need to wait 1 second to see different value on update.
-    ${r} =    update Resource    ${iserver}    InCSE1/Container1    ${rt_container}    ${attr}
-    ${lt2} =    LastModifiedTime    ${r}
-    Should Not Be Equal    ${oldr.json()['m2m:cnt']['lt']}    ${lt2}
+    ${r} =    Update Resource    ${iserver}    InCSE1/Container1    ${rt_container}    ${attr}
+    ${lt2} =    Last Modified Time    ${r}
+    Should Not Be Equal    ${lt1}    ${lt2}
 
-4.12 childResources create , parent's lastmodifiedTime update
+4.12 childResources create , parent's last modified time update
     [Documentation]    childResources create , parent's lastmodifiedTime update
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container1
-    ${lt1} =    LastModifiedTime    ${oldr}
+    ${lt1} =    Last Modified Time    ${oldr}
     Sleep    1s
     # We know Beryllium is going to be get rid of all sleep.
     # But as lastModifiedTime has precision in seconds,
     # we need to wait 1 second to see different value on update.
     ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"102","rn":"conIn1"
     ${r} =    Create Resource    ${iserver}    InCSE1/Container1    ${rt_contentInstance}    ${attr}
-    ${lt2} =    LastModifiedTime    ${r}
-    Should Not Be Equal    ${oldr.json()['m2m:cnt']['lt']}    ${lt2}
+    ${lt2} =    Last Modified Time    ${r}
+    Should Not Be Equal    ${lt1}    ${lt2}
     #-------------- 2 parentID ------------
 
 4.21 Check parentID(cse-container)
     [Documentation]    parentID should be InCSE1
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1
-    ${CSEID} =    Set Variable    ${oldr.json()['m2m:cb']['ri']}
+    ${CSEID} =    Resid    ${oldr}
     ${r} =    Retrieve Resource    ${iserver}    InCSE1/Container1
-    Should Be Equal    /InCSE1/${oldr.json()['m2m:cb']['ri']}    ${r.json()['m2m:cnt']['pi']}
+    ${pi} =    Parent Id    ${r}
+    Should Be Equal    /InCSE1/${CSEID}    ${pi}
 
 4.22 Check parentID(cse-container-container)
     [Documentation]    parentID should be correct
@@ -360,9 +357,10 @@ Delete the Container2-2.3
     ${r}=    Create Resource    ${iserver}    InCSE1/Container1    ${rt_container}    ${attr}
     ${status_code} =    Status Code    ${r}
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container1
-    ${CSEID} =    Set Variable    ${oldr.json()['m2m:cnt']['ri']}
+    ${CSEID} =    Resid    ${oldr}
     ${r} =    Retrieve Resource    ${iserver}    InCSE1/Container1/Container2
-    Should Be Equal    /InCSE1/${oldr.json()['m2m:cnt']['ri']}    ${r.json()['m2m:cnt']['pi']}
+    ${pi} =    Parent Id    ${r}
+    Should Be Equal    /InCSE1/${CSEID}    ${pi}
 
 4.23 Check parentID(cse-AE-container)
     [Documentation]    parentID should be correct
@@ -375,9 +373,10 @@ Delete the Container2-2.3
     ${r}=    Create Resource    ${iserver}    InCSE1/AE1    ${rt_container}    ${attr}
     ${status_code} =    Status Code    ${r}
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/AE1
-    ${CSEID} =    Set Variable    ${oldr.json()['m2m:ae']['ri']}
+    ${CSEID} =    Resid    ${oldr}
     ${r} =    Retrieve Resource    ${iserver}    InCSE1/AE1/Container2
-    Should Be Equal    /InCSE1/${oldr.json()['m2m:ae']['ri']}    ${r.json()['m2m:cnt']['pi']}
+    ${pi} =    Parent Id    ${r}
+    Should Be Equal    /InCSE1/${CSEID}    ${pi}
 
 4.24 Check parentID(cse-AE-container-container)
     [Documentation]    parentID should be correct
@@ -389,9 +388,10 @@ Delete the Container2-2.3
     ${r}=    Create Resource    ${iserver}    InCSE1/AE1/Container2    ${rt_container}    ${attr}
     ${status_code} =    Status Code    ${r}
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/AE1/Container2
-    ${CSEID} =    Set Variable    ${oldr.json()['m2m:cnt']['ri']}
+    ${CSEID} =    Resid    ${oldr}
     ${r} =    Retrieve Resource    ${iserver}    InCSE1/AE1/Container2/Container3
-    Should Be Equal    /InCSE1/${oldr.json()['m2m:cnt']['ri']}    ${r.json()['m2m:cnt']['pi']}
+    ${pi} =    Parent Id    ${r}
+    Should Be Equal    /InCSE1/${CSEID}    ${pi}
 
 Delete the test AE-4.2
     ${deleteRes} =    Delete Resource    ${iserver}    InCSE1/AE1
@@ -406,15 +406,16 @@ Delete the test AE-4.2
     ${container} =    Location    ${r}
     ${status_code} =    Status Code    ${r}
     ${oldr} =    Retrieve Resource    ${iserver}    ${container}
-    ${st} =    Set Variable    ${oldr.json()['m2m:cnt']['st']}
+    ${st} =    State Tag    ${oldr}
     Should Be Equal As Integers    0    ${st}
     # 4.32 stateTag (when update expirationTime)
     # 4.33 stateTag (when update accessControlPolicyIDs)
 
-4.34 stateTag (when update labels) + lastModifiedTime
+4.34 stateTag (when update labels) + last modified time
     [Documentation]    st and lt should be changed
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    ${oldst} =    Set Variable    ${oldr.json()['m2m:cnt']['st']}
+    ${oldst} =    State Tag    ${oldr}
+    ${lt1} =    Last Modified Time    ${oldr}
     ${attr} =    Set Variable    "lbl":["label1"]
     Sleep    1s
     # We know Beryllium is going to be get rid of all sleep.
@@ -422,15 +423,19 @@ Delete the test AE-4.2
     # we need to wait 1 second to see different value on update.
     Update Resource    ${iserver}    InCSE1/Container2    ${rt_container}    ${attr}
     ${r} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    Should Be Equal As Integers    ${oldst+1}    ${r.json()['m2m:cnt']['st']}
-    Should Not Be Equal    ${oldr.json()['m2m:cnt']['lt']}    ${r.json()['m2m:cnt']['lt']}
+    ${lt2} =    Last Modified Time    ${r}
+    ${st} =    State Tag    ${r}
+    ${oldstall} =    Create List    ${oldst+1}    ${oldst+2}
+    Should Contain    ${oldstall}    ${st}
+    Should Not Be Equal    ${lt1}    ${lt2}
     # 4.35 stateTag (when update announceTo)
     # 4.36 stateTag (when update announceAttribute)
 
-4.37 stateTag (when update MaxNrOfInstances) + lastModifiedTime
+4.37 stateTag (when update MaxNrOfInstances) + last modified time
     [Documentation]    st and lt should be changed
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    ${oldst} =    Set Variable    ${oldr.json()['m2m:cnt']['st']}
+    ${oldst} =    State Tag    ${oldr}
+    ${lt1} =    Last Modified Time    ${oldr}
     ${attr} =    Set Variable    "mni":5
     Sleep    1s
     # We know Beryllium is going to be get rid of all sleep.
@@ -438,13 +443,17 @@ Delete the test AE-4.2
     # we need to wait 1 second to see different value on update.
     Update Resource    ${iserver}    InCSE1/Container2    ${rt_container}    ${attr}
     ${r} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    Should Be Equal As Integers    ${oldst+1}    ${r.json()['m2m:cnt']['st']}
-    Should Not Be Equal    ${oldr.json()['m2m:cnt']['lt']}    ${r.json()['m2m:cnt']['lt']}
+    ${lt2} =    Last Modified Time    ${r}
+    ${st} =    State Tag    ${r}
+    ${oldstall} =    Create List    ${oldst+1}    ${oldst+2}
+    Should Contain    ${oldstall}    ${st}
+    Should Not Be Equal    ${lt1}    ${lt2}
 
-4.38 stateTag (when update MaxByteSize) + lastModifiedTime
+4.38 stateTag (when update MaxByteSize) + last modified time
     [Documentation]    st and lt should be changed
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    ${oldst} =    Set Variable    ${oldr.json()['m2m:cnt']['st']}
+    ${oldst} =    State Tag    ${oldr}
+    ${lt1} =    Last Modified Time    ${oldr}
     ${attr} =    Set Variable    "mbs":30
     Sleep    1s
     # We know Beryllium is going to be get rid of all sleep.
@@ -452,15 +461,19 @@ Delete the test AE-4.2
     # we need to wait 1 second to see different value on update.
     Update Resource    ${iserver}    InCSE1/Container2    ${rt_container}    ${attr}
     ${r} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    Should Be Equal As Integers    ${oldst+1}    ${r.json()['m2m:cnt']['st']}
-    Should Not Be Equal    ${oldr.json()['m2m:cnt']['lt']}    ${r.json()['m2m:cnt']['lt']}
+    ${lt2} =    Last Modified Time    ${r}
+    ${st} =    State Tag    ${r}
+    ${oldstall} =    Create List    ${oldst+1}    ${oldst+2}
+    Should Contain    ${oldstall}    ${st}
+    Should Not Be Equal    ${lt1}    ${lt2}
     # 4.39 stateTag (when update maxInstanceAge)
     # 4.310 stateTag (when update locationID)
 
-4.311 stateTag (when update ontologyRef) + lastModifiedTime
+4.311 stateTag (when update ontologyRef) + last modified time
     [Documentation]    st and lt should be changed
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    ${oldst} =    Set Variable    ${oldr.json()['m2m:cnt']['st']}
+    ${oldst} =    State Tag    ${oldr}
+    ${lt1} =    Last Modified Time    ${oldr}
     ${attr} =    Set Variable    "or":"http://google.com"
     Sleep    1s
     # We know Beryllium is going to be get rid of all sleep.
@@ -468,42 +481,52 @@ Delete the test AE-4.2
     # we need to wait 1 second to see different value on update.
     Update Resource    ${iserver}    InCSE1/Container2    ${rt_container}    ${attr}
     ${r} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    Should Be Equal As Integers    ${oldst+1}    ${r.json()['m2m:cnt']['st']}
-    Should Not Be Equal    ${oldr.json()['m2m:cnt']['lt']}    ${r.json()['m2m:cnt']['lt']}
+    ${lt2} =    Last Modified Time    ${r}
+    ${st} =    State Tag    ${r}
+    ${oldstall} =    Create List    ${oldst+1}    ${oldst+2}
+    Should Contain    ${oldstall}    ${st}
+    Should Not Be Equal    ${lt1}    ${lt2}
 
-4.312 when create child container, stateTag will not increase + lastModifiedTime should change
+4.312 when create child container, stateTag will not increase + last modified time should change
     [Documentation]    when create child container, stateTag will not increase + lastModifiedTime should not change
     # CSE
     #    |--Contianer2
     #    |--Container3
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    ${oldst} =    Set Variable    ${oldr.json()['m2m:cnt']['st']}
+    ${oldst} =    State Tag    ${oldr}
+    ${lt1} =    Last Modified Time    ${oldr}
     ${attr} =    Set Variable    "lbl":["label1"],"rn":"Container3"
-    Sleep    2s
+    Sleep    1s
     # We know Beryllium is going to be get rid of all sleep.
     # But as lastModifiedTime has precision in seconds,
     # we need to wait 1 second to see different value on update.
     Create Resource    ${iserver}    InCSE1/Container2    ${rt_container}    ${attr}
     ${r} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    Should Be Equal As Integers    ${oldst}    ${r.json()['m2m:cnt']['st']}
-    Should Not Be Equal    ${oldr.json()['m2m:cnt']['lt']}    ${r.json()['m2m:cnt']['lt']}
+    ${lt2} =    Last Modified Time    ${r}
+    ${st} =    State Tag    ${r}
+    Should Be Equal As Integers    ${oldst}    ${st}
+    Should Not Be Equal    ${lt1}    ${lt2}
 
-4.313 * when create child contentInsntance, state should increase + lastModifiedTime shold change
+4.313 * when create child contentInsntance, state should increase + last modified time should change
     [Documentation]    when create child contentInsntance, state should increase + lastModifiedTime shold not change
     # CSE
     #    |--Contianer2
     #    |--ContentInstance
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    ${oldst} =    Set Variable    ${oldr.json()['m2m:cnt']['st']}
+    ${oldst} =    State Tag    ${oldr}
+    ${lt1} =    Last Modified Time    ${oldr}
     ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"102"
-    Sleep    2s
+    Sleep    1s
     # We know Beryllium is going to be get rid of all sleep.
     # But as lastModifiedTime has precision in seconds,
     # we need to wait 1 second to see different value on update.
     Create Resource    ${iserver}    InCSE1/Container2    ${rt_contentInstance}    ${attr}
     ${r} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    Should Be Equal As Integers    ${oldst+1}    ${r.json()['m2m:cnt']['st']}
-    Should Not Be Equal    ${oldr.json()['m2m:cnt']['lt']}    ${r.json()['m2m:cnt']['lt']}
+    ${lt2} =    Last Modified Time    ${r}
+    ${st} =    State Tag    ${r}
+    ${oldstall} =    Create List    ${oldst+1}    ${oldst+2}
+    Should Contain    ${oldstall}    ${st}
+    Should Not Be Equal    ${lt1}    ${lt2}
 
 4.314 stateTag should not be updated when update child container
     [Documentation]    stateTag should not be updated when update child container
@@ -511,7 +534,8 @@ Delete the test AE-4.2
     #    |--Contianer2
     #    |--Container3
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    ${oldst} =    Set Variable    ${oldr.json()['m2m:cnt']['st']}
+    ${oldst} =    State Tag    ${oldr}
+    ${lt1} =    Last Modified Time    ${oldr}
     ${attr} =    Set Variable    "lbl":["label45"]
     Sleep    1s
     # We know Beryllium is going to be get rid of all sleep.
@@ -519,9 +543,10 @@ Delete the test AE-4.2
     # we need to wait 1 second to see different value on update.
     Update Resource    ${iserver}    InCSE1/Container2/Container3    ${rt_container}    ${attr}
     ${r} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    Should Be Equal As Integers    ${oldst}    ${r.json()['m2m:cnt']['st']}
-    ${lt2} =    LastModifiedTime    ${r}
-    Should Be Equal    ${oldr.json()['m2m:cnt']['lt']}    ${lt2}
+    ${lt2} =    Last Modified Time    ${r}
+    ${st} =    State Tag    ${r}
+    Should Be Equal As Integers    ${oldst}    ${st}
+    Should Be Equal    ${lt1}    ${lt2}
 
 Delete the Container2-4.3
     ${deleteRes} =    Delete Resource    ${iserver}    InCSE1/Container2
@@ -534,33 +559,36 @@ Delete the Container2-4.3
     ${container} =    Location    ${r}
     ${status_code} =    Status Code    ${r}
     ${oldr} =    Retrieve Resource    ${iserver}    ${container}
-    ${cni} =    Set Variable    ${oldr.json()['m2m:cnt']['cni']}
+    ${cni} =    Current Number Of Instances    ${oldr}
     Should Be Equal As Integers    0    ${cni}
 
 4.42 when conInstance create, parent container's cni should + 1
-    [Documentation]    when conInstance create, parent container's cni should + 1
+    [Documentation]    when conInstance create, parent container's cni should + 1.
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    ${oldcni} =    Set Variable    ${oldr.json()['m2m:cnt']['cni']}
+    ${oldcni} =    Current Number Of Instances    ${oldr}
     ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"102"
     Create Resource    ${iserver}    InCSE1/Container2    ${rt_contentInstance}    ${attr}
     ${r} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    Should Be Equal As Integers    ${oldcni+1}    ${r.json()['m2m:cnt']['cni']}
+    ${cni} =    Current Number Of Instances    ${r}
+    Should Be Equal As Integers    ${oldcni+1}    ${cni}
     # Test again
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    ${oldcni} =    Set Variable    ${oldr.json()['m2m:cnt']['cni']}
+    ${oldcni} =    Current Number Of Instances    ${oldr}
     ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"102","rn":"contentIn1"
     Create Resource    ${iserver}    InCSE1/Container2    ${rt_contentInstance}    ${attr}
     ${r} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    Should Be Equal As Integers    ${oldcni+1}    ${r.json()['m2m:cnt']['cni']}
+    ${cni} =    Current Number Of Instances    ${r}
+    Should Be Equal As Integers    ${oldcni+1}    ${cni}
 
 4.43 when conInstance delete, parent container's cni should - 1
     [Documentation]    Delete the conIn created in 4.42, when conInstance delete, parent container's cni should - 1
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    ${oldcni} =    Set Variable    ${oldr.json()['m2m:cnt']['cni']}
+    ${oldcni} =    Current Number Of Instances    ${oldr}
     ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"102"
     Delete Resource    ${iserver}    InCSE1/Container2/contentIn1
     ${r} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    Should Be Equal As Integers    ${oldcni-1}    ${r.json()['m2m:cnt']['cni']}
+    ${cni} =    Current Number Of Instances    ${r}
+    Should Be Equal As Integers    ${oldcni-1}    ${cni}
 
 Delete the Container2-4.4
     ${deleteRes} =    Delete Resource    ${iserver}    InCSE1/Container2
@@ -573,33 +601,36 @@ Delete the Container2-4.4
     ${container} =    Location    ${r}
     ${status_code} =    Status Code    ${r}
     ${oldr} =    Retrieve Resource    ${iserver}    ${container}
-    ${cbs} =    Set Variable    ${oldr.json()['m2m:cnt']['cbs']}
+    ${cbs} =    Current Byte Size    ${oldr}
     Should Be Equal As Integers    0    ${cbs}
 
 4.52 when conInstance create, parent container's cbs should + cs
     [Documentation]    when conInstance create, parent container's cbs should + cs
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    ${oldcbs} =    Set Variable    ${oldr.json()['m2m:cnt']['cbs']}
+    ${oldcbs} =    Current Byte Size    ${oldr}
     ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"102CSS"
     Create Resource    ${iserver}    InCSE1/Container2    ${rt_contentInstance}    ${attr}
     ${r} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    Should Be Equal As Integers    ${oldcbs+6}    ${r.json()['m2m:cnt']['cbs']}
+    ${cbs} =    Current Byte Size    ${r}
+    Should Be Equal As Integers    ${oldcbs+6}    ${cbs}
     # Test again
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    ${oldcbs} =    Set Variable    ${oldr.json()['m2m:cnt']['cbs']}
+    ${oldcbs} =    Current Byte Size    ${oldr}
     ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"xxx%%!@","rn":"contentIn1"
     Create Resource    ${iserver}    InCSE1/Container2    ${rt_contentInstance}    ${attr}
     ${r} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    Should Be Equal As Integers    ${oldcbs+7}    ${r.json()['m2m:cnt']['cbs']}
+    ${cbs} =    Current Byte Size    ${r}
+    Should Be Equal As Integers    ${oldcbs+7}    ${cbs}
 
 4.53 when conInstance delete, parent container's cbs should - cs
     [Documentation]    Delete the conIn created in 4.52, when conInstance delete, parent container's cbs should - cs
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    ${oldcbs} =    Set Variable    ${oldr.json()['m2m:cnt']['cbs']}
+    ${oldcbs} =    Current Byte Size    ${oldr}
     ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"102"
     Delete Resource    ${iserver}    InCSE1/Container2/contentIn1
     ${r} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    Should Be Equal As Integers    ${oldcbs-7}    ${r.json()['m2m:cnt']['cbs']}
+    ${cbs} =    Current Byte Size    ${r}
+    Should Be Equal As Integers    ${oldcbs-7}    ${cbs}
 
 Delete the Container2-4.5
     ${deleteRes} =    Delete Resource    ${iserver}    InCSE1/Container2
@@ -612,7 +643,7 @@ Delete the Container2-4.5
     ${container} =    Location    ${r}
     ${status_code} =    Status Code    ${r}
     ${oldr} =    Retrieve Resource    ${iserver}    ${container}
-    ${mni} =    Set Variable    ${oldr.json()['m2m:cnt']['mni']}
+    ${mni} =    Max Number Of Instances    ${oldr}
     Should Be Equal As Integers    1    ${mni}
     ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"102CSS"
     Create Resource    ${iserver}    InCSE1/Container2    ${rt_contentInstance}    ${attr}
@@ -624,9 +655,10 @@ Delete the Container2-4.5
     ${rr} =    Create Resource    ${iserver}    InCSE1/Container2    ${rt_contentInstance}    ${attr}
     Check Response and Retrieve Resource    ${rr}
     ${rr} =    Retrieve resource    ${iserver}    InCSE1/Container2
-    ${chr} =    Set Variable    ${rr.json()['m2m:cnt']['ch']}
-    ${cbs} =    Set Variable    ${rr.json()['m2m:cnt']['cbs']}
-    Should Be Equal As Integers    ${rr.json()['m2m:cnt']['cni']}    1
+    ${chr} =    Child Resource    ${rr}
+    ${cbs} =    Current Byte Size    ${rr}
+    ${cni} =    Current Number Of Instances    ${rr}
+    Should Be Equal As Integers    ${cni}    1
     ${childNumber} =    Get Length    ${chr}
     Should Be Equal As Integers    ${childNumber}    1
 
@@ -641,8 +673,8 @@ Delete the Container2-4.5
     #Create Resource    ${iserver}    InCSE1/Container2    ${rt_contentInstance}    ${attr}
     ${rr}=    Retrieve resource    ${iserver}    InCSE1/Container2
     Create Resource    ${iserver}    InCSE1/Container2    ${rt_contentInstance}    ${attr}
-    ${mni} =    Set Variable    ${rr.json()['m2m:cnt']['mni']}
-    ${chr} =    Set Variable    ${rr.json()['m2m:cnt']['ch']}
+    ${mni} =    Max Number Of Instances    ${rr}
+    ${chr} =    Child Resource    ${rr}
     Should Be Equal As Integers    ${mni}    3
 
 4.64 what if alread have 4, then set mni to 1
@@ -650,9 +682,10 @@ Delete the Container2-4.5
     ${attr} =    Set Variable    "mni":1
     ${r}=    Update Resource    ${iserver}    InCSE1/Container2    ${rt_container}    ${attr}
     ${rr}=    Retrieve resource    ${iserver}    InCSE1/Container2
-    ${chr} =    Set Variable    ${rr.json()['m2m:cnt']['ch']}
-    ${mni} =    Set Variable    ${rr.json()['m2m:cnt']['mni']}
-    Should Be Equal As Integers    ${rr.json()['m2m:cnt']['cni']}    1
+    ${chr} =    Child Resource    ${rr}
+    ${mni} =    Max Number Of Instances    ${rr}
+    ${cni} =    Current Number Of Instances    ${rr}
+    Should Be Equal As Integers    ${cni}    1
 
 Delete the Container2-4.6
     ${deleteRes} =    Delete Resource    ${iserver}    InCSE1/Container2
@@ -665,16 +698,15 @@ Delete the Container2-4.6
     ${container} =    Location    ${r}
     ${status_code} =    Status Code    ${r}
     ${oldr} =    Retrieve Resource    ${iserver}    ${container}
-    ${mbs} =    Set Variable    ${oldr.json()['m2m:cnt']['mbs']}
+    ${mbs} =    Max Byte Size    ${oldr}
     Should Be Equal As Integers    5    ${mbs}
 
 4.72 if maxByteSize = 5 , cannot create contentInstance with contenSize 8
     [Documentation]    if maxByteSize = 5 , cannot create contentInstance with contenSize 8
     ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"102C120c"
     # cannot create 2
-    ${error} =    Run Keyword And Expect Error    *    Create Resource    ${iserver}    InCSE1/Container2    ${rt_contentInstance}
+    ${error} =    Run Keyword And Expect Error    Cannot create this resource [400]*    Create Resource    ${iserver}    InCSE1/Container2    ${rt_contentInstance}
     ...    ${attr}
-    Should Start with    ${error}    Cannot create this resource [400]
 
 4.73 if update to 20 , cannot create another contentInstance
     [Documentation]    if update to 20 , cannot create another contentInstance
@@ -687,9 +719,10 @@ Delete the Container2-4.6
     Create Resource    ${iserver}    InCSE1/Container2    ${rt_contentInstance}    ${attr}
     Create Resource    ${iserver}    InCSE1/Container2    ${rt_contentInstance}    ${attr}
     ${rr}=    Retrieve resource    ${iserver}    InCSE1/Container2
-    ${cbs} =    Set Variable    ${rr.json()['m2m:cnt']['cbs']}
-    ${chr} =    Set Variable    ${rr.json()['m2m:cnt']['ch']}
-    Should Be Equal As Integers    ${rr.json()['m2m:cnt']['cni']}    4
+    ${cbs} =    Current Byte Size    ${rr}
+    ${chr} =    Child Resource    ${rr}
+    ${cni} =    Current Number Of Instances    ${rr}
+    Should Be Equal As Integers    ${cni}    4
     ${childNumber} =    Get Length    ${chr}
     Should Be Equal As Integers    ${childNumber}    4
 
@@ -698,9 +731,10 @@ Delete the Container2-4.6
     ${attr} =    Set Variable    "mbs":5
     ${r}=    Update Resource    ${iserver}    InCSE1/Container2    ${rt_container}    ${attr}
     ${rr}=    Retrieve resource    ${iserver}    InCSE1/Container2
-    ${chr} =    Set Variable    ${rr.json()['m2m:cnt']['ch']}
-    ${cbs} =    Set Variable    ${rr.json()['m2m:cnt']['cbs']}
-    Should Be Equal As Integers    ${rr.json()['m2m:cnt']['cni']}    1
+    ${chr} =    Child Resource    ${rr}
+    ${cbs} =    Current Byte Size    ${rr}
+    ${cni} =    Current Number Of Instances    ${rr}
+    Should Be Equal As Integers    ${cni}    1
     ${childNumber} =    Get Length    ${chr}
     Should Be Equal As Integers    ${childNumber}    1
 
@@ -710,10 +744,9 @@ Delete the Container2-4.7
 4.81 creator -- value must be null
     [Documentation]    creator -- value must be null
     ${attr} =    Set Variable    "cr":"VALUE"
-    ${error} =    Run Keyword And Expect Error    *    Create Resource    ${iserver}    InCSE1/Container1    ${rt_container}
+    ${error} =    Run Keyword And Expect Error    Cannot create this resource [400]*    Create Resource    ${iserver}    InCSE1/Container1    ${rt_container}
     ...    ${attr}
-    Should Start with    ${error}    Cannot create this resource [400]
-    Should Contain    ${error}    error    cr
+    Should Contain All Sub Strings    ${error}    error    cr
     #==================================================
     #    Finish
     #==================================================
@@ -740,18 +773,16 @@ Check Response and Retrieve Resource For Update
     ${text} =    Text    ${rr}
     [Return]    ${text}
 
-Cannot Create Container Error
+Create Container Expect Cannot Create Error
     [Arguments]    ${attr}
     [Documentation]    create Container Under InCSE1 and expect error
-    ${error} =    Run Keyword And Expect Error    *    Create Resource    ${iserver}    InCSE1    ${rt_container}
+    ${error} =    Run Keyword And Expect Error    Cannot create this resource [400]*    Create Resource    ${iserver}    InCSE1    ${rt_container}
     ...    ${attr}
-    Should Start with    ${error}    Cannot create this resource [400]
     [Return]    ${error}
 
-Cannot Update Container Error
+Update Container Expect Cannot Update Error
     [Arguments]    ${attr}
     [Documentation]    update Container Under InCSE1 and expect error
-    ${error} =    Run Keyword And Expect Error    *    Update Resource    ${iserver}    InCSE1/Container1    ${rt_container}
+    ${error} =    Run Keyword And Expect Error    Cannot update this resource [400]*    Update Resource    ${iserver}    InCSE1/Container1    ${rt_container}
     ...    ${attr}
-    Should Start with    ${error}    Cannot update this resource [400]
     [Return]    ${error}
similarity index 91%
rename from csit/suites/iotdm/basic/060_ConInAttributeTest.robot
rename to csit/suites/iotdm/basic/022_ResourceAttributesContentInstance.robot
index 4a4be3fc6066801e7fac98f9609b08426327806a..6a81b38b851d533b7529e4c7c175f6482fefa110 100644 (file)
@@ -1,5 +1,7 @@
 *** Settings ***
+Documentation     Tests for Content Instance resource attributes
 Suite Teardown    Kill The Tree    ${ODL_SYSTEM_IP}    InCSE1    admin    admin
+Resource          ../../../libraries/SubStrings.robot
 Library           ../../../libraries/criotdm.py
 Library           Collections
 
@@ -29,16 +31,15 @@ Set Suite Variable
 1.1 After Created, test whether all the mandatory attribtues are exist.
     [Documentation]    create 1 conIn test whether all the mandatory attribtues are exist
     ${attr} =    Set Variable    "rn":"Container1"
-    ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}
+    ${r}=    Create Resource With Command    ${iserver}    InCSE1    ${rt_container}    rcn=3    ${attr}
     ${container} =    Location    ${r}
     ${status_code} =    Status Code    ${r}
     Should Be Equal As Integers    ${status_code}    201
     ${attr} =    Set Variable    "con":"102CSS","rn":"conIn1"
-    Create Resource    ${iserver}    InCSE1/Container1    ${rt_contentInstance}    ${attr}
+    ${r} =    Create Resource With Command    ${iserver}    InCSE1/Container1    ${rt_contentInstance}    rcn=3    ${attr}
     ${text} =    Text    ${r}
-    Should Contain    ${text}    "ri":    "rn":    "cs":
-    Should Contain    ${text}    "lt":    "pi":    "con":
-    Should Contain    ${text}    "ct":    "rty":4
+    Should Contain All Sub Strings    ${text}    "ri":    "rn":    "cs":    "lt":    "pi":
+    ...    "con":    "ct":    "ty":4
     Should Not Contain    S{text}    "lbl"    "creator"    "or"
 
 1.21 Missing content should return error
@@ -130,31 +131,31 @@ Delete the ContenInstance 2.33
     [Documentation]    Mulitiple labels should return error
     ${attr} =    Set Variable    "con": "1", "lbl":["label1"],"lbl":["label2"]
     ${error} =    Cannot Craete ContentInstance Error    ${attr}
-    Should Contain    ${error}    Duplicate    lbl
+    Should Contain All Sub Strings    ${error}    Duplicate    lbl
 
 3.12 Multiple creator should return error
     [Documentation]    Multiple creator should return error
     ${attr} =    Set Variable    "con": "1", "cr":null, "cr":null
     ${error} =    Cannot Craete ContentInstance Error    ${attr}
-    Should Contain    ${error}    Duplicate    cr
+    Should Contain All Sub Strings    ${error}    Duplicate    cr
 
 3.13 Multiple contentInfo should return error
     [Documentation]    Multiple contentInfo should return error
     ${attr} =    Set Variable    "con": "1", "cnf":"1","cnf":"2"
     ${error} =    Cannot Craete ContentInstance Error    ${attr}
-    Should Contain    ${error}    Duplicate    cnf
+    Should Contain All Sub Strings    ${error}    Duplicate    cnf
 
 3.14 Multiple ontologyRef should return error
     [Documentation]    Multiple ontologyRef should return error
     ${attr} =    Set Variable    "con": "1", "or":"http://cisco.com","or":"http://google.com"
     ${error} =    Cannot Craete ContentInstance Error    ${attr}
-    Should Contain    ${error}    Duplicate    or
+    Should Contain All Sub Strings    ${error}    Duplicate    or
 
 3.15 Mulptiple content should return error
     [Documentation]    Mulptiple content should return error
     ${attr} =    Set Variable    "con": "1", "con":"2313"
     ${error} =    Cannot Craete ContentInstance Error    ${attr}
-    Should Contain    ${error}    Duplicate    con
+    Should Contain All Sub Strings    ${error}    Duplicate    con
     #----------------All attributes cannot be updated----------
 
 3.21 resourceType cannot be updated.
@@ -183,13 +184,13 @@ Delete the ContenInstance 2.33
 
 3.25 cretionTime cannot be updated.
     [Documentation]    update createTime and expect error
-    ${attr} =    Set Variable    "ct": "343434T34322"
+    ${attr} =    Set Variable    "ct": "20201210T123434"
     ${error} =    Cannot Update ContentInstance Error    ${attr}
     Should Contain    ${error}    Not permitted to update content
 
-3.26 lastmodifiedTime cannot be updated.
+3.26 last modified time cannot be updated.
     [Documentation]    update lt then expect error
-    ${attr} =    Set Variable    "lt": "434343T23232"
+    ${attr} =    Set Variable    "lt": "20201210T123434"
     ${error} =    Cannot Update ContentInstance Error    ${attr}
     Should Contain    ${error}    Not permitted to update content
 
@@ -255,7 +256,8 @@ Check Create and Retrieve ContentInstance
 Get Latest
     [Arguments]    ${resourceURI}
     ${latest} =    Retrieve Resource    ${iserver}    ${resourceURI}/latest
-    [Return]    ${latest.json()['m2m:cin']['con']}
+    ${con} =    Content    ${latest}
+    [Return]    ${con}
 
 Latest Con Test
     [Arguments]    ${resourceURI}
similarity index 66%
rename from csit/suites/iotdm/basic/040_AEAttributeTest.robot
rename to csit/suites/iotdm/basic/023_ResourceAttributesAE.robot
index e10fbb221a80a51a81406929d61da8cf2a651807..e439c26ad70e5903782b4fde0e00aff2665b8292 100644 (file)
@@ -1,5 +1,7 @@
 *** Settings ***
+Documentation     Tests for Application Entity (AE) resource attributes
 Suite Teardown    Kill The Tree    ${ODL_SYSTEM_IP}    InCSE1    admin    admin
+Resource          ../../../libraries/SubStrings.robot
 Library           ../../../libraries/criotdm.py
 Library           Collections
 
@@ -22,32 +24,29 @@ Set Suite Variable
     # For Creation, there are only 2 mandatory attribute: App-ID(api), AE-ID(aei)
 
 1.11 If include AE-ID should return error
-    [Documentation]    when create AE, Missing App-ID should return error
+    [Documentation]    when create AE, AE-ID should not be included
     ${attr} =    Set Variable    "aei":"ODL"
-    ${error} =    Run Keyword And Expect Error    *    Create Resource    ${iserver}    InCSE1    ${rt_ae}
+    ${error} =    Run Keyword And Expect Error    Cannot create this resource [400]*    Create Resource    ${iserver}    InCSE1    ${rt_ae}
     ...    ${attr}
-    Should Start with    ${error}    Cannot create this resource [400]
     Should Contain    ${error}    AE_ID
 
 1.21 Missing App-ID should return error
-    [Documentation]    when creete AE, Missing AE-ID should return error
+    [Documentation]    when creete AE, Missing APP-ID should return error
     ${attr} =    Set Variable    "apn":"ODL"
-    ${error} =    Run Keyword And Expect Error    *    Create Resource    ${iserver}    InCSE1    ${rt_ae}
+    ${error} =    Run Keyword And Expect Error    Cannot create this resource [400]*    Create Resource    ${iserver}    InCSE1    ${rt_ae}
     ...    ${attr}
-    Should Start with    ${error}    Cannot create this resource [400]
     Should Contain    ${error}    APP_ID
 
-1.3 After Created, test whether all the mandatory attribtues are exist.
+1.3 After AE Created, test whether all the mandatory attribtues are exist.
     [Documentation]    mandatory attributes should be there after created
     ${attr} =    Set Variable    "api":"ODL","rr":true,"rn":"AE1"
-    ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_ae}    ${attr}
+    ${r}=    Create Resource With Command    ${iserver}    InCSE1    ${rt_ae}    rcn=3    ${attr}
     ${status_code} =    Status Code    ${r}
     Should Be Equal As Integers    ${status_code}    201
     ${text} =    Text    ${r}
-    Should Contain    ${text}    "ri":    "rn":    "api":"ODL"
-    Should Contain    ${text}    "aei":    "lt":    "pi":
-    Should Contain    ${text}    "ct":    "rty":2
-    Should Not Contain    S{text}    "lbl"    "apn"    "or"
+    Should Contain All Sub Strings    ${text}    "ri":    "rn":    "api":"ODL"    "aei":    "lt":
+    ...    "pi":    "ct":    "ty":2
+    Should Not Contain Any Sub Strings    ${text}    "lbl"    "apn"    "or"
     # 1.13    if Child Container updated, parent Last Modified time will be updated?
     # 1.14    if Child Container's child updated, parent Last Modified time will not be updated?
     # support rcn(support change URI in python library)
@@ -60,91 +59,86 @@ Set Suite Variable
     [Documentation]    appName can be created through update (0-1)
     ${attr} =    Set Variable    "apn":"abcd"
     ${text} =    Update And Retrieve AE    ${attr}
-    Should Contain    ${text}    apn    abcd
+    Should Contain    ${text}    "apn":"abcd"
 
 2.12 appName can be modified (1-1)
     [Documentation]    appName can be modified (1-1)
     ${attr} =    Set Variable    "apn":"dbac"
     ${text} =    Update And Retrieve AE    ${attr}
     Should Not Contain    ${text}    abcd
-    Should Contain    ${text}    apn    dbac
+    Should Contain    ${text}    "apn":"dbac"
 
 2.13 if set to null, appName should be deleted
     [Documentation]    if set to null, appName should be deleted
     ${attr} =    Set Variable    "apn":null
     ${text} =    Update And Retrieve AE    ${attr}
-    Should Not Contain    ${text}    apn    abcd    dbac
+    Should Not Contain Any Sub Strings    ${text}    apn    abcd    dbac
 
 2.21 ontologyRef can be created through update (0-1)
     [Documentation]    ontologyRef can be created through update (0-1)
     ${attr} =    Set Variable    "or":"abcd"
     ${text} =    Update And Retrieve AE    ${attr}
-    Should Contain    ${text}    or    abcd
+    Should Contain    ${text}    "or":"abcd"
 
 2.22 ontologyRef can be modified (1-1)
     [Documentation]    ontologyRef can be modified (1-1)
     ${attr} =    Set Variable    "or":"dbac"
     ${text} =    Update And Retrieve AE    ${attr}
     Should Not Contain    ${text}    abcd
-    Should Contain    ${text}    or    dbac
+    Should Contain    ${text}    "or":"dbac"
 
 2.23 if set to null, ontologyRef should be deleted
     [Documentation]    if set to null, ontologyRef should be deleted
     ${attr} =    Set Variable    "or":null
     ${text} =    Update And Retrieve AE    ${attr}
-    Should Not Contain    ${text}    or    abcd    dbac
+    Should Not Contain Any Sub Strings    ${text}    or    abcd    dbac
 
 2.31 labels can be created through update (0-1)
     [Documentation]    labels can be created through update (0-1)
     ${attr} =    Set Variable    "lbl":["label1"]
     ${text} =    Update And Retrieve AE    ${attr}
-    Should Contain    ${text}    lbl    label1
+    Should Contain    ${text}    "lbl":["label1"]
 
 2.32 labels can be modified (1-1)
     [Documentation]    labels can be modified (1-1)
     ${attr} =    Set Variable    "lbl":["label2"]
     ${text} =    Update And Retrieve AE    ${attr}
     Should Not Contain    ${text}    label1
-    Should Contain    ${text}    lbl    label2
+    Should Contain    ${text}    "lbl":["label2"]
 
 2.33 if set to null, labels should be deleted(1-0)
     [Documentation]    if set to null, labels should be deleted(1-0)
     ${attr} =    Set Variable    "lbl":null
     ${text} =    Update And Retrieve AE    ${attr}
-    Should Not Contain    ${text}    lbl    label1    label2
+    Should Not Contain Any Sub Strings    ${text}    lbl    label1    label2
 
 2.34 labels can be created through update (0-n)
     [Documentation]    labels can be created through update (0-n)
     ${attr} =    Set Variable    "lbl":["label3","label4","label5"]
     ${text} =    Update And Retrieve AE    ${attr}
-    Should Contain    ${text}    lbl    label3    label4
-    Should Contain    ${text}    label5
+    Should Contain    ${text}    "lbl":["label3","label4","label5"]
 
 2.35 labels can be modified (n-n)(across)
     [Documentation]    labels can be modified (n-n)(across)
     ${attr} =    Set Variable    "lbl":["label4","label5","label6"]
     ${text} =    Update And Retrieve AE    ${attr}
-    Should Not Contain    ${text}    label1    label2    label3
-    Should Contain    ${text}    lbl    label4    label5
-    Should Contain    ${text}    label6
+    Should Not Contain Any Sub Strings    ${text}    label1    label2    label3
+    Should Contain    ${text}    "lbl":["label4","label5","label6"]
 
 2.36 labels can be modified (n-n)(not across)
     [Documentation]    labels can be modified (n-n)(not across)
     ${attr} =    Set Variable    "lbl":["label7","label8","label9"]
     ${text} =    Update And Retrieve AE    ${attr}
-    Should Not Contain    ${text}    label1    label2    label3
-    Should Not Contain    ${text}    label6    label4    label5
-    Should Contain    ${text}    lbl    label7    label8
-    Should Contain    ${text}    label9
+    Should Not Contain Any Sub Strings    ${text}    label1    label2    label3    label4    label5
+    ...    label6
+    Should Contain    ${text}    "lbl":["label7","label8","label9"]
 
 2.37 if set to null, labels should be deleted(n-0)
     [Documentation]    if set to null, labels should be deleted(n-0)
     ${attr} =    Set Variable    "lbl":null
     ${text} =    Update And Retrieve AE    ${attr}
-    Should Not Contain    ${text}    label1    label2    label3
-    Should Not Contain    ${text}    label6    label4    label5
-    Should Not Contain    ${text}    label7    label8    label9
-    Should Not Contain    ${text}    lbl
+    Should Not Contain Any Sub Strings    ${text}    label1    label2    label3    label4    label5
+    ...    label6    label7    label8    label9    lbl
     #======================================================
     #    AE Disturbing Attribute Test, Not Allowed Update
     #======================================================
@@ -153,118 +147,121 @@ Set Suite Variable
 3.11 Mulitiple App-ID should return error
     [Documentation]    Mulitiple App-ID should return error
     ${attr} =    Set Variable    "api":"ODL","api":"ODL2"
-    ${error} =    Cannot Update AE Error    ${attr}
-    Should Contain    ${error}    Duplicate key    api
+    ${error} =    Update AE Expect Cannot Update Error    ${attr}
+    Should Contain All Sub Strings    ${error}    Duplicate key    api
 
 3.12 Mulitiple AE-ID should return error
     [Documentation]    Mulitiple AE-ID should return error
     ${attr} =    Set Variable    "api":"ODL","aei":"ODL1"
-    ${error} =    Cannot Update AE Error    ${attr}
+    ${error} =    Update AE Expect Cannot Update Error    ${attr}
+    Should Contain    ${error}    AE_ID should be assigned by the system
 
 3.13 Multiple app-name should return error
     [Documentation]    Multiple app-name should return error
     ${attr} =    Set Variable    "api":"ODL","apn":"ODL1","apn":"ODL1"
-    ${error} =    Cannot Update AE Error    ${attr}
-    Should Contain    ${error}    Duplicate key    apn
+    ${error} =    Update AE Expect Cannot Update Error    ${attr}
+    Should Contain All Sub Strings    ${error}    Duplicate key    apn
 
 3.14 Multiple label attribute should return error(multiple array)
     [Documentation]    Multiple label attribute should return error(multiple array)
     ${attr} =    Set Variable    "api":"ODL","lbl":["ODL1"], "lbl":["dsdsd"]
-    ${error} =    Cannot Update AE Error    ${attr}
-    Should Contain    ${error}    Duplicate key    lbl
+    ${error} =    Update AE Expect Cannot Update Error    ${attr}
+    Should Contain    ${error}    Duplicate key
+    Should Contain    ${error}    lbl
 
 3.15 Multiple ontologyRef attribute should return error
     [Documentation]    Multiple ontologyRef attribute should return error
     ${attr} =    Set Variable    "api":"ODL","or":"http://hey/you", "or":"http://hey/you"
-    ${error} =    Cannot Update AE Error    ${attr}
+    ${error} =    Update AE Expect Cannot Update Error    ${attr}
     Should Contain    ${error}    Duplicate key    or
 
 3.21 Using Container's M attribute to create
     [Documentation]    Using Container's M attribute to create
     ${attr} =    Set Variable    "cr":null,"mni":1,"mbs":15,"or":"http://hey/you"
-    ${error} =    Cannot Update AE Error    ${attr}
-    Should Contain    ${error}    CONTENT(pc)
+    ${error} =    Update AE Expect Cannot Update Error    ${attr}
+    Should Contain    ${error}    CONTENT(pc) attribute not recognized: mni
 
 3.22 Using ContentInstance's M attribute to create
     [Documentation]    Using ContentInstance's M attribute to create
     ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"101"
-    ${error} =    Cannot Update AE Error    ${attr}
-    Should Contain    ${error}    CONTENT(pc)
+    ${error} =    Update AE Expect Cannot Update Error    ${attr}
+    Should Contain    ${error}    CONTENT(pc) attribute not recognized: con
     #------------------------------------------------------
     # using non-valid attribute to update then expect error
 
 3.31 resourceType cannot be update.
     [Documentation]    when update resourceType expext error
     ${attr} =    Set Variable    "ty":3
-    ${error} =    Cannot Update AE Error    ${attr}
-    Should Contain    ${error}    error
+    ${error} =    Update AE Expect Cannot Update Error    ${attr}
+    Should Contain    ${error}    "error":"CONTENT(pc) attribute not recognized: ty"
 
 3.32 resoureceID cannot be update.
     [Documentation]    when update resourceId expect error
     ${attr} =    Set Variable    "ri":"aaa"
-    ${error} =    Cannot Update AE Error    ${attr}
-    Should Contain    ${error}    error    ri
+    ${error} =    Update AE Expect Cannot Update Error    ${attr}
+    Should Contain    ${error}    "error":"CONTENT(pc) attribute not recognized: ri"
 
 3.33 resouceNme cannot be update.(write once)
     [Documentation]    when update resourceName expect error
     ${attr} =    Set Variable    "rn":"aaa"
-    ${error} =    Cannot Update AE Error    ${attr}
-    Should Contain    ${error}    error    rn
+    ${error} =    Update AE Expect Cannot Update Error    ${attr}
+    Should Contain    ${error}    "error":"Resource Name cannot be updated: InCSE1/AE1/aaa"
 
 3.34 parentID cannot be update.
     [Documentation]    when update parentID expect error
     ${attr} =    Set Variable    "pi":"aaa"
-    ${error} =    Cannot Update AE Error    ${attr}
-    Should Contain    ${error}    error    pi
+    ${error} =    Update AE Expect Cannot Update Error    ${attr}
+    Should Contain    ${error}    "error":"CONTENT(pc) attribute not recognized: pi"
 
 3.35 createTime cannot be update.
     [Documentation]    when update createTime expect error
     ${attr} =    Set Variable    "ct":"aaa"
-    ${error} =    Cannot Update AE Error    ${attr}
-    Should Contain    ${error}    error    ct
+    ${error} =    Update AE Expect Cannot Update Error    ${attr}
+    Should Contain    ${error}    "error":"CONTENT(pc) attribute not recognized: ct"
 
 3.36 app-id cannot be update
     [Documentation]    when update app-id expect error
     ${attr} =    Set Variable    "api":"aaa"
-    ${error} =    Cannot Update AE Error    ${attr}
-    Should Contain    ${error}    error    api
+    ${error} =    Update AE Expect Cannot Update Error    ${attr}
+    Should Contain    ${error}    "error":"APP_ID cannot be updated"
 
 3.37 ae-id cannot be updated
     [Documentation]    when update ae-id epxect error
     ${attr} =    Set Variable    "aei":"aaa"
-    ${error} =    Cannot Update AE Error    ${attr}
-    Should Contain    ${error}    error    aei
+    ${error} =    Update AE Expect Cannot Update Error    ${attr}
+    Should Contain    ${error}    "error":"CONTENT(pc) AE_ID should be assigned by the system, please do not include aei"
 
 3.38 LastMoifiedTime --- Special, cannot be modified by the user
     [Documentation]    LastMoifiedTime --- Special, cannot be modified by the user
     ${attr} =    Set Variable    "lt":"aaa"
-    ${error} =    Cannot Update AE Error    ${attr}
-    Should Contain    ${error}    error    lt
+    ${error} =    Update AE Expect Cannot Update Error    ${attr}
+    Should Contain    ${error}    "error":"CONTENT(pc) attribute not recognized: lt"
     #==================================================
     #    Functional Attribute Test
     #==================================================
     # 1. lastModifiedTime
     # 2. parentID
 
-4.1 if updated seccessfully, lastModifiedTime must be modified.
+4.1 if updated seccessfully, last modified time must be modified.
     [Documentation]    if updated seccessfully, lastModifiedTime must be modified.
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/AE1
-    ${lt1} =    LastModifiedTime    ${oldr}
+    ${lt1} =    Last Modified Time    ${oldr}
     ${attr} =    Set Variable    "lbl":["aaa"]
     Sleep    1s
     # We know Beryllium is going to be get rid of all sleep.
     # But as lastModifiedTime has precision in seconds,
     # we need to wait 1 second to see different value on update.
     ${r} =    update Resource    ${iserver}    InCSE1/AE1    ${rt_ae}    ${attr}
-    ${lt2} =    LastModifiedTime    ${r}
+    ${lt2} =    Last Modified Time    ${r}
     Should Not Be Equal    ${lt1}    ${lt2}
 
 4.2 Check parentID
     [Documentation]    check parentID whether it is correct
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1
-    ${CSEID} =    Set Variable    ${oldr.json()['m2m:cb']['ri']}
+    ${CSEID} =    Resid    ${oldr}
     ${r} =    Retrieve Resource    ${iserver}    InCSE1/AE1
-    Should Be Equal    /InCSE1/${oldr.json()['m2m:cb']['ri']}    ${r.json()['m2m:ae']['pi']}
+    ${pi} =    Parent Id    ${r}
+    Should Be Equal    /InCSE1/${CSEID}    ${pi}
     #==================================================
     #    Finish
     #==================================================
@@ -280,9 +277,8 @@ Update And Retrieve AE
     LOG    ${text}
     [Return]    ${text}
 
-Cannot Update AE Error
+Update AE Expect Cannot Update Error
     [Arguments]    ${attr}
-    ${error} =    Run Keyword And Expect Error    *    Update Resource    ${iserver}    InCSE1/AE1    ${rt_ae}
+    ${error} =    Run Keyword And Expect Error    Cannot update this resource [400]*    Update Resource    ${iserver}    InCSE1/AE1    ${rt_ae}
     ...    ${attr}
-    Should Start with    ${error}    Cannot update this resource [400]
     [Return]    ${error}
similarity index 87%
rename from csit/suites/iotdm/basic/090_AccessControlPolicyTest.robot
rename to csit/suites/iotdm/basic/024_ResourceAttributesACP.robot
index b023d00877c6f4afb6dfeead1681f0370084c32c..7a1116f40be7e795668edf8d0df7623339dfe97f 100644 (file)
@@ -1,5 +1,7 @@
 *** Settings ***
+Documentation     Tests for Access Control Policy (ACP) resource attributes
 Suite Teardown    Kill The Tree    ${ODL_SYSTEM_IP}    InCSE1    admin    admin
+Resource          ../../../libraries/SubStrings.robot
 Library           ../../../libraries/criotdm.py
 Library           Collections
 
@@ -23,22 +25,21 @@ Set Suite Variable
     # For Creation, there are no mandatory input attribute
 
 1.0 Test whether default ACP exist
-    Modify Headers Origin    ${iserver}    //iotsandbox.cisco.com:10000
+    Modify Headers Origin    ${iserver}    admin
     ${r} =    Retrieve Resource    ${iserver}    InCSE1/_defaultACP
     ${text} =    Text    ${r}
     LOG    ${text}
     ${status_code} =    Status Code    ${r}
     Should Be True    199 < ${status_code} < 299
 
-1.1 Create ACP without context, test whether all the reponse mandatory attribtues are exist.
-    [Documentation]    After Created, test whether all the mandatory attribtues are exist.
+1.1 Create ACP without context, test whether all the reponse mandatory attribtues exist.
+    [Documentation]    After Created, test whether all the mandatory attribtues exist.
     ${attr} =    Set Variable    "pv":{"acr":[{"acor" : ["111","222"],"acop":35},{"acor" : ["111","222"],"acop":35}]},"pvs":{"acr":[{"acor" : ["111","222"],"acop":7},{"acor" : ["111","222"],"acop":9}]},"rn":"Acp1"
     ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_acp}    ${attr}
     ${status_code} =    Status Code    ${r}
     Should Be Equal As Integers    ${status_code}    201
-    ${text} =    Text    ${r}
-    Should Contain    ${text}    "ct":    "lt":    "ty"
-    Should Contain    ${text}    "ri":    "pi":
+    ${text} =    Convert To String    ${r.text}
+    Should Contain All Sub Strings    ${text}    "ct":    "lt":    "ty"    "ri":    "pi":
 
 1.2 Create ACP with valid acip(ipv4)
     [Documentation]    After Created, test whether all the mandatory attribtues are exist.
@@ -46,9 +47,8 @@ Set Suite Variable
     ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_acp}    ${attr}
     ${status_code} =    Status Code    ${r}
     Should Be Equal As Integers    ${status_code}    201
-    ${text} =    Text    ${r}
-    Should Contain    ${text}    "ct":    "lt":    "ty"
-    Should Contain    ${text}    "ri":    "pi":
+    ${text} =    Convert To String    ${r.text}
+    Should Contain All Sub Strings    ${text}    "ct":    "lt":    "ty"    "ri":    "pi":
 
 1.3 Create ACP with invalid acip(ipv4)
     [Documentation]    input a invalid ipv4 address and expect error
@@ -64,9 +64,8 @@ Set Suite Variable
     ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_acp}    ${attr}
     ${status_code} =    Status Code    ${r}
     Should Be Equal As Integers    ${status_code}    201
-    ${text} =    Text    ${r}
-    Should Contain    ${text}    "ct":    "lt":    "ty"
-    Should Contain    ${text}    "ri":    "pi":
+    ${text} =    Convert To String    ${r.text}
+    Should Contain All Sub Strings    ${text}    "ct":    "lt":    "ty"    "ri":    "pi":
 
 1.5 Create ACP with invalid acip(ipv6)
     [Documentation]    input a invalid Ipv6 address and expect error
similarity index 65%
rename from csit/suites/iotdm/basic/100_NodeTest.robot
rename to csit/suites/iotdm/basic/025_ResourceAttributesNode.robot
index 2a64e72acac9fc568ff6d3a6dec7a49a0e5f7ab9..abc2cdc267a69662fb4b68fccdc2088487b066f7 100644 (file)
@@ -1,5 +1,7 @@
 *** Settings ***
+Documentation     Tests for Node resource attributes
 Suite Teardown    Kill The Tree    ${ODL_SYSTEM_IP}    InCSE1    admin    admin
+Resource          ../../../libraries/SubStrings.robot
 Library           ../../../libraries/criotdm.py
 Library           Collections
 
@@ -23,15 +25,14 @@ Set Suite Variable
     #==================================================
     # For Creation, there are no mandatory input attribute
 
-1.1 After Created, test whether all the mandatory attribtues are exist.
-    [Documentation]    After Created, test whether all the mandatory attribtues are exist.
+1.1 After Created, test whether all the mandatory attribtues exist.
+    [Documentation]    After Created, test whether all the mandatory attribtues exist.
     ${attr} =    Set Variable    "rn":"Container1"
-    ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}
+    ${r}=    Create Resource With Command    ${iserver}    InCSE1    ${rt_container}    rcn=3    ${attr}
     ${container} =    Location    ${r}
     ${status_code} =    Status Code    ${r}
     Should Be Equal As Integers    ${status_code}    201
-    ${text} =    Text    ${r}
-    Should Contain    ${text}    "ri":    "rn":    "cni"
-    Should Contain    ${text}    "lt":    "pi":    "st":
-    Should Contain    ${text}    "ct":    "rty":3    "cbs"
-    Should Not Contain    S{text}    "lbl"    "creator"    "or"
+    ${text} =    Convert To String    ${r.text}
+    Should Contain All Sub Strings    ${text}    "ri":    "rn":    "cni"    "lt":    "pi":
+    ...    "st":    "ct":    "ty":3    cbs"
+    Should Not Contain Any Sub Strings    ${text}    "lbl"    "creator"    "or"
similarity index 99%
rename from csit/suites/iotdm/basic/070_DeleteTest.robot
rename to csit/suites/iotdm/basic/091_ResourceHierarchyDelete.robot
index 1b9be44e4d7b25d7ce811ce30897050d13ab095c..f4bc7d790ca6a43cac857eecb7227ae1f34c0814 100644 (file)
@@ -1,4 +1,5 @@
 *** Settings ***
+Documentation     Tests deleting resources from multiple places in resource tree
 Suite Teardown    Kill The Tree    ${ODL_SYSTEM_IP}    InCSE1    admin    admin
 Library           ../../../libraries/criotdm.py
 Library           Collections
similarity index 91%
rename from csit/suites/iotdm/basic/030_LayerTest.robot
rename to csit/suites/iotdm/basic/092_ResourceHierarchyAE_CNT_CIN.robot
index f460cbb62c9b28ffd08bbb52dea699730c61b5b8..6a7541691ee86a262c0a5164db5f0ddb8f8a56bc 100644 (file)
@@ -1,6 +1,7 @@
 *** Settings ***
-Documentation     Test for layers AE/CONTAINER/CONTENTINSTANCE
+Documentation     Test for hierarchy of resources: AE/CONTAINER/CONTENTINSTANCE
 Suite Teardown    Kill The Tree    ${ODL_SYSTEM_IP}    InCSE1    admin    admin
+Resource          ../../../libraries/SubStrings.robot
 Library           ../../../libraries/criotdm.py
 Library           Collections
 
@@ -54,28 +55,25 @@ Set Suite Variable
     Response Is Correct    ${r}
     # Retrieve and test the lbl
     ${r} =    Retrieve Resource    ${iserver}    InCSE1/ODL3
-    ${Json} =    Text    ${r}
-    Should Contain    ${Json}    "aaa"    "bbb"    "ccc"
-    Should Contain    ${r.json()['m2m:ae']['lbl']}    aaa    bbb    ccc
+    Should Contain All Sub Strings    ${r.text}    "aaa"    "bbb"    "ccc"
     #==================================================
     #    Container Test
     #==================================================
 
-2.11 Create Container under AE without name
+2.11 Create Container without name under AE
     [Documentation]    Create Container under AE without name
     ${attr} =    Set Variable    "cr":null,"mni":1,"mbs":15,"or":"http://hey/you"
     Connect And Create Resource    InCSE1/ODL3    ${rt_container}    ${attr}
 
-2.12 Create Container under AE with name
-    [Documentation]    Invalid Input for Container Under AE with name (Already exist)
+2.12 Create Container with name under AE
+    [Documentation]    Create Container Under AE with name containerUnderAE and retrieve it to check if it is created
     ${attr} =    Set Variable    "cr":null,"mni":1,"mbs":15,"or":"http://hey/you","rn":"containerUnderAE"
-    ${r} =    Create Resource    ${iserver}    InCSE1/ODL3    ${rt_container}    ${attr}
+    ${r} =    Create Resource    ${iserver}    /InCSE1/ODL3    ${rt_container}    ${attr}
     ${container} =    Location    ${r}
     Response Is Correct    ${r}
     # retrieve it
     ${result} =    Retrieve Resource    ${iserver}    ${container}
-    ${text} =    Text    ${result}
-    Should Contain    ${text}    containerUnderAE
+    Should Contain    ${result.text}    containerUnderAE
 
 2.13 Invalid Input for Container Under AE with name (Already exist)
     [Documentation]    Invalid Input for Container Under AE with name (Already exist)
@@ -90,9 +88,7 @@ Set Suite Variable
     Response Is Correct    ${r}
     # Retrieve and test the lbl
     ${r} =    Retrieve Resource    ${iserver}    InCSE1/ODL3/containerUnderAE
-    ${Json} =    Text    ${r}
-    Should Contain    ${Json}    "aaa"    "bbb"    "ccc"
-    Should Contain    ${r.json()['m2m:cnt']['lbl']}    aaa    bbb    ccc
+    Should Contain All Sub Strings    ${r.text}    "aaa"    "bbb"    "ccc"
     #----------------------------------------------------------------------
 
 2.21 Create Container under InCSE1 without name
@@ -108,8 +104,7 @@ Set Suite Variable
     Response Is Correct    ${r}
     # retrieve it
     ${result} =    Retrieve Resource    ${iserver}    InCSE1/containerUnderCSE
-    ${text} =    Text    ${result}
-    Should Contain    ${text}    containerUnderCSE
+    Should Contain    ${result.text}    containerUnderCSE
 
 2.23 Invalid Input for Container Under CSE with name (Already exist)
     [Documentation]    Invalid Input for Container Under CSE with name (Already exist)
@@ -125,9 +120,7 @@ Set Suite Variable
     Response Is Correct    ${r}
     # Retrieve and test the lbl
     ${r} =    Retrieve Resource    ${iserver}    InCSE1/containerUnderCSE
-    ${Json} =    Text    ${r}
-    Should Contain    ${Json}    "aaa"    "bbb"    "ccc"
-    Should Contain    ${r.json()['m2m:cnt']['lbl']}    aaa    bbb    ccc
+    Should Contain All Sub Strings    ${r.text}    "aaa"    "bbb"    "ccc"
     #----------------------------------------------------------------------
 
 2.31 Create Container under Container without name
@@ -144,8 +137,7 @@ Set Suite Variable
     Response Is Correct    ${r}
     # retrieve it
     ${result} =    Retrieve Resource    ${iserver}    ${container}
-    ${text} =    Text    ${result}
-    Should Contain    ${text}    containerUnderContainer
+    Should Contain    ${result.text}    containerUnderContainer
 
 2.33 Invalid Input for Container Under Container with name (Already exist)
     [Documentation]    Invalid Input for Container Under Container with name (Already exist)
@@ -161,9 +153,7 @@ Set Suite Variable
     Response Is Correct    ${r}
     # Retrieve and test the lbl
     ${r} =    Retrieve Resource    ${iserver}    InCSE1/containerUnderCSE/containerUnderContainer
-    ${Json} =    Text    ${r}
-    Should Contain    ${Json}    "aaa"    "bbb"    "ccc"
-    Should Contain    ${r.json()['m2m:cnt']['lbl']}    aaa    bbb    ccc
+    Should Contain All Sub Strings    ${r.text}    "aaa"    "bbb"    "ccc"
 
 2.41 Invalid Input for AE under container with name(mess up layer)
     [Documentation]    Invalid Input for AE under container withoutname(mess up layer)
@@ -260,7 +250,11 @@ Set Suite Variable
 Delete the Container Under CSEBase
     [Documentation]    Delete the Container and AE Under CSEBase
     ${deleteRes} =    Delete Resource    ${iserver}    InCSE1/containerUnderCSE
+    ${status_code} =    Status Code    ${deleteRes}
+    Should Be Equal As Integers    ${status_code}    200
     ${deleteRes} =    Delete Resource    ${iserver}    InCSE1/ODL3
+    ${status_code} =    Status Code    ${deleteRes}
+    Should Be Equal As Integers    ${status_code}    200
 
 *** Keywords ***
 Connect And Create Resource