Search in sources :

Example 1 with DriverRegistryManager

use of org.onosproject.net.driver.impl.DriverRegistryManager in project onos by opennetworkinglab.

the class GroupManagerTest method setUp.

@Before
public void setUp() {
    mgr = new GroupManager();
    groupService = mgr;
    // mgr.deviceService = new DeviceManager();
    mgr.deviceService = new TestDeviceService();
    mgr.cfgService = new ComponentConfigAdapter();
    mgr.store = new SimpleGroupStore();
    mgr.mastershipService = new TestMastershipService();
    injectEventDispatcher(mgr, new TestEventDispatcher());
    providerRegistry = mgr;
    mgr.activate(null);
    mgr.addListener(listener);
    DriverRegistryManager driverRegistry = new DriverRegistryManager();
    driverService = new TestDriverManager(driverRegistry);
    driverRegistry.addDriver(new DefaultDriver("foo", ImmutableList.of(), "", "", "", ImmutableMap.of(GroupProgrammable.class, TestGroupProgrammable.class), ImmutableMap.of()));
    internalProvider = new TestGroupProvider(PID);
    provider = internalProvider;
    providerService = providerRegistry.register(provider);
    appId = new DefaultApplicationId(2, "org.groupmanager.test");
    assertTrue("provider should be registered", providerRegistry.getProviders().contains(provider.id()));
}
Also used : ComponentConfigAdapter(org.onosproject.cfg.ComponentConfigAdapter) TestEventDispatcher(org.onosproject.common.event.impl.TestEventDispatcher) SimpleGroupStore(org.onosproject.store.trivial.SimpleGroupStore) DefaultDriver(org.onosproject.net.driver.DefaultDriver) DriverRegistryManager(org.onosproject.net.driver.impl.DriverRegistryManager) DefaultApplicationId(org.onosproject.core.DefaultApplicationId) Before(org.junit.Before)

Example 2 with DriverRegistryManager

use of org.onosproject.net.driver.impl.DriverRegistryManager in project onos by opennetworkinglab.

the class PacketManagerTest method setUp.

@Before
public void setUp() {
    mgr = new PacketManager();
    injectEventDispatcher(mgr, new TestEventDispatcher());
    mgr.store = new SimplePacketStore();
    mgr.clusterService = new ClusterServiceAdapter();
    mgr.deviceService = new TestDeviceService();
    mgr.deviceService = new TestDeviceService();
    mgr.coreService = new TestCoreService();
    providerRegistry = mgr;
    mgr.activate();
    DriverRegistryManager driverRegistry = new DriverRegistryManager();
    driverService = new TestDriverManager(driverRegistry);
    driverRegistry.addDriver(new DefaultDriver("foo", ImmutableList.of(), "", "", "", ImmutableMap.of(PacketProgrammable.class, TestPacketProgrammable.class), ImmutableMap.of()));
}
Also used : TestEventDispatcher(org.onosproject.common.event.impl.TestEventDispatcher) ClusterServiceAdapter(org.onosproject.cluster.ClusterServiceAdapter) DefaultDriver(org.onosproject.net.driver.DefaultDriver) DriverRegistryManager(org.onosproject.net.driver.impl.DriverRegistryManager) SimplePacketStore(org.onosproject.store.trivial.SimplePacketStore) Before(org.junit.Before)

Example 3 with DriverRegistryManager

use of org.onosproject.net.driver.impl.DriverRegistryManager in project onos by opennetworkinglab.

the class FlowRuleManagerTest method setUp.

@Before
public void setUp() {
    mgr = new FlowRuleManager();
    mgr.store = new SimpleFlowRuleStore();
    injectEventDispatcher(mgr, new TestEventDispatcher());
    mgr.deviceService = new TestDeviceService();
    mgr.mastershipService = new TestMastershipService();
    mgr.coreService = new TestCoreService();
    mgr.operationsService = MoreExecutors.newDirectExecutorService();
    mgr.deviceInstallers = MoreExecutors.newDirectExecutorService();
    mgr.cfgService = new ComponentConfigAdapter();
    ClusterService mockClusterService = createMock(ClusterService.class);
    NodeId nodeId = new NodeId(NODE_ID);
    MockControllerNode mockControllerNode = new MockControllerNode(nodeId);
    expect(mockClusterService.getLocalNode()).andReturn(mockControllerNode).anyTimes();
    replay(mockClusterService);
    mgr.clusterService = mockClusterService;
    service = mgr;
    registry = mgr;
    DriverRegistryManager driverRegistry = new DriverRegistryManager();
    driverService = new TestDriverManager(driverRegistry);
    driverRegistry.addDriver(new DefaultDriver("foo", ImmutableList.of(), "", "", "", ImmutableMap.of(FlowRuleProgrammable.class, TestFlowRuleProgrammable.class), ImmutableMap.of()));
    mgr.activate(null);
    mgr.addListener(listener);
    provider = new TestProvider(PID);
    providerService = this.registry.register(provider);
    appId = new TestApplicationId(0, "FlowRuleManagerTest");
    assertTrue("provider should be registered", this.registry.getProviders().contains(provider.id()));
}
Also used : TestEventDispatcher(org.onosproject.common.event.impl.TestEventDispatcher) ComponentConfigAdapter(org.onosproject.cfg.ComponentConfigAdapter) ClusterService(org.onosproject.cluster.ClusterService) SimpleFlowRuleStore(org.onosproject.store.trivial.SimpleFlowRuleStore) NodeId(org.onosproject.cluster.NodeId) DefaultDriver(org.onosproject.net.driver.DefaultDriver) DriverRegistryManager(org.onosproject.net.driver.impl.DriverRegistryManager) Before(org.junit.Before)

