We are trying to implement the onem2m specification but we have some misunderstanding what makes a sensor an AE or an Container ?
For example, I have a ardunio board and I connected to it 10 simple leds. Then I am confused with two options. First one is I have one AE (Ardunio) and 10 containers (leds) for each leds. The other one is I have an AE (Ardunio), it is parent of another 10 AEs (leds) these AEs have their own container.
So what makes a resource an AE or a Container ? What should I look for making that decision ?
Perhaps the oneM2M resource structure is easier to understand when you look at the general architecture of a oneM2M device. Your Arduino most likely does not host a CSE, so it could be an Application Dedicated Node (ADN), that connects to a remote CSE.
Application is the keyword here: Your Arduino hosts an application, that, for example, reads and processes some sensor data. It implements the functional logic for that device. So, that application in oneM2M terms is an Application Entity (AE). In oneM2M an AE has certain properties, such as an application ID etc. It also holds the access rights to be connected to a remote CSE and access resources on that remote CSE.
An AE is also the root for the actual data and data structures, which this AE manages. This structure can be built from Containers. It is a common way to have one Container for each sensor and its data, for example a Temperature Container, an Air Pressure Container etc. It is also possible to have Containers within a Container if you want to structure your data a bit more.
The actual sensor data is managed within those Containers. These data entities are called ContentInstances. You usually only add ContentInstances to a container, but never remove or update them individually. This way you get a kind of small history of your data values. This behaviour, for example, how long this history should get, is a property of a Container and can be set individually. The Container offers two special data points, latest (la) and oldest (ol) which conveniently allows you to access the newest or oldest stored value in a Container, respectively.
Please note, that is also possible that a device may host more than one AE. The AE is an abstract concept. Your Arduino application might actually implement two AEs: one for storing the sensor data, and another one to read data from an CSE, for example to set operation parameters on the Arduino.
Also note, that there is a Node resource, if you want to represent the actual hardware device (node is the term for a connected device in oneM2M, as the "N" in the "ADN" explained above). Here, you can create a sub-structure that represents the device, get information about the firmware, battery status, network information etc, but also information about the AEs that are hosted on the device. Nodes, as AEs, are located at the root of a CSE.
I hope this helps you to structure the resource tree for your application.
Update
The following drawing visualises this resource tree.
CSEBase ─┬─ AE ─┬─ Container ─┬─ ContentInstance ◀═══ oldest
│ │ │
│ │ ├─ ContentInstance
│ │ │
│ │ ├── ...
│ │ │
│ │ └─ ContentInstance ◀═══ latest
│ │
│ └─ Container ─┬─ Container ─┬─ ContentInstance
│ │ │
│ │ └─ ...
│ │
│ └─ Container ─┬─ ContentInstance
│ │
│ └─ ...
│
├─ AE ─── ...
│
└─ Node ─── ...