use of org.onosproject.net.config.NetworkConfigEvent in project onos by opennetworkinglab.
the class DistributedNetworkConfigStore method addConfigFactory.
@Override
public void addConfigFactory(ConfigFactory configFactory) {
factoriesByConfig.put(configFactory.configClass().getName(), configFactory);
processPendingConfigs(configFactory);
notifyDelegate(new NetworkConfigEvent(CONFIG_REGISTERED, configFactory.configKey(), configFactory.configClass()));
}
use of org.onosproject.net.config.NetworkConfigEvent in project onos by opennetworkinglab.
the class InterfaceManagerTest method testRemoveInterface.
@Test
public void testRemoveInterface() throws Exception {
ConnectPoint cp = createConnectPoint(1);
NetworkConfigEvent event = new NetworkConfigEvent(NetworkConfigEvent.Type.CONFIG_REMOVED, cp, CONFIG_CLASS);
assertEquals(NUM_INTERFACES, interfaceManager.getInterfaces().size());
// Send in a config event removing an interface config
listener.event(event);
assertEquals(NUM_INTERFACES - 1, interfaceManager.getInterfaces().size());
}
use of org.onosproject.net.config.NetworkConfigEvent in project onos by opennetworkinglab.
the class LldpLinkProviderTest method portSuppressedByParentDeviceIdBlacklist.
/**
* Checks that discovery on reconfigured switch are properly restarted.
*/
@Test
public void portSuppressedByParentDeviceIdBlacklist() {
// / When Device is configured without suppression:OFF,
// / Port should be included for discovery
// add device in stub DeviceService without suppression configured
deviceService.putDevice(device(DID3));
deviceListener.event(deviceEvent(DeviceEvent.Type.DEVICE_ADDED, DID3));
// non-suppressed port added to suppressed device
final long portno3 = 3L;
deviceService.putPorts(DID3, port(DID3, portno3, true));
deviceListener.event(portEvent(DeviceEvent.Type.PORT_ADDED, DID3, port(DID3, portno3, true)));
// discovery should succeed
assertFalse("Discoverer is expected to start", provider.discoverers.get(DID3).isStopped());
assertTrue("Discoverer should contain the port there", provider.discoverers.get(DID3).containsPort(portno3));
// add suppression rule for "deviceId: "of:0000000000000003""
deviceBlacklist.add(DID3);
configListener.event(new NetworkConfigEvent(Type.CONFIG_ADDED, DID3, LinkDiscoveryFromDevice.class));
// / When Device is reconfigured with suppression:ON, Port also is same
// update device in stub DeviceService with suppression configured
deviceService.putDevice(device(DID3));
// update the Port in stub DeviceService. (Port has reference to Device)
deviceService.putPorts(DID3, port(DID3, portno3, true));
deviceListener.event(deviceEvent(DeviceEvent.Type.DEVICE_UPDATED, DID3));
// discovery helper for device is expected to be gone or stopped
LinkDiscovery linkDiscovery = provider.discoverers.get(DID3);
if (linkDiscovery != null) {
assertTrue("Discovery expected to be stopped", linkDiscovery.isStopped());
}
}
use of org.onosproject.net.config.NetworkConfigEvent in project onos by opennetworkinglab.
the class NetworkConfigLinksProviderTest method testRemoveLink.
/**
* Tests removal of a link from the configuration.
*/
@Test
public void testRemoveLink() {
LinkKey key = LinkKey.linkKey(src, dst);
configListener.event(new NetworkConfigEvent(NetworkConfigEvent.Type.CONFIG_ADDED, key, BasicLinkConfig.class));
assertThat(provider.configuredLinks, hasSize(1));
configListener.event(new NetworkConfigEvent(NetworkConfigEvent.Type.CONFIG_REMOVED, key, BasicLinkConfig.class));
assertThat(provider.configuredLinks, hasSize(0));
}
use of org.onosproject.net.config.NetworkConfigEvent in project onos by opennetworkinglab.
the class VplsConfigManagerTest method testReloadNullConfig.
/**
* Sends a network config event with null network config.
*/
@Test
public void testReloadNullConfig() {
((TestConfigService) vplsConfigManager.configService).setConfig(null);
NetworkConfigEvent event = new NetworkConfigEvent(NetworkConfigEvent.Type.CONFIG_ADDED, null, VplsAppConfig.class);
((TestConfigService) vplsConfigManager.configService).sendEvent(event);
Collection<VplsData> vplss = vplsConfigManager.vpls.getAllVpls();
assertEquals(0, vplss.size());
}
Aggregations