Search in sources :

Example 6 with ComponentConfigAdapter

use of org.onosproject.cfg.ComponentConfigAdapter in project onos by opennetworkinglab.

the class DistributedGroupStoreTest method setUp.

@Before
public void setUp() throws Exception {
    groupStoreImpl = new DistributedGroupStore();
    groupStoreImpl.storageService = new TestStorageService();
    groupStoreImpl.clusterCommunicator = new ClusterCommunicationServiceAdapter();
    groupStoreImpl.mastershipService = new MasterOfAll();
    groupStoreImpl.cfgService = new ComponentConfigAdapter();
    groupStoreImpl.deviceService = new InternalDeviceServiceImpl();
    ClusterService mockClusterService = createMock(ClusterService.class);
    NodeId nodeId = new NodeId(NODE_ID);
    MockControllerNode mockControllerNode = new MockControllerNode(nodeId);
    expect(mockClusterService.getLocalNode()).andReturn(mockControllerNode).anyTimes();
    replay(mockClusterService);
    groupStoreImpl.clusterService = mockClusterService;
    groupStoreImpl.activate(null);
    groupStore = groupStoreImpl;
    auditPendingReqQueue = TestUtils.getField(groupStoreImpl, "auditPendingReqQueue");
}
Also used : ComponentConfigAdapter(org.onosproject.cfg.ComponentConfigAdapter) ClusterService(org.onosproject.cluster.ClusterService) TestStorageService(org.onosproject.store.service.TestStorageService) NodeId(org.onosproject.cluster.NodeId) ClusterCommunicationServiceAdapter(org.onosproject.store.cluster.messaging.ClusterCommunicationServiceAdapter) Before(org.junit.Before)

Example 7 with ComponentConfigAdapter

use of org.onosproject.cfg.ComponentConfigAdapter in project onos by opennetworkinglab.

the class NeighbourResolutionManagerTest method setUp.

@Before
public void setUp() throws Exception {
    neighbourManager = new NeighbourResolutionManager();
    packetService = createMock(PacketService.class);
    packetService.requestPackets(anyObject(TrafficSelector.class), anyObject(PacketPriority.class), anyObject(ApplicationId.class));
    expectLastCall().anyTimes();
    packetService.addProcessor(anyObject(PacketProcessor.class), anyInt());
    expectLastCall().andDelegateTo(new TestPacketService()).once();
    packetService.cancelPackets(anyObject(TrafficSelector.class), anyObject(PacketPriority.class), anyObject(ApplicationId.class));
    expectLastCall().anyTimes();
    replay(packetService);
    neighbourManager.packetService = packetService;
    CoreService coreService = createNiceMock(CoreService.class);
    replay(coreService);
    neighbourManager.coreService = coreService;
    neighbourManager.componentConfigService = new ComponentConfigAdapter();
    neighbourManager.activate(new ComponentContextAdapter());
}
Also used : PacketPriority(org.onosproject.net.packet.PacketPriority) ComponentConfigAdapter(org.onosproject.cfg.ComponentConfigAdapter) ComponentContextAdapter(org.onlab.osgi.ComponentContextAdapter) PacketProcessor(org.onosproject.net.packet.PacketProcessor) PacketService(org.onosproject.net.packet.PacketService) TrafficSelector(org.onosproject.net.flow.TrafficSelector) CoreService(org.onosproject.core.CoreService) TestApplicationId(org.onosproject.TestApplicationId) ApplicationId(org.onosproject.core.ApplicationId) Before(org.junit.Before)

Example 8 with ComponentConfigAdapter

use of org.onosproject.cfg.ComponentConfigAdapter in project onos by opennetworkinglab.

the class DistributedStatisticStoreTest method setUp.

