Search in sources :

Example 31 with ServiceDirectory

use of org.onlab.osgi.ServiceDirectory in project onos by opennetworkinglab.

the class ControlMetricsCollectorResourceTest method setUpTest.

/**
 * Sets up the global values for all the tests.
 */
@Before
public void setUpTest() {
    ServiceDirectory testDirectory = new TestServiceDirectory().add(ControlPlaneMonitorService.class, mockControlPlaneMonitorService).add(MetricsService.class, mockMetricsService);
    setServiceDirectory(testDirectory);
}
Also used : ControlPlaneMonitorService(org.onosproject.cpman.ControlPlaneMonitorService) ServiceDirectory(org.onlab.osgi.ServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) Before(org.junit.Before)

Example 32 with ServiceDirectory

use of org.onlab.osgi.ServiceDirectory in project onos by opennetworkinglab.

the class K8sNetworkWebResourceTest method setUpTest.

/**
 * Sets up the global values for all the tests.
 */
@Before
public void setUpTest() {
    final CodecManager codecService = new CodecManager();
    codecService.activate();
    codecService.registerCodec(K8sNetwork.class, new K8sNetworkCodec());
    ServiceDirectory testDirectory = new TestServiceDirectory().add(K8sNetworkAdminService.class, mockAdminService).add(CodecService.class, codecService);
    setServiceDirectory(testDirectory);
    k8sNetwork = DefaultK8sNetwork.builder().networkId("sona-network").name("sona-network").type(K8sNetwork.Type.VXLAN).segmentId("1").cidr("10.10.0.0/24").mtu(1500).build();
}
Also used : K8sNetworkCodec(org.onosproject.k8snetworking.codec.K8sNetworkCodec) ServiceDirectory(org.onlab.osgi.ServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) CodecManager(org.onosproject.codec.impl.CodecManager) K8sNetworkAdminService(org.onosproject.k8snetworking.api.K8sNetworkAdminService) Before(org.junit.Before)

Example 33 with ServiceDirectory

use of org.onlab.osgi.ServiceDirectory in project onos by opennetworkinglab.

the class Ofdpa2GroupHandler method init.

public void init(DeviceId deviceId, PipelinerContext context) {
    ServiceDirectory serviceDirectory = context.directory();
    this.deviceId = deviceId;
    this.flowObjectiveStore = context.store();
    this.groupService = serviceDirectory.get(GroupService.class);
    this.storageService = serviceDirectory.get(StorageService.class);
    this.nextIndex = storageService.getAtomicCounter("group-id-index-counter");
    pendingAddNextObjectives = CacheBuilder.newBuilder().expireAfterWrite(20, TimeUnit.SECONDS).removalListener((RemovalNotification<GroupKey, List<OfdpaNextGroup>> notification) -> {
        if (notification.getCause() == RemovalCause.EXPIRED && Objects.nonNull(notification.getValue())) {
            notification.getValue().forEach(ofdpaNextGrp -> fail(ofdpaNextGrp.nextObjective(), ObjectiveError.GROUPINSTALLATIONFAILED));
        }
    }).build();
    pendingRemoveNextObjectives = CacheBuilder.newBuilder().expireAfterWrite(20, TimeUnit.SECONDS).removalListener((RemovalNotification<NextObjective, List<GroupKey>> notification) -> {
        if (notification.getCause() == RemovalCause.EXPIRED) {
            fail(notification.getKey(), ObjectiveError.GROUPREMOVALFAILED);
        }
    }).build();
    pendingGroups = CacheBuilder.newBuilder().expireAfterWrite(20, TimeUnit.SECONDS).removalListener((RemovalNotification<GroupKey, Set<GroupChainElem>> notification) -> {
        if (notification.getCause() == RemovalCause.EXPIRED) {
            log.error("Unable to install group with key {} and pending GCEs: {}", notification.getKey(), notification.getValue());
        }
    }).build();
    pendingUpdateNextObjectives = new ConcurrentHashMap<>();
    GroupChecker groupChecker = new GroupChecker(this);
    groupCheckerExecutor.scheduleAtFixedRate(groupChecker, 0, 500, TimeUnit.MILLISECONDS);
    groupService.addListener(innerGroupListener);
}
Also used : ServiceDirectory(org.onlab.osgi.ServiceDirectory) GroupKey(org.onosproject.net.group.GroupKey) DefaultGroupKey(org.onosproject.net.group.DefaultGroupKey) OfdpaGroupHandlerUtility.l2MulticastGroupKey(org.onosproject.driver.pipeline.ofdpa.OfdpaGroupHandlerUtility.l2MulticastGroupKey) RemovalNotification(com.google.common.cache.RemovalNotification) GroupService(org.onosproject.net.group.GroupService) StorageService(org.onosproject.store.service.StorageService)

