Search in sources :

Example 36 with TestEventDispatcher

use of org.onosproject.common.event.impl.TestEventDispatcher in project onos by opennetworkinglab.

the class VirtualNetworkTopologyManagerTest method setUp.

@Before
public void setUp() throws Exception {
    virtualNetworkManagerStore = new DistributedVirtualNetworkStore();
    coreService = new VirtualNetworkTopologyManagerTest.TestCoreService();
    TestUtils.setField(virtualNetworkManagerStore, "coreService", coreService);
    TestUtils.setField(virtualNetworkManagerStore, "storageService", new TestStorageService());
    virtualNetworkManagerStore.activate();
    manager = new VirtualNetworkManager();
    manager.store = virtualNetworkManagerStore;
    manager.coreService = coreService;
    NetTestTools.injectEventDispatcher(manager, new TestEventDispatcher());
    testDirectory = new TestServiceDirectory();
    TestUtils.setField(manager, "serviceDirectory", testDirectory);
    manager.activate();
}
Also used : TestEventDispatcher(org.onosproject.common.event.impl.TestEventDispatcher) DistributedVirtualNetworkStore(org.onosproject.incubator.net.virtual.store.impl.DistributedVirtualNetworkStore) TestStorageService(org.onosproject.store.service.TestStorageService) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) Before(org.junit.Before)

Example 37 with TestEventDispatcher

use of org.onosproject.common.event.impl.TestEventDispatcher in project onos by opennetworkinglab.

the class MappingManagerTest method setUp.

@Before
public void setUp() {
    manager = new MappingManager();
    manager.store = new SimpleMappingStore();
    injectEventDispatcher(manager, new TestEventDispatcher());
    manager.deviceService = new TestDeviceService();
    service = manager;
    adminService = manager;
    registry = manager;
    manager.activate();
    manager.addListener(listener);
    provider = new TestProvider(LISP_PID);
    providerService = registry.register(provider);
    appId = new TestApplicationId(0, "MappingManagerTest");
    assertTrue("provider should be registered", registry.getProviders().contains(provider.id()));
}
Also used : TestEventDispatcher(org.onosproject.common.event.impl.TestEventDispatcher) Before(org.junit.Before)

Example 38 with TestEventDispatcher

use of org.onosproject.common.event.impl.TestEventDispatcher in project onos by opennetworkinglab.

the class CfmMdManagerTest method setup.

@Before
public void setup() throws Exception, CfmConfigException {
    mdStore = new DistributedMdStore();
    MaintenanceAssociation maTest11 = DefaultMaintenanceAssociation.builder(MA_ID_1_1, MD_ID_1.getNameLength()).ccmInterval(MaintenanceAssociation.CcmInterval.INTERVAL_10MIN).maNumericId((short) 1).addToRemoteMepIdList(MepId.valueOf((short) 101)).addToRemoteMepIdList(MepId.valueOf((short) 102)).addToComponentList(DefaultComponent.builder(1).tagType(Component.TagType.VLAN_CTAG).build()).build();
    MaintenanceAssociation maTest12 = DefaultMaintenanceAssociation.builder(MA_ID_1_2, MD_ID_1.getNameLength()).ccmInterval(MaintenanceAssociation.CcmInterval.INTERVAL_10MIN).maNumericId((short) 2).addToRemoteMepIdList(MepId.valueOf((short) 201)).addToRemoteMepIdList(MepId.valueOf((short) 202)).addToComponentList(DefaultComponent.builder(2).tagType(Component.TagType.VLAN_CTAG).build()).build();
    MaintenanceDomain mdTest1 = DefaultMaintenanceDomain.builder(MD_ID_1).mdLevel(MaintenanceDomain.MdLevel.LEVEL1).mdNumericId((short) 1).addToMaList(maTest11).addToMaList(maTest12).build();
    TestUtils.setField(mdStore, "storageService", new TestStorageService());
    TestUtils.setField(mdStore, "clusterService", new CfmMdManagerTest.TestClusterService());
    TestUtils.setField(mdStore, "mastershipService", new CfmMdManagerTest.TestMastershipService());
    mdStore.activate();
    mdStore.createUpdateMaintenanceDomain(mdTest1);
    manager = new CfmMdManager();
    manager.store = mdStore;
    service = manager;
    TestUtils.setField(manager, "storageService", new TestStorageService());
    TestUtils.setField(manager, "coreService", new TestCoreService());
    TestUtils.setField(manager, "mepService", mepService);
    injectEventDispatcher(manager, new TestEventDispatcher());
    manager.appId = new CfmMdManagerTest.TestApplicationId(0, "CfmMdManagerTest");
    manager.activate();
}
Also used : TestEventDispatcher(org.onosproject.common.event.impl.TestEventDispatcher) TestStorageService(org.onosproject.store.service.TestStorageService) DefaultMaintenanceDomain(org.onosproject.incubator.net.l2monitoring.cfm.DefaultMaintenanceDomain) MaintenanceDomain(org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceDomain) DefaultMaintenanceAssociation(org.onosproject.incubator.net.l2monitoring.cfm.DefaultMaintenanceAssociation) MaintenanceAssociation(org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceAssociation) Before(org.junit.Before)

