|
| 1 | +*** Settings *** |
| 2 | +Resource ../../../resources/common.resource |
| 3 | +Library ThinEdgeIO |
| 4 | + |
| 5 | +Suite Setup Custom Setup |
| 6 | +Test Teardown Get Logs ${DEVICE_SN} |
| 7 | + |
| 8 | +Test Tags theme:tedge_agent |
| 9 | + |
| 10 | + |
| 11 | +*** Variables *** |
| 12 | +${DEVICE_SN} ${EMPTY} # Main device serial number |
| 13 | + |
| 14 | + |
| 15 | +*** Test Cases *** |
| 16 | +Query all entities |
| 17 | + ${entities}= List Entities |
| 18 | + |
| 19 | + Should Contain Entity {"@topic-id": "device/main//", "@type": "device"} ${entities} |
| 20 | + Should Contain Entity |
| 21 | + ... {"@topic-id":"device/main/service/service0","@parent":"device/main//","@type":"service","type":"service"} |
| 22 | + ... ${entities} |
| 23 | + Should Contain Entity |
| 24 | + ... {"@topic-id":"device/main/service/service1","@parent":"device/main//","@type":"service","type":"service"} |
| 25 | + ... ${entities} |
| 26 | + Should Contain Entity |
| 27 | + ... {"@topic-id":"device/child0//","@parent":"device/main//","@type":"child-device"} |
| 28 | + ... ${entities} |
| 29 | + Should Contain Entity |
| 30 | + ... {"@topic-id":"device/child00//","@parent":"device/child0//","@type":"child-device"} |
| 31 | + ... ${entities} |
| 32 | + Should Contain Entity |
| 33 | + ... {"@topic-id":"device/child000//","@parent":"device/child00//","@type":"child-device"} |
| 34 | + ... ${entities} |
| 35 | + Should Contain Entity |
| 36 | + ... {"@topic-id":"device/child1//","@parent":"device/main//","@type":"child-device"} |
| 37 | + ... ${entities} |
| 38 | + Should Contain Entity |
| 39 | + ... {"@topic-id":"device/child1/service/service10","@parent":"device/child1//","@type":"service","type":"service"} |
| 40 | + ... ${entities} |
| 41 | + Should Contain Entity |
| 42 | + ... {"@topic-id":"device/child2//","@parent":"device/main//","@type":"child-device"} |
| 43 | + ... ${entities} |
| 44 | + Should Contain Entity |
| 45 | + ... {"@topic-id":"device/child2/service/service20","@parent":"device/child2//","@type":"service","type":"service"} |
| 46 | + ... ${entities} |
| 47 | + Should Contain Entity |
| 48 | + ... {"@topic-id":"device/child2/service/service21","@parent":"device/child2//","@type":"service","type":"service"} |
| 49 | + ... ${entities} |
| 50 | + Should Contain Entity |
| 51 | + ... {"@topic-id":"device/child20//","@parent":"device/child2//","@type":"child-device"} |
| 52 | + ... ${entities} |
| 53 | + Should Contain Entity |
| 54 | + ... {"@topic-id":"device/child21//","@parent":"device/child2//","@type":"child-device"} |
| 55 | + ... ${entities} |
| 56 | + Should Contain Entity |
| 57 | + ... {"@topic-id":"device/child21/service/service210","@parent":"device/child21//","@type":"service","type":"service"} |
| 58 | + ... ${entities} |
| 59 | + Should Contain Entity |
| 60 | + ... {"@topic-id":"device/child210//","@parent":"device/child21//","@type":"child-device"} |
| 61 | + ... ${entities} |
| 62 | + Should Contain Entity |
| 63 | + ... {"@topic-id":"device/child210/service/service2100","@parent":"device/child210//","@type":"service","type":"service"} |
| 64 | + ... ${entities} |
| 65 | + Should Contain Entity |
| 66 | + ... {"@topic-id":"device/child2100//","@parent":"device/child210//","@type":"child-device"} |
| 67 | + ... ${entities} |
| 68 | + Should Contain Entity |
| 69 | + ... {"@topic-id":"device/child22//","@parent":"device/child2//","@type":"child-device"} |
| 70 | + ... ${entities} |
| 71 | + |
| 72 | +Query from child root |
| 73 | + ${entities}= List Entities root=device/child2// |
| 74 | + |
| 75 | + Length Should Be ${entities} 10 |
| 76 | + |
| 77 | + Should Contain Entity |
| 78 | + ... {"@topic-id":"device/child2//","@parent":"device/main//","@type":"child-device"} |
| 79 | + ... ${entities} |
| 80 | + Should Contain Entity |
| 81 | + ... {"@topic-id":"device/child2/service/service20","@parent":"device/child2//","@type":"service","type":"service"} |
| 82 | + ... ${entities} |
| 83 | + Should Contain Entity |
| 84 | + ... {"@topic-id":"device/child2/service/service21","@parent":"device/child2//","@type":"service","type":"service"} |
| 85 | + ... ${entities} |
| 86 | + Should Contain Entity |
| 87 | + ... {"@topic-id":"device/child20//","@parent":"device/child2//","@type":"child-device"} |
| 88 | + ... ${entities} |
| 89 | + Should Contain Entity |
| 90 | + ... {"@topic-id":"device/child21//","@parent":"device/child2//","@type":"child-device"} |
| 91 | + ... ${entities} |
| 92 | + Should Contain Entity |
| 93 | + ... {"@topic-id":"device/child21/service/service210","@parent":"device/child21//","@type":"service","type":"service"} |
| 94 | + ... ${entities} |
| 95 | + Should Contain Entity |
| 96 | + ... {"@topic-id":"device/child210//","@parent":"device/child21//","@type":"child-device"} |
| 97 | + ... ${entities} |
| 98 | + Should Contain Entity |
| 99 | + ... {"@topic-id":"device/child210/service/service2100","@parent":"device/child210//","@type":"service","type":"service"} |
| 100 | + ... ${entities} |
| 101 | + Should Contain Entity |
| 102 | + ... {"@topic-id":"device/child2100//","@parent":"device/child210//","@type":"child-device"} |
| 103 | + ... ${entities} |
| 104 | + Should Contain Entity |
| 105 | + ... {"@topic-id":"device/child22//","@parent":"device/child2//","@type":"child-device"} |
| 106 | + ... ${entities} |
| 107 | + |
| 108 | +Query by parent |
| 109 | + ${entities}= List Entities parent=device/child2// |
| 110 | + |
| 111 | + Length Should Be ${entities} 5 |
| 112 | + |
| 113 | + Should Contain Entity |
| 114 | + ... {"@topic-id":"device/child2/service/service20","@parent":"device/child2//","@type":"service","type":"service"} |
| 115 | + ... ${entities} |
| 116 | + Should Contain Entity |
| 117 | + ... {"@topic-id":"device/child2/service/service21","@parent":"device/child2//","@type":"service","type":"service"} |
| 118 | + ... ${entities} |
| 119 | + Should Contain Entity |
| 120 | + ... {"@topic-id":"device/child20//","@parent":"device/child2//","@type":"child-device"} |
| 121 | + ... ${entities} |
| 122 | + Should Contain Entity |
| 123 | + ... {"@topic-id":"device/child21//","@parent":"device/child2//","@type":"child-device"} |
| 124 | + ... ${entities} |
| 125 | + Should Contain Entity |
| 126 | + ... {"@topic-id":"device/child22//","@parent":"device/child2//","@type":"child-device"} |
| 127 | + ... ${entities} |
| 128 | + |
| 129 | +Query all children |
| 130 | + ${entities}= List Entities type=child-device |
| 131 | + Length Should Be ${entities} 10 |
| 132 | + |
| 133 | + Should Contain Entity |
| 134 | + ... {"@topic-id":"device/child0//","@parent":"device/main//","@type":"child-device"} |
| 135 | + ... ${entities} |
| 136 | + Should Contain Entity |
| 137 | + ... {"@topic-id":"device/child00//","@parent":"device/child0//","@type":"child-device"} |
| 138 | + ... ${entities} |
| 139 | + Should Contain Entity |
| 140 | + ... {"@topic-id":"device/child000//","@parent":"device/child00//","@type":"child-device"} |
| 141 | + ... ${entities} |
| 142 | + Should Contain Entity |
| 143 | + ... {"@topic-id":"device/child1//","@parent":"device/main//","@type":"child-device"} |
| 144 | + ... ${entities} |
| 145 | + Should Contain Entity |
| 146 | + ... {"@topic-id":"device/child2//","@parent":"device/main//","@type":"child-device"} |
| 147 | + ... ${entities} |
| 148 | + Should Contain Entity |
| 149 | + ... {"@topic-id":"device/child20//","@parent":"device/child2//","@type":"child-device"} |
| 150 | + ... ${entities} |
| 151 | + Should Contain Entity |
| 152 | + ... {"@topic-id":"device/child21//","@parent":"device/child2//","@type":"child-device"} |
| 153 | + ... ${entities} |
| 154 | + Should Contain Entity |
| 155 | + ... {"@topic-id":"device/child210//","@parent":"device/child21//","@type":"child-device"} |
| 156 | + ... ${entities} |
| 157 | + Should Contain Entity |
| 158 | + ... {"@topic-id":"device/child2100//","@parent":"device/child210//","@type":"child-device"} |
| 159 | + ... ${entities} |
| 160 | + Should Contain Entity |
| 161 | + ... {"@topic-id":"device/child22//","@parent":"device/child2//","@type":"child-device"} |
| 162 | + ... ${entities} |
| 163 | + |
| 164 | +Query all services |
| 165 | + ${entities}= List Entities type=service |
| 166 | + |
| 167 | + Should Contain Entity |
| 168 | + ... {"@topic-id":"device/main/service/service0","@parent":"device/main//","@type":"service","type":"service"} |
| 169 | + ... ${entities} |
| 170 | + Should Contain Entity |
| 171 | + ... {"@topic-id":"device/main/service/service1","@parent":"device/main//","@type":"service","type":"service"} |
| 172 | + ... ${entities} |
| 173 | + Should Contain Entity |
| 174 | + ... {"@topic-id":"device/child1/service/service10","@parent":"device/child1//","@type":"service","type":"service"} |
| 175 | + ... ${entities} |
| 176 | + Should Contain Entity |
| 177 | + ... {"@topic-id":"device/child2/service/service20","@parent":"device/child2//","@type":"service","type":"service"} |
| 178 | + ... ${entities} |
| 179 | + Should Contain Entity |
| 180 | + ... {"@topic-id":"device/child2/service/service21","@parent":"device/child2//","@type":"service","type":"service"} |
| 181 | + ... ${entities} |
| 182 | + Should Contain Entity |
| 183 | + ... {"@topic-id":"device/child21/service/service210","@parent":"device/child21//","@type":"service","type":"service"} |
| 184 | + ... ${entities} |
| 185 | + Should Contain Entity |
| 186 | + ... {"@topic-id":"device/child210/service/service2100","@parent":"device/child210//","@type":"service","type":"service"} |
| 187 | + ... ${entities} |
| 188 | + |
| 189 | +Query with parent and type |
| 190 | + ${entities}= List Entities parent=device/child2// type=child-device |
| 191 | + Length Should Be ${entities} 3 |
| 192 | + |
| 193 | + Should Contain Entity |
| 194 | + ... {"@topic-id":"device/child20//","@parent":"device/child2//","@type":"child-device"} |
| 195 | + ... ${entities} |
| 196 | + Should Contain Entity |
| 197 | + ... {"@topic-id":"device/child21//","@parent":"device/child2//","@type":"child-device"} |
| 198 | + ... ${entities} |
| 199 | + Should Contain Entity |
| 200 | + ... {"@topic-id":"device/child22//","@parent":"device/child2//","@type":"child-device"} |
| 201 | + ... ${entities} |
| 202 | + |
| 203 | + |
| 204 | +*** Keywords *** |
| 205 | +Custom Setup |
| 206 | + ${DEVICE_SN}= Setup |
| 207 | + Set Suite Variable $DEVICE_SN |
| 208 | + |
| 209 | + # Build the entity tree: |
| 210 | + # main |
| 211 | + # |--- service0 |
| 212 | + # |--- service1 |
| 213 | + # |--- child0 |
| 214 | + # | |--- child00 |
| 215 | + # | | |--- child000 |
| 216 | + # |--- child1 |
| 217 | + # | |--- service10 |
| 218 | + # |--- child2 |
| 219 | + # | |--- service20 |
| 220 | + # | |--- service21 |
| 221 | + # | |--- child20 |
| 222 | + # | |--- child21 |
| 223 | + # | | |--- service210 |
| 224 | + # | | |--- child210 |
| 225 | + # | | | |-- service2100 |
| 226 | + # | | | |-- child2100 |
| 227 | + # | |--- child22 |
| 228 | + Register Entity device/main/service/service0 service device/main// |
| 229 | + Register Entity device/main/service/service1 service device/main// |
| 230 | + Register Entity device/child0// child-device device/main// |
| 231 | + Register Entity device/child00// child-device device/child0// |
| 232 | + Register Entity device/child000// child-device device/child00// |
| 233 | + Register Entity device/child1// child-device device/main// |
| 234 | + Register Entity device/child1/service/service10 service device/child1// |
| 235 | + Register Entity device/child2// child-device device/main// |
| 236 | + Register Entity device/child2/service/service20 service device/child2// |
| 237 | + Register Entity device/child2/service/service21 service device/child2// |
| 238 | + Register Entity device/child20// child-device device/child2// |
| 239 | + Register Entity device/child21// child-device device/child2// |
| 240 | + Register Entity device/child21/service/service210 service device/child21// |
| 241 | + Register Entity device/child210// child-device device/child21// |
| 242 | + Register Entity device/child210/service/service2100 service device/child210// |
| 243 | + Register Entity device/child2100// child-device device/child210// |
| 244 | + Register Entity device/child22// child-device device/child2// |
0 commit comments