Search in sources :

Example 16 with ConfigApplyDelegate

use of org.onosproject.net.config.ConfigApplyDelegate in project onos by opennetworkinglab.

the class PiPipeconfManagerTest method setUp.

@Before
public void setUp() throws IOException {
    mgr = new PiPipeconfManager();
    pipeconf = BASIC_PIPECONF;
    mgr.cfgService = cfgService;
    mgr.driverAdminService = driverAdminService;
    injectEventDispatcher(mgr, new TestEventDispatcher());
    ObjectMapper mapper = new ObjectMapper();
    ConfigApplyDelegate delegate = new MockDelegate();
    String keyBasic = "basic";
    JsonNode jsonNodeBasic = mapper.readTree(jsonStreamBasic);
    basicDeviceConfig.init(DEVICE_ID, keyBasic, jsonNodeBasic, mapper, delegate);
    mgr.activate();
}
Also used : TestEventDispatcher(org.onosproject.common.event.impl.TestEventDispatcher) JsonNode(com.fasterxml.jackson.databind.JsonNode) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ConfigApplyDelegate(org.onosproject.net.config.ConfigApplyDelegate) Before(org.junit.Before)

Example 17 with ConfigApplyDelegate

use of org.onosproject.net.config.ConfigApplyDelegate in project onos by opennetworkinglab.

the class NetconfDeviceProviderTest method setUp.

@Before
public void setUp() throws IOException {
    coreService = createMock(CoreService.class);
    expect(coreService.registerApplication(APP_NAME)).andReturn(appId).anyTimes();
    replay(coreService);
    provider.coreService = coreService;
    provider.providerRegistry = deviceRegistry;
    provider.mastershipService = mastershipService;
    provider.deviceService = deviceService;
    provider.providerService = providerService;
    provider.cfgService = cfgService;
    provider.controller = controller;
    provider.deviceKeyAdminService = deviceKeyAdminService;
    provider.componentConfigService = new ComponentConfigAdapter();
    AbstractProjectableModel.setDriverService(null, new DriverServiceAdapter());
    provider.activate(null);
    devices.clear();
    available = false;
    firstRequest = true;
    DeviceId subject = DeviceId.deviceId(NETCONF_DEVICE_ID_STRING);
    DeviceId subjectIpv6 = DeviceId.deviceId(NETCONF_DEVICE_ID_STRING_IPV6);
    String key = "netconf";
    ObjectMapper mapper = new ObjectMapper();
    JsonNode jsonNode = mapper.readTree(jsonStream);
    ConfigApplyDelegate delegate = new MockDelegate();
    netconfDeviceConfig.init(subject, key, jsonNode, mapper, delegate);
    JsonNode jsonNodesshKey = mapper.readTree(jsonStreamSshKey);
    netconfDeviceConfigSshKey.init(subject, key, jsonNodesshKey, mapper, delegate);
    JsonNode jsonNodeEmpty = mapper.createObjectNode();
    netconfDeviceConfigEmptyIpv4.init(subject, key, jsonNodeEmpty, mapper, delegate);
    netconfDeviceConfigEmptyIpv6.init(subjectIpv6, key, jsonNodeEmpty, mapper, delegate);
    deviceAdded = new CountDownLatch(0);
}
Also used : ComponentConfigAdapter(org.onosproject.cfg.ComponentConfigAdapter) DriverServiceAdapter(org.onosproject.net.driver.DriverServiceAdapter) DeviceId(org.onosproject.net.DeviceId) CoreService(org.onosproject.core.CoreService) JsonNode(com.fasterxml.jackson.databind.JsonNode) CountDownLatch(java.util.concurrent.CountDownLatch) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ConfigApplyDelegate(org.onosproject.net.config.ConfigApplyDelegate) Before(org.junit.Before)

Example 18 with ConfigApplyDelegate

use of org.onosproject.net.config.ConfigApplyDelegate in project onos by opennetworkinglab.

the class DefaultSnmpv3DeviceTest method setUp.

@Before
public void setUp() throws Exception {
    JsonNode jsonNode = mapper.readTree(jsonStream);
    ConfigApplyDelegate delegate = new DefaultSnmpv3DeviceTest.MockDelegate();
    config.init(deviceId, KEY, jsonNode, mapper, delegate);
    defaultSnmpv3Device = new DefaultSnmpv3Device(config);
}
Also used : JsonNode(com.fasterxml.jackson.databind.JsonNode) ConfigApplyDelegate(org.onosproject.net.config.ConfigApplyDelegate) Before(org.junit.Before)