@Before
public void setUp() throws Exception {
    statStore = new DistributedStatisticStore();
    statStore.cfgService = new ComponentConfigAdapter();
    mockClusterService = createMock(ClusterService.class);
    statStore.clusterService = mockClusterService;
    statStore.clusterService = mockClusterService;
    nodeId = new NodeId("1");
    mockControllerNode = new SetMockControllerNode(nodeId);
    expect(mockClusterService.getLocalNode()).andReturn(mockControllerNode).anyTimes();
    replay(mockClusterService);
    statStore.clusterCommunicator = new ClusterCommunicationServiceAdapter();
    statStore.mastershipService = new MasterOfAll();
    statStore.activate(mockContext);
    store = statStore;
}
Also used : ComponentConfigAdapter(org.onosproject.cfg.ComponentConfigAdapter) ClusterService(org.onosproject.cluster.ClusterService) NodeId(org.onosproject.cluster.NodeId) ClusterCommunicationServiceAdapter(org.onosproject.store.cluster.messaging.ClusterCommunicationServiceAdapter) Before(org.junit.Before)

Example 9 with ComponentConfigAdapter

use of org.onosproject.cfg.ComponentConfigAdapter in project onos by opennetworkinglab.

the class PathIntentCompilerTest method setUp.

/**
 * Configures mock objects used in all the test cases.
 * Creates the intents to test as well.
 */
