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 NetworkConfigWebResourceTest method setUpMocks.
/**
* Sets up mocked config service.
*/
@Before
public void setUpMocks() {
mockNetworkConfigService = new MockNetworkConfigService();
ServiceDirectory testDirectory = new TestServiceDirectory().add(NetworkConfigService.class, mockNetworkConfigService);
setServiceDirectory(testDirectory);
}
use of org.onlab.osgi.ServiceDirectory in project onos by opennetworkinglab.
the class RegionsResourceTest method setupTest.
/**
* Sets up the global values for all the tests.
*/
@Before
public void setupTest() {
final CodecManager codecService = new CodecManager();
codecService.activate();
ServiceDirectory testDirectory = new TestServiceDirectory().add(RegionService.class, mockRegionService).add(RegionAdminService.class, mockRegionAdminService).add(CodecService.class, codecService);
setServiceDirectory(testDirectory);
}
Aggregations