Example 19 with ConfigApplyDelegate

use of org.onosproject.net.config.ConfigApplyDelegate in project onos by opennetworkinglab.

the class V3SnmpConfigurationTest method setUp.

@Before
public void setUp() throws Exception {
    JsonNode jsonNode = mapper.readTree(jsonStream);
    ConfigApplyDelegate delegate = new MockDelegate();
    config.init(deviceId, KEY, jsonNode, mapper, delegate);
    defaultSnmpv3Device = new DefaultSnmpv3Device(config);
    v3SnmpConfiguration = V3SnmpConfiguration.builder().setAddress(defaultSnmpv3Device.getSnmpHost()).setSecurityName(defaultSnmpv3Device.getSecurityName()).setSecurityLevel(defaultSnmpv3Device.getSecurityLevel()).setAuthenticationProtocol(defaultSnmpv3Device.getAuthProtocol()).setAuthenticationPassword(defaultSnmpv3Device.getAuthPassword()).setPrivacyProtocol(defaultSnmpv3Device.getPrivProtocol()).setPrivacyPassword(defaultSnmpv3Device.getPrivPassword()).setContextName(defaultSnmpv3Device.getContextName()).build();
    v3SnmpConfiguration.setPort(defaultSnmpv3Device.getSnmpPort());
}
Also used : JsonNode(com.fasterxml.jackson.databind.JsonNode) ConfigApplyDelegate(org.onosproject.net.config.ConfigApplyDelegate) Before(org.junit.Before)

Example 20 with ConfigApplyDelegate

use of org.onosproject.net.config.ConfigApplyDelegate in project trellis-control by opennetworkinglab.

the class RouteHandlerTest method setUp.