Example 4 with DriverRegistryManager

use of org.onosproject.net.driver.impl.DriverRegistryManager in project onos by opennetworkinglab.

the class MeterManagerTest method setup.

@Before
public void setup() {
    DeviceService deviceService = new TestDeviceService();
    DriverRegistryManager driverRegistry = new DriverRegistryManager();
    DriverManager driverService = new TestDriverManager(driverRegistry, deviceService, new NetworkConfigServiceAdapter());
    driverRegistry.addDriver(new DefaultDriver("foo", ImmutableList.of(), "", "", "", ImmutableMap.of(MeterProgrammable.class, TestMeterProgrammable.class, MeterQuery.class, TestMeterQuery.class), ImmutableMap.of()));
    meterStore = new DistributedMeterStore();
    TestUtils.setField(meterStore, "storageService", new TestStorageService());
    TestUtils.setField(meterStore, "driverService", driverService);
    KryoNamespace.Builder testKryoBuilder = TestUtils.getField(meterStore, "APP_KRYO_BUILDER");
    testKryoBuilder.register(TestApplicationId.class);
    Serializer testSerializer = Serializer.using(Lists.newArrayList(testKryoBuilder.build()));
    TestUtils.setField(meterStore, "serializer", testSerializer);
    meterStore.activate();
    manager = new MeterManager();
    TestUtils.setField(manager, "store", meterStore);
    injectEventDispatcher(manager, new TestEventDispatcher());
    manager.deviceService = deviceService;
    manager.mastershipService = new TestMastershipService();
    manager.cfgService = new ComponentConfigAdapter();
    manager.clusterService = new TestClusterService();
    registry = manager;
    manager.driverService = driverService;
    Dictionary<String, Object> cfgDict = new Hashtable<>();
    expect(componentContext.getProperties()).andReturn(cfgDict);
    replay(componentContext);
    manager.activate(componentContext);
    provider = new TestProvider(PID);
    providerService = registry.register(provider);
    assertTrue("provider should be registered", registry.getProviders().contains(provider.id()));
}
Also used : TestEventDispatcher(org.onosproject.common.event.impl.TestEventDispatcher) TestStorageService(org.onosproject.store.service.TestStorageService) Hashtable(java.util.Hashtable) DeviceService(org.onosproject.net.device.DeviceService) DistributedMeterStore(org.onosproject.store.meter.impl.DistributedMeterStore) ComponentConfigAdapter(org.onosproject.cfg.ComponentConfigAdapter) DefaultDriver(org.onosproject.net.driver.DefaultDriver) KryoNamespace(org.onlab.util.KryoNamespace) NetworkConfigServiceAdapter(org.onosproject.net.config.NetworkConfigServiceAdapter) DriverManager(org.onosproject.net.driver.impl.DriverManager) DriverRegistryManager(org.onosproject.net.driver.impl.DriverRegistryManager) Serializer(org.onosproject.store.service.Serializer) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)4 TestEventDispatcher (org.onosproject.common.event.impl.TestEventDispatcher)4 DefaultDriver (org.onosproject.net.driver.DefaultDriver)4 DriverRegistryManager (org.onosproject.net.driver.impl.DriverRegistryManager)4 ComponentConfigAdapter (org.onosproject.cfg.ComponentConfigAdapter)3 Hashtable (java.util.Hashtable)1 KryoNamespace (org.onlab.util.KryoNamespace)1 ClusterService (org.onosproject.cluster.ClusterService)1 ClusterServiceAdapter (org.onosproject.cluster.ClusterServiceAdapter)1 NodeId (org.onosproject.cluster.NodeId)1 DefaultApplicationId (org.onosproject.core.DefaultApplicationId)1 NetworkConfigServiceAdapter (org.onosproject.net.config.NetworkConfigServiceAdapter)1 DeviceService (org.onosproject.net.device.DeviceService)1 DriverManager (org.onosproject.net.driver.impl.DriverManager)1 DistributedMeterStore (org.onosproject.store.meter.impl.DistributedMeterStore)1 Serializer (org.onosproject.store.service.Serializer)1 TestStorageService (org.onosproject.store.service.TestStorageService)1 SimpleFlowRuleStore (org.onosproject.store.trivial.SimpleFlowRuleStore)1 SimpleGroupStore (org.onosproject.store.trivial.SimpleGroupStore)1 SimplePacketStore (org.onosproject.store.trivial.SimplePacketStore)1