@Override
 public void init(UiConnection connection, ServiceDirectory directory) {
   super.init(connection, directory);
   deviceService = directory.get(DeviceService.class);
   hostService = directory.get(HostService.class);
   linkService = directory.get(LinkService.class);
 }
Example #2
0
  @Override
  public void init(DeviceId deviceId, PipelinerContext context) {
    log.debug("Initiate OLT pipeline");
    this.serviceDirectory = context.directory();
    this.deviceId = deviceId;

    flowRuleService = serviceDirectory.get(FlowRuleService.class);
    coreService = serviceDirectory.get(CoreService.class);
    groupService = serviceDirectory.get(GroupService.class);
    flowObjectiveStore = context.store();

    appId = coreService.registerApplication("org.onosproject.driver.OLTPipeline");

    pendingGroups =
        CacheBuilder.newBuilder()
            .expireAfterWrite(20, TimeUnit.SECONDS)
            .removalListener(
                (RemovalNotification<GroupKey, NextObjective> notification) -> {
                  if (notification.getCause() == RemovalCause.EXPIRED) {
                    fail(notification.getValue(), ObjectiveError.GROUPINSTALLATIONFAILED);
                  }
                })
            .build();

    groupService.addListener(new InnerGroupListener());
  }