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