Example 34 with ServiceDirectory

use of org.onlab.osgi.ServiceDirectory in project onos by opennetworkinglab.

the class RestconfWebResourceTest method setup.

@Before
public void setup() {
    ServiceDirectory testDirectory = new TestServiceDirectory().add(RestconfService.class, restconfService);
    setServiceDirectory(testDirectory);
}
Also used : ServiceDirectory(org.onlab.osgi.ServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) Before(org.junit.Before)

Example 35 with ServiceDirectory

use of org.onlab.osgi.ServiceDirectory in project onos by opennetworkinglab.

the class MepWebResourceTest method setUpTest.

@Before
public void setUpTest() throws CfmConfigException {
    CfmCodecContext context = new CfmCodecContext();
    ServiceDirectory testDirectory = new TestServiceDirectory().add(CfmMepService.class, mepService).add(CfmMdService.class, mdService).add(CodecService.class, context.codecManager());
    setServiceDirectory(testDirectory);
    mepEntry1 = DefaultMepEntry.builder(MEPID1, DeviceId.deviceId("netconf:1.2.3.4:830"), PortNumber.portNumber(1), Mep.MepDirection.UP_MEP, MDNAME1, MANAME1).buildEntry();
}
Also used : CfmCodecContext(org.onosproject.cfm.CfmCodecContext) ServiceDirectory(org.onlab.osgi.ServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) CfmMdService(org.onosproject.incubator.net.l2monitoring.cfm.service.CfmMdService) Before(org.junit.Before)

Aggregations

ServiceDirectory (org.onlab.osgi.ServiceDirectory)54 Before (org.junit.Before)51 TestServiceDirectory (org.onlab.osgi.TestServiceDirectory)51 CodecManager (org.onosproject.codec.impl.CodecManager)30 DeviceService (org.onosproject.net.device.DeviceService)7 CfmCodecContext (org.onosproject.cfm.CfmCodecContext)5 CodecService (org.onosproject.codec.CodecService)5 CoreService (org.onosproject.core.CoreService)3 CfmMdService (org.onosproject.incubator.net.l2monitoring.cfm.service.CfmMdService)3 OpenstackRouterAdminService (org.onosproject.openstacknetworking.api.OpenstackRouterAdminService)3 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2 DefaultServiceDirectory (org.onlab.osgi.DefaultServiceDirectory)2 ClusterService (org.onosproject.cluster.ClusterService)2 SoamService (org.onosproject.incubator.net.l2monitoring.soam.SoamService)2 K8sNetworkAdminService (org.onosproject.k8snetworking.api.K8sNetworkAdminService)2 GroupService (org.onosproject.net.group.GroupService)2 OpenstackNetworkAdminService (org.onosproject.openstacknetworking.api.OpenstackNetworkAdminService)2 OpenstackSecurityGroupAdminService (org.onosproject.openstacknetworking.api.OpenstackSecurityGroupAdminService)2 RemovalNotification (com.google.common.cache.RemovalNotification)1 MetricsService (org.onlab.metrics.MetricsService)1