/** * Construct a L3ForwardServiceImpl object. * * @param appId the application id of vtn */ public L3ForwardServiceImpl(ApplicationId appId) { this.appId = checkNotNull(appId, "ApplicationId can not be null"); ServiceDirectory serviceDirectory = new DefaultServiceDirectory(); this.flowObjectiveService = serviceDirectory.get(FlowObjectiveService.class); }
/** * Construct a DnatServiceImpl object. * * @param appId the application id of vtn */ public DnatServiceImpl(ApplicationId appId) { this.appId = checkNotNull(appId, "ApplicationId can not be null"); ServiceDirectory serviceDirectory = new DefaultServiceDirectory(); this.flowObjectiveService = serviceDirectory.get(FlowObjectiveService.class); }
/** * Construct a SnatServiceImpl object. * * @param appId the application id of vtn */ public SnatServiceImpl(ApplicationId appId) { this.appId = checkNotNull(appId, "ApplicationId can not be null"); ServiceDirectory serviceDirectory = new DefaultServiceDirectory(); this.flowObjectiveService = serviceDirectory.get(FlowObjectiveService.class); }
/** * Construct a ArpServiceImpl object. * * @param appId the application id of vtn */ public ArpServiceImpl(ApplicationId appId) { this.appId = checkNotNull(appId, "ApplicationId can not be null"); ServiceDirectory serviceDirectory = new DefaultServiceDirectory(); this.flowObjectiveService = serviceDirectory.get(FlowObjectiveService.class); }
/** * Constructor. * * @param appId the application id of vtn */ public ClassifierServiceImpl(ApplicationId appId) { this.appId = checkNotNull(appId, "ApplicationId can not be null"); ServiceDirectory serviceDirectory = new DefaultServiceDirectory(); this.flowObjectiveService = serviceDirectory.get(FlowObjectiveService.class); }
/** * Constructor. * * @param appId the application id of vtn */ public L2ForwardServiceImpl(ApplicationId appId) { this.appId = checkNotNull(appId, "ApplicationId can not be null"); ServiceDirectory serviceDirectory = new DefaultServiceDirectory(); this.flowObjectiveService = serviceDirectory.get(FlowObjectiveService.class); this.driverService = serviceDirectory.get(DriverService.class); }
protected void activate() { ServiceDirectory services = new DefaultServiceDirectory(); coreService = services.get(CoreService.class); mastershipService = services.get(MastershipService.class); hostService = services.get(HostService.class); hostService.addListener(hostListener); log.info("Started"); }
/** * Decodes a extension instruction. * * @return extension treatment */ private Instruction decodeExtension() { ObjectNode node = (ObjectNode) json.get(InstructionCodec.EXTENSION); if (node != null) { DeviceId deviceId = getDeviceId(); ServiceDirectory serviceDirectory = new DefaultServiceDirectory(); DeviceService deviceService = serviceDirectory.get(DeviceService.class); Device device = deviceService.getDevice(deviceId); if (device == null) { throw new IllegalArgumentException("Device not found"); } if (device.is(ExtensionTreatmentCodec.class)) { ExtensionTreatmentCodec treatmentCodec = device.as(ExtensionTreatmentCodec.class); ExtensionTreatment treatment = treatmentCodec.decode(node, context); return Instructions.extension(treatment, deviceId); } else { throw new IllegalArgumentException( "There is no codec to decode extension for device " + deviceId.toString()); } } return null; }
/** * Encodes a extension instruction. * * @param result json node that the instruction attributes are added to */ private void encodeExtension(ObjectNode result) { final Instructions.ExtensionInstructionWrapper extensionInstruction = (Instructions.ExtensionInstructionWrapper) instruction; DeviceId deviceId = extensionInstruction.deviceId(); ServiceDirectory serviceDirectory = new DefaultServiceDirectory(); DeviceService deviceService = serviceDirectory.get(DeviceService.class); Device device = deviceService.getDevice(deviceId); if (device == null) { throw new IllegalArgumentException("Device not found"); } if (device.is(ExtensionTreatmentCodec.class)) { ExtensionTreatmentCodec treatmentCodec = device.as(ExtensionTreatmentCodec.class); ObjectNode node = treatmentCodec.encode(extensionInstruction.extensionInstruction(), context); result.set(InstructionCodec.EXTENSION, node); } else { throw new IllegalArgumentException( "There is no codec to encode extension for device " + deviceId.toString()); } }
/** * Explicit constructor. * * @param appId application id. */ public SfcFlowRuleInstallerImpl(ApplicationId appId) { this.appId = checkNotNull(appId, "ApplicationId can not be null"); ServiceDirectory serviceDirectory = new DefaultServiceDirectory(); this.flowObjectiveService = serviceDirectory.get(FlowObjectiveService.class); this.driverService = serviceDirectory.get(DriverService.class); this.deviceService = serviceDirectory.get(DeviceService.class); this.hostService = serviceDirectory.get(HostService.class); this.virtualPortService = serviceDirectory.get(VirtualPortService.class); this.vtnRscService = serviceDirectory.get(VtnRscService.class); this.portPairService = serviceDirectory.get(PortPairService.class); this.portPairGroupService = serviceDirectory.get(PortPairGroupService.class); this.flowClassifierService = serviceDirectory.get(FlowClassifierService.class); this.tenantNetworkService = serviceDirectory.get(TenantNetworkService.class); nshSi = 0xff; }
@Override public void process(long sid, ObjectNode payload) { String id = string(payload, ID); ServiceDirectory serviceDirectory = new DefaultServiceDirectory(); vtnRscService = serviceDirectory.get(VtnRscService.class); virtualPortService = serviceDirectory.get(VirtualPortService.class);