@Before
public void setUp() {
    ObjectMapper mapper = new ObjectMapper();
    ConfigApplyDelegate delegate = config -> {
    };
    SegmentRoutingDeviceConfig dev1Config = new SegmentRoutingDeviceConfig();
    JsonNode dev1Tree = mapper.createObjectNode();
    dev1Config.init(CP1.deviceId(), "host-handler-test", dev1Tree, mapper, delegate);
    dev1Config.setPairDeviceId(CP2.deviceId()).setPairLocalPort(P9);
    SegmentRoutingDeviceConfig dev2Config = new SegmentRoutingDeviceConfig();
    JsonNode dev2Tree = mapper.createObjectNode();
    dev2Config.init(CP2.deviceId(), "host-handler-test", dev2Tree, mapper, delegate);
    dev2Config.setPairDeviceId(CP1.deviceId()).setPairLocalPort(P9);
    MockNetworkConfigRegistry mockNetworkConfigRegistry = new MockNetworkConfigRegistry();
    mockNetworkConfigRegistry.applyConfig(dev1Config);
    mockNetworkConfigRegistry.applyConfig(dev2Config);
    // Initialize Segment Routing Manager
    srManager = new MockSegmentRoutingManager(NEXT_TABLE, ROUTER_MACS);
    srManager.storageService = createMock(StorageService.class);
    expect(srManager.storageService.consistentMapBuilder()).andReturn(new TestConsistentMap.Builder<>()).anyTimes();
    expect(srManager.storageService.consistentMultimapBuilder()).andReturn(new TestConsistentMultimap.Builder<>()).anyTimes();
    replay(srManager.storageService);
    srManager.cfgService = new NetworkConfigRegistryAdapter();
    srManager.deviceConfiguration = createMock(DeviceConfiguration.class);
    srManager.flowObjectiveService = new MockFlowObjectiveService(BRIDGING_TABLE, NEXT_TABLE);
    srManager.routingRulePopulator = new MockRoutingRulePopulator(srManager, ROUTING_TABLE);
    srManager.defaultRoutingHandler = new MockDefaultRoutingHandler(srManager, SUBNET_TABLE, ROUTING_TABLE, LED_DEVICES);
    srManager.interfaceService = new MockInterfaceService(INTERFACES);
    hostService = new MockHostService(HOSTS);
    srManager.hostService = hostService;
    srManager.cfgService = mockNetworkConfigRegistry;
    srManager.routeService = new MockRouteService(ROUTE_STORE);
    srManager.phasedRecoveryService = createMock(PhasedRecoveryService.class);
    expect(srManager.phasedRecoveryService.isEnabled()).andReturn(true).anyTimes();
    replay(srManager.phasedRecoveryService);
    routeHandler = new RouteHandler(srManager);
    ROUTING_TABLE.clear();
    BRIDGING_TABLE.clear();
    SUBNET_TABLE.clear();
}
Also used : Route(org.onosproject.routeservice.Route) HostLocation(org.onosproject.net.HostLocation) Host(org.onosproject.net.Host) Interface(org.onosproject.net.intf.Interface) PortNumber(org.onosproject.net.PortNumber) RouteEvent(org.onosproject.routeservice.RouteEvent) SegmentRoutingDeviceConfig(org.onosproject.segmentrouting.config.SegmentRoutingDeviceConfig) HostService(org.onosproject.net.host.HostService) ConnectPoint(org.onosproject.net.ConnectPoint) DefaultHost(org.onosproject.net.DefaultHost) Lists(com.google.common.collect.Lists) StorageService(org.onosproject.store.service.StorageService) EasyMock.reset(org.easymock.EasyMock.reset) Map(java.util.Map) PhasedRecoveryService(org.onosproject.segmentrouting.phasedrecovery.api.PhasedRecoveryService) JsonNode(com.fasterxml.jackson.databind.JsonNode) NetworkConfigRegistryAdapter(org.onosproject.net.config.NetworkConfigRegistryAdapter) HostEvent(org.onosproject.net.host.HostEvent) EasyMock.replay(org.easymock.EasyMock.replay) EasyMock.createMock(org.easymock.EasyMock.createMock) HostId(org.onosproject.net.HostId) Before(org.junit.Before) IpAddress(org.onlab.packet.IpAddress) TrafficTreatment(org.onosproject.net.flow.TrafficTreatment) TestConsistentMap(org.onosproject.store.service.TestConsistentMap) ConfigApplyDelegate(org.onosproject.net.config.ConfigApplyDelegate) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) VlanId(org.onlab.packet.VlanId) Set(java.util.Set) Test(org.junit.Test) ProviderId(org.onosproject.net.provider.ProviderId) TestConsistentMultimap(org.onosproject.store.service.TestConsistentMultimap) EasyMock.expect(org.easymock.EasyMock.expect) Maps(com.google.common.collect.Maps) InterfaceIpAddress(org.onosproject.net.host.InterfaceIpAddress) Sets(com.google.common.collect.Sets) EasyMock.expectLastCall(org.easymock.EasyMock.expectLastCall) List(java.util.List) MacAddress(org.onlab.packet.MacAddress) DeviceId(org.onosproject.net.DeviceId) ResolvedRoute(org.onosproject.routeservice.ResolvedRoute) Assert(org.junit.Assert) EasyMock.verify(org.easymock.EasyMock.verify) IpPrefix(org.onlab.packet.IpPrefix) SegmentRoutingDeviceConfig(org.onosproject.segmentrouting.config.SegmentRoutingDeviceConfig) JsonNode(com.fasterxml.jackson.databind.JsonNode) ConfigApplyDelegate(org.onosproject.net.config.ConfigApplyDelegate) StorageService(org.onosproject.store.service.StorageService) PhasedRecoveryService(org.onosproject.segmentrouting.phasedrecovery.api.PhasedRecoveryService) NetworkConfigRegistryAdapter(org.onosproject.net.config.NetworkConfigRegistryAdapter) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Before(org.junit.Before)

Aggregations

ConfigApplyDelegate (org.onosproject.net.config.ConfigApplyDelegate)22 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)19 JsonNode (com.fasterxml.jackson.databind.JsonNode)16 Before (org.junit.Before)16 Test (org.junit.Test)10 InputStream (java.io.InputStream)7 DeviceId (org.onosproject.net.DeviceId)7 JsonNodeFactory (com.fasterxml.jackson.databind.node.JsonNodeFactory)6 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)5 Matchers.is (org.hamcrest.Matchers.is)5 TestApplicationId (org.onosproject.TestApplicationId)5 Set (java.util.Set)4 Assert (org.junit.Assert)4 ApplicationId (org.onosproject.core.ApplicationId)4 ConnectPoint (org.onosproject.net.ConnectPoint)4 Map (java.util.Map)3 IpAddress (org.onlab.packet.IpAddress)3 VlanId (org.onlab.packet.VlanId)3 HostId (org.onosproject.net.HostId)3 HostLocation (org.onosproject.net.HostLocation)3