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