Mahesh Poojary S | a4df1aa | 2016-05-13 08:53:53 +0530 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2016-present Open Networking Laboratory |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | package org.onosproject.pce.pceservice; |
| 17 | |
| 18 | import static org.hamcrest.MatcherAssert.assertThat; |
| 19 | import static org.hamcrest.Matchers.is; |
| 20 | import static org.hamcrest.Matchers.notNullValue; |
| 21 | import static org.hamcrest.Matchers.nullValue; |
| 22 | |
| 23 | import static org.onosproject.net.Link.Type.DIRECT; |
| 24 | |
| 25 | import java.util.HashMap; |
| 26 | import java.util.Iterator; |
| 27 | import java.util.Map; |
| 28 | import java.util.List; |
| 29 | import java.util.LinkedList; |
| 30 | |
| 31 | import org.junit.After; |
| 32 | import org.junit.Before; |
| 33 | import org.junit.Test; |
| 34 | |
| 35 | import org.onosproject.incubator.net.resource.label.LabelResourceId; |
| 36 | import org.onosproject.incubator.net.resource.label.LabelResourceAdminService; |
| 37 | import org.onosproject.incubator.net.resource.label.LabelResourceService; |
| 38 | import org.onosproject.incubator.net.tunnel.LabelStack; |
| 39 | import org.onosproject.net.ConnectPoint; |
| 40 | import org.onosproject.net.DefaultAnnotations; |
| 41 | import org.onosproject.net.DefaultPath; |
| 42 | import org.onosproject.net.DeviceId; |
| 43 | import org.onosproject.net.PortNumber; |
| 44 | import org.onosproject.net.Path; |
| 45 | import org.onosproject.pce.pcestore.api.PceStore; |
| 46 | import org.onosproject.net.provider.ProviderId; |
| 47 | import org.onosproject.pce.util.LabelResourceAdapter; |
| 48 | import org.onosproject.pce.util.PceStoreAdapter; |
| 49 | import org.onosproject.net.DefaultLink; |
| 50 | import org.onosproject.net.Link; |
| 51 | |
| 52 | /** |
| 53 | * Unit tests for PceccSrTeBeHandler class. |
| 54 | */ |
| 55 | public class PceccSrTeBeHandlerTest { |
| 56 | |
| 57 | public static final long GLOBAL_LABEL_SPACE_MIN = 4097; |
| 58 | public static final long GLOBAL_LABEL_SPACE_MAX = 5121; |
| 59 | |
| 60 | private PceccSrTeBeHandler srTeHandler; |
| 61 | protected LabelResourceAdminService labelRsrcAdminService; |
| 62 | protected LabelResourceService labelRsrcService; |
| 63 | protected PceStore pceStore; |
| 64 | private ProviderId providerId; |
| 65 | private DeviceId deviceId1; |
| 66 | private DeviceId deviceId2; |
| 67 | private DeviceId deviceId3; |
| 68 | private DeviceId deviceId4; |
| 69 | private DeviceId deviceId5; |
| 70 | private PortNumber port1; |
| 71 | private PortNumber port2; |
| 72 | private PortNumber port3; |
| 73 | private PortNumber port4; |
| 74 | private PortNumber port5; |
| 75 | private Link link1; |
| 76 | private Link link2; |
| 77 | private Link link3; |
| 78 | private Link link4; |
| 79 | private Path path1; |
| 80 | LabelResourceId labelId; |
| 81 | private LabelResourceId labelId1 = LabelResourceId.labelResourceId(4098); |
| 82 | private LabelResourceId labelId2 = LabelResourceId.labelResourceId(4099); |
| 83 | private Map<DeviceId, String> deviceIdLsrIdMap; |
| 84 | |
| 85 | @Before |
| 86 | public void setUp() throws Exception { |
| 87 | // Initialization of member variables |
| 88 | srTeHandler = PceccSrTeBeHandler.getInstance(); |
| 89 | labelRsrcService = new LabelResourceAdapter(); |
| 90 | labelRsrcAdminService = new LabelResourceAdapter(); |
| 91 | pceStore = new PceStoreAdapter(); |
| 92 | srTeHandler.initialize(labelRsrcAdminService, labelRsrcService, pceStore); |
| 93 | |
| 94 | // Creates path |
| 95 | // Creates list of links |
| 96 | providerId = new ProviderId("of", "foo"); |
| 97 | deviceId1 = DeviceId.deviceId("of:A"); |
| 98 | deviceId2 = DeviceId.deviceId("of:B"); |
| 99 | deviceId3 = DeviceId.deviceId("of:C"); |
| 100 | deviceId4 = DeviceId.deviceId("of:D"); |
| 101 | deviceId5 = DeviceId.deviceId("of:E"); |
| 102 | port1 = PortNumber.portNumber(1); |
| 103 | port2 = PortNumber.portNumber(2); |
| 104 | port3 = PortNumber.portNumber(3); |
| 105 | port4 = PortNumber.portNumber(4); |
| 106 | port5 = PortNumber.portNumber(5); |
| 107 | List<Link> linkList = new LinkedList<>(); |
| 108 | |
| 109 | link1 = DefaultLink.builder() |
| 110 | .providerId(providerId) |
| 111 | .annotations(DefaultAnnotations.builder().set("key1", "yahoo").build()) |
| 112 | .src(new ConnectPoint(deviceId1, port1)) |
| 113 | .dst(new ConnectPoint(deviceId2, port2)) |
| 114 | .type(DIRECT) |
| 115 | .state(Link.State.ACTIVE) |
| 116 | .build(); |
| 117 | linkList.add(link1); |
| 118 | link2 = DefaultLink.builder() |
| 119 | .providerId(providerId) |
| 120 | .annotations(DefaultAnnotations.builder().set("key2", "yahoo").build()) |
| 121 | .src(new ConnectPoint(deviceId2, port2)) |
| 122 | .dst(new ConnectPoint(deviceId3, port3)) |
| 123 | .type(DIRECT) |
| 124 | .state(Link.State.ACTIVE) |
| 125 | .build(); |
| 126 | linkList.add(link2); |
| 127 | link3 = DefaultLink.builder() |
| 128 | .providerId(providerId) |
| 129 | .annotations(DefaultAnnotations.builder().set("key3", "yahoo").build()) |
| 130 | .src(new ConnectPoint(deviceId3, port3)) |
| 131 | .dst(new ConnectPoint(deviceId4, port4)) |
| 132 | .type(DIRECT) |
| 133 | .state(Link.State.ACTIVE) |
| 134 | .build(); |
| 135 | linkList.add(link3); |
| 136 | link4 = DefaultLink.builder() |
| 137 | .providerId(providerId) |
| 138 | .annotations(DefaultAnnotations.builder().set("key4", "yahoo").build()) |
| 139 | .src(new ConnectPoint(deviceId4, port4)) |
| 140 | .dst(new ConnectPoint(deviceId5, port5)) |
| 141 | .type(DIRECT) |
| 142 | .state(Link.State.ACTIVE) |
| 143 | .build(); |
| 144 | linkList.add(link4); |
| 145 | |
| 146 | // Path |
| 147 | path1 = new DefaultPath(providerId, linkList, 10); |
| 148 | } |
| 149 | |
| 150 | @After |
| 151 | public void tearDown() throws Exception { |
| 152 | } |
| 153 | |
| 154 | /** |
| 155 | * Checks the operation of getInstance() method. |
| 156 | */ |
| 157 | @Test |
| 158 | public void testGetInstance() { |
| 159 | assertThat(srTeHandler, is(notNullValue())); |
| 160 | } |
| 161 | |
| 162 | /** |
| 163 | * Checks the operation of reserveGlobalPool() method. |
| 164 | */ |
| 165 | @Test |
| 166 | public void testReserveGlobalPool() { |
| 167 | assertThat(srTeHandler.reserveGlobalPool(GLOBAL_LABEL_SPACE_MIN, |
| 168 | GLOBAL_LABEL_SPACE_MAX), is(true)); |
| 169 | } |
| 170 | |
| 171 | /** |
| 172 | * Checks the operation of allocateNodeLabel() method on node label. |
| 173 | * Considered some nodes are already available before PceManager came up. |
| 174 | */ |
| 175 | @Test |
| 176 | public void testAllocateNodeLabel1() { |
| 177 | // Specific device deviceId1 |
| 178 | |
| 179 | // Devices mapping with lsr-id |
| 180 | deviceIdLsrIdMap = new HashMap<>(); |
| 181 | |
| 182 | //device 1 |
| 183 | String lsrId1 = "11.1.1.1"; |
| 184 | deviceIdLsrIdMap.put(deviceId1, lsrId1); |
| 185 | |
| 186 | // device 2 |
| 187 | String lsrId2 = "12.1.1.1"; |
| 188 | deviceIdLsrIdMap.put(deviceId2, lsrId2); |
| 189 | |
| 190 | // device 3 |
| 191 | String lsrId3 = "13.1.1.1"; |
| 192 | deviceIdLsrIdMap.put(deviceId3, lsrId3); |
| 193 | |
| 194 | // device 4 |
| 195 | String lsrId4 = "14.1.1.1"; |
| 196 | deviceIdLsrIdMap.put(deviceId4, lsrId4); |
| 197 | |
| 198 | // device 5 |
| 199 | String lsrId5 = "15.1.1.1"; |
| 200 | deviceIdLsrIdMap.put(deviceId5, lsrId5); |
| 201 | |
| 202 | // Considered devices are stored in deviceIdLsrIdMap. |
| 203 | // Creating temporary tempDeviceIdLsrIdMap to pass to allocateNodeLabel() |
| 204 | Map<DeviceId, String> tempDeviceIdLsrIdMap = new HashMap<>(); |
| 205 | for (Map.Entry element : deviceIdLsrIdMap.entrySet()) { |
| 206 | DeviceId devId = (DeviceId) element.getKey(); |
| 207 | String lsrId = (String) element.getValue(); |
| 208 | |
| 209 | // Allocate node label for specific device devId |
| 210 | assertThat(srTeHandler.allocateNodeLabel(devId, lsrId, tempDeviceIdLsrIdMap), is(true)); |
| 211 | |
| 212 | // Retrieve label from store |
| 213 | LabelResourceId labelId = pceStore.getGlobalNodeLabel(devId); |
| 214 | |
| 215 | // Check whether label is generated for this device devId |
| 216 | assertThat(labelId, is(notNullValue())); |
| 217 | |
| 218 | //Now add device to tempDeviceIdLsrIdMap |
| 219 | tempDeviceIdLsrIdMap.put(devId, lsrId); |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | /** |
| 224 | * Checks the operation of allocateNodeLabel() method on node label. |
| 225 | * Considered initially map is empty and keep on getting new devices from event. |
| 226 | */ |
| 227 | @Test |
| 228 | public void testAllocateNodeLabel2() { |
| 229 | // Specific device deviceId1 |
| 230 | |
| 231 | // Device-id mapping with lsr-id |
| 232 | deviceIdLsrIdMap = new HashMap<>(); |
| 233 | |
| 234 | //device 1 |
| 235 | String lsrId1 = "11.1.1.1"; |
| 236 | // Allocate node label for specific device deviceId1 |
| 237 | assertThat(srTeHandler.allocateNodeLabel(deviceId1, lsrId1, deviceIdLsrIdMap), is(true)); |
| 238 | // Retrieve label from store |
| 239 | LabelResourceId labelId = pceStore.getGlobalNodeLabel(deviceId1); |
| 240 | // Check whether label is generated for this device deviceId1 |
| 241 | assertThat(labelId, is(notNullValue())); |
| 242 | //Now add device to deviceIdLsrIdMap |
| 243 | deviceIdLsrIdMap.put(deviceId1, lsrId1); |
| 244 | |
| 245 | // device 2 |
| 246 | String lsrId2 = "12.1.1.1"; |
| 247 | // Allocate node label for specific device deviceId2 |
| 248 | assertThat(srTeHandler.allocateNodeLabel(deviceId2, lsrId2, deviceIdLsrIdMap), is(true)); |
| 249 | // Retrieve label from store |
| 250 | labelId = pceStore.getGlobalNodeLabel(deviceId2); |
| 251 | // Check whether label is generated for this device deviceId2 |
| 252 | assertThat(labelId, is(notNullValue())); |
| 253 | //Now add device to deviceIdLsrIdMap |
| 254 | deviceIdLsrIdMap.put(deviceId2, lsrId2); |
| 255 | |
| 256 | // device 3 |
| 257 | String lsrId3 = "13.1.1.1"; |
| 258 | // Allocate node label for specific device deviceId3 |
| 259 | assertThat(srTeHandler.allocateNodeLabel(deviceId3, lsrId3, deviceIdLsrIdMap), is(true)); |
| 260 | // Retrieve label from store |
| 261 | labelId = pceStore.getGlobalNodeLabel(deviceId3); |
| 262 | // Check whether label is generated for this device deviceId3 |
| 263 | assertThat(labelId, is(notNullValue())); |
| 264 | //Now add device to deviceIdLsrIdMap |
| 265 | deviceIdLsrIdMap.put(deviceId3, lsrId3); |
| 266 | |
| 267 | // device 4 |
| 268 | String lsrId4 = "14.1.1.1"; |
| 269 | // Allocate node label for specific device deviceId4 |
| 270 | assertThat(srTeHandler.allocateNodeLabel(deviceId4, lsrId4, deviceIdLsrIdMap), is(true)); |
| 271 | // Retrieve label from store |
| 272 | labelId = pceStore.getGlobalNodeLabel(deviceId4); |
| 273 | // Check whether label is generated for this device deviceId4 |
| 274 | assertThat(labelId, is(notNullValue())); |
| 275 | //Now add device to deviceIdLsrIdMap |
| 276 | deviceIdLsrIdMap.put(deviceId4, lsrId4); |
| 277 | |
| 278 | // device 5 |
| 279 | String lsrId5 = "15.1.1.1"; |
| 280 | // Allocate node label for specific device deviceId5 |
| 281 | assertThat(srTeHandler.allocateNodeLabel(deviceId5, lsrId5, deviceIdLsrIdMap), is(true)); |
| 282 | // Retrieve label from store |
| 283 | labelId = pceStore.getGlobalNodeLabel(deviceId5); |
| 284 | // Check whether label is generated for this device deviceId5 |
| 285 | assertThat(labelId, is(notNullValue())); |
| 286 | //Now add device to deviceIdLsrIdMap |
| 287 | deviceIdLsrIdMap.put(deviceId5, lsrId5); |
| 288 | } |
| 289 | |
| 290 | /** |
| 291 | * Checks the operation of releaseNodeLabel() method on node label. |
| 292 | */ |
| 293 | @Test |
| 294 | public void testReleaseNodeLabelSuccess() { |
| 295 | testAllocateNodeLabel2(); |
| 296 | // Specific device deviceId1 |
| 297 | |
| 298 | //device 1 |
| 299 | String lsrId1 = "11.1.1.1"; |
| 300 | // Check whether successfully released node label |
| 301 | assertThat(srTeHandler.releaseNodeLabel(deviceId1, lsrId1, deviceIdLsrIdMap), is(true)); |
| 302 | // Check whether successfully removed label from store |
| 303 | LabelResourceId labelId = pceStore.getGlobalNodeLabel(deviceId1); |
| 304 | assertThat(labelId, is(nullValue())); |
| 305 | // Remove released deviceId1 |
| 306 | deviceIdLsrIdMap.remove(deviceId1); |
| 307 | |
| 308 | //device 2 |
| 309 | String lsrId2 = "12.1.1.1"; |
| 310 | // Check whether successfully released node label |
| 311 | assertThat(srTeHandler.releaseNodeLabel(deviceId2, lsrId2, deviceIdLsrIdMap), is(true)); |
| 312 | // Check whether successfully removed label from store |
| 313 | labelId = pceStore.getGlobalNodeLabel(deviceId2); |
| 314 | assertThat(labelId, is(nullValue())); |
| 315 | // Remove released deviceId2 |
| 316 | deviceIdLsrIdMap.remove(deviceId2); |
| 317 | |
| 318 | //device 3 |
| 319 | String lsrId3 = "13.1.1.1"; |
| 320 | // Check whether successfully released node label |
| 321 | assertThat(srTeHandler.releaseNodeLabel(deviceId3, lsrId3, deviceIdLsrIdMap), is(true)); |
| 322 | // Check whether successfully removed label from store |
| 323 | labelId = pceStore.getGlobalNodeLabel(deviceId3); |
| 324 | assertThat(labelId, is(nullValue())); |
| 325 | // Remove released deviceId3 |
| 326 | deviceIdLsrIdMap.remove(deviceId3); |
| 327 | |
| 328 | //device 4 |
| 329 | String lsrId4 = "14.1.1.1"; |
| 330 | // Check whether successfully released node label |
| 331 | assertThat(srTeHandler.releaseNodeLabel(deviceId4, lsrId4, deviceIdLsrIdMap), is(true)); |
| 332 | // Check whether successfully removed label from store |
| 333 | labelId = pceStore.getGlobalNodeLabel(deviceId4); |
| 334 | assertThat(labelId, is(nullValue())); |
| 335 | // Remove released deviceId4 |
| 336 | deviceIdLsrIdMap.remove(deviceId4); |
| 337 | |
| 338 | //device 5 |
| 339 | String lsrId5 = "15.1.1.1"; |
| 340 | // Check whether successfully released node label |
| 341 | assertThat(srTeHandler.releaseNodeLabel(deviceId5, lsrId5, deviceIdLsrIdMap), is(true)); |
| 342 | // Check whether successfully removed label from store |
| 343 | labelId = pceStore.getGlobalNodeLabel(deviceId5); |
| 344 | assertThat(labelId, is(nullValue())); |
| 345 | // Remove released deviceId5 |
| 346 | deviceIdLsrIdMap.remove(deviceId5); |
| 347 | } |
| 348 | |
| 349 | @Test |
| 350 | public void testReleaseNodeLabelFailure() { |
| 351 | testAllocateNodeLabel2(); |
| 352 | |
| 353 | //device 6 |
| 354 | String lsrId6 = "16.1.1.1"; |
| 355 | // Check whether successfully released node label |
| 356 | DeviceId deviceId6 = DeviceId.deviceId("foo6"); |
| 357 | assertThat(srTeHandler.releaseNodeLabel(deviceId6, lsrId6, deviceIdLsrIdMap), is(false)); |
| 358 | } |
| 359 | |
| 360 | /** |
| 361 | * Checks the operation of allocateAdjacencyLabel() method on adjacency label. |
| 362 | */ |
| 363 | @Test |
| 364 | public void testAllocateAdjacencyLabel() { |
| 365 | // test link1 |
| 366 | // Check whether adjacency label is allocated successfully. |
| 367 | assertThat(srTeHandler.allocateAdjacencyLabel(link1), is(true)); |
| 368 | // Retrieve from store and check whether adjacency label is generated successfully for this device. |
| 369 | LabelResourceId labelId = pceStore.getAdjLabel(link1); |
| 370 | assertThat(labelId, is(notNullValue())); |
| 371 | |
| 372 | // test link2 |
| 373 | // Check whether adjacency label is allocated successfully. |
| 374 | assertThat(srTeHandler.allocateAdjacencyLabel(link2), is(true)); |
| 375 | // Retrieve from store and check whether adjacency label is generated successfully for this device. |
| 376 | labelId = pceStore.getAdjLabel(link2); |
| 377 | assertThat(labelId, is(notNullValue())); |
| 378 | |
| 379 | // test link3 |
| 380 | // Check whether adjacency label is allocated successfully. |
| 381 | assertThat(srTeHandler.allocateAdjacencyLabel(link3), is(true)); |
| 382 | // Retrieve from store and check whether adjacency label is generated successfully for this device. |
| 383 | labelId = pceStore.getAdjLabel(link3); |
| 384 | assertThat(labelId, is(notNullValue())); |
| 385 | |
| 386 | // test link4 |
| 387 | // Check whether adjacency label is allocated successfully. |
| 388 | assertThat(srTeHandler.allocateAdjacencyLabel(link4), is(true)); |
| 389 | // Retrieve from store and check whether adjacency label is generated successfully for this device. |
| 390 | labelId = pceStore.getAdjLabel(link4); |
| 391 | assertThat(labelId, is(notNullValue())); |
| 392 | } |
| 393 | |
| 394 | /** |
| 395 | * Checks the operation of releaseAdjacencyLabel() method on adjacency label. |
| 396 | */ |
| 397 | @Test |
| 398 | public void testReleaseAdjacencyLabel() { |
| 399 | // Test link1 |
| 400 | // Check whether adjacency label is released successfully. |
| 401 | assertThat(srTeHandler.allocateAdjacencyLabel(link1), is(true)); |
| 402 | assertThat(srTeHandler.releaseAdjacencyLabel(link1), is(true)); |
| 403 | // Retrieve from store and check whether adjacency label is removed successfully for this device. |
| 404 | LabelResourceId labelId = pceStore.getAdjLabel(link1); |
| 405 | assertThat(labelId, is(nullValue())); |
| 406 | |
| 407 | // Test link2 |
| 408 | // Check whether adjacency label is released successfully. |
| 409 | assertThat(srTeHandler.allocateAdjacencyLabel(link2), is(true)); |
| 410 | assertThat(srTeHandler.releaseAdjacencyLabel(link2), is(true)); |
| 411 | // Retrieve from store and check whether adjacency label is removed successfully for this device. |
| 412 | labelId = pceStore.getAdjLabel(link2); |
| 413 | assertThat(labelId, is(nullValue())); |
| 414 | } |
| 415 | |
| 416 | /** |
| 417 | * Checks the operation of computeLabelStack() method. |
| 418 | */ |
| 419 | @Test |
| 420 | public void testComputeLabelStack() { |
| 421 | // Allocate node labels to each devices |
| 422 | labelId = LabelResourceId.labelResourceId(4097); |
| 423 | pceStore.addGlobalNodeLabel(deviceId1, labelId); |
| 424 | labelId = LabelResourceId.labelResourceId(4098); |
| 425 | pceStore.addGlobalNodeLabel(deviceId2, labelId); |
| 426 | labelId = LabelResourceId.labelResourceId(4099); |
| 427 | pceStore.addGlobalNodeLabel(deviceId3, labelId); |
| 428 | labelId = LabelResourceId.labelResourceId(4100); |
| 429 | pceStore.addGlobalNodeLabel(deviceId4, labelId); |
| 430 | labelId = LabelResourceId.labelResourceId(4101); |
| 431 | pceStore.addGlobalNodeLabel(deviceId5, labelId); |
| 432 | |
| 433 | // Allocate adjacency labels to each devices |
| 434 | labelId = LabelResourceId.labelResourceId(5122); |
| 435 | pceStore.addAdjLabel(link1, labelId); |
| 436 | labelId = LabelResourceId.labelResourceId(5123); |
| 437 | pceStore.addAdjLabel(link2, labelId); |
| 438 | labelId = LabelResourceId.labelResourceId(5124); |
| 439 | pceStore.addAdjLabel(link3, labelId); |
| 440 | labelId = LabelResourceId.labelResourceId(5125); |
| 441 | pceStore.addAdjLabel(link4, labelId); |
| 442 | |
| 443 | // Compute label stack |
| 444 | LabelStack labelStack = srTeHandler.computeLabelStack(path1); |
| 445 | |
| 446 | // check node-label of deviceId1 |
| 447 | List<LabelResourceId> labelList = labelStack.labelResources(); |
| 448 | Iterator<LabelResourceId> iterator = labelList.iterator(); |
| 449 | labelId = (LabelResourceId) iterator.next(); |
| 450 | assertThat(labelId, is(LabelResourceId.labelResourceId(4097))); |
| 451 | |
| 452 | // check adjacency label of deviceId1 |
| 453 | labelId = (LabelResourceId) iterator.next(); |
| 454 | assertThat(labelId, is(LabelResourceId.labelResourceId(5122))); |
| 455 | |
| 456 | // check node-label of deviceId2 |
| 457 | labelId = (LabelResourceId) iterator.next(); |
| 458 | assertThat(labelId, is(LabelResourceId.labelResourceId(4098))); |
| 459 | |
| 460 | // check adjacency label of deviceId2 |
| 461 | labelId = (LabelResourceId) iterator.next(); |
| 462 | assertThat(labelId, is(LabelResourceId.labelResourceId(5123))); |
| 463 | |
| 464 | // check node-label of deviceId3 |
| 465 | labelId = (LabelResourceId) iterator.next(); |
| 466 | assertThat(labelId, is(LabelResourceId.labelResourceId(4099))); |
| 467 | |
| 468 | // check adjacency label of deviceId3 |
| 469 | labelId = (LabelResourceId) iterator.next(); |
| 470 | assertThat(labelId, is(LabelResourceId.labelResourceId(5124))); |
| 471 | |
| 472 | // check node-label of deviceId4 |
| 473 | labelId = (LabelResourceId) iterator.next(); |
| 474 | assertThat(labelId, is(LabelResourceId.labelResourceId(4100))); |
| 475 | |
| 476 | // check adjacency label of deviceId4 |
| 477 | labelId = (LabelResourceId) iterator.next(); |
| 478 | assertThat(labelId, is(LabelResourceId.labelResourceId(5125))); |
| 479 | |
| 480 | // check node-label of deviceId5 |
| 481 | labelId = (LabelResourceId) iterator.next(); |
| 482 | assertThat(labelId, is(LabelResourceId.labelResourceId(4101))); |
| 483 | } |
| 484 | } |