Update iotdm library and tests. 21/26921/9
authorwucangji <wucangji@gmail.com>
Mon, 14 Sep 2015 17:19:18 +0000 (13:19 -0400)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 25 Feb 2016 05:58:38 +0000 (05:58 +0000)
Support latest resource format.(Feb 22)

Change-Id: I38cdb8053f51161b2cdd518b4a32ea831d7fe733
Signed-off-by: wucangji <wucangji@gmail.com>
csit/libraries/ciotdm.py
csit/libraries/criotdm.py
csit/suites/iotdm/basic/030_LayerTest.robot
csit/suites/iotdm/basic/040_AEAttributeTest.robot
csit/suites/iotdm/basic/050_ContainerAttributeTest.robot
csit/suites/iotdm/basic/060_ConInAttributeTest.robot
csit/suites/iotdm/basic/070_DeleteTest.robot
csit/suites/iotdm/basic/080_FilterCriteriaTest.robot
csit/suites/iotdm/basic/090_AccessControlPolicyTest.robot [new file with mode: 0644]
csit/suites/iotdm/basic/100_NodeTest.robot [new file with mode: 0644]

index a342c4e9ab6c9a7d4473548c6bec0fbbcb9f562b..6f56bf936b9157f81cb6642aaff536f6e57dfad8 100644 (file)
@@ -24,18 +24,62 @@ cse_payload = '''
 
 resourcepayload = '''
 {
-  any:
-  [
-    {%s}
-  ]
+    %s
 }
 '''
 
+ae_payload = '''
+{
+    "m2m:ae":{%s}
+}
+'''
+
+con_payload = '''
+{
+    "m2m:cnt":{%s}
+}
+'''
+
+cin_payload = '''
+{
+   "m2m:cin":{%s}
+}
+'''
+
+sub_payload = '''
+{
+    "m2m:sub":{%s}
+}
+'''
+
+acp_payload = '''
+{
+    "m2m:acp":{%s}
+}
+'''
+
+nod_payload = '''
+{
+    "m2m:nod":{%s}
+}
+'''
+
+resources = {"m2m:ae", "m2m:cnt", "m2m:cin", "m2m:sub",
+             "m2m:acp", "m2m:nod", "m2m:grp"}
+
+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):
     """Deserialize response, return value for key or None."""
-    val = response.json()
-    return val.get(key, None)
+    dic = response.json()
+    key1 = list(dic.keys())
+    if len(key1) != 1:
+        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)
 
 
 def name(response):
@@ -92,12 +136,12 @@ def error(response):
         return None
 
 
-def normalize(resourceURI):
+def normalize(resource_uri):
     """Remove the first / of /InCSE1/ae1."""
-    if resourceURI is not None:
-        if resourceURI[0] == "/":
-            return resourceURI[1:]
-    return resourceURI
+    if resource_uri is not None:
+        if resource_uri[0] == "/":
+            return resource_uri[1:]
+    return resource_uri
 
 
 class connect:
@@ -116,141 +160,145 @@ class connect:
             # Admittedly these are "magic values" but are required
             # and until a proper defaulting initializer is in place
             # are hard-coded.
-            'content-type': 'application/json',
+            'content-type': 'application/vnd.onem2m-res+json',
             'X-M2M-Origin': '//localhost:10000',
             'X-M2M-RI': '12345',
             'X-M2M-OT': 'NOW'
         }
         self.server = "%s://" % (protocol) + server
-        if base is not None:
-            self.url = self.server + op_provision
-            self.response = self.session.post(
-                self.url, data=self.payload, timeout=self.timeout)
-            print(self.response.text)
-
-    def create(self, parent, restype, attr=None, name=None):
-        """Create resource."""
+        self.url = self.server + op_provision
+        self.response = self.session.post(
+            self.url, data=self.payload, timeout=self.timeout)
+
+    def modify_headers_origin(self, new_origin):
+        """Modify the headers to test ACP."""
+        self.headers['X-M2M-Origin'] = new_origin
+
+    def create(self, parent, restype, attr=None):
+        """Create certain resource with attributes under parent URI.
+
+        Args:
+            :param parent: the target URI
+            :param restype: the resourceType of the resource
+            :param attr: the payload of the resource
+        """
         if parent is None:
             return None
-        payload = resourcepayload % (attr)
-        print payload
-        self.headers['X-M2M-NM'] = name
+        restype = int(restype)
+        payload = payload_map[restype]
+        payload = payload % (attr)
+        self.headers['content-type'] = 'application/\
+            vnd.onem2m-res+json;ty=%s' % (restype)
         parent = normalize(parent)
-        self.url = self.server + ":8282/%s?ty=%s&rcn=1" % (
-            parent, restype)
+        self.url = self.server + ":8282/%s?&rcn=1" % (
+            parent)
         self.response = self.session.post(
             self.url, payload, timeout=self.timeout, headers=self.headers)
-        return self.response
 
-    def createWithCommand(self, parent, restype,
-                          command, attr=None, name=None):
-        """Create resource."""
+    def create_with_command(self, parent, restype,
+                            command, attr=None):
+        """Create certain resource with attributes under parent URI.
+
+        Args:
+            :param parent: the target URI
+            :param restype: the resourceType of the resource
+            :param command: the command would be in the URI after &
+            :param attr: the payload of the resource
+        """
         if parent is None:
             return None
-        payload = resourcepayload % (attr)
-        print payload
-        if name is None:
-            self.headers['X-M2M-NM'] = None
-        else:
-            self.headers['X-M2M-NM'] = name
+        restype = int(restype)
+        payload = payload_map[restype]
+        payload = payload % (attr)
+        self.headers['content-type'] = 'application/\
+            vnd.onem2m-res+json;ty=%s' % (restype)
         parent = normalize(parent)
-        self.url = self.server + ":8282/%s?ty=%s&%s" % (
-            parent, restype, command)
+        self.url = self.server + ":8282/%s?%s" % (
+            parent, command)
         self.response = self.session.post(
             self.url, payload, timeout=self.timeout, headers=self.headers)
-        return self.response
 
-    def retrieve(self, resourceURI):
-        """Retrieve resource."""
-        if resourceURI is None:
+    def retrieve(self, resource_uri):
+        """Retrieve resource using resource_uri."""
+        if resource_uri is None:
             return None
-        resourceURI = normalize(resourceURI)
-        self.url = self.server + ":8282/%s?rcn=5&drt=2" % (resourceURI)
+        resource_uri = normalize(resource_uri)
+        self.url = self.server + ":8282/%s?rcn=5" % (resource_uri)
         self.headers['X-M2M-NM'] = None
+        self.headers['content-type'] = 'application/vnd.onem2m-res+json'
         self.response = self.session.get(
             self.url, timeout=self.timeout, headers=self.headers
         )
-        return self.response
 
-    def retrieveWithCommand(self, resourceURI, command):
-        """Retrieve resource with command."""
-        if resourceURI is None:
+    def retrieve_with_command(self, resource_uri, command):
+        """Retrieve resource using resource_uri with command."""
+        if resource_uri is None:
             return None
         if command is None:
             return None
-        resourceURI = normalize(resourceURI)
-        self.url = self.server + ":8282/%s?%s" % (resourceURI, command)
+        resource_uri = normalize(resource_uri)
+        self.url = self.server + ":8282/%s?%s" % (resource_uri, command)
         self.headers['X-M2M-NM'] = None
+        self.headers['content-type'] = 'application/vnd.onem2m-res+json'
         self.response = self.session.get(
             self.url, timeout=self.timeout, headers=self.headers
         )
-        return self.response
 
-    def update(self, resourceURI, restype, attr=None, name=None):
-        """Update resource attr."""
-        if resourceURI is None:
+    def update(self, resource_uri, restype, attr=None):
+        """Update resource at resource_uri with new attributes."""
+        if resource_uri is None:
             return None
-        resourceURI = normalize(resourceURI)
-        # print(payload)
-        payload = resourcepayload % (attr)
-        print payload
-        if name is None:
-            self.headers['X-M2M-NM'] = None
-        else:
-            self.headers['X-M2M-NM'] = name
-        self.url = self.server + ":8282/%s" % (resourceURI)
+        resource_uri = normalize(resource_uri)
+        restype = int(restype)
+        payload = payload_map[restype]
+        payload = payload % (attr)
+        self.headers['content-type'] = 'application/vnd.onem2m-res+json'
+        self.url = self.server + ":8282/%s" % (resource_uri)
         self.response = self.session.put(
             self.url, payload, timeout=self.timeout, headers=self.headers)
-        return self.response
 
-    def updateWithCommand(self, resourceURI, restype,
-                          command, attr=None, name=None):
-        """Update resource attr."""
-        if resourceURI is None:
+    def update_with_command(self, resource_uri, restype,
+                            command, attr=None):
+        """Update resource at resource_uri with new attributes."""
+        if resource_uri is None:
             return None
-        resourceURI = normalize(resourceURI)
-        # print(payload)
-        payload = resourcepayload % (attr)
-        print payload
-        if name is None:
-            self.headers['X-M2M-NM'] = None
-        else:
-            self.headers['X-M2M-NM'] = name
-        self.url = self.server + ":8282/%s?%s" % (resourceURI, command)
+        resource_uri = normalize(resource_uri)
+        restype = int(restype)
+        payload = payload_map[restype]
+        payload = payload % (attr)
+        self.headers['content-type'] = 'application/vnd.onem2m-res+json'
+        self.url = self.server + ":8282/%s?%s" % (resource_uri, command)
         self.response = self.session.put(
             self.url, payload, timeout=self.timeout, headers=self.headers)
-        return self.response
 
-    def delete(self, resourceURI):
-        """Delete the resource with the provresourceURIed resourceURI."""
-        if resourceURI is None:
+    def delete(self, resource_uri):
+        """Delete the resource at the resource_uri."""
+        if resource_uri is None:
             return None
-        resourceURI = normalize(resourceURI)
-        self.url = self.server + ":8282/%s" % (resourceURI)
+        resource_uri = normalize(resource_uri)
+        self.url = self.server + ":8282/%s" % (resource_uri)
         self.headers['X-M2M-NM'] = None
+        self.headers['content-type'] = 'application/vnd.onem2m-res+json'
         self.response = self.session.delete(self.url, timeout=self.timeout,
                                             headers=self.headers)
-        return self.response
 
-    def deleteWithCommand(self, resourceURI, command):
-        """Delete the resource with the provresourceURIed resourceURI."""
-        if resourceURI is None:
+    def delete_with_command(self, resource_uri, command):
+        """Delete the resource at the resource_uri."""
+        if resource_uri is None:
             return None
-        resourceURI = normalize(resourceURI)
-        self.url = self.server + ":8282/%s?%s" % (resourceURI, command)
+        resource_uri = normalize(resource_uri)
+        self.url = self.server + ":8282/%s?%s" % (resource_uri, command)
         self.headers['X-M2M-NM'] = None
+        self.headers['content-type'] = 'application/vnd.onem2m-res+json'
         self.response = self.session.delete(self.url, timeout=self.timeout,
                                             headers=self.headers)
-        return self.response
 
     def tree(self):
         """Get the resource tree."""
         self.url = self.server + op_tree
         self.response = self.session.get(self.url)
-        return self.response
 
     def kill(self):
         """Kill the tree."""
         self.url = self.server + op_cleanup
         self.response = self.session.post(self.url)
-        return self.response
index 804f9db376f0736322e3d1fecb45ce21b9cff09f..85bb13719a41ffb35f839d2477ea016a506fd700 100644 (file)
@@ -8,75 +8,78 @@ def connect_to_iotdm(host, user, password, prot):
         user, password), protocol=prot)
 
 
-def create_resource(connection, parent, restype, attribute=None, name=None):
+def modify_headers_origin(connection, new_origin):
+    """Replace the headers origin with the neworigin to test ACP."""
+    connection.modify_headers_origin(new_origin)
+
+
+def create_resource(connection, parent, restype, attribute=None):
     """Create resource without command."""
-    restype = int(restype)
-    response = connection.create(parent, restype, attribute, name=name)
-    Check_Response(response, "create")
-    return response
+    connection.create(parent, restype, attribute)
+    check_response(connection.response, "create")
+    return connection.response
 
 
 def create_resource_with_command(connection, parent, restype,
-                                 command, attribute=None, name=None):
+                                 command, attribute=None):
     """According to command in the header, create the resource."""
-    restype = int(restype)
-    response = connection.createWithCommand(parent, restype,
-                                            command, attribute, name=name)
-    Check_Response(response, "create")
-    return response
+    connection.create_with_command(parent, restype,
+                                   command, attribute)
+    check_response(connection.response, "create")
+    return connection.response
 
 
 def create_subscription(connection, parent, ip, port):
     """Create subscription."""
     uri = "http://%s:%d" % (ip, int(port))
-    response = connection.create(parent, "subscription", {
+    connection.create(parent, "subscription", {
         "notificationURI": uri,
         "notificationContentType": "wholeResource"})
-    Check_Response(response, "create")
-    return response
+    check_response(connection.response, "create")
+    return connection.response
 
 
 def retrieve_resource(connection, resid):
     """Retrieve resource according to resourceID."""
-    response = connection.retrieve(resid)
-    Check_Response(response, "retrieve")
-    return response
+    connection.retrieve(resid)
+    check_response(connection.response, "retrieve")
+    return connection.response
 
 
 def retrieve_resource_with_command(connection, resid, command):
     """According to command, retrieve source with the resourceID."""
-    response = connection.retrieveWithCommand(resid, command)
-    Check_Response(response, "retrieve")
-    return response
+    connection.retrieve_with_command(resid, command)
+    check_response(connection.response, "retrieve")
+    return connection.response
 
 
-def update_resource(connection, resid, restype, attr, nm=None):
+def update_resource(connection, resid, restype, attr):
     """According to resourceID, update resource."""
-    response = connection.update(resid, restype, attr, nm)
-    Check_Response(response, "update")
-    return response
+    connection.update(resid, restype, attr)
+    check_response(connection.response, "update")
+    return connection.response
 
 
 def update_resource_with_command(connection, resid,
-                                 restype, command, attr, nm=None):
+                                 restype, command, attr):
     """According to command, update resource with resourceID."""
-    response = connection.updateWithCommand(resid, restype, command, attr, nm)
-    Check_Response(response, "update")
-    return response
+    connection.update_with_command(resid, restype, command, attr)
+    check_response(connection.response, "update")
+    return connection.response
 
 
 def delete_resource(connection, resid):
     """According to resourceID, delete the resource."""
-    response = connection.delete(resid)
-    Check_Response(response, "delete")
-    return response
+    connection.delete(resid)
+    check_response(connection.response, "delete")
+    return connection.response
 
 
 def delete_resource_with_command(connection, resid, command):
     """According to command, delete the resource with resourceID."""
-    response = connection.deleteWithCommand(resid, command)
-    Check_Response(response, "delete")
-    return response
+    connection.delete_with_command(resid, command)
+    check_response(connection.response, "delete")
+    return connection.response
 
 
 def resid(response):
@@ -86,10 +89,10 @@ def resid(response):
 
 def name(response):
     """Return resourceName."""
-    resourceName = ciotdm.name(response)
-    if resourceName is None:
+    resource_name = ciotdm.name(response)
+    if resource_name is None:
         raise AssertionError('Cannot find this resource')
-    return resourceName
+    return resource_name
 
 
 def text(response):
@@ -97,7 +100,7 @@ def text(response):
     return response.text
 
 
-def lastModifiedTime(response):
+def last_modified_time(response):
     """Return resource lastModifiedTime."""
     return ciotdm.lastModifiedTime(response)
 
@@ -117,14 +120,19 @@ def elapsed(response):
     return response.elapsed.total_seconds()
 
 
-def kill_the_tree(host, CSEID, username, password):
+def location(response):
+    """Return response content-location."""
+    return response.headers['Content-Location']
+
+
+def kill_the_tree(host, cseid, username, password):
     """Delete the whole tree."""
-    connection = ciotdm.connect(host, base=CSEID,
+    connection = ciotdm.connect(host, base=cseid,
                                 auth=(username, password), protocol="http")
     connection.kill()
 
 
-def Check_Response(response, operation):
+def check_response(response, operation):
     """Check whether the connection is none."""
     if response is None:
         raise AssertionError('Cannot %s this resource') % (operation)
index 010ba0cdbdc44723e4ad4d5385a395f9dea2c01c..f460cbb62c9b28ffd08bbb52dea699730c61b5b8 100644 (file)
@@ -23,41 +23,40 @@ Set Suite Variable
 
 1.11 Valid Input for AE without name
     [Documentation]    Valid Input for AE without name
-    ${attr} =    Set Variable    "aei":"ODL","api":"jb","apn":"jb2","or":"http://hey/you"
+    ${attr} =    Set Variable    "api":"jb","apn":"jb2","or":"http://hey/you","rr":true
     ${r} =    Create Resource    ${iserver}    InCSE1    ${rt_ae}    ${attr}
     Response Is Correct    ${r}
 
 1.12 Valid Input for AE with name
-    ${attr} =    Set Variable    "aei":"ODL","api":"jb","apn":"jb2","or":"http://hey/you"
-    ${r} =    Create Resource    ${iserver}    InCSE1    ${rt_ae}    ${attr}    ODL3
+    ${attr} =    Set Variable    "api":"jb","apn":"jb2","or":"http://hey/you","rr":true,"rn":"ODL3"
+    ${r} =    Create Resource    ${iserver}    InCSE1    ${rt_ae}    ${attr}
     Response Is Correct    ${r}
 
 1.13 Invalid Input for AE with name Already Exist, should return error
     [Documentation]    Invalid Input for AE with name Already Exist, should return error
-    ${attr} =    Set Variable    "aei":"ODL","api":"jb","apn":"jb2","or":"http://hey/you"
+    ${attr} =    Set Variable    "api":"jb","apn":"jb2","or":"http://hey/you","rr":true,"rn":"ODL3"
     ${error} =    Run Keyword And Expect Error    *    Create Resource    ${iserver}    InCSE1    ${rt_ae}
-    ...    ${attr}    ODL3
+    ...    ${attr}
     Should Start with    ${error}    Cannot create this resource [409]
 
 1.14 Invalid Input for AE (AE cannot be created under AE)
     [Documentation]    Invalid Input for AE (AE cannot be created under AE), expect error
-    ${attr} =    Set Variable    "aei":"ODL","api":"jb","apn":"jb2","or":"http://hey/you"
+    ${attr} =    Set Variable    "api":"jb","apn":"jb2","or":"http://hey/you","rr":true,"rn":"ODL4"
     ${error} =    Run Keyword And Expect Error    *    Create Resource    ${iserver}    InCSE1/ODL3    ${rt_ae}
-    ...    ${attr}    ODL4
+    ...    ${attr}
     Should Start with    ${error}    Cannot create this resource [405]
     # -----------------    Update and Retrieve -------------
 
 1.15 Valid Update AE's label
     [Documentation]    Valid Update AE's label
     ${attr} =    Set Variable    "lbl":["aaa","bbb","ccc"]
-    ${r} =    Update Resource    ${iserver}    InCSE1/ODL3    2    ${attr}
-    ${ae} =    Name    ${r}
+    ${r} =    Update Resource    ${iserver}    InCSE1/ODL3    ${rt_ae}    ${attr}
     Response Is Correct    ${r}
     # Retrieve and test the lbl
-    ${r} =    Retrieve Resource    ${iserver}    ${ae}
+    ${r} =    Retrieve Resource    ${iserver}    InCSE1/ODL3
     ${Json} =    Text    ${r}
     Should Contain    ${Json}    "aaa"    "bbb"    "ccc"
-    Should Contain    ${r.json()['lbl']}    aaa    bbb    ccc
+    Should Contain    ${r.json()['m2m:ae']['lbl']}    aaa    bbb    ccc
     #==================================================
     #    Container Test
     #==================================================
@@ -69,33 +68,31 @@ Set Suite Variable
 
 2.12 Create Container under AE with name
     [Documentation]    Invalid Input for Container Under AE with name (Already exist)
-    ${attr} =    Set Variable    "cr":null,"mni":1,"mbs":15,"or":"http://hey/you"
-    ${r} =    Create Resource    ${iserver}    InCSE1/ODL3    ${rt_container}    ${attr}    containerUnderAE
-    ${container} =    Name    ${r}
+    ${attr} =    Set Variable    "cr":null,"mni":1,"mbs":15,"or":"http://hey/you","rn":"containerUnderAE"
+    ${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    ${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)
-    ${attr} =    Set Variable    "cr":null,"mni":1,"mbs":15,"or":"http://hey/you"
+    ${attr} =    Set Variable    "cr":null,"mni":1,"mbs":15,"or":"http://hey/you","rn":"containerUnderAE"
     ${error} =    Run Keyword And Expect Error    *    Connect And Create Resource    InCSE1/ODL3    ${rt_container}    ${attr}
-    ...    containerUnderAE
     Should Start with    ${error}    Cannot create this resource [409]
 
 2.14 Update Container Label
     [Documentation]    Update Label to ["aaa","bbb","ccc"]
     ${attr} =    Set Variable    "lbl":["aaa","bbb","ccc"]
     ${r} =    Update Resource    ${iserver}    InCSE1/ODL3/containerUnderAE    ${rt_container}    ${attr}
-    ${container} =    Name    ${r}
     Response Is Correct    ${r}
     # Retrieve and test the lbl
-    ${r} =    Retrieve Resource    ${iserver}    ${container}
+    ${r} =    Retrieve Resource    ${iserver}    InCSE1/ODL3/containerUnderAE
     ${Json} =    Text    ${r}
     Should Contain    ${Json}    "aaa"    "bbb"    "ccc"
-    Should Contain    ${r.json()['lbl']}    aaa    bbb    ccc
+    Should Contain    ${r.json()['m2m:cnt']['lbl']}    aaa    bbb    ccc
     #----------------------------------------------------------------------
 
 2.21 Create Container under InCSE1 without name
@@ -106,32 +103,31 @@ Set Suite Variable
 
 2.22 Create Container under CSE with name
     [Documentation]    Create Container under CSE with name
-    ${attr} =    Set Variable    "cr":null,"mni":1,"mbs":15,"or":"http://hey/you"
-    ${r} =    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}    containerUnderCSE
+    ${attr} =    Set Variable    "cr":null,"mni":1,"mbs":15,"or":"http://hey/you","rn":"containerUnderCSE"
+    ${r} =    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}
     Response Is Correct    ${r}
     # retrieve it
     ${result} =    Retrieve Resource    ${iserver}    InCSE1/containerUnderCSE
     ${text} =    Text    ${result}
-    Should Contain    ${text}    "contaienrUnderCSE"
+    Should Contain    ${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)
-    ${attr} =    Set Variable    "cr":null,"mni":1,"mbs":15,"or":"http://hey/you"
+    ${attr} =    Set Variable    "cr":null,"mni":1,"mbs":15,"or":"http://hey/you","rn":"containerUnderCSE"
     ${error} =    Run Keyword And Expect Error    *    Create Resource    ${iserver}    InCSE1    ${rt_container}
-    ...    ${attr}    containerUnderCSE
+    ...    ${attr}
     Should Start with    ${error}    Cannot create this resource [409]
 
 2.24 Update Container Label
     [Documentation]    Update Container Label
     ${attr} =    Set Variable    "lbl":["aaa","bbb","ccc"]
     ${r} =    Update Resource    ${iserver}    InCSE1/containerUnderCSE    ${rt_container}    ${attr}
-    ${container} =    Name    ${r}
     Response Is Correct    ${r}
     # Retrieve and test the lbl
-    ${r} =    Retrieve Resource    ${iserver}    ${container}
+    ${r} =    Retrieve Resource    ${iserver}    InCSE1/containerUnderCSE
     ${Json} =    Text    ${r}
     Should Contain    ${Json}    "aaa"    "bbb"    "ccc"
-    Should Contain    ${r.json()['lbl']}    aaa    bbb    ccc
+    Should Contain    ${r.json()['m2m:cnt']['lbl']}    aaa    bbb    ccc
     #----------------------------------------------------------------------
 
 2.31 Create Container under Container without name
@@ -142,20 +138,20 @@ Set Suite Variable
 
 2.32 Create Container under Container with name
     [Documentation]    Create Container under Container with name
-    ${attr} =    Set Variable    "cr":null,"mni":1,"mbs":15,"or":"http://hey/you"
-    ${r} =    Create Resource    ${iserver}    InCSE1/containerUnderCSE    ${rt_container}    ${attr}    containerUnderContainer
-    ${container} =    Name    ${r}
+    ${attr} =    Set Variable    "cr":null,"mni":1,"mbs":15,"or":"http://hey/you","rn":"containerUnderContainer"
+    ${r} =    Create Resource    ${iserver}    InCSE1/containerUnderCSE    ${rt_container}    ${attr}
+    ${container} =    Location    ${r}
     Response Is Correct    ${r}
     # retrieve it
     ${result} =    Retrieve Resource    ${iserver}    ${container}
     ${text} =    Text    ${result}
-    Should Contain    ${text}    "containerUnderContainer"
+    Should Contain    ${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)
-    ${attr} =    Set Variable    "cr":null,"mni":1,"mbs":15,"or":"http://hey/you"
+    ${attr} =    Set Variable    "cr":null,"mni":1,"mbs":15,"or":"http://hey/you","rn":"containerUnderContainer"
     ${error} =    Run Keyword And Expect Error    *    Create Resource    ${iserver}    InCSE1/containerUnderCSE    ${rt_container}
-    ...    ${attr}    containerUnderContainer
+    ...    ${attr}
     Should Start with    ${error}    Cannot create this resource [409]
 
 2.34 Update Container Label
@@ -167,13 +163,13 @@ Set Suite Variable
     ${r} =    Retrieve Resource    ${iserver}    InCSE1/containerUnderCSE/containerUnderContainer
     ${Json} =    Text    ${r}
     Should Contain    ${Json}    "aaa"    "bbb"    "ccc"
-    Should Contain    ${r.json()['lbl']}    aaa    bbb    ccc
+    Should Contain    ${r.json()['m2m:cnt']['lbl']}    aaa    bbb    ccc
 
-2.41 Invalid Input for AE under container withoutname(mess up layer)
+2.41 Invalid Input for AE under container with name(mess up layer)
     [Documentation]    Invalid Input for AE under container withoutname(mess up layer)
-    ${attr} =    Set Variable    "aei":"ODL","api":"jb","apn":"jb2","or":"http://hey/you"
+    ${attr} =    Set Variable    "api":"jb","apn":"jb2","or":"http://hey/you","rr":true,"rn":"ODL4"
     ${error} =    Run Keyword And Expect Error    *    Create Resource    ${iserver}    InCSE1/containerUnderCSE    ${rt_ae}
-    ...    ${attr}    ODL4
+    ...    ${attr}
     Should Start with    ${error}    Cannot create this resource [405]
     Should Contain    ${error}    Cannot create AE under this resource type: 3
     #==================================================
@@ -188,8 +184,8 @@ Set Suite Variable
 
 3.12 Valid contentInstance under CSEBase/container with name
     [Documentation]    Valid contentInstance under CSEBase/container with name
-    ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"102"
-    ${r} =    Create Resource    ${iserver}    InCSE1/containerUnderCSE    ${rt_contentInstance}    ${attr}    conIn1
+    ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"102","rn":"conIn1"
+    ${r} =    Create Resource    ${iserver}    InCSE1/containerUnderCSE    ${rt_contentInstance}    ${attr}
     Response Is Correct    ${r}
 
 3.13 Invalid contentInstance under CSEBase
@@ -218,7 +214,7 @@ Set Suite Variable
 
 3.16 Invalid AE under contentInstance
     [Documentation]    Invalid AE under contentInstance
-    ${attr} =    Set Variable    "aei":"ODL","api":"jb","apn":"jb2","or":"http://hey/you"
+    ${attr} =    Set Variable    "api":"jb","apn":"jb2","or":"http://hey/you","rr":true
     ${error} =    Run Keyword And Expect Error    *    Create Resource    ${iserver}    InCSE1/containerUnderCSE/conIn1    ${rt_ae}
     ...    ${attr}
     Should Start with    ${error}    Cannot create this resource [405]
@@ -237,9 +233,9 @@ Set Suite Variable
 
 4.11 Delete AE without child resource
     [Documentation]    Delete AE without child resource
-    ${attr} =    Set Variable    "aei":"ODL","api":"jb","apn":"jb2","or":"http://hey/you"
+    ${attr} =    Set Variable    "api":"jb","apn":"jb2","or":"http://hey/you","rr":true
     ${r} =    Create Resource    ${iserver}    InCSE1    ${rt_ae}    ${attr}
-    ${ae} =    Name    ${r}
+    ${ae} =    Location    ${r}
     Response Is Correct    ${r}
     ${deleteRes} =    Delete Resource    ${iserver}    ${ae}
     ${status_code} =    Status Code    ${deleteRes}
@@ -252,7 +248,7 @@ Set Suite Variable
     [Documentation]    Delete Container without child resource
     ${attr} =    Set Variable    "cr":null,"mni":1,"mbs":15,"or":"http://hey/you"
     ${r} =    Create Resource    ${iserver}    InCSE1/ODL3    ${rt_container}    ${attr}
-    ${container} =    Name    ${r}
+    ${container} =    Location    ${r}
     Response Is Correct    ${r}
     ${deleteRes} =    Delete Resource    ${iserver}    ${container}
     ${status_code} =    Status Code    ${deleteRes}
@@ -268,10 +264,10 @@ Delete the Container Under CSEBase
 
 *** Keywords ***
 Connect And Create Resource
-    [Arguments]    ${targetURI}    ${resoutceType}    ${attr}    ${resourceName}=${EMPTY}
+    [Arguments]    ${targetURI}    ${resoutceType}    ${attr}
     ${iserver} =    Connect To Iotdm    ${httphost}    ${httpuser}    ${httppass}    http
-    ${r} =    Create Resource    ${iserver}    ${targetURI}    ${resoutceType}    ${attr}    ${resourceName}
-    ${container} =    Name    ${r}
+    ${r} =    Create Resource    ${iserver}    ${targetURI}    ${resoutceType}    ${attr}
+    ${container} =    Resid    ${r}
     ${status_code} =    Status Code    ${r}
     Should Be Equal As Integers    ${status_code}    201
 
index 6b02a85079c7b3d18e5900984014deebe2302a67..e10fbb221a80a51a81406929d61da8cf2a651807 100644 (file)
@@ -21,31 +21,31 @@ Set Suite Variable
     #==================================================
     # For Creation, there are only 2 mandatory attribute: App-ID(api), AE-ID(aei)
 
-1.11 Missing App-ID should return error
+1.11 If include AE-ID should return error
     [Documentation]    when create AE, Missing App-ID should return error
     ${attr} =    Set Variable    "aei":"ODL"
     ${error} =    Run Keyword And Expect Error    *    Create Resource    ${iserver}    InCSE1    ${rt_ae}
     ...    ${attr}
     Should Start with    ${error}    Cannot create this resource [400]
-    Should Contain    ${error}    APP_ID missing parameter
+    Should Contain    ${error}    AE_ID
 
-1.21 Missing AE-ID should return error
+1.21 Missing App-ID should return error
     [Documentation]    when creete AE, Missing AE-ID should return error
-    ${attr} =    Set Variable    "api":"ODL"
+    ${attr} =    Set Variable    "apn":"ODL"
     ${error} =    Run Keyword And Expect Error    *    Create Resource    ${iserver}    InCSE1    ${rt_ae}
     ...    ${attr}
     Should Start with    ${error}    Cannot create this resource [400]
-    Should Contain    ${error}    AE_ID missing parameter
+    Should Contain    ${error}    APP_ID
 
 1.3 After Created, test whether all the mandatory attribtues are exist.
     [Documentation]    mandatory attributes should be there after created
-    ${attr} =    Set Variable    "api":"ODL","aei":"ODL"
-    ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_ae}    ${attr}    AE1
+    ${attr} =    Set Variable    "api":"ODL","rr":true,"rn":"AE1"
+    ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_ae}    ${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":"ODL"    "lt":    "pi":
+    Should Contain    ${text}    "aei":    "lt":    "pi":
     Should Contain    ${text}    "ct":    "rty":2
     Should Not Contain    S{text}    "lbl"    "apn"    "or"
     # 1.13    if Child Container updated, parent Last Modified time will be updated?
@@ -152,31 +152,30 @@ Set Suite Variable
 
 3.11 Mulitiple App-ID should return error
     [Documentation]    Mulitiple App-ID should return error
-    ${attr} =    Set Variable    "aei":"ODL","api":"ODL","api":"ODL2"
+    ${attr} =    Set Variable    "api":"ODL","api":"ODL2"
     ${error} =    Cannot Update AE Error    ${attr}
     Should Contain    ${error}    Duplicate key    api
 
 3.12 Mulitiple AE-ID should return error
     [Documentation]    Mulitiple AE-ID should return error
-    ${attr} =    Set Variable    "aei":"ODL","api":"ODL","aei":"ODL1"
+    ${attr} =    Set Variable    "api":"ODL","aei":"ODL1"
     ${error} =    Cannot Update AE Error    ${attr}
-    Should Contain    ${error}    Duplicate key    aei
 
 3.13 Multiple app-name should return error
     [Documentation]    Multiple app-name should return error
-    ${attr} =    Set Variable    "aei":"ODL","api":"ODL","apn":"ODL1","apn":"ODL1"
+    ${attr} =    Set Variable    "api":"ODL","apn":"ODL1","apn":"ODL1"
     ${error} =    Cannot Update AE Error    ${attr}
     Should Contain    ${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    "aei":"ODL","api":"ODL","lbl":["ODL1"], "lbl":["dsdsd"]
+    ${attr} =    Set Variable    "api":"ODL","lbl":["ODL1"], "lbl":["dsdsd"]
     ${error} =    Cannot Update AE Error    ${attr}
     Should Contain    ${error}    Duplicate key    lbl
 
 3.15 Multiple ontologyRef attribute should return error
     [Documentation]    Multiple ontologyRef attribute should return error
-    ${attr} =    Set Variable    "aei":"ODL","api":"ODL","or":"http://hey/you", "or":"http://hey/you"
+    ${attr} =    Set Variable    "api":"ODL","or":"http://hey/you", "or":"http://hey/you"
     ${error} =    Cannot Update AE Error    ${attr}
     Should Contain    ${error}    Duplicate key    or
 
@@ -250,8 +249,6 @@ Set Suite Variable
 4.1 if updated seccessfully, lastModifiedTime must be modified.
     [Documentation]    if updated seccessfully, lastModifiedTime must be modified.
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/AE1
-    ${text} =    Text    ${oldr}
-    LOG    ${text}
     ${lt1} =    LastModifiedTime    ${oldr}
     ${attr} =    Set Variable    "lbl":["aaa"]
     Sleep    1s
@@ -259,17 +256,15 @@ Set Suite Variable
     # 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}
-    ${text} =    Text    ${r}
-    LOG    ${text}
     ${lt2} =    LastModifiedTime    ${r}
-    Should Not Be Equal    ${oldr.json()['lt']}    ${lt2}
+    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()['ri']}
+    ${CSEID} =    Set Variable    ${oldr.json()['m2m:cb']['ri']}
     ${r} =    Retrieve Resource    ${iserver}    InCSE1/AE1
-    Should Be Equal    ${oldr.json()['ri']}    ${r.json()['pi']}
+    Should Be Equal    /InCSE1/${oldr.json()['m2m:cb']['ri']}    ${r.json()['m2m:ae']['pi']}
     #==================================================
     #    Finish
     #==================================================
index 7dece440f237e73a4291d3ada87c2a9510f66c16..a8aec5a3c5718083c9f6539935605a6a0e10770e 100644 (file)
@@ -23,16 +23,18 @@ 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
-    ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}    Container1
-    ${container} =    Name    ${r}
+    ${attr} =    Set Variable    "rn":"Container1"
+    ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${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 Contain    ${text}    "ct":    "ty":3    "cbs"
     Should Not Contain    S{text}    "lbl"    "creator"    "or"
+
+
     #==================================================
     #    Container Optional Attribute Test (Allowed)
     #==================================================
@@ -41,8 +43,8 @@ Set Suite Variable
 
 2.11 maxNumberofInstance (mni) can be added when create
     [Documentation]    maxNumberofInstance (mni) can be added when create
-    ${attr} =    Set Variable    "mni":3
-    ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}    Container2
+    ${attr} =    Set Variable    "mni":3,"rn":"Container2"
+    ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}
     ${text} =    Check Response and Retrieve Resource    ${r}
     Should Contain    ${text}    "mni"
 
@@ -53,14 +55,14 @@ Delete the Container2-2.1
     [Documentation]    maxNumberofInstance (mni) can be added through update (0-1)
     ${attr} =    Set Variable    "mni":3
     ${r} =    update Resource    ${iserver}    InCSE1/Container1    ${rt_container}    ${attr}
-    ${text} =    Check Response and Retrieve Resource    ${r}
+    ${text} =    Check Response and Retrieve Resource For Update    ${r}    InCSE1/Container1
     Should Contain    ${text}    "mni"
 
 2.13 maxNumberofInstance (mni) can be modified through update (1-1)
     [Documentation]    maxNumberofInstance (mni) can be modified through update (1-1)
     ${attr} =    Set Variable    "mni":5
     ${r} =    update Resource    ${iserver}    InCSE1/Container1    ${rt_container}    ${attr}
-    ${text} =    Check Response and Retrieve Resource    ${r}
+    ${text} =    Check Response and Retrieve Resource For Update    ${r}    InCSE1/Container1
     Should Contain    ${text}    "mni":5
     Should Not Contain    ${text}    "mni":3
 
@@ -68,13 +70,13 @@ Delete the Container2-2.1
     [Documentation]    if set to null, maxnumberofInstance (mni) can be deleted through delete(1-0)
     ${attr} =    Set Variable    "mni":null
     ${r} =    update Resource    ${iserver}    InCSE1/Container1    ${rt_container}    ${attr}
-    ${text} =    Check Response and Retrieve Resource    ${r}
+    ${text} =    Check Response and Retrieve Resource For Update    ${r}    InCSE1/Container1
     Should Not Contain    ${text}    "mni"
 
 2.21 maxByteSize (mbs) can be added when create
     [Documentation]    maxByteSize (mbs) can be added when create
-    ${attr} =    Set Variable    "mbs":20
-    ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}    Container2
+    ${attr} =    Set Variable    "mbs":20,"rn":"Container2"
+    ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}
     ${text} =    Check Response and Retrieve Resource    ${r}
     Should Contain    ${text}    "mbs"
 
@@ -85,14 +87,14 @@ Delete the Container2-2.2
     [Documentation]    maxByteSize (mbs) can be added through update (0-1)
     ${attr} =    Set Variable    "mbs":20
     ${r} =    update Resource    ${iserver}    InCSE1/Container1    ${rt_container}    ${attr}
-    ${text} =    Check Response and Retrieve Resource    ${r}
+    ${text} =    Check Response and Retrieve Resource For Update    ${r}    InCSE1/Container1
     Should Contain    ${text}    "mbs"
 
 2.23 maxByteSize (mbs) can be modified through update (1-1)
     [Documentation]    maxByteSize (mbs) can be modified through update (1-1)
     ${attr} =    Set Variable    "mbs":25
     ${r} =    update Resource    ${iserver}    InCSE1/Container1    ${rt_container}    ${attr}
-    ${text} =    Check Response and Retrieve Resource    ${r}
+    ${text} =    Check Response and Retrieve Resource For Update    ${r}    InCSE1/Container1
     Should Contain    ${text}    "mbs":25
     Should Not Contain    ${text}    "mbs":20
 
@@ -100,14 +102,14 @@ Delete the Container2-2.2
     [Documentation]    if set to null, maxByteSize (mbs) can be deleted through delete(1-0)
     ${attr} =    Set Variable    "mbs":null
     ${r} =    update Resource    ${iserver}    InCSE1/Container1    ${rt_container}    ${attr}
-    ${text} =    Check Response and Retrieve Resource    ${r}
+    ${text} =    Check Response and Retrieve Resource For Update    ${r}    InCSE1/Container1
     Should Not Contain    ${text}    "mbs"
 
 2.31 ontologyRef(or) can be added when create
     [Documentation]    ontologyRef(or) can be added when create
-    ${attr} =    Set Variable    "or":"http://cisco.com"
-    ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}    Container2
-    ${text} =    Check Response and Retrieve Resource    ${r}
+    ${attr} =    Set Variable    "or":"http://cisco.com","rn":"Container2"
+    ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}
+    ${text} =    Check Response and Retrieve Resource For Update    ${r}    InCSE1/Container2
     Should Contain    ${text}    "or"
 
 Delete the Container2-2.3
@@ -117,14 +119,14 @@ Delete the Container2-2.3
     [Documentation]    ontologyRef(or) can be added through update (0-1)
     ${attr} =    Set Variable    "or":"http://cisco.com"
     ${r} =    update Resource    ${iserver}    InCSE1/Container1    ${rt_container}    ${attr}
-    ${text} =    Check Response and Retrieve Resource    ${r}
+    ${text} =    Check Response and Retrieve Resource For Update    ${r}    InCSE1/Container1
     Should Contain    ${text}    "or"
 
 2.33 ontologyRef(or) can be modified through update (1-1)
     [Documentation]    ontologyRef(or) can be modified through update (1-1)
     ${attr} =    Set Variable    "or":"http://iotdm.com"
     ${r} =    update Resource    ${iserver}    InCSE1/Container1    ${rt_container}    ${attr}
-    ${text} =    Check Response and Retrieve Resource    ${r}
+    ${text} =    Check Response and Retrieve Resource For Update    ${r}    InCSE1/Container1
     Should Contain    ${text}    "or":"http://iotdm.com"
     Should Not Contain    ${text}    "or":"http://cisco.com"
 
@@ -132,21 +134,21 @@ Delete the Container2-2.3
     [Documentation]    if set to null, ontologyRef(or) can be deleted through delete(1-0)
     ${attr} =    Set Variable    "or":null
     ${r} =    update Resource    ${iserver}    InCSE1/Container1    ${rt_container}    ${attr}
-    ${text} =    Check Response and Retrieve Resource    ${r}
+    ${text} =    Check Response and Retrieve Resource For Update    ${r}    InCSE1/Container1
     Should Not Contain    ${text}    "or"
 
 2.41 labels can be created through update (0-1)
     [Documentation]    labels can be created through update (0-1)
     ${attr} =    Set Variable    "lbl":["label1"]
     ${r} =    update Resource    ${iserver}    InCSE1/Container1    ${rt_container}    ${attr}
-    ${text} =    Check Response and Retrieve Resource    ${r}
+    ${text} =    Check Response and Retrieve Resource For Update    ${r}    InCSE1/Container1
     Should Contain    ${text}    lbl    label1
 
 2.42 labels can be modified (1-1)
     [Documentation]    labels can be modified (1-1)
     ${attr} =    Set Variable    "lbl":["label2"]
     ${r} =    update Resource    ${iserver}    InCSE1/Container1    ${rt_container}    ${attr}
-    ${text} =    Check Response and Retrieve Resource    ${r}
+    ${text} =    Check Response and Retrieve Resource For Update    ${r}    InCSE1/Container1
     Should Not Contain    ${text}    label1
     Should Contain    ${text}    lbl    label2
 
@@ -154,14 +156,14 @@ Delete the Container2-2.3
     [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    ${r}
+    ${text} =    Check Response and Retrieve Resource For Update    ${r}    InCSE1/Container1
     Should Not Contain    ${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    ${r}
+    ${text} =    Check Response and Retrieve Resource For Update    ${r}    InCSE1/Container1
     Should Contain    ${text}    lbl    label3    label4
     Should Contain    ${text}    label5
 
@@ -169,7 +171,7 @@ Delete the Container2-2.3
     [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    ${r}
+    ${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
@@ -178,7 +180,7 @@ Delete the Container2-2.3
     [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    ${r}
+    ${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
@@ -188,7 +190,7 @@ Delete the Container2-2.3
     [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    ${r}
+    ${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
@@ -320,8 +322,6 @@ Delete the Container2-2.3
 4.11 if updated seccessfully, lastModifiedTime must be modified.
     [Documentation]    if updated seccessfully, lastModifiedTime must be modified.
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container1
-    ${text} =    Text    ${oldr}
-    LOG    ${text}
     ${lt1} =    LastModifiedTime    ${oldr}
     ${attr} =    Set Variable    "lbl":["aaa"]
     Sleep    1s
@@ -330,60 +330,56 @@ Delete the Container2-2.3
     # 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()['lt']}    ${lt2}
+    Should Not Be Equal    ${oldr.json()['m2m:cnt']['lt']}    ${lt2}
 
 4.12 childResources create , parent's lastmodifiedTime update
     [Documentation]    childResources create , parent's lastmodifiedTime update
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container1
-    ${text} =    Text    ${oldr}
-    LOG    ${text}
     ${lt1} =    LastModifiedTime    ${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"
-    ${r} =    Create Resource    ${iserver}    InCSE1/Container1    ${rt_contentInstance}    ${attr}    conIn1
+    ${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()['lt']}    ${lt2}
+    Should Not Be Equal    ${oldr.json()['m2m:cnt']['lt']}    ${lt2}
     #-------------- 2 parentID ------------
 
 4.21 Check parentID(cse-container)
     [Documentation]    parentID should be InCSE1
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1
-    ${CSEID} =    Set Variable    ${oldr.json()['ri']}
+    ${CSEID} =    Set Variable    ${oldr.json()['m2m:cb']['ri']}
     ${r} =    Retrieve Resource    ${iserver}    InCSE1/Container1
-    Should Be Equal    ${oldr.json()['ri']}    ${r.json()['pi']}
+    Should Be Equal    /InCSE1/${oldr.json()['m2m:cb']['ri']}    ${r.json()['m2m:cnt']['pi']}
 
 4.22 Check parentID(cse-container-container)
     [Documentation]    parentID should be correct
     # CSE
     #    |--Contianer1
     #    |--Container2
-    ${attr} =    Set Variable
-    ${r}=    Create Resource    ${iserver}    InCSE1/Container1    ${rt_container}    ${attr}    Container2
-    ${container} =    Name    ${r}
+    ${attr} =    Set Variable    "rn":"Container2"
+    ${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()['ri']}
+    ${CSEID} =    Set Variable    ${oldr.json()['m2m:cnt']['ri']}
     ${r} =    Retrieve Resource    ${iserver}    InCSE1/Container1/Container2
-    Should Be Equal    ${oldr.json()['ri']}    ${r.json()['pi']}
+    Should Be Equal    /InCSE1/${oldr.json()['m2m:cnt']['ri']}    ${r.json()['m2m:cnt']['pi']}
 
 4.23 Check parentID(cse-AE-container)
     [Documentation]    parentID should be correct
     # CSE
     #    |--AE1
     #    |--Container2
-    ${attr} =    Set Variable    "api":"ODL","aei":"ODL"
-    ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_ae}    ${attr}    AE1
-    ${attr} =    Set Variable
-    ${r}=    Create Resource    ${iserver}    InCSE1/AE1    ${rt_container}    ${attr}    Container2
-    ${container} =    Name    ${r}
+    ${attr} =    Set Variable    "api":"ODL","apn":"ODL","rr":true,"rn":"AE1"
+    ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_ae}    ${attr}
+    ${attr} =    Set Variable    "rn":"Container2"
+    ${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()['ri']}
+    ${CSEID} =    Set Variable    ${oldr.json()['m2m:ae']['ri']}
     ${r} =    Retrieve Resource    ${iserver}    InCSE1/AE1/Container2
-    Should Be Equal    ${oldr.json()['ri']}    ${r.json()['pi']}
+    Should Be Equal    /InCSE1/${oldr.json()['m2m:ae']['ri']}    ${r.json()['m2m:cnt']['pi']}
 
 4.24 Check parentID(cse-AE-container-container)
     [Documentation]    parentID should be correct
@@ -391,14 +387,13 @@ Delete the Container2-2.3
     #    |--AE1
     #    |--Container2
     #    |--- Container3
-    ${attr} =    Set Variable
-    ${r}=    Create Resource    ${iserver}    InCSE1/AE1/Container2    ${rt_container}    ${attr}    Container3
-    ${container} =    Name    ${r}
+    ${attr} =    Set Variable    "rn":"Container3"
+    ${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()['ri']}
+    ${CSEID} =    Set Variable    ${oldr.json()['m2m:cnt']['ri']}
     ${r} =    Retrieve Resource    ${iserver}    InCSE1/AE1/Container2/Container3
-    Should Be Equal    ${oldr.json()['ri']}    ${r.json()['pi']}
+    Should Be Equal    /InCSE1/${oldr.json()['m2m:cnt']['ri']}    ${r.json()['m2m:cnt']['pi']}
 
 Delete the test AE-4.2
     ${deleteRes} =    Delete Resource    ${iserver}    InCSE1/AE1
@@ -408,12 +403,12 @@ Delete the test AE-4.2
     [Documentation]    when create, st should be 0
     # CSE
     #    |--Container2
-    ${attr} =    Set Variable
-    ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}    Container2
-    ${container} =    Name    ${r}
+    ${attr} =    Set Variable    "rn":"Container2"
+    ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}
+    ${container} =    Location    ${r}
     ${status_code} =    Status Code    ${r}
-    ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    ${st} =    Set Variable    ${oldr.json()['st']}
+    ${oldr} =    Retrieve Resource    ${iserver}    ${container}
+    ${st} =    Set Variable    ${oldr.json()['m2m:cnt']['st']}
     Should Be Equal As Integers    0    ${st}
     # 4.32 stateTag (when update expirationTime)
     # 4.33 stateTag (when update accessControlPolicyIDs)
@@ -421,7 +416,7 @@ Delete the test AE-4.2
 4.34 stateTag (when update labels) + lastModifiedTime
     [Documentation]    st and lt should be changed
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    ${oldst} =    Set Variable    ${oldr.json()['st']}
+    ${oldst} =    Set Variable    ${oldr.json()['m2m:cnt']['st']}
     ${attr} =    Set Variable    "lbl":["label1"]
     Sleep    1s
     # We know Beryllium is going to be get rid of all sleep.
@@ -429,15 +424,15 @@ 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()['st']}
-    Should Not Be Equal    ${oldr.json()['lt']}    ${r.json()['lt']}
+    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']}
     # 4.35 stateTag (when update announceTo)
     # 4.36 stateTag (when update announceAttribute)
 
 4.37 stateTag (when update MaxNrOfInstances) + lastModifiedTime
     [Documentation]    st and lt should be changed
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    ${oldst} =    Set Variable    ${oldr.json()['st']}
+    ${oldst} =    Set Variable    ${oldr.json()['m2m:cnt']['st']}
     ${attr} =    Set Variable    "mni":5
     Sleep    1s
     # We know Beryllium is going to be get rid of all sleep.
@@ -445,13 +440,13 @@ 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()['st']}
-    Should Not Be Equal    ${oldr.json()['lt']}    ${r.json()['lt']}
+    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']}
 
 4.38 stateTag (when update MaxByteSize) + lastModifiedTime
     [Documentation]    st and lt should be changed
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    ${oldst} =    Set Variable    ${oldr.json()['st']}
+    ${oldst} =    Set Variable    ${oldr.json()['m2m:cnt']['st']}
     ${attr} =    Set Variable    "mbs":30
     Sleep    1s
     # We know Beryllium is going to be get rid of all sleep.
@@ -459,15 +454,15 @@ 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()['st']}
-    Should Not Be Equal    ${oldr.json()['lt']}    ${r.json()['lt']}
+    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']}
     # 4.39 stateTag (when update maxInstanceAge)
     # 4.310 stateTag (when update locationID)
 
 4.311 stateTag (when update ontologyRef) + lastModifiedTime
     [Documentation]    st and lt should be changed
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    ${oldst} =    Set Variable    ${oldr.json()['st']}
+    ${oldst} =    Set Variable    ${oldr.json()['m2m:cnt']['st']}
     ${attr} =    Set Variable    "or":"http://google.com"
     Sleep    1s
     # We know Beryllium is going to be get rid of all sleep.
@@ -475,8 +470,8 @@ 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()['st']}
-    Should Not Be Equal    ${oldr.json()['lt']}    ${r.json()['lt']}
+    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']}
 
 4.312 when create child container, stateTag will not increase + lastModifiedTime should change
     [Documentation]    when create child container, stateTag will not increase + lastModifiedTime should not change
@@ -484,18 +479,16 @@ Delete the test AE-4.2
     #    |--Contianer2
     #    |--Container3
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    ${oldst} =    Set Variable    ${oldr.json()['st']}
-    ${attr} =    Set Variable    "lbl":["label1"]
-    Sleep    1s
+    ${oldst} =    Set Variable    ${oldr.json()['m2m:cnt']['st']}
+    ${attr} =    Set Variable    "lbl":["label1"],"rn":"Container3"
+    Sleep    2s
     # 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}    Container3
+    Create Resource    ${iserver}    InCSE1/Container2    ${rt_container}    ${attr}
     ${r} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    ${text} =    Text    ${r}
-    LOG    ${text}
-    Should Be Equal As Integers    ${oldst}    ${r.json()['st']}
-    Should Not Be Equal    ${oldr.json()['lt']}    ${r.json()['lt']}
+    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']}
 
 4.313 * when create child contentInsntance, state should increase + lastModifiedTime shold change
     [Documentation]    when create child contentInsntance, state should increase + lastModifiedTime shold not change
@@ -503,18 +496,16 @@ Delete the test AE-4.2
     #    |--Contianer2
     #    |--ContentInstance
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    ${oldst} =    Set Variable    ${oldr.json()['st']}
+    ${oldst} =    Set Variable    ${oldr.json()['m2m:cnt']['st']}
     ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"102"
-    Sleep    1s
+    Sleep    2s
     # 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
-    ${text} =    Text    ${r}
-    LOG    ${text}
-    Should Be Equal As Integers    ${oldst+1}    ${r.json()['st']}
-    Should Not Be Equal    ${oldr.json()['lt']}    ${r.json()['lt']}
+    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']}
 
 4.314 stateTag should not be updated when update child container
     [Documentation]    stateTag should not be updated when update child container
@@ -522,7 +513,7 @@ Delete the test AE-4.2
     #    |--Contianer2
     #    |--Container3
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    ${oldst} =    Set Variable    ${oldr.json()['st']}
+    ${oldst} =    Set Variable    ${oldr.json()['m2m:cnt']['st']}
     ${attr} =    Set Variable    "lbl":["label45"]
     Sleep    1s
     # We know Beryllium is going to be get rid of all sleep.
@@ -530,11 +521,9 @@ 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
-    ${text} =    Text    ${r}
-    LOG    ${text}
-    Should Be Equal As Integers    ${oldst}    ${r.json()['st']}
+    Should Be Equal As Integers    ${oldst}    ${r.json()['m2m:cnt']['st']}
     ${lt2} =    LastModifiedTime    ${r}
-    Should Be Equal    ${oldr.json()['lt']}    ${r.json()['lt']}
+    Should Be Equal    ${oldr.json()['m2m:cnt']['lt']}    ${lt2}
 
 Delete the Container2-4.3
     ${deleteRes} =    Delete Resource    ${iserver}    InCSE1/Container2
@@ -542,44 +531,38 @@ Delete the Container2-4.3
 
 4.41 when container create, cni should be 0
     [Documentation]    when container create, cni should be 0
-    ${attr} =    Set Variable
-    ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}    Container2
-    ${container} =    Name    ${r}
+    ${attr} =    Set Variable    "rn":"Container2"
+    ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}
+    ${container} =    Location    ${r}
     ${status_code} =    Status Code    ${r}
-    ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    ${cni} =    Set Variable    ${oldr.json()['cni']}
+    ${oldr} =    Retrieve Resource    ${iserver}    ${container}
+    ${cni} =    Set Variable    ${oldr.json()['m2m:cnt']['cni']}
     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
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    ${oldcni} =    Set Variable    ${oldr.json()['cni']}
+    ${oldcni} =    Set Variable    ${oldr.json()['m2m:cnt']['cni']}
     ${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
-    ${text} =    Text    ${r}
-    LOG    ${text}
-    Should Be Equal As Integers    ${oldcni+1}    ${r.json()['cni']}
+    Should Be Equal As Integers    ${oldcni+1}    ${r.json()['m2m:cnt']['cni']}
     # Test again
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    ${oldcni} =    Set Variable    ${oldr.json()['cni']}
-    ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"102"
-    Create Resource    ${iserver}    InCSE1/Container2    ${rt_contentInstance}    ${attr}    contentIn1
+    ${oldcni} =    Set Variable    ${oldr.json()['m2m:cnt']['cni']}
+    ${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
-    ${text} =    Text    ${r}
-    LOG    ${text}
-    Should Be Equal As Integers    ${oldcni+1}    ${r.json()['cni']}
+    Should Be Equal As Integers    ${oldcni+1}    ${r.json()['m2m:cnt']['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()['cni']}
+    ${oldcni} =    Set Variable    ${oldr.json()['m2m:cnt']['cni']}
     ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"102"
     Delete Resource    ${iserver}    InCSE1/Container2/contentIn1
     ${r} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    ${text} =    Text    ${r}
-    LOG    ${text}
-    Should Be Equal As Integers    ${oldcni-1}    ${r.json()['cni']}
+    Should Be Equal As Integers    ${oldcni-1}    ${r.json()['m2m:cnt']['cni']}
 
 Delete the Container2-4.4
     ${deleteRes} =    Delete Resource    ${iserver}    InCSE1/Container2
@@ -587,44 +570,38 @@ Delete the Container2-4.4
 
 4.51 when container create, cbs should be 0
     [Documentation]    when container create, cbs should be 0
-    ${attr} =    Set Variable
-    ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}    Container2
-    ${container} =    Name    ${r}
+    ${attr} =    Set Variable    "rn":"Container2"
+    ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}
+    ${container} =    Location    ${r}
     ${status_code} =    Status Code    ${r}
-    ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    ${cbs} =    Set Variable    ${oldr.json()['cbs']}
+    ${oldr} =    Retrieve Resource    ${iserver}    ${container}
+    ${cbs} =    Set Variable    ${oldr.json()['m2m:cnt']['cbs']}
     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()['cbs']}
+    ${oldcbs} =    Set Variable    ${oldr.json()['m2m:cnt']['cbs']}
     ${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
-    ${text} =    Text    ${r}
-    LOG    ${text}
-    Should Be Equal As Integers    ${oldcbs+6}    ${r.json()['cbs']}
+    Should Be Equal As Integers    ${oldcbs+6}    ${r.json()['m2m:cnt']['cbs']}
     # Test again
     ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    ${oldcbs} =    Set Variable    ${oldr.json()['cbs']}
-    ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"xxx%%!@"
-    Create Resource    ${iserver}    InCSE1/Container2    ${rt_contentInstance}    ${attr}    contentIn1
+    ${oldcbs} =    Set Variable    ${oldr.json()['m2m:cnt']['cbs']}
+    ${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
-    ${text} =    Text    ${r}
-    LOG    ${text}
-    Should Be Equal As Integers    ${oldcbs+7}    ${r.json()['cbs']}
+    Should Be Equal As Integers    ${oldcbs+7}    ${r.json()['m2m:cnt']['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()['cbs']}
+    ${oldcbs} =    Set Variable    ${oldr.json()['m2m:cnt']['cbs']}
     ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"102"
     Delete Resource    ${iserver}    InCSE1/Container2/contentIn1
     ${r} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    ${text} =    Text    ${r}
-    LOG    ${text}
-    Should Be Equal As Integers    ${oldcbs-7}    ${r.json()['cbs']}
+    Should Be Equal As Integers    ${oldcbs-7}    ${r.json()['m2m:cnt']['cbs']}
 
 Delete the Container2-4.5
     ${deleteRes} =    Delete Resource    ${iserver}    InCSE1/Container2
@@ -632,51 +609,52 @@ Delete the Container2-4.5
 
 4.61 if maxNrOfInstance = 1 , can create 1 contentInstance
     [Documentation]    if maxNrOfInstance = 1 , can create 1 contentInstance
-    ${attr} =    Set Variable    "mni":1
-    ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}    Container2
-    ${container} =    Name    ${r}
+    ${attr} =    Set Variable    "mni":1,"rn":"Container2"
+    ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}
+    ${container} =    Location    ${r}
     ${status_code} =    Status Code    ${r}
-    ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    ${mni} =    Set Variable    ${oldr.json()['mni']}
+    ${oldr} =    Retrieve Resource    ${iserver}    ${container}
+    ${mni} =    Set Variable    ${oldr.json()['m2m:cnt']['mni']}
     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}
 
-4.62 if maxNrOfInstance = 1 , cannot create 2 contentInstance
+4.62 if maxNrOfInstance = 1 , when create 2 contentInstance, the first one should be deleted
     [Documentation]    if maxNrOfInstance = 1 , cannot create 2 contentInstance
     ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"102CSS"
     # cannot create 2
-    ${error} =    Run Keyword And Expect Error    *    Create Resource    ${iserver}    InCSE1/Container2    ${rt_contentInstance}
-    ...    ${attr}
-    Should Start with    ${error}    Cannot create this resource [400]
-
-4.63 if update to 3 , cannot create 4 contentInstance
+    ${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
+    ${childNumber} =    Get Length    ${chr}
+    Should Be Equal As Integers    ${childNumber}    1
+
+4.63 if update to 3 , when create 4 or more contentInstance, the current number instance should be 3
     [Documentation]    if update to 3 , cannot create 4 contentInstance
     ${attr} =    Set Variable    "mni":3
     ${r}=    Update Resource    ${iserver}    InCSE1/Container2    ${rt_container}    ${attr}
     ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"102CSS"
     # create 3
-    Create Resource    ${iserver}    InCSE1/Container2    ${rt_contentInstance}    ${attr}    cin1
-    Create Resource    ${iserver}    InCSE1/Container2    ${rt_contentInstance}    ${attr}    cin2
+    Create Resource    ${iserver}    InCSE1/Container2    ${rt_contentInstance}    ${attr}
+    Create Resource    ${iserver}    InCSE1/Container2    ${rt_contentInstance}    ${attr}
     #Create Resource    ${iserver}    InCSE1/Container2    ${rt_contentInstance}    ${attr}
     ${rr}=    Retrieve resource    ${iserver}    InCSE1/Container2
-    ${mni} =    Set Variable    ${rr.json()['mni']}
-    ${chr} =    Set Variable    ${rr.json()['ch']}
-    ${text} =    Text    ${rr}
-    LOG    ${text}
-    # cannot create 4
-    ${error} =    Run Keyword And Expect Error    *    Create Resource    ${iserver}    InCSE1/Container2    ${rt_contentInstance}
-    ...    ${attr}
-    Should Start with    ${error}    Cannot create this resource [400]
+    Create Resource    ${iserver}    InCSE1/Container2    ${rt_contentInstance}    ${attr}
+    ${mni} =    Set Variable    ${rr.json()['m2m:cnt']['mni']}
+    ${chr} =    Set Variable    ${rr.json()['m2m:cnt']['ch']}
+    Should Be Equal As Integers    ${mni}    3
 
-4.64 what if alread have 4, then set mni to 1 ?
-    [Documentation]    what if alread have 4, then set mni to 1 ?
+4.64 what if alread have 4, then set mni to 1
+    [Documentation]    if alread have 4, then set mni to 1, will delete 3 children
     ${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()['ch']}
-    ${mni} =    Set Variable    ${rr.json()['mni']}
-    Should Be Equal As Integers    ${rr.json()['cni']}    1
+    ${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
 
 Delete the Container2-4.6
     ${deleteRes} =    Delete Resource    ${iserver}    InCSE1/Container2
@@ -684,19 +662,17 @@ Delete the Container2-4.6
 
 4.71 if maxByteSize = 5 , can create contentInstance with contentSize 5
     [Documentation]    if maxByteSize = 5 , can create contentInstance with contentSize 5
-    ${attr} =    Set Variable    "mbs":5
-    ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}    Container2
-    ${container} =    Name    ${r}
+    ${attr} =    Set Variable    "mbs":5,"rn":"Container2"
+    ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}
+    ${container} =    Location    ${r}
     ${status_code} =    Status Code    ${r}
-    ${oldr} =    Retrieve Resource    ${iserver}    InCSE1/Container2
-    ${mbs} =    Set Variable    ${oldr.json()['mbs']}
+    ${oldr} =    Retrieve Resource    ${iserver}    ${container}
+    ${mbs} =    Set Variable    ${oldr.json()['m2m:cnt']['mbs']}
     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":"102C"
-    # create 1 (6 bytes)
-    Create Resource    ${iserver}    InCSE1/Container2    ${rt_contentInstance}    ${attr}
+    ${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}
     ...    ${attr}
@@ -707,29 +683,28 @@ Delete the Container2-4.6
     ${attr} =    Set Variable    "mbs":20
     ${r}=    Update Resource    ${iserver}    InCSE1/Container2    ${rt_container}    ${attr}
     ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"102CS"
-    # create 3
-    Create Resource    ${iserver}    InCSE1/Container2    ${rt_contentInstance}    ${attr}    cin1
-    Create Resource    ${iserver}    InCSE1/Container2    ${rt_contentInstance}    ${attr}    cin2
-    Create Resource    ${iserver}    InCSE1/Container2    ${rt_contentInstance}    ${attr}    cin3
-    Create Resource    ${iserver}    InCSE1/Container2    ${rt_contentInstance}    ${attr}    cin4
+    # create 4 cin
+    Create Resource    ${iserver}    InCSE1/Container2    ${rt_contentInstance}    ${attr}
+    Create Resource    ${iserver}    InCSE1/Container2    ${rt_contentInstance}    ${attr}
+    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()['cbs']}
-    ${chr} =    Set Variable    ${rr.json()['ch']}
-    ${text} =    Text    ${rr}
-    LOG    ${text}
-    # cannot create 4
-    ${error} =    Run Keyword And Expect Error    *    Create Resource    ${iserver}    InCSE1/Container2    ${rt_contentInstance}
-    ...    ${attr}
-    Should Start with    ${error}    Cannot create this resource [400]
-
-4.74 what if alread have 20, then set mbs to 5 ?
-    [Documentation]    what if alread have 20, then set mbs to 5 ?
+    ${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
+    ${childNumber} =    Get Length    ${chr}
+    Should Be Equal As Integers    ${childNumber}    4
+
+4.74 if alread have 20, then set mbs to 5,will delete contentInstance until mbs less than 5.
+    [Documentation]    what if alread have 20, then set mbs to 5, will delete contentInstance until mbs less than 5.
     ${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()['ch']}
-    ${cbs} =    Set Variable    ${rr.json()['cbs']}
-    Should Be Equal As Integers    ${rr.json()['cni']}    1
+    ${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
+    ${childNumber} =    Get Length    ${chr}
+    Should Be Equal As Integers    ${childNumber}    1
 
 Delete the Container2-4.7
     ${deleteRes} =    Delete Resource    ${iserver}    InCSE1/Container2
@@ -752,13 +727,21 @@ Delete the test Container1
 *** Keywords ***
 Check Response and Retrieve Resource
     [Arguments]    ${r}
-    ${con} =    Name    ${r}
+    ${con} =    Location    ${r}
     ${status_code} =    Status Code    ${r}
     Should Be True    199 < ${status_code} < 299
     ${rr} =    Retrieve Resource    ${iserver}    ${con}
     ${text} =    Text    ${rr}
     [Return]    ${text}
 
+Check Response and Retrieve Resource For Update
+    [Arguments]    ${r}    ${location}
+    ${status_code} =    Status Code    ${r}
+    Should Be True    199 < ${status_code} < 299
+    ${rr} =    Retrieve Resource    ${iserver}    ${location}
+    ${text} =    Text    ${rr}
+    [Return]    ${text}
+
 Cannot Create Container Error
     [Arguments]    ${attr}
     [Documentation]    create Container Under InCSE1 and expect error
index 8d5c5c8a938f95904e69eb212a390ae9e56b9b0d..a4b4180a34be284715d56ff286d9a71a6f574fa0 100644 (file)
@@ -28,13 +28,13 @@ 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
-    ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}    Container1
-    ${container} =    Name    ${r}
+    ${attr} =    Set Variable    "rn":"Container1"
+    ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}
+    ${container} =    Location    ${r}
     ${status_code} =    Status Code    ${r}
     Should Be Equal As Integers    ${status_code}    201
-    ${attr} =    Set Variable    "con":"102CSS"
-    Create Resource    ${iserver}    InCSE1/Container1    ${rt_contentInstance}    ${attr}    conIn1
+    ${attr} =    Set Variable    "con":"102CSS","rn":"conIn1"
+    Create Resource    ${iserver}    InCSE1/Container1    ${rt_contentInstance}    ${attr}
     ${text} =    Text    ${r}
     Should Contain    ${text}    "ri":    "rn":    "cs":
     Should Contain    ${text}    "lt":    "pi":    "con":
@@ -57,9 +57,9 @@ Set Suite Variable
 
 2.11 ContentInfo (cnf) can be added when create
     [Documentation]    ContentInfo (cnf) can be added when create
-    ${attr} =    Set Variable    "cnf": "1","con":"102CSS"
+    ${attr} =    Set Variable    "cnf": "1","con":"102CSS","rn":"conIn2"
     # create conIn under Container1
-    ${r}=    Create Resource    ${iserver}    InCSE1/Container1    ${rt_contentInstance}    ${attr}    conIn2
+    ${r}=    Create Resource    ${iserver}    InCSE1/Container1    ${rt_contentInstance}    ${attr}
     ${text} =    Check Create and Retrieve ContentInstance    ${r}
     Should Contain    ${text}    cnf
 
@@ -74,9 +74,9 @@ Delete the ContenInstance 2.1
 
 2.21 OntologyRef (or) can be added when create
     [Documentation]    OntologyRef (or) can be added when create
-    ${attr} =    Set Variable    "or": "http://cisco.com","con":"102CSS"
+    ${attr} =    Set Variable    "or": "http://cisco.com","con":"102CSS","rn":"conIn2"
     # create conIn under Container1
-    ${r}=    Create Resource    ${iserver}    InCSE1/Container1    ${rt_contentInstance}    ${attr}    conIn2
+    ${r}=    Create Resource    ${iserver}    InCSE1/Container1    ${rt_contentInstance}    ${attr}
     ${text} =    Check Create and Retrieve ContentInstance    ${r}
     Should Contain    ${text}    or
 
@@ -91,8 +91,8 @@ Delete the ContenInstance 2.2
 
 2.31 labels[single] can be added when create
     [Documentation]    create conIn under Container1, labels[single] can be added when create
-    ${attr} =    Set Variable    "lbl":["ds"],"con":"102CSS"
-    ${r}=    Create Resource    ${iserver}    InCSE1/Container1    ${rt_contentInstance}    ${attr}    conIn2
+    ${attr} =    Set Variable    "lbl":["ds"],"con":"102CSS","rn":"conIn2"
+    ${r}=    Create Resource    ${iserver}    InCSE1/Container1    ${rt_contentInstance}    ${attr}
     ${text} =    Check Create and Retrieve ContentInstance    ${r}
     Should Contain    ${text}    lbl
 
@@ -107,9 +107,9 @@ Delete the ContenInstance 2.31
 
 2.33 labels (multiple) can be added when create
     [Documentation]    labels (multiple) can be added when create
-    ${attr} =    Set Variable    "lbl":["http://cisco.com","dsds"],"con":"102CSS"
+    ${attr} =    Set Variable    "lbl":["http://cisco.com","dsds"],"con":"102CSS","rn":"conIn2"
     # create conIn under Container1
-    ${r}=    Create Resource    ${iserver}    InCSE1/Container1    ${rt_contentInstance}    ${attr}    conIn2
+    ${r}=    Create Resource    ${iserver}    InCSE1/Container1    ${rt_contentInstance}    ${attr}
     ${text} =    Check Create and Retrieve ContentInstance    ${r}
     Should Contain    ${text}    lbl
 
@@ -204,17 +204,25 @@ Delete the ContenInstance 2.33
     ${attr} =    Set Variable    "con": "1"
     ${error} =    Cannot Update ContentInstance Error    ${attr}
     Should Contain    ${error}    Not permitted to update content
-    #==================================================
-    #    Functional Attribute Test
-    #==================================================
-    # Next step:
-    # creator
-    # contentSzie
-    # contentInfo
-    # content
-    #==================================================
-    #    Finish
-    #==================================================
+
+4.11 GetLatest Test
+    [Documentation]    Set mni to 1 when creating a container, then continue creating <cin> "get latest" should always return the last created <cin>'s "con" value.
+    ${attr} =    Set Variable    "mni":1,"rn":"Container2"
+    ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}
+    ${container} =    Location    ${r}
+    ${random} =    Evaluate    random.randint(0,50)    modules=random
+    ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"${random}"
+    Create Resource    ${iserver}    ${container}    ${rt_contentInstance}    ${attr}
+    ${latestCon} =    Get Latest     ${container}
+    Should Be Equal As Strings    ${random}    ${latestCon}
+
+4.12 GetLatest Loop 50 times Test
+    [Documentation]    Just like 4.11, but do 50 times.
+    ${attr} =    Set Variable    "mni":1,"rn":"Container3"
+    ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}
+    ${container} =    Location    ${r}
+    : FOR    ${INDEX}    IN RANGE    1    100
+    \    Latest Con Test    ${container}
 
 Delete the test Container1
     [Documentation]    Delete the test Container1
@@ -237,9 +245,22 @@ Cannot Craete ContentInstance Error
 
 Check Create and Retrieve ContentInstance
     [Arguments]    ${r}
-    ${con} =    Name    ${r}
+    ${con} =    Location    ${r}
     ${status_code} =    Status Code    ${r}
     Should Be Equal As Integers    ${status_code}    201
     ${rr} =    Retrieve Resource    ${iserver}    ${con}
     ${text} =    Text    ${rr}
     [Return]    ${text}
+
+Get Latest
+    [Arguments]    ${resourceURI}
+    ${latest} =    Retrieve Resource    ${iserver}    ${resourceURI}/latest
+    [Return]    ${latest.json()['m2m:cin']['con']}
+
+Latest Con Test
+    [Arguments]    ${resourceURI}
+    ${random} =    Evaluate    random.randint(0,50)    modules=random
+    ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"${random}"
+    Create Resource    ${iserver}    ${resourceURI}    ${rt_contentInstance}    ${attr}
+    ${latestCon} =    Get Latest     ${resourceURI}
+    Should Be Equal As Strings    ${random}    ${latestCon}
index fb634b6438c8fb23aaf02a6858f8b4be0bf10929..a8de4ffc6e5fbe2a399e7857429e8de49eca8a40 100644 (file)
@@ -22,9 +22,9 @@ Set Suite Variable
 
 4.11 Delete AE without child resource
     [Documentation]    Create AE then delete it
-    ${attr} =    Set Variable    "aei":"ODL","api":"jb","apn":"jb2","or":"http://hey/you"
+    ${attr} =    Set Variable    "api":"jb","apn":"jb2","or":"http://hey/you","rr":true
     ${r} =    Create Resource    ${iserver}    InCSE1    ${rt_ae}    ${attr}
-    ${ae} =    Name    ${r}
+    ${ae} =    Location    ${r}
     Response Is Correct    ${r}
     #------------- Delete -----------------------------
     ${deleteRes} =    Delete Resource    ${iserver}    ${ae}
@@ -38,7 +38,7 @@ Set Suite Variable
     [Documentation]    create container then delete it
     ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you"
     ${r} =    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}
-    ${container} =    Name    ${r}
+    ${container} =    Location    ${r}
     Response Is Correct    ${r}
     #------------- Delete -----------------------------
     ${deleteRes} =    Delete Resource    ${iserver}    ${container}
@@ -50,17 +50,17 @@ Set Suite Variable
 
 4.13 Delete contentInstance under InCSE1/AE/container/
     [Documentation]    Delete contentInstance under InCSE1/AE/container/
-    ${attr} =    Set Variable    "aei":"ODL","api":"jb","apn":"jb2","or":"http://hey/you"
-    ${r} =    Create Resource    ${iserver}    InCSE1    ${rt_ae}    ${attr}    AE1
-    ${ae} =    Name    ${r}
+    ${attr} =    Set Variable    "api":"jb","apn":"jb2","or":"http://hey/you","rr":true,"rn":"AE1"
+    ${r} =    Create Resource    ${iserver}    InCSE1    ${rt_ae}    ${attr}
+    ${ae} =    Location    ${r}
     Response Is Correct    ${r}
-    ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you"
-    ${r} =    Create Resource    ${iserver}    ${ae}    ${rt_container}    ${attr}    Con1
-    ${container} =    Name    ${r}
+    ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you","rn":"Con1"
+    ${r} =    Create Resource    ${iserver}    ${ae}    ${rt_container}    ${attr}
+    ${container} =    Location    ${r}
     Response Is Correct    ${r}
     ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"101"
     ${r} =    Create Resource    ${iserver}    ${container}    ${rt_contentInstance}    ${attr}
-    ${conIn} =    Name    ${r}
+    ${conIn} =    Location    ${r}
     Response Is Correct    ${r}
     #------------- Delete -----------------------------
     ${deleteRes} =    Delete Resource    ${iserver}    ${conIn}
@@ -72,13 +72,13 @@ Set Suite Variable
 
 4.14 Delete contentInstance under InCSE1/Container/
     [Documentation]    Delete contentInstance under InCSE1/Container/
-    ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you"
-    ${r} =    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}    Con2
-    ${container} =    Name    ${r}
+    ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you","rn":"Con2"
+    ${r} =    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}
+    ${container} =    Location    ${r}
     Response Is Correct    ${r}
     ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"101"
     ${r} =    Create Resource    ${iserver}    ${container}    ${rt_contentInstance}    ${attr}
-    ${conIn} =    Name    ${r}
+    ${conIn} =    Location    ${r}
     Response Is Correct    ${r}
     #------------- Delete -----------------------------
     ${deleteRes} =    Delete Resource    ${iserver}    ${conIn}
@@ -90,13 +90,13 @@ Set Suite Variable
 
 4.15 Delete contentIsntance under InCSE1/Container/container/
     [Documentation]    Delete contentIsntance under InCSE1/Container/container/
-    ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you"
-    ${r} =    Create Resource    ${iserver}    InCSE1/Con2    ${rt_container}    ${attr}    Con3
-    ${container} =    Name    ${r}
+    ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you","rn":"Con3"
+    ${r} =    Create Resource    ${iserver}    InCSE1/Con2    ${rt_container}    ${attr}
+    ${container} =    Location    ${r}
     Response Is Correct    ${r}
     ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"101"
     ${r} =    Create Resource    ${iserver}    ${container}    ${rt_contentInstance}    ${attr}
-    ${conIn} =    Name    ${r}
+    ${conIn} =    Location    ${r}
     Response Is Correct    ${r}
     #------------- Delete -----------------------------
     ${deleteRes} =    Delete Resource    ${iserver}    ${conIn}
@@ -120,21 +120,21 @@ Set Suite Variable
 
 4.22 Delete AE with 3 child Container
     [Documentation]    Delete AE with 3 child Container
-    ${attr} =    Set Variable    "aei":"ODL","api":"jb","apn":"jb2","or":"http://hey/you"
-    ${r} =    Create Resource    ${iserver}    InCSE1    ${rt_ae}    ${attr}    AE1
-    ${ae} =    Name    ${r}
+    ${attr} =    Set Variable    "api":"jb","apn":"jb2","or":"http://hey/you","rr":true,"rn":"AE1"
+    ${r} =    Create Resource    ${iserver}    InCSE1    ${rt_ae}    ${attr}
+    ${ae} =    Location    ${r}
     Response Is Correct    ${r}
-    ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you"
-    ${r} =    Create Resource    ${iserver}    ${ae}    ${rt_container}    ${attr}    Con2
-    ${container} =    Name    ${r}
+    ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you","rn":"Con2"
+    ${r} =    Create Resource    ${iserver}    ${ae}    ${rt_container}    ${attr}
+    ${container} =    Location    ${r}
     Response Is Correct    ${r}
-    ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you"
-    ${r} =    Create Resource    ${iserver}    ${ae}    ${rt_container}    ${attr}    Con3
-    ${container} =    Name    ${r}
+    ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you","rn":"Con3"
+    ${r} =    Create Resource    ${iserver}    ${ae}    ${rt_container}    ${attr}
+    ${container} =    Location    ${r}
     Response Is Correct    ${r}
-    ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you"
-    ${r} =    Create Resource    ${iserver}    ${ae}    ${rt_container}    ${attr}    Con4
-    ${container} =    Name    ${r}
+    ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you","rn":"Con4"
+    ${r} =    Create Resource    ${iserver}    ${ae}    ${rt_container}    ${attr}
+    ${container} =    Location    ${r}
     Response Is Correct    ${r}
     # ----------- Delete the parent AE --------------
     ${r} =    Delete Resource    ${iserver}    InCSE1/AE1
@@ -155,17 +155,17 @@ Set Suite Variable
 
 4.23 Delete AE with 1 child Container/1 contentInstance
     [Documentation]    Delete AE with 1 child Container/1 contentInstance
-    ${attr} =    Set Variable    "aei":"ODL","api":"jb","apn":"jb2","or":"http://hey/you"
-    ${r} =    Create Resource    ${iserver}    InCSE1    ${rt_ae}    ${attr}    AE1
-    ${ae} =    Name    ${r}
+    ${attr} =    Set Variable    "api":"jb","apn":"jb2","or":"http://hey/you","rr":true,"rn":"AE1"
+    ${r} =    Create Resource    ${iserver}    InCSE1    ${rt_ae}    ${attr}
+    ${ae} =    Location    ${r}
     Response Is Correct    ${r}
-    ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you"
-    ${r} =    Create Resource    ${iserver}    ${ae}    ${rt_container}    ${attr}    Con2
-    ${container} =    Name    ${r}
+    ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you","rn":"Con2"
+    ${r} =    Create Resource    ${iserver}    ${ae}    ${rt_container}    ${attr}
+    ${container} =    Location    ${r}
     Response Is Correct    ${r}
-    ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"101"
-    ${r} =    Create Resource    ${iserver}    ${container}    ${rt_contentInstance}    ${attr}    conIn1
-    ${name} =    Name    ${r}
+    ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"101","rn":"conIn1"
+    ${r} =    Create Resource    ${iserver}    ${container}    ${rt_contentInstance}    ${attr}
+    ${name} =    Location    ${r}
     Response Is Correct    ${r}
     # ----------- Delete the parent AE --------------
     ${r} =    Delete Resource    ${iserver}    InCSE1/AE1
@@ -180,20 +180,22 @@ Set Suite Variable
 
 4.24 Delete AE with 1 child Container/3 contentInsntace
     [Documentation]    Delete AE with 1 child Container/3 contentInsntace
-    ${attr} =    Set Variable    "aei":"ODL","api":"jb","apn":"jb2","or":"http://hey/you"
-    ${r} =    Create Resource    ${iserver}    InCSE1    ${rt_ae}    ${attr}    AE1
-    ${ae} =    Name    ${r}
+    ${attr} =    Set Variable    "api":"jb","apn":"jb2","or":"http://hey/you","rr":true,"rn":"AE1"
+    ${r} =    Create Resource    ${iserver}    InCSE1    ${rt_ae}    ${attr}
+    ${ae} =    Location    ${r}
     Response Is Correct    ${r}
-    ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you"
-    ${r} =    Create Resource    ${iserver}    ${ae}    ${rt_container}    ${attr}    Con2
-    ${container} =    Name    ${r}
+    ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you","rn":"Con2"
+    ${r} =    Create Resource    ${iserver}    ${ae}    ${rt_container}    ${attr}
+    ${container} =    Location    ${r}
     Response Is Correct    ${r}
-    ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"101"
-    ${r} =    Create Resource    ${iserver}    ${container}    ${rt_contentInstance}    ${attr}    conIn1
+    ${attr1} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"101","rn":"conIn1"
+    ${r} =    Create Resource    ${iserver}    ${container}    ${rt_contentInstance}    ${attr1}
     Response Is Correct    ${r}
-    ${r} =    Create Resource    ${iserver}    ${container}    ${rt_contentInstance}    ${attr}    conIn2
+    ${attr2} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"101","rn":"conIn2"
+    ${r} =    Create Resource    ${iserver}    ${container}    ${rt_contentInstance}    ${attr2}
     Response Is Correct    ${r}
-    ${r} =    Create Resource    ${iserver}    ${container}    ${rt_contentInstance}    ${attr}    conIn3
+    ${attr3} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"101","rn":"conIn3"
+    ${r} =    Create Resource    ${iserver}    ${container}    ${rt_contentInstance}    ${attr3}
     Response Is Correct    ${r}
     # ----------- Delete the parent AE --------------
     ${r} =    Delete Resource    ${iserver}    InCSE1/AE1
@@ -210,34 +212,31 @@ Set Suite Variable
 
 4.25 Delete AE with 3 child Container/9 contentInstance
     [Documentation]    Delete AE with 3 child Container/9 contentInstance
-    ${attr} =    Set Variable    "aei":"ODL","api":"jb","apn":"jb2","or":"http://hey/you"
-    ${r} =    Create Resource    ${iserver}    InCSE1    ${rt_ae}    ${attr}    AE1
-    ${ae} =    Name    ${r}
+    ${attr} =    Set Variable    "api":"jb","apn":"jb2","or":"http://hey/you","rr":true,"rn":"AE1"
+    ${r} =    Create Resource    ${iserver}    InCSE1    ${rt_ae}    ${attr}
+    ${ae} =    Location    ${r}
     Response Is Correct    ${r}
-    ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you"
-    ${r} =    Create Resource    ${iserver}    ${ae}    ${rt_container}    ${attr}    Con1
-    ${container1} =    Name    ${r}
+    ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you","rn":"Con1"
+    ${r} =    Create Resource    ${iserver}    ${ae}    ${rt_container}    ${attr}
+    ${container1} =    Location    ${r}
     Response Is Correct    ${r}
-    ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you"
-    ${r} =    Create Resource    ${iserver}    ${ae}    ${rt_container}    ${attr}    Con2
-    ${container2} =    Name    ${r}
+    ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you","rn":"Con2"
+    ${r} =    Create Resource    ${iserver}    ${ae}    ${rt_container}    ${attr}
+    ${container2} =    Location    ${r}
     Response Is Correct    ${r}
-    ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you"
-    ${r} =    Create Resource    ${iserver}    ${ae}    ${rt_container}    ${attr}    Con3
-    ${container3} =    Name    ${r}
+    ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you","rn":"Con3"
+    ${r} =    Create Resource    ${iserver}    ${ae}    ${rt_container}    ${attr}
+    ${container3} =    Location    ${r}
     Response Is Correct    ${r}
     ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"101"
     : FOR    ${conName}    IN    conIn1    conIn2    conIn3
-    \    ${r} =    Create Resource    ${iserver}    ${container1}    ${rt_contentInstance}    ${attr}
-    \    ...    ${conName}
+    \    ${r} =    Create Resource    ${iserver}    ${container1}    ${rt_contentInstance}    ${attr},"rn":${conName}
     \    Response Is Correct    ${r}
     : FOR    ${conName}    IN    conIn1    conIn2    conIn3
-    \    ${r} =    Create Resource    ${iserver}    ${container2}    ${rt_contentInstance}    ${attr}
-    \    ...    ${conName}
+    \    ${r} =    Create Resource    ${iserver}    ${container2}    ${rt_contentInstance}    ${attr},"rn":${conName}
     \    Response Is Correct    ${r}
     : FOR    ${conName}    IN    conIn1    conIn2    conIn3
-    \    ${r} =    Create Resource    ${iserver}    ${container3}    ${rt_contentInstance}    ${attr}
-    \    ...    ${conName}
+    \    ${r} =    Create Resource    ${iserver}    ${container3}    ${rt_contentInstance}    ${attr},"rn":${conName}
     \    Response Is Correct    ${r}
     # ----------- Delete the parent AE --------------
     ${r} =    Delete Resource    ${iserver}    InCSE1/AE1
@@ -275,17 +274,17 @@ Set Suite Variable
 4.32 Delete Container with 3 child Container
     [Documentation]    Delete Container with 3 child Container
     ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you"
-    ${r} =    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}    ConTop1
-    ${container} =    Name    ${r}
+    ${r} =    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr},"rn":"ConTop1"
+    ${container} =    Location    ${r}
     Response Is Correct    ${r}
-    ${r} =    Create Resource    ${iserver}    ${container}    ${rt_container}    ${attr}    Con1
-    ${container1} =    Name    ${r}
+    ${r} =    Create Resource    ${iserver}    ${container}    ${rt_container}    ${attr},"rn":"Con1"
+    ${container1} =    Location    ${r}
     Response Is Correct    ${r}
-    ${r} =    Create Resource    ${iserver}    ${container}    ${rt_container}    ${attr}    Con2
-    ${container2} =    Name    ${r}
+    ${r} =    Create Resource    ${iserver}    ${container}    ${rt_container}    ${attr},"rn":"Con2"
+    ${container2} =    Location    ${r}
     Response Is Correct    ${r}
-    ${r} =    Create Resource    ${iserver}    ${container}    ${rt_container}    ${attr}    Con3
-    ${container3} =    Name    ${r}
+    ${r} =    Create Resource    ${iserver}    ${container}    ${rt_container}    ${attr},"rn":"Con3"
+    ${container3} =    Location    ${r}
     Response Is Correct    ${r}
     # ----------- Delete the parent Container --------------
     ${r} =    Delete Resource    ${iserver}    InCSE1/ConTop1
@@ -301,17 +300,17 @@ Set Suite Variable
 
 4.33 Delete Container with 1 child Container/1 contentInstance
     [Documentation]    Delete Container with 1 child Container/1 contentInstance
-    ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you"
-    ${r} =    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}    Con1
-    ${con} =    Name    ${r}
+    ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you","rn":"Con1"
+    ${r} =    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}
+    ${con} =    Location    ${r}
     Response Is Correct    ${r}
-    ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you"
-    ${r} =    Create Resource    ${iserver}    ${con}    ${rt_container}    ${attr}    Con2
-    ${container} =    Name    ${r}
+    ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you","rn":"Con2"
+    ${r} =    Create Resource    ${iserver}    ${con}    ${rt_container}    ${attr}
+    ${container} =    Location    ${r}
     Response Is Correct    ${r}
-    ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"101"
-    ${r} =    Create Resource    ${iserver}    ${container}    ${rt_contentInstance}    ${attr}    conIn1
-    ${name} =    Name    ${r}
+    ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"101","rn":"conIn1"
+    ${r} =    Create Resource    ${iserver}    ${container}    ${rt_contentInstance}    ${attr}
+    ${name} =    Location    ${r}
     Response Is Correct    ${r}
     # ----------- Delete the parent Container --------------
     ${r} =    Delete Resource    ${iserver}    InCSE1/Con1
@@ -326,20 +325,20 @@ Set Suite Variable
 
 4.34 Delete Container with 1 child Container/3 contentInsntace
     [Documentation]    Delete Container with 1 child Container/3 contentInsntace
-    ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you"
-    ${r} =    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}    Con1
-    ${con} =    Name    ${r}
+    ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you","rn":"Con1"
+    ${r} =    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}
+    ${con} =    Location    ${r}
     Response Is Correct    ${r}
-    ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you"
-    ${r} =    Create Resource    ${iserver}    ${con}    ${rt_container}    ${attr}    Con2
-    ${container} =    Name    ${r}
+    ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you","rn":"Con2"
+    ${r} =    Create Resource    ${iserver}    ${con}    ${rt_container}    ${attr}
+    ${container} =    Location    ${r}
     Response Is Correct    ${r}
     ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"101"
-    ${r} =    Create Resource    ${iserver}    ${container}    ${rt_contentInstance}    ${attr}    conIn1
+    ${r} =    Create Resource    ${iserver}    ${container}    ${rt_contentInstance}    ${attr},"rn":"conIn1"
     Response Is Correct    ${r}
-    ${r} =    Create Resource    ${iserver}    ${container}    ${rt_contentInstance}    ${attr}    conIn2
+    ${r} =    Create Resource    ${iserver}    ${container}    ${rt_contentInstance}    ${attr},"rn":"conIn2"
     Response Is Correct    ${r}
-    ${r} =    Create Resource    ${iserver}    ${container}    ${rt_contentInstance}    ${attr}    conIn3
+    ${r} =    Create Resource    ${iserver}    ${container}    ${rt_contentInstance}    ${attr},"rn":"conIn3"
     Response Is Correct    ${r}
     # ----------- Delete the parent Container --------------
     ${r} =    Delete Resource    ${iserver}    InCSE1/Con1
@@ -357,30 +356,27 @@ Set Suite Variable
 4.35 Delete Container with 3 child Container/9 contentInstance
     [Documentation]    Delete Container with 3 child Container/9 contentInstance
     ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":15,"or":"http://hey/you"
-    ${r} =    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}    Con1
-    ${con} =    Name    ${r}
+    ${r} =    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr},"rn":"Con1"
+    ${con} =    Location    ${r}
     Response Is Correct    ${r}
-    ${r} =    Create Resource    ${iserver}    ${con}    ${rt_container}    ${attr}    Con2
-    ${container1} =    Name    ${r}
+    ${r} =    Create Resource    ${iserver}    ${con}    ${rt_container}    ${attr},"rn":"Con2"
+    ${container1} =    Location    ${r}
     Response Is Correct    ${r}
-    ${r} =    Create Resource    ${iserver}    ${con}    ${rt_container}    ${attr}    Con3
-    ${container2} =    Name    ${r}
+    ${r} =    Create Resource    ${iserver}    ${con}    ${rt_container}    ${attr},"rn":"Con3"
+    ${container2} =    Location    ${r}
     Response Is Correct    ${r}
-    ${r} =    Create Resource    ${iserver}    ${con}    ${rt_container}    ${attr}    Con4
-    ${container3} =    Name    ${r}
+    ${r} =    Create Resource    ${iserver}    ${con}    ${rt_container}    ${attr},"rn":"Con4"
+    ${container3} =    Location    ${r}
     Response Is Correct    ${r}
     ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"101"
     : FOR    ${conName}    IN    conIn1    conIn2    conIn3
-    \    ${r} =    Create Resource    ${iserver}    ${container1}    ${rt_contentInstance}    ${attr}
-    \    ...    ${conName}
+    \    ${r} =    Create Resource    ${iserver}    ${container1}    ${rt_contentInstance}    ${attr},"rn":${conName}
     \    Response Is Correct    ${r}
     : FOR    ${conName}    IN    conIn1    conIn2    conIn3
-    \    ${r} =    Create Resource    ${iserver}    ${container2}    ${rt_contentInstance}    ${attr}
-    \    ...    ${conName}
+    \    ${r} =    Create Resource    ${iserver}    ${container2}    ${rt_contentInstance}    ${attr},"rn":${conName}
     \    Response Is Correct    ${r}
     : FOR    ${conName}    IN    conIn1    conIn2    conIn3
-    \    ${r} =    Create Resource    ${iserver}    ${container3}    ${rt_contentInstance}    ${attr}
-    \    ...    ${conName}
+    \    ${r} =    Create Resource    ${iserver}    ${container3}    ${rt_contentInstance}    ${attr},"rn":${conName}
     \    Response Is Correct    ${r}
     # ----------- Delete the parent Container --------------
     ${r} =    Delete Resource    ${iserver}    InCSE1/Con1
@@ -406,12 +402,13 @@ Set Suite Variable
 *** Keywords ***
 Response Is Correct
     [Arguments]    ${r}
-    ${status_code} =    Status Code    ${r}
-    Should Be True    199 < ${status_code} < 299
     ${text} =    Text    ${r}
     LOG    ${text}
     ${json} =    Json    ${r}
     LOG    ${json}
+    ${status_code} =    Status Code    ${r}
+    Should Be True    199 < ${status_code} < 299
+
 
 Cannot Retrieve Error
     [Arguments]    ${uri}
index ea8af703452844dd076a71c677850a9728c14625..9774e6522d16e70427cea893a4d6c8ac0e37467f 100644 (file)
@@ -22,16 +22,15 @@ Set Suite Variable
 
 1.1 rcn is legal in create
     [Documentation]    rcn=1, 2, 3, 0 is legal
-    ${attr} =    Set Variable    "aei":"ODL","api":"jb","apn":"jb2","or":"http://hey/you"
+    ${attr} =    Set Variable    "api":"jb","apn":"jb2","or":"http://hey/you","rr":true
     : FOR    ${rcn}    IN    \    1    2    3
     ...    0
     \    ${r} =    Create Resource With Command    ${iserver}    InCSE1    ${rt_ae}    rcn=${rcn}
     \    ...    ${attr}
-    #add check reponse here in the next step, seperate them
 
 1.2 rcn is illegal in create
     [Documentation]    rcn=4, 5, 6, 7 is illegal
-    ${attr} =    Set Variable    "aei":"ODL","api":"jb","apn":"jb2","or":"http://hey/you"
+    ${attr} =    Set Variable    "api":"jb","apn":"jb2","or":"http://hey/you","rr":true
     : FOR    ${rcn}    IN    4    5    6    7
     \    ${error} =    Run Keyword And Expect Error    *    Create Resource With Command    ${iserver}    InCSE1
     \    ...    ${rt_ae}    rcn=${rcn}    ${attr}
@@ -39,14 +38,15 @@ Set Suite Variable
     \    Should Contain    ${error}    rcn
 
 2.1 rcn is legal in update
-    [Documentation]    rcn=1, 4, 0/ null is legal
+    [Documentation]    rcn=1, 0/ null is legal
     ${attr} =    Set Variable    "or":"http://hey/you"
-    : FOR    ${rcn}    IN    \    0    1    4
+    : FOR    ${rcn}    IN    \    0    1    5
+    ...    6
     \    ${r} =    Update Resource With Command    ${iserver}    InCSE1/AE1    ${rt_ae}    rcn=${rcn}
     \    ...    ${attr}
 
 2.2 rcn is illegal in update
-    [Documentation]    rcn=2, 3, 5, 6, 7 is illegal
+    [Documentation]    rcn=2, 3, 7 is illegal
     ${attr} =    Set Variable    "or":"http://hey/you"
     : FOR    ${rcn}    IN    2    3    4    7
     \    ${error} =    Run Keyword And Expect Error    *    Update Resource With Command    ${iserver}    InCSE1/AE1
@@ -70,10 +70,9 @@ Set Suite Variable
     \    Should Contain    ${error}    rcn
 
 4.2 rcn is illegal in delete
-    [Documentation]    rcn=4, 5, 6, 7 is illegal
+    [Documentation]    rcn=2, 3, 4, 5, 6, 7 is illegal
     ${attr} =    Set Variable    "or":"http://hey/you"
-    : FOR    ${rcn}    IN    2    3    4    5
-    ...    6    7
+    : FOR    ${rcn}    IN    2    3    4    7
     \    ${error} =    Run Keyword And Expect Error    *    Delete Resource With Command    ${iserver}    InCSE1/AE1
     \    ...    rcn=${rcn}
     \    Should Start with    ${error}    Cannot delete this resource [400]
@@ -90,33 +89,33 @@ Create the tree
 
 1. createdBefore
     ${r} =    Retrieve Resource With Command    ${iserver}    InCSE1/AE1    rcn=4&crb=20160612T033748Z
-    ${count} =    Get Length    ${r.json()['ch']}
+    ${count} =    Get Length    ${r.json()['m2m:ae']['ch']}
     Should Be Equal As Integers    ${count}    2
 
 2. createdAfter
     ${r} =    Retrieve Resource With Command    ${iserver}    InCSE1/AE1    rcn=4&cra=20150612T033748Z
-    ${count} =    Get Length    ${r.json()['ch']}
+    ${count} =    Get Length    ${r.json()['m2m:ae']['ch']}
     Should Be Equal As Integers    ${count}    2
 
 3. modifiedSince
     ${r} =    Retrieve Resource With Command    ${iserver}    InCSE1/AE1    rcn=4&ms=20150612T033748Z
-    ${count} =    Get Length    ${r.json()['ch']}
+    ${count} =    Get Length    ${r.json()['m2m:ae']['ch']}
     Should Be Equal As Integers    ${count}    2
 
 4. unmodifiedSince
     ${r} =    Retrieve Resource With Command    ${iserver}    InCSE1/AE1    rcn=4&us=20160612T033748Z
-    ${count} =    Get Length    ${r.json()['ch']}
+    ${count} =    Get Length    ${r.json()['m2m:ae']['ch']}
     Should Be Equal As Integers    ${count}    2
 
 5. stateTagSmaller
     ${r} =    Retrieve Resource With Command    ${iserver}    InCSE1/Container3    rcn=4&sts=3
     ${count} =    Get Length    ${r.json()['ch']}
-    ${s} =    Set Variable    ${r.json()['ch']}
     Should Be Equal As Integers    ${count}    5
 
 6. stateTagBigger
     ${r} =    Retrieve Resource With Command    ${iserver}    InCSE1/Container3    rcn=4&stb=1
-    ${count} =    Get Length    ${r.json()['ch']}
+
+    ${count} =    Get Length    ${r.json()['m2m:cnt']['ch']}
     Should Be Equal As Integers    ${count}    2
     # 7. expireBefore
     # 8. expireAfter
@@ -141,45 +140,41 @@ Create the tree
     ${r} =    Retrieve Resource With Command    ${iserver}    InCSE1    rcn=4&rty=3&szb=5
     ${count} =    Get Length    ${r.json()['ch']}
     Should Be Equal As Integers    ${count}    1
-    # 13. contentType
-    # 14. limit
-    #    ${r} =    Retrieve Resource With Command    ${iserver}    InCSE1    rcn=4&rty=3&lim=2
-    #    ${count} =    Get Length    ${r.json()['ch']}
-    #    Should Be Equal As Integers    ${count}    2
-    #15. attribute
-    #16. filterUsage
-    # different conditions shall use the "AND" logical operation;
-    # same conditions shall use the "OR" logical operation.
+
+2.1 And Test - labels
+
+    ${r} =    Retrieve Resource With Command    ${iserver}    InCSE1    fu=1&rcn=4&sts=4&lbl=contentInstanceUnderContainerContainer&lbl=underCSE
+    ${count} =    Get Length    ${r.json()}
+    Should Be Equal As Integers    ${count}    6
 
 *** Keywords ***
 Connect And Create The Tree
     [Documentation]    Create a tree that contain AE/ container / contentInstance in different layers
     ${iserver} =    Connect To Iotdm    ${httphost}    ${httpuser}    ${httppass}    http
-    ${attr} =    Set Variable    "aei":"ODL","api":"jb","apn":"jb2","or":"http://hey/you"
-    Create Resource    ${iserver}    InCSE1    ${rt_ae}    ${attr}    AE1
-    Create Resource    ${iserver}    InCSE1    ${rt_ae}    ${attr}    AE2
-    Create Resource    ${iserver}    InCSE1    ${rt_ae}    ${attr}    AE3
-    ${attr} =    Set Variable
-    Create Resource    ${iserver}    InCSE1/AE1    ${rt_container}    ${attr}    Container1
-    Create Resource    ${iserver}    InCSE1/AE1    ${rt_container}    ${attr}    Container2
+    ${attr} =    Set Variable    "api":"jb","apn":"jb2","or":"http://hey/you","rr":true
+    Create Resource    ${iserver}    InCSE1    ${rt_ae}    ${attr},"rn":"AE1"
+    Create Resource    ${iserver}    InCSE1    ${rt_ae}    ${attr},"rn":"AE2"
+    Create Resource    ${iserver}    InCSE1    ${rt_ae}    ${attr},"rn":"AE3"
+    Create Resource    ${iserver}    InCSE1/AE1    ${rt_container}    "rn":"Container1"
+    Create Resource    ${iserver}    InCSE1/AE1    ${rt_container}    "rn":"Container2"
     ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":150,"or":"http://hey/you","lbl":["underCSE"]
-    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}    Container3
-    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}    Container4
-    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr}    Container5
+    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr},"rn":"Container3"
+    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr},"rn":"Container4"
+    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${attr},"rn":"Container5"
     ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":150,"or":"http://hey/you","lbl":["underAEContainer"]
-    Create Resource    ${iserver}    InCSE1/AE1/Container1    ${rt_container}    ${attr}    Container6
+    Create Resource    ${iserver}    InCSE1/AE1/Container1    ${rt_container}    ${attr},"rn":"Container6"
     ${attr} =    Set Variable    "cr":null,"mni":5,"mbs":150,"or":"http://hey/you","lbl":["underCSEContainer"]
-    Create Resource    ${iserver}    InCSE1/Container3    ${rt_container}    ${attr}    Container7
-    Create Resource    ${iserver}    InCSE1/Container3    ${rt_container}    ${attr}    Container8
-    Create Resource    ${iserver}    InCSE1/Container3    ${rt_container}    ${attr}    Container9
+    Create Resource    ${iserver}    InCSE1/Container3    ${rt_container}    ${attr},"rn":"Container7"
+    Create Resource    ${iserver}    InCSE1/Container3    ${rt_container}    ${attr},"rn":"Container8"
+    Create Resource    ${iserver}    InCSE1/Container3    ${rt_container}    ${attr},"rn":"Container9"
     ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"102","lbl":["contentInstanceUnderAEContainer"]
-    Create Resource    ${iserver}    InCSE1/AE1/Container1    ${rt_contentInstance}    ${attr}    conIn1
-    Create Resource    ${iserver}    InCSE1/AE1/Container1    ${rt_contentInstance}    ${attr}    conIn2
+    Create Resource    ${iserver}    InCSE1/AE1/Container1    ${rt_contentInstance}    ${attr},"rn":"conIn1"
+    Create Resource    ${iserver}    InCSE1/AE1/Container1    ${rt_contentInstance}    ${attr},"rn":"conIn2"
     ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"102","lbl":["contentInstanceUnderContainerContainer"]
-    Create Resource    ${iserver}    InCSE1/Container3    ${rt_contentInstance}    ${attr}    conIn3
-    Create Resource    ${iserver}    InCSE1/Container3    ${rt_contentInstance}    ${attr}    conIn4
-    Create Resource    ${iserver}    InCSE1/Container3    ${rt_contentInstance}    ${attr}    conIn5
+    Create Resource    ${iserver}    InCSE1/Container3    ${rt_contentInstance}    ${attr},"rn":"conIn3"
+    Create Resource    ${iserver}    InCSE1/Container3    ${rt_contentInstance}    ${attr},"rn":"conIn4"
+    Create Resource    ${iserver}    InCSE1/Container3    ${rt_contentInstance}    ${attr},"rn":"conIn5"
     ${attr} =    Set Variable    "cnf": "1","or": "http://hey/you","con":"102","lbl":["contentInstanceUnderContainer"]
-    Create Resource    ${iserver}    InCSE1/Container4    ${rt_contentInstance}    ${attr}    conIn6
-    Create Resource    ${iserver}    InCSE1/Container4    ${rt_contentInstance}    ${attr}    conIn7
-    Create Resource    ${iserver}    InCSE1/Container4    ${rt_contentInstance}    ${attr}    conIn8
+    Create Resource    ${iserver}    InCSE1/Container4    ${rt_contentInstance}    ${attr},"rn":"conIn6"
+    Create Resource    ${iserver}    InCSE1/Container4    ${rt_contentInstance}    ${attr},"rn":"conIn7"
+    Create Resource    ${iserver}    InCSE1/Container4    ${rt_contentInstance}    ${attr},"rn":"conIn8"
diff --git a/csit/suites/iotdm/basic/090_AccessControlPolicyTest.robot b/csit/suites/iotdm/basic/090_AccessControlPolicyTest.robot
new file mode 100644 (file)
index 0000000..1eeac91
--- /dev/null
@@ -0,0 +1,93 @@
+*** Settings ***
+Suite Teardown    Kill The Tree    ${ODL_SYSTEM_IP}    InCSE1    admin    admin
+Library           ../../../libraries/criotdm.py
+Library           Collections
+
+*** Variables ***
+${httphost}       ${ODL_SYSTEM_IP}
+${httpuser}       admin
+${httppass}       admin
+${rt_ae}          2
+${rt_container}    3
+${rt_contentInstance}    4
+${rt_acp}    1
+
+*** Test Cases ***
+Set Suite Variable
+    [Documentation]    set a suite variable ${iserver}
+    ${iserver} =    Connect To Iotdm    ${httphost}    ${httpuser}    ${httppass}    http
+    Set Suite Variable    ${iserver}
+    #==================================================
+    #    Container Mandatory Attribute Test
+    #==================================================
+    # For Creation, there are no mandatory input attribute
+
+1.0 Test whether default ACP exist
+    Modify Headers Origin    ${iserver}    //iotsandbox.cisco.com:10000
+    ${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.
+    ${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":
+
+1.2 Create ACP with valid acip(ipv4)
+    [Documentation]    After Created, test whether all the mandatory attribtues are exist.
+    ${attr} =    Set Variable    "pv":{"acr":[{"acor" : ["111","222"],"acop":35,"acco":[{"acip":{"ipv4":["127.0.0.1"]}}]},{"acor" : ["111","222"],"acop":35}]},"pvs":{"acr":[{"acor" : ["111","222"],"acop":7},{"acor" : ["111","222"],"acop":9}]},"rn":"Acp2"
+    ${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":
+
+1.3 Create ACP with invalid acip(ipv4)
+    [documentation]    input a invalid ipv4 address and expect error
+    ${attr} =    Set Variable    "pv":{"acr":[{"acor" : ["111","222"],"acop":35,"acco":[{"acip":{"ipv4":["127.0.01"]}}]},{"acor" : ["111","222"],"acop":35}]},"pvs":{"acr":[{"acor" : ["111","222"],"acop":7},{"acor" : ["111","222"],"acop":9}]},"rn":"Acp3"
+    ${error}=    Run Keyword And Expect Error    *    Create Resource    ${iserver}    InCSE1    ${rt_acp}    ${attr}
+    Should Start with    ${error}    Cannot create this resource [400]
+    Should Contain    ${error}    not a valid Ipv4 address
+
+1.4 Create ACP with valid acip(ipv6)
+    [Documentation]    After Created, test whether all the mandatory attribtues are exist.
+    ${attr} =    Set Variable    "pv":{"acr":[{"acor" : ["111","222"],"acop":35,"acco":[{"acip":{"ipv6":["2001:db8:0:0:0:ff00:42:8329"]}}]},{"acor" : ["111","222"],"acop":35}]},"pvs":{"acr":[{"acor" : ["111","222"],"acop":7},{"acor" : ["111","222"],"acop":9}]},"rn":"Acp4"
+    ${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":
+
+1.5 Create ACP with invalid acip(ipv6)
+    [documentation]    input a invalid Ipv6 address and expect error
+    ${attr} =    Set Variable    "pv":{"acr":[{"acor" : ["111","222"],"acop":35,"acco":[{"acip":{"ipv6":["2001:db8:0:0:0:ff00:42"]}}]},{"acor" : ["111","222"],"acop":35}]},"pvs":{"acr":[{"acor" : ["111","222"],"acop":7},{"acor" : ["111","222"],"acop":9}]},"rn":"Acp3"
+    ${error}=    Run Keyword And Expect Error    *    Create Resource    ${iserver}    InCSE1    ${rt_acp}    ${attr}
+    Should Start with    ${error}    Cannot create this resource [400]
+    Should Contain    ${error}    not a valid Ipv6 address
+
+
+*** Keywords ***
+Connect And Create Resource
+    [Arguments]    ${targetURI}    ${resoutceType}    ${attr}    ${resourceName}=${EMPTY}
+    ${iserver} =    Connect To Iotdm    ${httphost}    ${httpuser}    ${httppass}    http
+    ${r} =    Create Resource    ${iserver}    ${targetURI}    ${resoutceType}    ${attr}    ${resourceName}
+    ${status_code} =    Status Code    ${r}
+    Should Be Equal As Integers    ${status_code}    201
+
+Response Is Correct
+    [Arguments]    ${r}
+    ${text} =    Text    ${r}
+    LOG    ${text}
+    ${json} =    Json    ${r}
+    LOG    ${json}
+    ${status_code} =    Status Code    ${r}
+    Should Be True    199 < ${status_code} < 299
\ No newline at end of file
diff --git a/csit/suites/iotdm/basic/100_NodeTest.robot b/csit/suites/iotdm/basic/100_NodeTest.robot
new file mode 100644 (file)
index 0000000..e578c63
--- /dev/null
@@ -0,0 +1,37 @@
+*** Settings ***
+Suite Teardown    Kill The Tree    ${ODL_SYSTEM_IP}    InCSE1    admin    admin
+Library           ../../../libraries/criotdm.py
+Library           Collections
+
+*** Variables ***
+${httphost}       ${ODL_SYSTEM_IP}
+${httpuser}       admin
+${httppass}       admin
+${rt_ae}          2
+${rt_container}    3
+${rt_contentInstance}    4
+${rt_acp}    1
+${rt_node}    14
+
+*** Test Cases ***
+Set Suite Variable
+    [Documentation]    set a suite variable ${iserver}
+    ${iserver} =    Connect To Iotdm    ${httphost}    ${httpuser}    ${httppass}    http
+    Set Suite Variable    ${iserver}
+    #==================================================
+    #    Container Mandatory Attribute Test
+    #==================================================
+    # 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.
+    ${attr} =    Set Variable    "rn":"Container1"
+    ${r}=    Create Resource    ${iserver}    InCSE1    ${rt_container}    ${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"
\ No newline at end of file