Search in sources :

Example 11 with NetworkConfigEvent

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()));
}
Also used : NetworkConfigEvent(org.onosproject.net.config.NetworkConfigEvent)

Example 12 with NetworkConfigEvent

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());
}
Also used : NetworkConfigEvent(org.onosproject.net.config.NetworkConfigEvent) ConnectPoint(org.onosproject.net.ConnectPoint) Test(org.junit.Test)

Example 13 with NetworkConfigEvent

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());
    }
}
Also used : NetworkConfigEvent(org.onosproject.net.config.NetworkConfigEvent) LinkDiscovery(org.onosproject.provider.lldpcommon.LinkDiscovery) Test(org.junit.Test)

Example 14 with NetworkConfigEvent

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));
}
Also used : LinkKey(org.onosproject.net.LinkKey) NetworkConfigEvent(org.onosproject.net.config.NetworkConfigEvent) BasicLinkConfig(org.onosproject.net.config.basics.BasicLinkConfig) Test(org.junit.Test)

Example 15 with NetworkConfigEvent

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());
}
Also used : NetworkConfigEvent(org.onosproject.net.config.NetworkConfigEvent) VplsData(org.onosproject.vpls.api.VplsData) VplsTest(org.onosproject.vpls.VplsTest) Test(org.junit.Test)

Aggregations

NetworkConfigEvent (org.onosproject.net.config.NetworkConfigEvent)18 Test (org.junit.Test)16 ConnectPoint (org.onosproject.net.ConnectPoint)5 VplsTest (org.onosproject.vpls.VplsTest)4 VplsData (org.onosproject.vpls.api.VplsData)4 Interface (org.onosproject.net.intf.Interface)3 CompletableFuture (java.util.concurrent.CompletableFuture)2 ExecutionException (java.util.concurrent.ExecutionException)2 TimeoutException (java.util.concurrent.TimeoutException)2 LinkKey (org.onosproject.net.LinkKey)2 NetworkConfigListener (org.onosproject.net.config.NetworkConfigListener)2 BasicLinkConfig (org.onosproject.net.config.basics.BasicLinkConfig)2 InterfaceConfig (org.onosproject.net.config.basics.InterfaceConfig)2 InterfaceIpAddress (org.onosproject.net.host.InterfaceIpAddress)2 LinkDiscovery (org.onosproject.provider.lldpcommon.LinkDiscovery)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 VlanId (org.onlab.packet.VlanId)1