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