Search in sources :

Example 56 with TestStorageService

use of org.onosproject.store.service.TestStorageService in project onos by opennetworkinglab.

the class DistributedMappingStoreTest method setUp.

/**
 * Sets up the storage service test harness.
 */
@Before
public void setUp() {
    mappingStore = new DistributedMappingStore();
    mappingStore.storageService = new TestStorageService();
    mappingStore.deviceService = new InternalDeviceServiceAdapter();
    mappingStore.setDelegate(event -> {
    });
    IpPrefix ipPrefix = IpPrefix.valueOf(IP_ADDRESS);
    MappingAddress address = MappingAddresses.ipv4MappingAddress(ipPrefix);
    MappingKey key = DefaultMappingKey.builder().withAddress(address).build();
    MappingAction action = MappingActions.noAction();
    MappingTreatment treatment = DefaultMappingTreatment.builder().withAddress(address).setUnicastPriority(10).setUnicastWeight(10).build();
    MappingValue value = DefaultMappingValue.builder().withAction(action).add(treatment).build();
    device1 = new MockDevice(ProviderId.NONE, DEVICE_ID_1, Device.Type.OTHER, "foo.inc", "0", "0", "0", null, DefaultAnnotations.builder().build());
    device2 = new MockDevice(ProviderId.NONE, DEVICE_ID_2, Device.Type.OTHER, "foo.inc", "0", "0", "0", null, DefaultAnnotations.builder().build());
    Mapping originalMapping1 = DefaultMapping.builder().forDevice(DEVICE_ID_1).withId(1000L).withKey(key).withValue(value).build();
    Mapping originalMapping2 = DefaultMapping.builder().forDevice(DEVICE_ID_2).withId(2000L).withKey(key).withValue(value).build();
    mapping1 = new DefaultMappingEntry(originalMapping1);
    mapping2 = new DefaultMappingEntry(originalMapping2);
    mappingStore.activate();
}
Also used : IpPrefix(org.onlab.packet.IpPrefix) MappingAddress(org.onosproject.mapping.addresses.MappingAddress) MappingAction(org.onosproject.mapping.actions.MappingAction) TestStorageService(org.onosproject.store.service.TestStorageService) DefaultMapping(org.onosproject.mapping.DefaultMapping) Mapping(org.onosproject.mapping.Mapping) DefaultMappingEntry(org.onosproject.mapping.DefaultMappingEntry) DefaultMappingKey(org.onosproject.mapping.DefaultMappingKey) MappingKey(org.onosproject.mapping.MappingKey) MappingTreatment(org.onosproject.mapping.MappingTreatment) DefaultMappingTreatment(org.onosproject.mapping.DefaultMappingTreatment) DefaultMappingValue(org.onosproject.mapping.DefaultMappingValue) MappingValue(org.onosproject.mapping.MappingValue) Before(org.junit.Before)

Example 57 with TestStorageService

use of org.onosproject.store.service.TestStorageService in project onos by opennetworkinglab.

the class OFAgentManagerTest method setUp.

@Before
public void setUp() throws Exception {
    ofAgentStore = new DistributedOFAgentStore();
    TestUtils.setField(ofAgentStore, "coreService", createMock(CoreService.class));
    TestUtils.setField(ofAgentStore, "storageService", new TestStorageService());
    TestUtils.setField(ofAgentStore, "eventExecutor", MoreExecutors.newDirectExecutorService());
    ofAgentStore.activate();
    expect(mockCoreService.registerApplication(anyObject())).andReturn(APP_ID).anyTimes();
    replay(mockCoreService);
    expect(mockClusterService.getLocalNode()).andReturn(LOCAL_NODE).anyTimes();
    replay(mockClusterService);
    expect(mockLeadershipService.runForLeadership(anyObject())).andReturn(null).anyTimes();
    mockLeadershipService.addListener(anyObject());
    mockLeadershipService.removeListener(anyObject());
    mockLeadershipService.withdraw(anyObject());
    replay(mockLeadershipService);
    target = new OFAgentManager();
    target.coreService = mockCoreService;
    target.leadershipService = mockLeadershipService;
    target.virtualNetService = mockVirtualNetService;
    target.clusterService = mockClusterService;
    target.ofAgentStore = ofAgentStore;
    target.addListener(testListener);
    target.activate();
}
Also used : TestStorageService(org.onosproject.store.service.TestStorageService) CoreService(org.onosproject.core.CoreService) Before(org.junit.Before)

Example 58 with TestStorageService

use of org.onosproject.store.service.TestStorageService in project onos by opennetworkinglab.

the class GnpyManagerTest method setUp.

@Before
public void setUp() throws Exception {
    ObjectMapper mapper = new ObjectMapper();
    reply = mapper.readTree(this.getClass().getResourceAsStream("gnpy-response.json"));
    manager = new GnpyManager();
    manager.storageService = new TestStorageService();
    manager.linkService = new InternalLinkService();
    manager.coreService = new InternalCoreService();
    manager.activate();
}
Also used : TestStorageService(org.onosproject.store.service.TestStorageService) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Before(org.junit.Before)

