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();
}
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()));
}
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();
}
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<>());
}
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<>());
}
Aggregations