Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with |
| 5 | * the License. You may obtain a copy of the License at |
| 6 | * |
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | * |
| 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on |
| 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| 11 | * specific language governing permissions and limitations under the License. |
| 12 | */ |
| 13 | package org.onosproject.provider.bgp.topology.impl; |
| 14 | |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 15 | import static org.hamcrest.MatcherAssert.assertThat; |
| 16 | import static org.hamcrest.core.Is.is; |
| 17 | import static org.hamcrest.core.IsNot.not; |
| 18 | import static org.onosproject.net.Link.State.ACTIVE; |
Priyanka B | 658aa698 | 2016-05-27 21:34:49 +0530 | [diff] [blame] | 19 | import static org.onosproject.net.MastershipRole.MASTER; |
| 20 | import static org.hamcrest.Matchers.nullValue; |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 21 | |
| 22 | import java.util.Collection; |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 23 | import java.util.HashMap; |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 24 | import java.util.HashSet; |
| 25 | import java.util.LinkedList; |
| 26 | import java.util.List; |
| 27 | import java.util.Map; |
| 28 | import java.util.Set; |
| 29 | import java.util.concurrent.CopyOnWriteArraySet; |
| 30 | |
| 31 | import org.junit.After; |
| 32 | import org.junit.Before; |
| 33 | import org.junit.Test; |
Priyanka B | 658aa698 | 2016-05-27 21:34:49 +0530 | [diff] [blame] | 34 | import org.onlab.junit.TestUtils; |
| 35 | import org.onlab.junit.TestUtils.TestUtilsException; |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 36 | import org.onlab.packet.ChassisId; |
Priyanka B | 658aa698 | 2016-05-27 21:34:49 +0530 | [diff] [blame] | 37 | import org.onlab.packet.Ip4Address; |
| 38 | import org.onlab.util.Bandwidth; |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 39 | import org.onosproject.bgp.controller.BgpLinkListener; |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 40 | import org.onosproject.bgp.controller.BgpNodeListener; |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame] | 41 | import org.onosproject.bgpio.exceptions.BgpParseException; |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 42 | import org.onosproject.bgpio.protocol.linkstate.BgpLinkLSIdentifier; |
| 43 | import org.onosproject.bgpio.protocol.linkstate.BgpLinkLsNlriVer4; |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame] | 44 | import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSIdentifier; |
| 45 | import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4; |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 46 | import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4.ProtocolType; |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 47 | import org.onosproject.bgpio.protocol.linkstate.NodeDescriptors; |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 48 | import org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails; |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 49 | import org.onosproject.bgpio.types.AutonomousSystemTlv; |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame] | 50 | import org.onosproject.bgpio.types.BgpValueType; |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 51 | import org.onosproject.bgpio.types.IsIsNonPseudonode; |
Priyanka B | 658aa698 | 2016-05-27 21:34:49 +0530 | [diff] [blame] | 52 | import org.onosproject.bgpio.types.LinkStateAttributes; |
| 53 | import org.onosproject.incubator.net.resource.label.LabelResourceAdminService; |
| 54 | import org.onosproject.incubator.net.resource.label.LabelResourceId; |
| 55 | import org.onosproject.incubator.net.resource.label.LabelResourcePool; |
| 56 | import org.onosproject.mastership.MastershipEvent; |
| 57 | import org.onosproject.mastership.MastershipListener; |
| 58 | import org.onosproject.mastership.MastershipServiceAdapter; |
| 59 | import org.onosproject.mastership.MastershipEvent.Type; |
| 60 | import org.onosproject.net.link.LinkServiceAdapter; |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 61 | import org.onosproject.bgpio.types.LinkLocalRemoteIdentifiersTlv; |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 62 | import org.onosproject.bgpio.types.RouteDistinguisher; |
Priyanka B | 658aa698 | 2016-05-27 21:34:49 +0530 | [diff] [blame] | 63 | import org.onosproject.bgpio.types.attr.BgpAttrNodeFlagBitTlv; |
| 64 | import org.onosproject.bgpio.types.attr.BgpAttrNodeIsIsAreaId; |
| 65 | import org.onosproject.bgpio.types.attr.BgpAttrRouterIdV4; |
| 66 | import org.onosproject.bgpio.types.attr.BgpLinkAttrIgpMetric; |
| 67 | import org.onosproject.bgpio.types.attr.BgpLinkAttrMaxLinkBandwidth; |
| 68 | import org.onosproject.bgpio.types.attr.BgpLinkAttrTeDefaultMetric; |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 69 | import org.onosproject.bgpio.util.Constants; |
Priyanka B | 658aa698 | 2016-05-27 21:34:49 +0530 | [diff] [blame] | 70 | import org.onosproject.cluster.NodeId; |
| 71 | import org.onosproject.cluster.RoleInfo; |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 72 | import org.onosproject.net.ConnectPoint; |
| 73 | import org.onosproject.net.DefaultDevice; |
| 74 | import org.onosproject.net.DefaultLink; |
| 75 | import org.onosproject.net.Device; |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 76 | import org.onosproject.net.DeviceId; |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 77 | import org.onosproject.net.Link; |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 78 | import org.onosproject.net.MastershipRole; |
Priyanka B | 658aa698 | 2016-05-27 21:34:49 +0530 | [diff] [blame] | 79 | import org.onosproject.net.PortNumber; |
| 80 | import org.onosproject.net.config.Config; |
| 81 | import org.onosproject.net.config.ConfigApplyDelegate; |
| 82 | import org.onosproject.net.config.ConfigFactory; |
| 83 | import org.onosproject.net.config.NetworkConfigRegistryAdapter; |
Sho SHIMIZU | b6c63a3 | 2016-05-26 12:07:19 -0700 | [diff] [blame] | 84 | import org.onosproject.net.config.basics.BandwidthCapacity; |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 85 | import org.onosproject.net.device.DeviceDescription; |
| 86 | import org.onosproject.net.device.DeviceProvider; |
| 87 | import org.onosproject.net.device.DeviceProviderRegistry; |
| 88 | import org.onosproject.net.device.DeviceProviderService; |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 89 | import org.onosproject.net.device.DeviceServiceAdapter; |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 90 | import org.onosproject.net.device.PortDescription; |
| 91 | import org.onosproject.net.device.PortStatistics; |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 92 | import org.onosproject.net.link.LinkDescription; |
| 93 | import org.onosproject.net.link.LinkProvider; |
| 94 | import org.onosproject.net.link.LinkProviderRegistry; |
| 95 | import org.onosproject.net.link.LinkProviderService; |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 96 | import org.onosproject.net.provider.ProviderId; |
Priyanka B | 658aa698 | 2016-05-27 21:34:49 +0530 | [diff] [blame] | 97 | import org.onosproject.net.resource.Resource; |
| 98 | import org.onosproject.net.resource.ResourceAdminService; |
| 99 | import org.onosproject.net.resource.ResourceId; |
| 100 | |
| 101 | import com.fasterxml.jackson.databind.JsonNode; |
| 102 | import com.fasterxml.jackson.databind.ObjectMapper; |
| 103 | import com.fasterxml.jackson.databind.node.JsonNodeFactory; |
| 104 | import com.fasterxml.jackson.databind.node.ObjectNode; |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 105 | |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 106 | /** |
| 107 | * Test for BGP topology provider. |
| 108 | */ |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 109 | public class BgpTopologyProviderTest { |
Priyanka B | 9bee080 | 2016-04-27 22:06:02 +0530 | [diff] [blame] | 110 | private static final DeviceId DID2 = DeviceId.deviceId("l3:rd=0::routinguniverse=0:asn=10"); |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 111 | private static final String UNKNOWN = new String("unknown"); |
Priyanka B | 9bee080 | 2016-04-27 22:06:02 +0530 | [diff] [blame] | 112 | public static ProviderId providerId = new ProviderId("l3", "foo"); |
Priyanka B | 658aa698 | 2016-05-27 21:34:49 +0530 | [diff] [blame] | 113 | private static final NodeId NODE1 = new NodeId("Master1"); |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 114 | |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 115 | private final BgpTopologyProvider provider = new BgpTopologyProvider(); |
| 116 | private final TestDeviceRegistry nodeRegistry = new TestDeviceRegistry(); |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 117 | private final TestLinkRegistry linkRegistry = new TestLinkRegistry(); |
| 118 | private final MockBgpController controller = new MockBgpController(); |
| 119 | private MockDeviceService deviceService = new MockDeviceService(); |
Priyanka B | 658aa698 | 2016-05-27 21:34:49 +0530 | [diff] [blame] | 120 | private MockLinkService linkService = new MockLinkService(); |
| 121 | private MockMastershipService mastershipService = new MockMastershipService(); |
| 122 | private MockNetConfigRegistryAdapter networkConfigService = new MockNetConfigRegistryAdapter(); |
| 123 | private MockLabelResourceService labelResourceAdminService = new MockLabelResourceService(); |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 124 | private Map<DeviceId, Device> deviceMap = new HashMap<>(); |
Priyanka B | 658aa698 | 2016-05-27 21:34:49 +0530 | [diff] [blame] | 125 | private MastershipListener listener; |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 126 | |
| 127 | @Before |
Priyanka B | 658aa698 | 2016-05-27 21:34:49 +0530 | [diff] [blame] | 128 | public void startUp() throws TestUtilsException { |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 129 | provider.deviceProviderRegistry = nodeRegistry; |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 130 | provider.linkProviderRegistry = linkRegistry; |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 131 | provider.controller = controller; |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 132 | provider.deviceService = deviceService; |
Priyanka B | 658aa698 | 2016-05-27 21:34:49 +0530 | [diff] [blame] | 133 | provider.linkService = linkService; |
| 134 | provider.labelResourceAdminService = labelResourceAdminService; |
| 135 | provider.mastershipService = mastershipService; |
| 136 | provider.networkConfigService = networkConfigService; |
| 137 | listener = TestUtils.getField(provider, "masterListener"); |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 138 | provider.activate(); |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 139 | assertThat("device provider should be registered", not(nodeRegistry.provider)); |
| 140 | assertThat("link provider should be registered", not(linkRegistry.linkProvider)); |
| 141 | assertThat("node listener should be registered", not(controller.nodeListener)); |
| 142 | assertThat("link listener should be registered", not(controller.linkListener)); |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 143 | } |
| 144 | |
| 145 | @After |
| 146 | public void tearDown() { |
| 147 | provider.deactivate(); |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 148 | provider.controller = null; |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 149 | provider.deviceService = null; |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 150 | provider.deviceProviderRegistry = null; |
Priyanka B | 658aa698 | 2016-05-27 21:34:49 +0530 | [diff] [blame] | 151 | provider.linkService = null; |
| 152 | provider.mastershipService = null; |
| 153 | provider.networkConfigService = null; |
| 154 | provider.labelResourceAdminService = null; |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 155 | assertThat(controller.nodeListener, is(new HashSet<BgpNodeListener>())); |
| 156 | assertThat(controller.linkListener, is(new HashSet<BgpLinkListener>())); |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 157 | } |
| 158 | |
Priyanka B | 658aa698 | 2016-05-27 21:34:49 +0530 | [diff] [blame] | 159 | private class MockLabelResourceService implements LabelResourceAdminService { |
| 160 | |
| 161 | Map<DeviceId, LabelResourcePool> resourcePool = new HashMap<>(); |
| 162 | |
| 163 | @Override |
| 164 | public boolean createDevicePool(DeviceId deviceId, LabelResourceId beginLabel, LabelResourceId endLabel) { |
| 165 | LabelResourcePool labelResource = new LabelResourcePool(deviceId.toString(), |
| 166 | beginLabel.labelId(), |
| 167 | endLabel.labelId()); |
| 168 | if (resourcePool.containsValue(labelResource)) { |
| 169 | return false; |
| 170 | } |
| 171 | |
| 172 | resourcePool.put(deviceId, labelResource); |
| 173 | return true; |
| 174 | } |
| 175 | |
| 176 | @Override |
| 177 | public boolean createGlobalPool(LabelResourceId beginLabel, LabelResourceId endLabel) { |
| 178 | // TODO Auto-generated method stub |
| 179 | return false; |
| 180 | } |
| 181 | |
| 182 | @Override |
| 183 | public boolean destroyDevicePool(DeviceId deviceId) { |
| 184 | LabelResourcePool devicePool = resourcePool.get(deviceId); |
| 185 | |
| 186 | if (devicePool == null) { |
| 187 | return false; |
| 188 | } |
| 189 | |
| 190 | resourcePool.remove(deviceId); |
| 191 | return true; |
| 192 | } |
| 193 | |
| 194 | @Override |
| 195 | public boolean destroyGlobalPool() { |
| 196 | // TODO Auto-generated method stub |
| 197 | return false; |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | /* Mock test for device service */ |
| 202 | private class MockNetConfigRegistryAdapter extends NetworkConfigRegistryAdapter { |
| 203 | private ConfigFactory cfgFactory; |
| 204 | private Map<ConnectPoint, BandwidthCapacity> classConfig = new HashMap<>(); |
| 205 | |
| 206 | @Override |
| 207 | public void registerConfigFactory(ConfigFactory configFactory) { |
| 208 | cfgFactory = configFactory; |
| 209 | } |
| 210 | |
| 211 | @Override |
| 212 | public void unregisterConfigFactory(ConfigFactory configFactory) { |
| 213 | cfgFactory = null; |
| 214 | } |
| 215 | |
| 216 | @Override |
| 217 | public <S, C extends Config<S>> C addConfig(S subject, Class<C> configClass) { |
| 218 | if (configClass == BandwidthCapacity.class) { |
| 219 | BandwidthCapacity devCap = new BandwidthCapacity(); |
| 220 | classConfig.put((ConnectPoint) subject, devCap); |
| 221 | |
| 222 | JsonNode node = new ObjectNode(new MockJsonNode()); |
| 223 | ObjectMapper mapper = new ObjectMapper(); |
| 224 | ConfigApplyDelegate delegate = new InternalApplyDelegate(); |
| 225 | devCap.init((ConnectPoint) subject, null, node, mapper, delegate); |
| 226 | return (C) devCap; |
| 227 | } |
| 228 | |
| 229 | return null; |
| 230 | } |
| 231 | |
| 232 | @Override |
| 233 | public <S, C extends Config<S>> void removeConfig(S subject, Class<C> configClass) { |
| 234 | classConfig.remove(subject); |
| 235 | } |
| 236 | |
| 237 | @Override |
| 238 | public <S, C extends Config<S>> C getConfig(S subject, Class<C> configClass) { |
| 239 | if (configClass == BandwidthCapacity.class) { |
| 240 | return (C) classConfig.get(subject); |
| 241 | } |
| 242 | return null; |
| 243 | } |
| 244 | |
| 245 | private class MockJsonNode extends JsonNodeFactory { |
| 246 | } |
| 247 | |
| 248 | // Auxiliary delegate to receive notifications about changes applied to |
| 249 | // the network configuration - by the apps. |
| 250 | private class InternalApplyDelegate implements ConfigApplyDelegate { |
| 251 | @Override |
| 252 | public void onApply(Config config) { |
| 253 | } |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | private class MockMastershipService extends MastershipServiceAdapter { |
| 258 | @Override |
| 259 | public MastershipRole getLocalRole(DeviceId deviceId) { |
| 260 | return MASTER; |
| 261 | } |
| 262 | |
| 263 | @Override |
| 264 | public boolean isLocalMaster(DeviceId deviceId) { |
| 265 | return getLocalRole(deviceId) == MASTER; |
| 266 | } |
| 267 | |
| 268 | @Override |
| 269 | public NodeId getMasterFor(DeviceId deviceId) { |
| 270 | return NODE1; |
| 271 | } |
| 272 | } |
| 273 | |
| 274 | private class MockResourceAdminService implements ResourceAdminService { |
| 275 | Map<ResourceId, List<Resource>> registeredRes = new HashMap<>(); |
| 276 | |
| 277 | @Override |
| 278 | public boolean register(List<Resource> resources) { |
| 279 | for (Resource res : resources) { |
| 280 | List<Resource> resource = new LinkedList<>(); |
| 281 | resource.add(res); |
| 282 | if (registeredRes.containsKey(res.id())) { |
| 283 | resource.addAll(registeredRes.get(res.id())); |
| 284 | } |
| 285 | registeredRes.put(res.id(), resource); |
| 286 | } |
| 287 | return true; |
| 288 | } |
| 289 | |
| 290 | @Override |
| 291 | public boolean unregister(List<ResourceId> ids) { |
| 292 | for (ResourceId id : ids) { |
| 293 | if (registeredRes.containsKey(id)) { |
| 294 | registeredRes.remove(id); |
| 295 | } else { |
| 296 | return false; |
| 297 | } |
| 298 | } |
| 299 | return true; |
| 300 | } |
| 301 | } |
| 302 | |
| 303 | private class MockLinkService extends LinkServiceAdapter { |
| 304 | |
| 305 | @Override |
| 306 | public Link getLink(ConnectPoint src, ConnectPoint dst) { |
| 307 | for (Link link : linkRegistry.links) { |
| 308 | if (link.src().equals(src) && link.dst().equals(dst)) { |
| 309 | return link; |
| 310 | } |
| 311 | } |
| 312 | return null; |
| 313 | } |
| 314 | } |
| 315 | |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 316 | /* Class implement device test registry */ |
| 317 | private class TestDeviceRegistry implements DeviceProviderRegistry { |
| 318 | DeviceProvider provider; |
| 319 | |
| 320 | Set<DeviceId> connected = new HashSet<>(); |
Priyanka B | 658aa698 | 2016-05-27 21:34:49 +0530 | [diff] [blame] | 321 | Map<DeviceId, List<PortDescription>> portUpdated = new HashMap<>(); |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 322 | |
| 323 | @Override |
| 324 | public DeviceProviderService register(DeviceProvider provider) { |
| 325 | this.provider = provider; |
| 326 | return new TestProviderService(); |
| 327 | } |
| 328 | |
| 329 | @Override |
| 330 | public void unregister(DeviceProvider provider) { |
| 331 | } |
| 332 | |
| 333 | @Override |
| 334 | public Set<ProviderId> getProviders() { |
| 335 | return null; |
| 336 | } |
| 337 | |
| 338 | private class TestProviderService implements DeviceProviderService { |
| 339 | |
| 340 | @Override |
| 341 | public DeviceProvider provider() { |
| 342 | return null; |
| 343 | } |
| 344 | |
| 345 | @Override |
| 346 | public void deviceConnected(DeviceId deviceId, DeviceDescription deviceDescription) { |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 347 | if (!deviceId.equals(DID2)) { |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 348 | connected.add(deviceId); |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 349 | Device device = new DefaultDevice(BgpTopologyProviderTest.providerId, deviceId, Device.Type.ROUTER, |
Priyanka B | 658aa698 | 2016-05-27 21:34:49 +0530 | [diff] [blame] | 350 | UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, new ChassisId(), deviceDescription.annotations()); |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 351 | deviceMap.put(deviceId, device); |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 352 | } |
| 353 | } |
| 354 | |
| 355 | @Override |
| 356 | public void deviceDisconnected(DeviceId deviceId) { |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 357 | if (!deviceId.equals(DID2)) { |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 358 | connected.remove(deviceId); |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 359 | deviceMap.remove(deviceId); |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 360 | } |
| 361 | } |
| 362 | |
| 363 | @Override |
| 364 | public void updatePorts(DeviceId deviceId, List<PortDescription> portDescriptions) { |
Priyanka B | 658aa698 | 2016-05-27 21:34:49 +0530 | [diff] [blame] | 365 | portUpdated.put(deviceId, portDescriptions); |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 366 | } |
| 367 | |
| 368 | @Override |
| 369 | public void portStatusChanged(DeviceId deviceId, PortDescription portDescription) { |
| 370 | // TODO Auto-generated method stub |
| 371 | |
| 372 | } |
| 373 | |
| 374 | @Override |
| 375 | public void receivedRoleReply(DeviceId deviceId, MastershipRole requested, MastershipRole response) { |
| 376 | // TODO Auto-generated method stub |
| 377 | |
| 378 | } |
| 379 | |
| 380 | @Override |
| 381 | public void updatePortStatistics(DeviceId deviceId, Collection<PortStatistics> portStatistics) { |
| 382 | // TODO Auto-generated method stub |
| 383 | |
| 384 | } |
| 385 | } |
| 386 | } |
| 387 | |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 388 | /* Class implement device test registry */ |
| 389 | private class TestLinkRegistry implements LinkProviderRegistry { |
| 390 | LinkProvider linkProvider; |
| 391 | Set<Link> links = new HashSet<>(); |
| 392 | |
| 393 | @Override |
| 394 | public LinkProviderService register(LinkProvider provider) { |
| 395 | this.linkProvider = provider; |
| 396 | return new TestProviderService(); |
| 397 | } |
| 398 | |
| 399 | @Override |
| 400 | public void unregister(LinkProvider provider) { |
| 401 | // TODO Auto-generated method stub |
| 402 | } |
| 403 | |
| 404 | @Override |
| 405 | public Set<ProviderId> getProviders() { |
| 406 | return null; |
| 407 | } |
| 408 | |
| 409 | private class TestProviderService implements LinkProviderService { |
| 410 | |
| 411 | @Override |
| 412 | public void linkDetected(LinkDescription linkDescription) { |
Priyanka B | 658aa698 | 2016-05-27 21:34:49 +0530 | [diff] [blame] | 413 | links.add(DefaultLink.builder() |
| 414 | .src(linkDescription.src()) |
| 415 | .dst(linkDescription.dst()) |
| 416 | .state(ACTIVE) |
| 417 | .type(linkDescription.type()) |
| 418 | .providerId(BgpTopologyProviderTest.providerId) |
| 419 | .annotations(linkDescription.annotations()) |
| 420 | .build()); |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 421 | } |
| 422 | |
| 423 | @Override |
| 424 | public void linkVanished(LinkDescription linkDescription) { |
| 425 | links.remove(DefaultLink.builder().src(linkDescription.src()) |
| 426 | .dst(linkDescription.dst()).state(ACTIVE).type(linkDescription.type()) |
| 427 | .providerId(BgpTopologyProviderTest.providerId).build()); |
| 428 | } |
| 429 | |
| 430 | @Override |
| 431 | public void linksVanished(ConnectPoint connectPoint) { |
| 432 | // TODO Auto-generated method stub |
| 433 | } |
| 434 | |
| 435 | @Override |
| 436 | public void linksVanished(DeviceId deviceId) { |
| 437 | // TODO Auto-generated method stub |
| 438 | } |
| 439 | |
| 440 | @Override |
| 441 | public LinkProvider provider() { |
| 442 | // TODO Auto-generated method stub |
| 443 | return null; |
| 444 | } |
| 445 | } |
| 446 | } |
| 447 | |
| 448 | /* Test class for BGP controller */ |
| 449 | private class MockBgpController extends BgpControllerAdapter { |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 450 | protected Set<BgpNodeListener> nodeListener = new CopyOnWriteArraySet<>(); |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 451 | protected Set<BgpLinkListener> linkListener = new CopyOnWriteArraySet<>(); |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 452 | |
| 453 | @Override |
| 454 | public void addListener(BgpNodeListener nodeListener) { |
| 455 | this.nodeListener.add(nodeListener); |
| 456 | } |
| 457 | |
| 458 | @Override |
| 459 | public void removeListener(BgpNodeListener nodeListener) { |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 460 | this.nodeListener.remove(nodeListener); |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 461 | } |
| 462 | |
| 463 | @Override |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 464 | public void addLinkListener(BgpLinkListener linkListener) { |
| 465 | this.linkListener.add(linkListener); |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 466 | } |
| 467 | |
| 468 | @Override |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 469 | public void removeLinkListener(BgpLinkListener linkListener) { |
| 470 | this.linkListener.remove(linkListener); |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 471 | } |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 472 | } |
| 473 | |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 474 | /* Mock test for device service */ |
| 475 | private class MockDeviceService extends DeviceServiceAdapter { |
| 476 | @Override |
| 477 | public Device getDevice(DeviceId deviceId) { |
| 478 | return deviceMap.get(deviceId); |
| 479 | } |
| 480 | } |
| 481 | |
| 482 | /** |
| 483 | * Validate node is added to the device validating URI, RIB should get updated properly. |
| 484 | */ |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 485 | @Test |
| 486 | public void bgpTopologyProviderTestAddDevice1() { |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 487 | LinkedList<BgpValueType> subTlvs = new LinkedList<>(); |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame] | 488 | BgpValueType tlv = new AutonomousSystemTlv(100); |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 489 | short deslength = AutonomousSystemTlv.LENGTH; |
| 490 | short desType = AutonomousSystemTlv.TYPE; |
| 491 | |
| 492 | subTlvs.add(tlv); |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame] | 493 | BgpNodeLSIdentifier localNodeDescriptors = new BgpNodeLSIdentifier(new NodeDescriptors(subTlvs, deslength, |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 494 | desType)); |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame] | 495 | BgpNodeLSNlriVer4 nodeNlri = new BgpNodeLSNlriVer4(0, (byte) Constants.DIRECT, localNodeDescriptors, false, |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 496 | new RouteDistinguisher()); |
| 497 | |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 498 | PathAttrNlriDetails details = new PathAttrNlriDetails(); |
| 499 | details.setIdentifier(0); |
| 500 | details.setProtocolID(ProtocolType.DIRECT); |
| 501 | List<BgpValueType> pathAttributes = new LinkedList<>(); |
| 502 | details.setPathAttribute(pathAttributes); |
| 503 | |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 504 | for (BgpNodeListener l : controller.nodeListener) { |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 505 | l.addNode(nodeNlri, details); |
| 506 | assertThat(nodeRegistry.connected.size(), is(1)); |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 507 | l.deleteNode(nodeNlri); |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 508 | assertThat(nodeRegistry.connected.size(), is(0)); |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 509 | } |
| 510 | } |
| 511 | |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 512 | /** |
| 513 | * Validate node is not added to the device for invalid URI, RIB count should be zero. |
| 514 | */ |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 515 | @Test |
| 516 | public void bgpTopologyProviderTestAddDevice2() { |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame] | 517 | LinkedList<BgpValueType> subTlvs; |
| 518 | BgpValueType tlv = new AutonomousSystemTlv(10); |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 519 | short deslength = AutonomousSystemTlv.LENGTH; |
| 520 | short desType = AutonomousSystemTlv.TYPE; |
| 521 | |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 522 | PathAttrNlriDetails details = new PathAttrNlriDetails(); |
| 523 | details.setIdentifier(0); |
| 524 | details.setProtocolID(ProtocolType.DIRECT); |
| 525 | List<BgpValueType> pathAttributes = new LinkedList<>(); |
| 526 | details.setPathAttribute(pathAttributes); |
| 527 | |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 528 | subTlvs = new LinkedList<>(); |
| 529 | subTlvs.add(tlv); |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame] | 530 | BgpNodeLSIdentifier localNodeDescriptors = new BgpNodeLSIdentifier(new NodeDescriptors(subTlvs, deslength, |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 531 | desType)); |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame] | 532 | BgpNodeLSNlriVer4 nodeNlri = new BgpNodeLSNlriVer4(0, (byte) Constants.DIRECT, localNodeDescriptors, false, |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 533 | new RouteDistinguisher()); |
| 534 | |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 535 | |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 536 | for (BgpNodeListener l : controller.nodeListener) { |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 537 | l.addNode(nodeNlri, details); |
| 538 | assertThat(nodeRegistry.connected.size(), is(0)); |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 539 | } |
| 540 | } |
| 541 | |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 542 | /** |
| 543 | * Delete node when node does not exist, RIB count should be zero. |
| 544 | */ |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 545 | @Test |
| 546 | public void bgpTopologyProviderTestAddDevice3() { |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame] | 547 | LinkedList<BgpValueType> subTlvs; |
| 548 | BgpValueType tlv = new AutonomousSystemTlv(10); |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 549 | short deslength = AutonomousSystemTlv.LENGTH; |
| 550 | short desType = AutonomousSystemTlv.TYPE; |
| 551 | |
| 552 | subTlvs = new LinkedList<>(); |
| 553 | subTlvs.add(tlv); |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame] | 554 | BgpNodeLSIdentifier localNodeDescriptors = new BgpNodeLSIdentifier(new NodeDescriptors(subTlvs, deslength, |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 555 | desType)); |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame] | 556 | BgpNodeLSNlriVer4 nodeNlri = new BgpNodeLSNlriVer4(0, (byte) Constants.DIRECT, localNodeDescriptors, false, |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 557 | new RouteDistinguisher()); |
| 558 | |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 559 | for (BgpNodeListener l : controller.nodeListener) { |
| 560 | l.deleteNode(nodeNlri); |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 561 | assertThat(nodeRegistry.connected.size(), is(0)); |
| 562 | } |
| 563 | } |
| 564 | |
Priyanka B | 658aa698 | 2016-05-27 21:34:49 +0530 | [diff] [blame] | 565 | |
| 566 | /** |
| 567 | * Validate node is added to the device with all device annotations. |
| 568 | */ |
| 569 | @Test |
| 570 | public void bgpTopologyProviderTestAddDevice4() { |
| 571 | LinkedList<BgpValueType> subTlvs = new LinkedList<>(); |
| 572 | BgpValueType tlv = new AutonomousSystemTlv(100); |
| 573 | short deslength = AutonomousSystemTlv.LENGTH; |
| 574 | short desType = AutonomousSystemTlv.TYPE; |
| 575 | |
| 576 | subTlvs.add(tlv); |
| 577 | BgpNodeLSIdentifier localNodeDescriptors = new BgpNodeLSIdentifier(new NodeDescriptors(subTlvs, deslength, |
| 578 | desType)); |
| 579 | BgpNodeLSNlriVer4 nodeNlri = new BgpNodeLSNlriVer4(0, (byte) Constants.DIRECT, localNodeDescriptors, false, |
| 580 | new RouteDistinguisher()); |
| 581 | |
| 582 | PathAttrNlriDetails details = new PathAttrNlriDetails(); |
| 583 | details.setIdentifier(0); |
| 584 | details.setProtocolID(ProtocolType.DIRECT); |
| 585 | List<BgpValueType> pathAttributes = new LinkedList<>(); |
| 586 | List<BgpValueType> linkStateAttr = new LinkedList<>(); |
| 587 | tlv = BgpAttrNodeFlagBitTlv.of(true, true, true, false); |
| 588 | linkStateAttr.add(tlv); |
| 589 | tlv = BgpAttrNodeIsIsAreaId.of(new byte[] {01, 01, 01, 01}); |
| 590 | linkStateAttr.add(tlv); |
| 591 | tlv = BgpAttrRouterIdV4.of(Ip4Address.valueOf("1.1.1.1"), LinkStateAttributes.ATTR_NODE_IPV4_LOCAL_ROUTER_ID); |
| 592 | linkStateAttr.add(tlv); |
| 593 | pathAttributes.add(new LinkStateAttributes(linkStateAttr)); |
| 594 | details.setPathAttribute(pathAttributes); |
| 595 | |
| 596 | for (BgpNodeListener l : controller.nodeListener) { |
| 597 | l.addNode(nodeNlri, details); |
| 598 | |
| 599 | assertThat(deviceMap.values().iterator().next().annotations().value(BgpTopologyProvider.ABR_BIT), |
| 600 | is("false")); |
| 601 | assertThat(deviceMap.values().iterator().next().annotations().value(BgpTopologyProvider.EXTERNAL_BIT), |
| 602 | is("true")); |
| 603 | assertThat(deviceMap.values().iterator().next().annotations().value(BgpTopologyProvider.INTERNAL_BIT), |
| 604 | is("false")); |
| 605 | assertThat(deviceMap.values().iterator().next().annotations().value(BgpTopologyProvider.PSEUDO), |
| 606 | is("false")); |
| 607 | assertThat(deviceMap.values().iterator().next().annotations().value(BgpTopologyProvider.AREAID).getBytes(), |
| 608 | is(new byte[] {01, 01, 01, 01})); |
| 609 | assertThat(deviceMap.values().iterator().next().annotations().value(BgpTopologyProvider.LSRID), |
| 610 | is("1.1.1.1")); |
| 611 | |
| 612 | assertThat(nodeRegistry.connected.size(), is(1)); |
| 613 | l.deleteNode(nodeNlri); |
| 614 | assertThat(nodeRegistry.connected.size(), is(0)); |
| 615 | } |
| 616 | } |
| 617 | |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 618 | /** |
| 619 | * Add a link and two devices. |
| 620 | * |
| 621 | * @throws BgpParseException while adding a link. |
| 622 | */ |
| 623 | @Test |
| 624 | public void bgpTopologyProviderTestAddLink1() throws BgpParseException { |
| 625 | LinkedList<BgpValueType> localTlvs = new LinkedList<>(); |
| 626 | LinkedList<BgpValueType> remoteTlvs = new LinkedList<>(); |
| 627 | LinkedList<BgpValueType> linkdes = new LinkedList<>(); |
| 628 | BgpValueType tlv = new AutonomousSystemTlv(10); |
| 629 | short deslength = AutonomousSystemTlv.LENGTH; |
| 630 | short desType = AutonomousSystemTlv.TYPE; |
| 631 | |
| 632 | localTlvs.add(tlv); |
| 633 | remoteTlvs.add(tlv); |
| 634 | tlv = IsIsNonPseudonode.of(new byte[] {20, 20, 20, 20, 00, 20}); |
| 635 | localTlvs.add(tlv); |
| 636 | tlv = IsIsNonPseudonode.of(new byte[] {30, 30, 30, 30, 00, 30}); |
| 637 | remoteTlvs.add(tlv); |
| 638 | NodeDescriptors localNode = new NodeDescriptors(localTlvs, deslength, desType); |
| 639 | NodeDescriptors remoteNode = new NodeDescriptors(remoteTlvs, deslength, desType); |
| 640 | BgpNodeLSIdentifier localNodeDescriptors = new BgpNodeLSIdentifier(localNode); |
| 641 | BgpNodeLSNlriVer4 nodeNlri = new BgpNodeLSNlriVer4(0, (byte) Constants.DIRECT, localNodeDescriptors, false, |
| 642 | new RouteDistinguisher()); |
| 643 | |
| 644 | BgpNodeLSIdentifier remoteNodeDescriptors = new BgpNodeLSIdentifier(remoteNode); |
| 645 | BgpNodeLSNlriVer4 remNodeNlri = new BgpNodeLSNlriVer4(0, (byte) Constants.DIRECT, remoteNodeDescriptors, false, |
| 646 | new RouteDistinguisher()); |
| 647 | |
| 648 | PathAttrNlriDetails details = new PathAttrNlriDetails(); |
| 649 | details.setIdentifier(0); |
| 650 | details.setProtocolID(ProtocolType.DIRECT); |
| 651 | List<BgpValueType> pathAttributes = new LinkedList<>(); |
| 652 | details.setPathAttribute(pathAttributes); |
| 653 | |
| 654 | tlv = LinkLocalRemoteIdentifiersTlv.of(99, 100); |
| 655 | linkdes.add(tlv); |
| 656 | BgpLinkLSIdentifier linkId = new BgpLinkLSIdentifier(localNode, remoteNode, linkdes); |
| 657 | BgpLinkLsNlriVer4 linkNlri = new BgpLinkLsNlriVer4((byte) Constants.DIRECT, 0, linkId, |
| 658 | new RouteDistinguisher(), false); |
| 659 | for (BgpNodeListener l : controller.nodeListener) { |
| 660 | l.addNode(nodeNlri, details); |
| 661 | assertThat(nodeRegistry.connected.size(), is(1)); |
| 662 | l.addNode(remNodeNlri, details); |
| 663 | assertThat(nodeRegistry.connected.size(), is(2)); |
| 664 | } |
| 665 | for (BgpLinkListener l : controller.linkListener) { |
| 666 | l.addLink(linkNlri, details); |
| 667 | assertThat(linkRegistry.links.size(), is(1)); |
| 668 | } |
| 669 | } |
| 670 | |
| 671 | /** |
| 672 | * Add a link and delete a link. |
| 673 | * |
| 674 | * @throws BgpParseException while adding or removing the link |
| 675 | */ |
| 676 | @Test |
| 677 | public void bgpTopologyProviderTestAddLink2() throws BgpParseException { |
| 678 | LinkedList<BgpValueType> localTlvs = new LinkedList<>(); |
| 679 | LinkedList<BgpValueType> remoteTlvs = new LinkedList<>(); |
| 680 | LinkedList<BgpValueType> linkdes = new LinkedList<>(); |
| 681 | BgpValueType tlv = new AutonomousSystemTlv(10); |
| 682 | short deslength = AutonomousSystemTlv.LENGTH; |
| 683 | short desType = AutonomousSystemTlv.TYPE; |
| 684 | |
| 685 | localTlvs.add(tlv); |
| 686 | remoteTlvs.add(tlv); |
| 687 | tlv = IsIsNonPseudonode.of(new byte[] {20, 20, 20, 20, 00, 20}); |
| 688 | localTlvs.add(tlv); |
| 689 | tlv = IsIsNonPseudonode.of(new byte[] {30, 30, 30, 30, 00, 30}); |
| 690 | remoteTlvs.add(tlv); |
| 691 | NodeDescriptors localNode = new NodeDescriptors(localTlvs, deslength, desType); |
| 692 | NodeDescriptors remoteNode = new NodeDescriptors(remoteTlvs, deslength, desType); |
| 693 | BgpNodeLSIdentifier localNodeDescriptors = new BgpNodeLSIdentifier(localNode); |
| 694 | BgpNodeLSNlriVer4 nodeNlri = new BgpNodeLSNlriVer4(0, (byte) Constants.DIRECT, localNodeDescriptors, false, |
| 695 | new RouteDistinguisher()); |
| 696 | |
| 697 | BgpNodeLSIdentifier remoteNodeDescriptors = new BgpNodeLSIdentifier(remoteNode); |
| 698 | BgpNodeLSNlriVer4 remNodeNlri = new BgpNodeLSNlriVer4(0, (byte) Constants.DIRECT, remoteNodeDescriptors, false, |
| 699 | new RouteDistinguisher()); |
| 700 | |
| 701 | PathAttrNlriDetails details = new PathAttrNlriDetails(); |
| 702 | details.setIdentifier(0); |
| 703 | details.setProtocolID(ProtocolType.DIRECT); |
| 704 | List<BgpValueType> pathAttributes = new LinkedList<>(); |
| 705 | details.setPathAttribute(pathAttributes); |
| 706 | |
| 707 | tlv = LinkLocalRemoteIdentifiersTlv.of(99, 100); |
| 708 | linkdes.add(tlv); |
| 709 | BgpLinkLSIdentifier linkId = new BgpLinkLSIdentifier(localNode, remoteNode, linkdes); |
| 710 | BgpLinkLsNlriVer4 linkNlri = new BgpLinkLsNlriVer4((byte) Constants.DIRECT, 0, linkId, |
| 711 | new RouteDistinguisher(), false); |
| 712 | for (BgpNodeListener l : controller.nodeListener) { |
| 713 | l.addNode(nodeNlri, details); |
| 714 | assertThat(nodeRegistry.connected.size(), is(1)); |
| 715 | l.addNode(remNodeNlri, details); |
| 716 | assertThat(nodeRegistry.connected.size(), is(2)); |
| 717 | l.deleteNode(nodeNlri); |
| 718 | assertThat(nodeRegistry.connected.size(), is(1)); |
| 719 | } |
| 720 | for (BgpLinkListener l : controller.linkListener) { |
| 721 | l.addLink(linkNlri, details); |
| 722 | assertThat(linkRegistry.links.size(), is(1)); |
| 723 | l.deleteLink(linkNlri); |
| 724 | assertThat(linkRegistry.links.size(), is(0)); |
| 725 | } |
| 726 | } |
| 727 | |
| 728 | /** |
Priyanka B | 658aa698 | 2016-05-27 21:34:49 +0530 | [diff] [blame] | 729 | * Add a link and delete a link with registering/unregistering bandwidth. |
| 730 | * |
| 731 | * @throws BgpParseException while adding or removing the link |
| 732 | * @throws InterruptedException while registering for bandwidth |
| 733 | */ |
| 734 | @Test |
| 735 | public void bgpTopologyProviderTestAddLink3() throws BgpParseException, InterruptedException { |
| 736 | LinkedList<BgpValueType> localTlvs = new LinkedList<>(); |
| 737 | LinkedList<BgpValueType> remoteTlvs = new LinkedList<>(); |
| 738 | LinkedList<BgpValueType> linkdes = new LinkedList<>(); |
| 739 | BgpValueType tlv = new AutonomousSystemTlv(10); |
| 740 | short deslength = AutonomousSystemTlv.LENGTH; |
| 741 | short desType = AutonomousSystemTlv.TYPE; |
| 742 | |
| 743 | localTlvs.add(tlv); |
| 744 | remoteTlvs.add(tlv); |
| 745 | tlv = IsIsNonPseudonode.of(new byte[] {20, 20, 20, 20, 00, 20}); |
| 746 | localTlvs.add(tlv); |
| 747 | tlv = IsIsNonPseudonode.of(new byte[] {30, 30, 30, 30, 00, 30}); |
| 748 | remoteTlvs.add(tlv); |
| 749 | NodeDescriptors localNode = new NodeDescriptors(localTlvs, deslength, desType); |
| 750 | NodeDescriptors remoteNode = new NodeDescriptors(remoteTlvs, deslength, desType); |
| 751 | BgpNodeLSIdentifier localNodeDescriptors = new BgpNodeLSIdentifier(localNode); |
| 752 | BgpNodeLSNlriVer4 nodeNlri = new BgpNodeLSNlriVer4(0, (byte) Constants.DIRECT, localNodeDescriptors, false, |
| 753 | new RouteDistinguisher()); |
| 754 | |
| 755 | BgpNodeLSIdentifier remoteNodeDescriptors = new BgpNodeLSIdentifier(remoteNode); |
| 756 | BgpNodeLSNlriVer4 remNodeNlri = new BgpNodeLSNlriVer4(0, (byte) Constants.DIRECT, remoteNodeDescriptors, false, |
| 757 | new RouteDistinguisher()); |
| 758 | |
| 759 | PathAttrNlriDetails details = new PathAttrNlriDetails(); |
| 760 | details.setIdentifier(0); |
| 761 | details.setProtocolID(ProtocolType.DIRECT); |
| 762 | List<BgpValueType> pathAttributes = new LinkedList<>(); |
| 763 | details.setPathAttribute(pathAttributes); |
| 764 | |
| 765 | tlv = LinkLocalRemoteIdentifiersTlv.of(99, 100); |
| 766 | linkdes.add(tlv); |
| 767 | BgpLinkLSIdentifier linkId = new BgpLinkLSIdentifier(localNode, remoteNode, linkdes); |
| 768 | BgpLinkLsNlriVer4 linkNlri = new BgpLinkLsNlriVer4((byte) Constants.DIRECT, 0, linkId, |
| 769 | new RouteDistinguisher(), false); |
| 770 | |
| 771 | for (BgpNodeListener l : controller.nodeListener) { |
| 772 | l.addNode(nodeNlri, details); |
| 773 | assertThat(nodeRegistry.connected.size(), is(1)); |
| 774 | l.addNode(remNodeNlri, details); |
| 775 | assertThat(nodeRegistry.connected.size(), is(2)); |
| 776 | l.deleteNode(remNodeNlri); |
| 777 | assertThat(nodeRegistry.connected.size(), is(1)); |
| 778 | } |
| 779 | |
| 780 | List<BgpValueType> linkPathAttributes = new LinkedList<>(); |
| 781 | List<BgpValueType> linkStateAttr = new LinkedList<>(); |
| 782 | tlv = BgpLinkAttrIgpMetric.of(10, 4); |
| 783 | linkStateAttr.add(tlv); |
| 784 | tlv = BgpLinkAttrTeDefaultMetric.of(20); |
| 785 | linkStateAttr.add(tlv); |
| 786 | tlv = BgpLinkAttrMaxLinkBandwidth.of(30, LinkStateAttributes.ATTR_LINK_MAX_RES_BANDWIDTH); |
| 787 | linkStateAttr.add(tlv); |
| 788 | linkPathAttributes.add(new LinkStateAttributes(linkStateAttr)); |
| 789 | details.setPathAttribute(linkPathAttributes); |
| 790 | |
| 791 | for (BgpLinkListener l : controller.linkListener) { |
| 792 | l.addLink(linkNlri, details); |
| 793 | assertThat(linkRegistry.links.size(), is(1)); |
| 794 | assertThat(linkRegistry.links.iterator().next().annotations().value(BgpTopologyProvider.COST), |
| 795 | is("10")); |
| 796 | assertThat(linkRegistry.links.iterator().next().annotations().value(BgpTopologyProvider.TE_COST), |
| 797 | is("20")); |
| 798 | |
| 799 | l.deleteLink(linkNlri); |
| 800 | assertThat(linkRegistry.links.size(), is(0)); |
| 801 | } |
| 802 | } |
| 803 | |
| 804 | /** |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 805 | * Invalid link. |
| 806 | * |
| 807 | * @throws BgpParseException while adding or deleting a link |
| 808 | */ |
| 809 | @Test |
| 810 | public void bgpTopologyProviderTestDeleteLink3() throws BgpParseException { |
| 811 | LinkedList<BgpValueType> localTlvs = new LinkedList<>(); |
| 812 | LinkedList<BgpValueType> remoteTlvs = new LinkedList<>(); |
| 813 | LinkedList<BgpValueType> linkdes = new LinkedList<>(); |
| 814 | BgpValueType tlv = new AutonomousSystemTlv(10); |
| 815 | short deslength = AutonomousSystemTlv.LENGTH; |
| 816 | short desType = AutonomousSystemTlv.TYPE; |
| 817 | |
| 818 | localTlvs.add(tlv); |
| 819 | remoteTlvs.add(tlv); |
| 820 | tlv = IsIsNonPseudonode.of(new byte[] {20, 20, 20, 20, 00, 20}); |
| 821 | localTlvs.add(tlv); |
| 822 | tlv = IsIsNonPseudonode.of(new byte[] {30, 30, 30, 30, 00, 30}); |
| 823 | remoteTlvs.add(tlv); |
| 824 | NodeDescriptors localNode = new NodeDescriptors(localTlvs, deslength, desType); |
| 825 | NodeDescriptors remoteNode = new NodeDescriptors(remoteTlvs, deslength, desType); |
| 826 | BgpNodeLSIdentifier localNodeDescriptors = new BgpNodeLSIdentifier(localNode); |
| 827 | BgpNodeLSNlriVer4 nodeNlri = new BgpNodeLSNlriVer4(0, (byte) Constants.DIRECT, localNodeDescriptors, false, |
| 828 | new RouteDistinguisher()); |
| 829 | |
| 830 | BgpNodeLSIdentifier remoteNodeDescriptors = new BgpNodeLSIdentifier(remoteNode); |
| 831 | BgpNodeLSNlriVer4 remNodeNlri = new BgpNodeLSNlriVer4(0, (byte) Constants.DIRECT, remoteNodeDescriptors, false, |
| 832 | new RouteDistinguisher()); |
| 833 | |
| 834 | PathAttrNlriDetails details = new PathAttrNlriDetails(); |
| 835 | details.setIdentifier(0); |
| 836 | details.setProtocolID(ProtocolType.DIRECT); |
| 837 | List<BgpValueType> pathAttributes = new LinkedList<>(); |
| 838 | details.setPathAttribute(pathAttributes); |
| 839 | |
| 840 | tlv = LinkLocalRemoteIdentifiersTlv.of(99, 100); |
| 841 | linkdes.add(tlv); |
| 842 | BgpLinkLSIdentifier linkId = new BgpLinkLSIdentifier(localNode, remoteNode, linkdes); |
| 843 | BgpLinkLsNlriVer4 linkNlri = new BgpLinkLsNlriVer4((byte) Constants.DIRECT, 0, linkId, |
| 844 | new RouteDistinguisher(), false); |
| 845 | for (BgpNodeListener l : controller.nodeListener) { |
| 846 | l.addNode(nodeNlri, details); |
| 847 | l.addNode(remNodeNlri, details); |
| 848 | assertThat(nodeRegistry.connected.size(), is(2)); |
| 849 | l.deleteNode(nodeNlri); |
| 850 | assertThat(nodeRegistry.connected.size(), is(1)); |
| 851 | } |
| 852 | for (BgpLinkListener l : controller.linkListener) { |
| 853 | l.deleteLink(linkNlri); |
| 854 | assertThat(linkRegistry.links.size(), is(0)); |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 855 | } |
| 856 | } |
Priyanka B | 658aa698 | 2016-05-27 21:34:49 +0530 | [diff] [blame] | 857 | |
| 858 | /** |
| 859 | * Add device check label registration is done. |
| 860 | * |
| 861 | * @throws BgpParseException while adding a device |
| 862 | */ |
| 863 | @Test |
| 864 | public void bgpTopologyProviderDeviceTestLabel1() throws BgpParseException { |
| 865 | LinkedList<BgpValueType> subTlvs = new LinkedList<>(); |
| 866 | BgpValueType tlv = new AutonomousSystemTlv(100); |
| 867 | short deslength = AutonomousSystemTlv.LENGTH; |
| 868 | short desType = AutonomousSystemTlv.TYPE; |
| 869 | |
| 870 | subTlvs.add(tlv); |
| 871 | BgpNodeLSIdentifier localNodeDescriptors = new BgpNodeLSIdentifier(new NodeDescriptors(subTlvs, deslength, |
| 872 | desType)); |
| 873 | BgpNodeLSNlriVer4 nodeNlri = new BgpNodeLSNlriVer4(0, (byte) Constants.DIRECT, localNodeDescriptors, false, |
| 874 | new RouteDistinguisher()); |
| 875 | |
| 876 | PathAttrNlriDetails details = new PathAttrNlriDetails(); |
| 877 | details.setIdentifier(0); |
| 878 | details.setProtocolID(ProtocolType.DIRECT); |
| 879 | List<BgpValueType> pathAttributes = new LinkedList<>(); |
| 880 | List<BgpValueType> linkStateAttributes = new LinkedList<>(); |
| 881 | tlv = BgpAttrRouterIdV4.of(Ip4Address.valueOf("1.1.1.1"), LinkStateAttributes.ATTR_NODE_IPV4_LOCAL_ROUTER_ID); |
| 882 | linkStateAttributes.add(tlv); |
| 883 | pathAttributes.add(new LinkStateAttributes(linkStateAttributes)); |
| 884 | details.setPathAttribute(pathAttributes); |
| 885 | |
| 886 | for (BgpNodeListener l : controller.nodeListener) { |
| 887 | l.addNode(nodeNlri, details); |
| 888 | assertThat(nodeRegistry.connected.size(), is(1)); |
| 889 | } |
| 890 | |
| 891 | MastershipEvent event = new MastershipEvent(Type.MASTER_CHANGED, nodeRegistry.connected.iterator().next(), |
| 892 | new RoleInfo(NodeId.nodeId("Node1"), new LinkedList<>())); |
| 893 | |
| 894 | listener.event(event); |
| 895 | assertThat(labelResourceAdminService.resourcePool.keySet().size(), is(1)); |
| 896 | } |
| 897 | |
| 898 | /** |
| 899 | * Add device check label registration is done and delete node destroy label pool. |
| 900 | * |
| 901 | * @throws BgpParseException while adding a device |
| 902 | */ |
| 903 | @Test |
| 904 | public void bgpTopologyProviderDeviceTestLabel2() throws BgpParseException { |
| 905 | LinkedList<BgpValueType> subTlvs = new LinkedList<>(); |
| 906 | BgpValueType tlv = new AutonomousSystemTlv(100); |
| 907 | short deslength = AutonomousSystemTlv.LENGTH; |
| 908 | short desType = AutonomousSystemTlv.TYPE; |
| 909 | |
| 910 | subTlvs.add(tlv); |
| 911 | BgpNodeLSIdentifier localNodeDescriptors = new BgpNodeLSIdentifier(new NodeDescriptors(subTlvs, deslength, |
| 912 | desType)); |
| 913 | BgpNodeLSNlriVer4 nodeNlri = new BgpNodeLSNlriVer4(0, (byte) Constants.DIRECT, localNodeDescriptors, false, |
| 914 | new RouteDistinguisher()); |
| 915 | |
| 916 | PathAttrNlriDetails details = new PathAttrNlriDetails(); |
| 917 | details.setIdentifier(0); |
| 918 | details.setProtocolID(ProtocolType.DIRECT); |
| 919 | List<BgpValueType> pathAttributes = new LinkedList<>(); |
| 920 | List<BgpValueType> linkStateAttributes = new LinkedList<>(); |
| 921 | tlv = BgpAttrRouterIdV4.of(Ip4Address.valueOf("1.1.1.1"), LinkStateAttributes.ATTR_NODE_IPV4_LOCAL_ROUTER_ID); |
| 922 | linkStateAttributes.add(tlv); |
| 923 | pathAttributes.add(new LinkStateAttributes(linkStateAttributes)); |
| 924 | details.setPathAttribute(pathAttributes); |
| 925 | |
| 926 | for (BgpNodeListener l : controller.nodeListener) { |
| 927 | l.addNode(nodeNlri, details); |
| 928 | assertThat(nodeRegistry.connected.size(), is(1)); |
| 929 | // Check label resource reserved for that device |
| 930 | MastershipEvent event = new MastershipEvent(Type.MASTER_CHANGED, nodeRegistry.connected.iterator().next(), |
| 931 | new RoleInfo(NodeId.nodeId("Node1"), new LinkedList<>())); |
| 932 | listener.event(event); |
| 933 | assertThat(labelResourceAdminService.resourcePool.keySet().size(), is(1)); |
| 934 | |
| 935 | l.deleteNode(nodeNlri); |
| 936 | assertThat(nodeRegistry.connected.size(), is(0)); |
| 937 | assertThat(labelResourceAdminService.resourcePool.keySet().size(), is(0)); |
| 938 | } |
| 939 | } |
| 940 | |
| 941 | /** |
| 942 | * Add a link register bandwidth and remove link unregister bandwidth. |
| 943 | * |
| 944 | * @throws BgpParseException while registering/unregistering bandwidth |
| 945 | */ |
| 946 | @Test |
| 947 | public void bgpTopologyProviderDeviceTestLabel3() throws BgpParseException { |
| 948 | LinkedList<BgpValueType> localTlvs = new LinkedList<>(); |
| 949 | LinkedList<BgpValueType> remoteTlvs = new LinkedList<>(); |
| 950 | LinkedList<BgpValueType> linkdes = new LinkedList<>(); |
| 951 | BgpValueType tlv = new AutonomousSystemTlv(10); |
| 952 | short deslength = AutonomousSystemTlv.LENGTH; |
| 953 | short desType = AutonomousSystemTlv.TYPE; |
| 954 | |
| 955 | localTlvs.add(tlv); |
| 956 | remoteTlvs.add(tlv); |
| 957 | tlv = IsIsNonPseudonode.of(new byte[] {20, 20, 20, 20, 00, 20}); |
| 958 | localTlvs.add(tlv); |
| 959 | tlv = IsIsNonPseudonode.of(new byte[] {30, 30, 30, 30, 00, 30}); |
| 960 | remoteTlvs.add(tlv); |
| 961 | NodeDescriptors localNode = new NodeDescriptors(localTlvs, deslength, desType); |
| 962 | NodeDescriptors remoteNode = new NodeDescriptors(remoteTlvs, deslength, desType); |
| 963 | BgpNodeLSIdentifier localNodeDescriptors = new BgpNodeLSIdentifier(localNode); |
| 964 | BgpNodeLSNlriVer4 nodeNlri = new BgpNodeLSNlriVer4(0, (byte) Constants.DIRECT, localNodeDescriptors, false, |
| 965 | new RouteDistinguisher()); |
| 966 | |
| 967 | BgpNodeLSIdentifier remoteNodeDescriptors = new BgpNodeLSIdentifier(remoteNode); |
| 968 | BgpNodeLSNlriVer4 remNodeNlri = new BgpNodeLSNlriVer4(0, (byte) Constants.DIRECT, remoteNodeDescriptors, false, |
| 969 | new RouteDistinguisher()); |
| 970 | |
| 971 | PathAttrNlriDetails details = new PathAttrNlriDetails(); |
| 972 | details.setIdentifier(0); |
| 973 | details.setProtocolID(ProtocolType.DIRECT); |
| 974 | List<BgpValueType> pathAttributes = new LinkedList<>(); |
| 975 | List<BgpValueType> linkStateAttributes = new LinkedList<>(); |
| 976 | tlv = BgpAttrRouterIdV4.of(Ip4Address.valueOf("1.1.1.1"), LinkStateAttributes.ATTR_NODE_IPV4_LOCAL_ROUTER_ID); |
| 977 | linkStateAttributes.add(tlv); |
| 978 | pathAttributes.add(new LinkStateAttributes(linkStateAttributes)); |
| 979 | details.setPathAttribute(pathAttributes); |
| 980 | |
| 981 | tlv = LinkLocalRemoteIdentifiersTlv.of(99, 100); |
| 982 | linkdes.add(tlv); |
| 983 | BgpLinkLSIdentifier linkId = new BgpLinkLSIdentifier(localNode, remoteNode, linkdes); |
| 984 | BgpLinkLsNlriVer4 linkNlri = new BgpLinkLsNlriVer4((byte) Constants.DIRECT, 0, linkId, |
| 985 | new RouteDistinguisher(), false); |
| 986 | |
| 987 | for (BgpNodeListener l : controller.nodeListener) { |
| 988 | l.addNode(nodeNlri, details); |
| 989 | assertThat(nodeRegistry.connected.size(), is(1)); |
| 990 | //Check label resource reserved for that device |
| 991 | MastershipEvent event = new MastershipEvent(Type.MASTER_CHANGED, nodeRegistry.connected.iterator().next(), |
| 992 | new RoleInfo(NodeId.nodeId("Node1"), new LinkedList<>())); |
| 993 | listener.event(event); |
| 994 | assertThat(labelResourceAdminService.resourcePool.keySet().size(), is(1)); |
| 995 | l.addNode(remNodeNlri, details); |
| 996 | assertThat(nodeRegistry.connected.size(), is(2)); |
| 997 | l.deleteNode(remNodeNlri); |
| 998 | assertThat(nodeRegistry.connected.size(), is(1)); |
| 999 | assertThat(labelResourceAdminService.resourcePool.keySet().size(), is(1)); |
| 1000 | } |
| 1001 | |
| 1002 | List<BgpValueType> linkPathAttributes = new LinkedList<>(); |
| 1003 | List<BgpValueType> linkStateAttr = new LinkedList<>(); |
| 1004 | tlv = BgpLinkAttrIgpMetric.of(10, 4); |
| 1005 | linkStateAttr.add(tlv); |
| 1006 | tlv = BgpLinkAttrTeDefaultMetric.of(20); |
| 1007 | linkStateAttr.add(tlv); |
| 1008 | tlv = BgpLinkAttrMaxLinkBandwidth.of(70, LinkStateAttributes.ATTR_LINK_MAX_RES_BANDWIDTH); |
| 1009 | linkStateAttr.add(tlv); |
| 1010 | linkPathAttributes.add(new LinkStateAttributes(linkStateAttr)); |
| 1011 | details.setPathAttribute(linkPathAttributes); |
| 1012 | |
| 1013 | for (BgpLinkListener l : controller.linkListener) { |
| 1014 | l.addLink(linkNlri, details); |
| 1015 | assertThat(linkRegistry.links.size(), is(1)); |
| 1016 | assertThat(linkRegistry.links.iterator().next().annotations().value(BgpTopologyProvider.COST), |
| 1017 | is("10")); |
| 1018 | assertThat(linkRegistry.links.iterator().next().annotations().value(BgpTopologyProvider.TE_COST), |
| 1019 | is("20")); |
| 1020 | |
| 1021 | ConnectPoint src = new ConnectPoint( |
| 1022 | DeviceId.deviceId("l3:rd=0::routinguniverse=0:asn=10:isoid=1414.1414.0014"), |
| 1023 | PortNumber.portNumber(4294967395L)); |
| 1024 | ConnectPoint dst = new ConnectPoint( |
| 1025 | DeviceId.deviceId("l3:rd=0::routinguniverse=0:asn=10:isoid=1e1e.1e1e.001e"), |
| 1026 | PortNumber.portNumber(4294967396L)); |
| 1027 | BandwidthCapacity bandwidth = networkConfigService.getConfig(src, BandwidthCapacity.class); |
| 1028 | assertThat(bandwidth.capacity().bps(), is(70.0 * 1_000_000L)); |
| 1029 | |
| 1030 | bandwidth = networkConfigService.getConfig(dst, BandwidthCapacity.class); |
| 1031 | assertThat(bandwidth.capacity(), is(Bandwidth.bps(70.0 * 1_000_000L))); |
| 1032 | |
| 1033 | l.deleteLink(linkNlri); |
| 1034 | assertThat(linkRegistry.links.size(), is(0)); |
| 1035 | bandwidth = networkConfigService.getConfig(src, BandwidthCapacity.class); |
| 1036 | assertThat(bandwidth, is(nullValue())); |
| 1037 | bandwidth = networkConfigService.getConfig(dst, BandwidthCapacity.class); |
| 1038 | assertThat(bandwidth, is(nullValue())); |
| 1039 | } |
| 1040 | } |
Shashikanth VH | 1ca26ce | 2015-11-20 23:19:49 +0530 | [diff] [blame] | 1041 | } |