Example 59 with TestStorageService

use of org.onosproject.store.service.TestStorageService in project onos by opennetworkinglab.

the class OpenstackNetworkManagerTest method setUp.

@Before
public void setUp() throws Exception {
    NETWORK.setId(NETWORK_ID);
    NETWORK_COPY.setId(NETWORK_ID);
    SUBNET.setId(SUBNET_ID);
    SUBNET_COPY.setId(SUBNET_ID);
    PORT.setId(PORT_ID);
    PORT_COPY.setId(PORT_ID);
    osNetworkStore = new DistributedOpenstackNetworkStore();
    TestUtils.setField(osNetworkStore, "coreService", new TestCoreService());
    TestUtils.setField(osNetworkStore, "storageService", new TestStorageService());
    TestUtils.setField(osNetworkStore, "preCommitPortService", new TestPreCommitPortService());
    TestUtils.setField(osNetworkStore, "eventExecutor", MoreExecutors.newDirectExecutorService());
    osNetworkStore.activate();
    target = new OpenstackNetworkManager();
    TestUtils.setField(target, "coreService", new TestCoreService());
    TestUtils.setField(target, "packetService", new PacketServiceAdapter());
    TestUtils.setField(target, "deviceService", new DeviceServiceAdapter());
    TestUtils.setField(target, "storageService", new TestStorageService());
    TestUtils.setField(target, "clusterService", new ClusterServiceAdapter());
    TestUtils.setField(target, "openstacknodeService", new TestOpenstackNodeManager());
    target.osNetworkStore = osNetworkStore;
    target.addListener(testListener);
    target.activate();
}
Also used : PacketServiceAdapter(org.onosproject.net.packet.PacketServiceAdapter) TestStorageService(org.onosproject.store.service.TestStorageService) ClusterServiceAdapter(org.onosproject.cluster.ClusterServiceAdapter) DeviceServiceAdapter(org.onosproject.net.device.DeviceServiceAdapter) Before(org.junit.Before)

Example 60 with TestStorageService

use of org.onosproject.store.service.TestStorageService in project onos by opennetworkinglab.

the class OpenstackRoutingSnatIcmpHandlerTest method setUp.

/**
 * Initial setup for this unit test.
 */
@Before
public void setUp() throws IOException {
    icmpHandler = new OpenstackRoutingSnatIcmpHandler();
    icmpHandler.coreService = new TestCoreService();
    icmpHandler.packetService = new TestPacketService();
    icmpHandler.storageService = new TestStorageService();
    icmpHandler.osNodeService = new TestOpenstackNodeService();
    icmpHandler.instancePortService = new TestInstancePortService();
    icmpHandler.osNetworkService = new TestOpenstackNetworkService();
    icmpHandler.osRouterService = new TestOpenstackRouterService();
    icmpHandler.leadershipService = new TestLeadershipService();
    icmpHandler.osFlowRuleService = new TestOpenstackFlowRuleService();
    icmpHandler.clusterService = new TestClusterService();
    TestUtils.setField(icmpHandler, "eventExecutor", MoreExecutors.newDirectExecutorService());
    icmpHandler.activate();
    createPort();
    createSubnet();
    createInstancePortMap();
    createRouterInterfaceMap();
    createRouterMap();
}
Also used : TestStorageService(org.onosproject.store.service.TestStorageService) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)75 TestStorageService (org.onosproject.store.service.TestStorageService)75 TestEventDispatcher (org.onosproject.common.event.impl.TestEventDispatcher)18 TestServiceDirectory (org.onlab.osgi.TestServiceDirectory)12 DistributedVirtualNetworkStore (org.onosproject.incubator.net.virtual.store.impl.DistributedVirtualNetworkStore)12 CoreService (org.onosproject.core.CoreService)8 ClusterServiceAdapter (org.onosproject.cluster.ClusterServiceAdapter)6 ClusterCommunicationServiceAdapter (org.onosproject.store.cluster.messaging.ClusterCommunicationServiceAdapter)5 TestApplicationId (org.onosproject.TestApplicationId)3 ComponentConfigAdapter (org.onosproject.cfg.ComponentConfigAdapter)3 ClusterService (org.onosproject.cluster.ClusterService)3 LeadershipServiceAdapter (org.onosproject.cluster.LeadershipServiceAdapter)3 CoreServiceAdapter (org.onosproject.core.CoreServiceAdapter)3 VirtualNetworkStore (org.onosproject.incubator.net.virtual.VirtualNetworkStore)3 VirtualProviderManager (org.onosproject.incubator.net.virtual.impl.provider.VirtualProviderManager)3 FlowObjectiveServiceAdapter (org.onosproject.net.flowobjective.FlowObjectiveServiceAdapter)3 Semaphore (java.util.concurrent.Semaphore)2 ComponentContextAdapter (org.onlab.osgi.ComponentContextAdapter)2 KryoNamespace (org.onlab.util.KryoNamespace)2 NodeId (org.onosproject.cluster.NodeId)2