Example 39 with TestEventDispatcher

use of org.onosproject.common.event.impl.TestEventDispatcher in project onos by opennetworkinglab.

the class CfmMepManagerTest method setup.

@Before
public void setup() throws CfmConfigException {
    mepManager = new CfmMepManager();
    mepStore = new DistributedMepStore();
    storageService = new MockStorageService();
    ma1 = DefaultMaintenanceAssociation.builder(MANAME1, MDNAME1.getNameLength()).build();
    ma2 = DefaultMaintenanceAssociation.builder(MANAME2, MDNAME2.getNameLength()).build();
    TestUtils.setField(mepStore, "storageService", storageService);
    ((DistributedMepStore) mepStore).activate();
    TestUtils.setField(mepManager, "coreService", new TestCoreService());
    TestUtils.setField(mepManager, "deviceService", deviceService);
    TestUtils.setField(mepManager, "cfmMdService", mdService);
    TestUtils.setField(mepManager, "mepStore", mepStore);
    injectEventDispatcher(mepManager, new TestEventDispatcher());
    mepService = mepManager;
    mepManager.activate();
    mep1 = DefaultMep.builder(MEPID1, DEVICE_ID1, PortNumber.P0, Mep.MepDirection.UP_MEP, MDNAME1, MANAME1).build();
    mepStore.createUpdateMep(new MepKeyId(MDNAME1, MANAME1, MEPID1), mep1);
    mep11 = DefaultMep.builder(MEPID11, DEVICE_ID1, PortNumber.P0, Mep.MepDirection.UP_MEP, MDNAME1, MANAME1).build();
    mepStore.createUpdateMep(new MepKeyId(MDNAME1, MANAME1, MEPID11), mep11);
    mep12 = DefaultMep.builder(MEPID12, DEVICE_ID1, PortNumber.P0, Mep.MepDirection.UP_MEP, MDNAME2, MANAME2).build();
    mepStore.createUpdateMep(new MepKeyId(MDNAME2, MANAME2, MEPID12), mep12);
    mep2 = DefaultMep.builder(MEPID2, DEVICE_ID2, PortNumber.portNumber(2), Mep.MepDirection.UP_MEP, MDNAME1, MANAME1).build();
    mepStore.createUpdateMep(new MepKeyId(MDNAME1, MANAME1, MEPID2), mep2);
    mep21 = DefaultMep.builder(MEPID21, DEVICE_ID2, PortNumber.portNumber(2), Mep.MepDirection.UP_MEP, MDNAME1, MANAME1).build();
    mepStore.createUpdateMep(new MepKeyId(MDNAME1, MANAME1, MEPID21), mep21);
    mep22 = DefaultMep.builder(MEPID22, DEVICE_ID2, PortNumber.portNumber(2), Mep.MepDirection.UP_MEP, MDNAME2, MANAME2).build();
    mepStore.createUpdateMep(new MepKeyId(MDNAME2, MANAME2, MEPID22), mep22);
    device1 = new DefaultDevice(ProviderId.NONE, DEVICE_ID1, Device.Type.SWITCH, TEST_MFR, TEST_HW_VERSION, TEST_SW_VERSION, TEST_SN, new ChassisId(1), DefaultAnnotations.builder().set(AnnotationKeys.DRIVER, TEST_DRIVER).build());
    device2 = new DefaultDevice(ProviderId.NONE, DEVICE_ID2, Device.Type.SWITCH, TEST_MFR, TEST_HW_VERSION, TEST_SW_VERSION, TEST_SN, new ChassisId(2), DefaultAnnotations.builder().set(AnnotationKeys.DRIVER, TEST_DRIVER).build());
    AbstractProjectableModel.setDriverService(null, driverService);
    Map<Class<? extends Behaviour>, Class<? extends Behaviour>> behaviours = new HashMap<>();
    behaviours.put(DeviceDescriptionDiscovery.class, TestDeviceDiscoveryBehavior.class);
    behaviours.put(CfmMepProgrammable.class, TestCfmMepProgrammable.class);
    behaviours.put(SoamDmProgrammable.class, TestSoamDmProgrammable.class);
    testDriver = new DefaultDriver(TEST_DRIVER, new ArrayList<Driver>(), TEST_MFR, TEST_HW_VERSION, TEST_SW_VERSION, behaviours, new HashMap<>());
}
Also used : TestEventDispatcher(org.onosproject.common.event.impl.TestEventDispatcher) ChassisId(org.onlab.packet.ChassisId) Behaviour(org.onosproject.net.driver.Behaviour) HashMap(java.util.HashMap) DefaultDevice(org.onosproject.net.DefaultDevice) ArrayList(java.util.ArrayList) DefaultDriver(org.onosproject.net.driver.DefaultDriver) MepKeyId(org.onosproject.incubator.net.l2monitoring.cfm.identifier.MepKeyId) Before(org.junit.Before)