@Before
public void setUp() {
    sut = new PathIntentCompiler();
    coreService = createMock(CoreService.class);
    expect(coreService.registerApplication("org.onosproject.net.intent")).andReturn(appId);
    sut.coreService = coreService;
    sut.resourceService = new MockResourceService();
    super.setUp();
    intent = PathIntent.builder().appId(APP_ID).selector(selector).treatment(treatment).priority(PRIORITY).path(new DefaultPath(pid, links, ScalarWeight.toWeight(hops))).build();
    // Intent with VLAN encap without egress VLAN
    constraintVlanIntent = PathIntent.builder().appId(APP_ID).selector(selector).treatment(treatment).priority(PRIORITY).constraints(ImmutableList.of(new EncapsulationConstraint(EncapsulationType.VLAN))).path(new DefaultPath(pid, links, ScalarWeight.toWeight(hops))).build();
    // Intent with VLAN encap with ingress and egress VLAN
    constrainIngressEgressVlanIntent = PathIntent.builder().appId(APP_ID).selector(vlanSelector).treatment(vlanTreatment).priority(PRIORITY).constraints(ImmutableList.of(new EncapsulationConstraint(EncapsulationType.VLAN))).path(new DefaultPath(pid, links, ScalarWeight.toWeight(hops))).build();
    constraintMplsIntent = PathIntent.builder().appId(APP_ID).selector(selector).treatment(treatment).priority(PRIORITY).constraints(ImmutableList.of(new EncapsulationConstraint(EncapsulationType.MPLS))).path(new DefaultPath(pid, links, ScalarWeight.toWeight(hops))).build();
    edgeIntentNoVlan = PathIntent.builder().appId(APP_ID).selector(selector).treatment(treatment).priority(PRIORITY).constraints(ImmutableList.of(new EncapsulationConstraint(EncapsulationType.VLAN))).path(new DefaultPath(pid, edgeNet, ScalarWeight.toWeight(edgeHops))).build();
    edgeIntentIngressVlan = PathIntent.builder().appId(APP_ID).selector(vlanSelector).treatment(treatment).priority(PRIORITY).constraints(ImmutableList.of(new EncapsulationConstraint(EncapsulationType.VLAN))).path(new DefaultPath(pid, edgeNet, ScalarWeight.toWeight(edgeHops))).build();
    edgeIntentEgressVlan = PathIntent.builder().appId(APP_ID).selector(selector).treatment(vlanTreatment).priority(PRIORITY).constraints(ImmutableList.of(new EncapsulationConstraint(EncapsulationType.VLAN))).path(new DefaultPath(pid, edgeNet, ScalarWeight.toWeight(edgeHops))).build();
    edgeIntentVlan = PathIntent.builder().appId(APP_ID).selector(vlanSelector).treatment(vlanTreatment).priority(PRIORITY).constraints(ImmutableList.of(new EncapsulationConstraint(EncapsulationType.VLAN))).path(new DefaultPath(pid, edgeNet, ScalarWeight.toWeight(edgeHops))).build();
    singleHopIndirectIntentNoVlan = PathIntent.builder().appId(APP_ID).selector(selector).treatment(treatment).priority(PRIORITY).constraints(ImmutableList.of(new EncapsulationConstraint(EncapsulationType.VLAN))).path(new DefaultPath(pid, singleHopIndirect, ScalarWeight.toWeight(singleHopIndirectHops))).build();
    singleHopIndirectIntentIngressVlan = PathIntent.builder().appId(APP_ID).selector(vlanSelector).treatment(treatment).priority(PRIORITY).constraints(ImmutableList.of(new EncapsulationConstraint(EncapsulationType.VLAN))).path(new DefaultPath(pid, singleHopIndirect, ScalarWeight.toWeight(singleHopIndirectHops))).build();
    singleHopIndirectIntentEgressVlan = PathIntent.builder().appId(APP_ID).selector(selector).treatment(vlanTreatment).priority(PRIORITY).constraints(ImmutableList.of(new EncapsulationConstraint(EncapsulationType.VLAN))).path(new DefaultPath(pid, singleHopIndirect, ScalarWeight.toWeight(singleHopIndirectHops))).build();
    singleHopIndirectIntentVlan = PathIntent.builder().appId(APP_ID).selector(vlanSelector).treatment(vlanTreatment).priority(PRIORITY).constraints(ImmutableList.of(new EncapsulationConstraint(EncapsulationType.VLAN))).path(new DefaultPath(pid, singleHopIndirect, ScalarWeight.toWeight(singleHopIndirectHops))).build();
    singleHopDirectIntentNoVlan = PathIntent.builder().appId(APP_ID).selector(selector).treatment(treatment).priority(PRIORITY).constraints(ImmutableList.of(new EncapsulationConstraint(EncapsulationType.VLAN))).path(new DefaultPath(pid, singleHopDirect, ScalarWeight.toWeight(singleHopDirectHops))).build();
    singleHopDirectIntentIngressVlan = PathIntent.builder().appId(APP_ID).selector(vlanSelector).treatment(treatment).priority(PRIORITY).constraints(ImmutableList.of(new EncapsulationConstraint(EncapsulationType.VLAN))).path(new DefaultPath(pid, singleHopDirect, ScalarWeight.toWeight(singleHopDirectHops))).build();
    singleHopDirectIntentEgressVlan = PathIntent.builder().appId(APP_ID).selector(selector).treatment(vlanTreatment).priority(PRIORITY).constraints(ImmutableList.of(new EncapsulationConstraint(EncapsulationType.VLAN))).path(new DefaultPath(pid, singleHopDirect, ScalarWeight.toWeight(singleHopDirectHops))).build();
    singleHopDirectIntentVlan = PathIntent.builder().appId(APP_ID).selector(vlanSelector).treatment(vlanTreatment).priority(PRIORITY).constraints(ImmutableList.of(new EncapsulationConstraint(EncapsulationType.VLAN))).path(new DefaultPath(pid, singleHopDirect, ScalarWeight.toWeight(singleHopDirectHops))).build();
    intentExtensionService = createMock(IntentExtensionService.class);
    intentExtensionService.registerCompiler(PathIntent.class, sut);
    intentExtensionService.unregisterCompiler(PathIntent.class);
    registrator = new IntentConfigurableRegistrator();
    registrator.extensionService = intentExtensionService;
    registrator.cfgService = new ComponentConfigAdapter();
    registrator.activate();
    sut.registrator = registrator;
    replay(coreService, intentExtensionService);
}
Also used : EncapsulationConstraint(org.onosproject.net.intent.constraint.EncapsulationConstraint) ComponentConfigAdapter(org.onosproject.cfg.ComponentConfigAdapter) MockResourceService(org.onosproject.net.resource.MockResourceService) IntentExtensionService(org.onosproject.net.intent.IntentExtensionService) CoreService(org.onosproject.core.CoreService) DefaultPath(org.onosproject.net.DefaultPath) Before(org.junit.Before)