Example 40 with TestEventDispatcher

use of org.onosproject.common.event.impl.TestEventDispatcher in project onos by opennetworkinglab.

the class SoamManagerTest method setup.

@Before
public void setup() throws CfmConfigException, SoamConfigException {
    soamManager = new SoamManager();
    TestUtils.setField(soamManager, "coreService", new TestCoreService());
    TestUtils.setField(soamManager, "cfmMepService", mepService);
    TestUtils.setField(soamManager, "deviceService", deviceService);
    injectEventDispatcher(soamManager, new TestEventDispatcher());
    soamService = soamManager;
    soamManager.activate();
    DelayMeasurementEntry dmEntry1 = DefaultDelayMeasurementEntry.builder(DMID101, DelayMeasurementCreate.DmType.DM1DMTX, DelayMeasurementCreate.Version.Y17312011, MepId.valueOf((short) 11), Mep.Priority.PRIO5).build();
    DelayMeasurementEntry dmEntry2 = DefaultDelayMeasurementEntry.builder(DMID102, DelayMeasurementCreate.DmType.DM1DMTX, DelayMeasurementCreate.Version.Y17312011, MepId.valueOf((short) 11), Mep.Priority.PRIO6).build();
    mep1 = DefaultMepEntry.builder(MEPID1, DEVICE_ID1, PortNumber.P0, Mep.MepDirection.UP_MEP, MDNAME1, MANAME1).addToDelayMeasurementList(dmEntry1).addToDelayMeasurementList(dmEntry2).buildEntry();
    device1 = new DefaultDevice(ProviderId.NONE, DEVICE_ID1, Device.Type.SWITCH, TEST_MFR, TEST_HW_VERSION, TEST_SW_VERSION, TEST_SN, new ChassisId(1), DefaultAnnotations.builder().set(AnnotationKeys.DRIVER, TEST_DRIVER).build());
    AbstractProjectableModel.setDriverService(null, driverService);
    Map<Class<? extends Behaviour>, Class<? extends Behaviour>> behaviours = new HashMap<>();
    behaviours.put(DeviceDescriptionDiscovery.class, TestDeviceDiscoveryBehavior.class);
    behaviours.put(CfmMepProgrammable.class, TestCfmMepProgrammable.class);
    behaviours.put(SoamDmProgrammable.class, TestSoamDmProgrammable.class);
    testDriver = new DefaultDriver(TEST_DRIVER, new ArrayList<Driver>(), TEST_MFR, TEST_HW_VERSION, TEST_SW_VERSION, behaviours, new HashMap<>());
}
Also used : TestEventDispatcher(org.onosproject.common.event.impl.TestEventDispatcher) ChassisId(org.onlab.packet.ChassisId) Behaviour(org.onosproject.net.driver.Behaviour) HashMap(java.util.HashMap) DelayMeasurementEntry(org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementEntry) DefaultDelayMeasurementEntry(org.onosproject.incubator.net.l2monitoring.soam.delay.DefaultDelayMeasurementEntry) DefaultDevice(org.onosproject.net.DefaultDevice) DefaultDriver(org.onosproject.net.driver.DefaultDriver) ArrayList(java.util.ArrayList) Before(org.junit.Before)

Aggregations

TestEventDispatcher (org.onosproject.common.event.impl.TestEventDispatcher)41 Before (org.junit.Before)39 TestStorageService (org.onosproject.store.service.TestStorageService)18 TestServiceDirectory (org.onlab.osgi.TestServiceDirectory)13 DistributedVirtualNetworkStore (org.onosproject.incubator.net.virtual.store.impl.DistributedVirtualNetworkStore)13 CoreService (org.onosproject.core.CoreService)8 ComponentConfigAdapter (org.onosproject.cfg.ComponentConfigAdapter)6 VirtualProviderManager (org.onosproject.incubator.net.virtual.impl.provider.VirtualProviderManager)6 DefaultDriver (org.onosproject.net.driver.DefaultDriver)6 TestApplicationId (org.onosproject.TestApplicationId)4 ClusterServiceAdapter (org.onosproject.cluster.ClusterServiceAdapter)4 VirtualProviderRegistryService (org.onosproject.incubator.net.virtual.provider.VirtualProviderRegistryService)4 SimpleVirtualFlowRuleStore (org.onosproject.incubator.net.virtual.store.impl.SimpleVirtualFlowRuleStore)4 DriverRegistryManager (org.onosproject.net.driver.impl.DriverRegistryManager)4 ClusterService (org.onosproject.cluster.ClusterService)3 VirtualNetworkStore (org.onosproject.incubator.net.virtual.VirtualNetworkStore)3 SimpleVirtualFlowObjectiveStore (org.onosproject.incubator.net.virtual.store.impl.SimpleVirtualFlowObjectiveStore)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Semaphore (java.util.concurrent.Semaphore)2