Example 10 with ComponentConfigAdapter

use of org.onosproject.cfg.ComponentConfigAdapter in project onos by opennetworkinglab.

the class LinkCollectionIntentFlowObjectiveCompilerTest method setUp.

@Before
public void setUp() {
    compiler = new LinkCollectionIntentFlowObjectiveCompiler();
    coreService = createMock(CoreService.class);
    expect(coreService.registerApplication("org.onosproject.net.intent")).andReturn(appId);
    flowObjectiveService = new FlowObjectiveServiceAdapter();
    resourceService = new MockResourceService();
    compiler.coreService = coreService;
    compiler.flowObjectiveService = flowObjectiveService;
    domainService = createMock(DomainService.class);
    expect(domainService.getDomain(anyObject(DeviceId.class))).andReturn(LOCAL).anyTimes();
    compiler.domainService = domainService;
    super.setUp();
    intentExtensionService = createMock(IntentExtensionService.class);
    intentExtensionService.registerCompiler(LinkCollectionIntent.class, compiler);
    intentExtensionService.unregisterCompiler(LinkCollectionIntent.class);
    registrator = new IntentConfigurableRegistrator();
    registrator.extensionService = intentExtensionService;
    registrator.cfgService = new ComponentConfigAdapter();
    registrator.activate();
    compiler.registrator = registrator;
    compiler.resourceService = resourceService;
    LinkCollectionCompiler.optimizeInstructions = false;
    LinkCollectionCompiler.copyTtl = false;
    replay(coreService, domainService, intentExtensionService);
    compiler.activate();
}
Also used : ComponentConfigAdapter(org.onosproject.cfg.ComponentConfigAdapter) MockResourceService(org.onosproject.net.resource.MockResourceService) IntentExtensionService(org.onosproject.net.intent.IntentExtensionService) DomainService(org.onosproject.net.domain.DomainService) FlowObjectiveServiceAdapter(org.onosproject.net.flowobjective.FlowObjectiveServiceAdapter) CoreService(org.onosproject.core.CoreService) Before(org.junit.Before)

Aggregations

ComponentConfigAdapter (org.onosproject.cfg.ComponentConfigAdapter)30 Before (org.junit.Before)27 CoreService (org.onosproject.core.CoreService)12 IntentExtensionService (org.onosproject.net.intent.IntentExtensionService)7 MockResourceService (org.onosproject.net.resource.MockResourceService)7 TestEventDispatcher (org.onosproject.common.event.impl.TestEventDispatcher)6 DomainService (org.onosproject.net.domain.DomainService)6 ClusterService (org.onosproject.cluster.ClusterService)4 NodeId (org.onosproject.cluster.NodeId)4 DeviceServiceAdapter (org.onosproject.net.device.DeviceServiceAdapter)4 DriverServiceAdapter (org.onosproject.net.driver.DriverServiceAdapter)4 CoreServiceAdapter (org.onosproject.core.CoreServiceAdapter)3 DefaultDriver (org.onosproject.net.driver.DefaultDriver)3 DriverRegistryManager (org.onosproject.net.driver.impl.DriverRegistryManager)3 ClusterCommunicationServiceAdapter (org.onosproject.store.cluster.messaging.ClusterCommunicationServiceAdapter)3 TestStorageService (org.onosproject.store.service.TestStorageService)3 Test (org.junit.Test)2 ComponentContextAdapter (org.onlab.osgi.ComponentContextAdapter)2 FlowRuleIntent (org.onosproject.net.intent.FlowRuleIntent)2 Intent (org.onosproject.net.intent.Intent)2