/** * Produces device URI from the given DPID. * * @param dpid device dpid * @return device URI */ public static URI uri(Dpid dpid) { return uri(dpid.value); }
private void pushTableStatistics(Dpid dpid, OFTableStatsReply replies) { DeviceId did = DeviceId.deviceId(Dpid.uri(dpid)); List<TableStatisticsEntry> tableStatsEntries = replies.getEntries().stream() .map(entry -> buildTableStatistics(did, entry)) .filter(Objects::nonNull) .collect(Collectors.toList()); providerService.pushTableStatistics(did, tableStatsEntries); }
@Override public void switchAdded(Dpid dpid) { if (providerService == null) { return; } DeviceId deviceId = deviceId(uri(dpid)); OpenFlowControlMessageAggregator ofcma = new OpenFlowControlMessageAggregator(metricsService, providerService, deviceId); ScheduledFuture result = executor.scheduleAtFixedRate(ofcma, AGGR_INIT_DELAY, AGGR_PERIOD, AGGR_TIME_UNIT, true); aggregators.put(dpid, ofcma); executorResults.put(dpid, result); }
@Override public void switchRemoved(Dpid dpid) { if (providerService == null) { return; } providerService.deviceDisconnected(deviceId(uri(dpid))); stopCollectorIfNeeded(collectors.remove(dpid)); }
@Override public void portChanged(Dpid dpid, OFPortStatus status) { LOG.debug("portChanged({},{})", dpid, status); PortDescription portDescription = buildPortDescription(status); providerService.portStatusChanged(deviceId(uri(dpid)), portDescription); }
@Override public void switchChanged(Dpid dpid) { LOG.debug("switchChanged({})", dpid); if (providerService == null) { return; } DeviceId did = deviceId(uri(dpid)); OpenFlowSwitch sw = controller.getSwitch(dpid); if (sw == null) { return; } final List<PortDescription> ports = buildPortDescriptions(sw); LOG.debug("switchChanged({}) {}", did, ports); providerService.updatePorts(did, ports); }
private void pushPortMetrics(Dpid dpid, List<OFPortStatsEntry> portStatsEntries) { DeviceId deviceId = DeviceId.deviceId(Dpid.uri(dpid)); Collection<PortStatistics> stats = buildPortStatistics(deviceId, portStatsEntries); providerService.updatePortStatistics(deviceId, stats); }
@Override public void receivedRoleReply(Dpid dpid, RoleState requested, RoleState response) { LOG.debug("receivedRoleReply({},{},{})", dpid, requested, response); MastershipRole request = roleOf(requested); MastershipRole reply = roleOf(response); providerService.receivedRoleReply(deviceId(uri(dpid)), request, reply); }
GroupOperation operation = pendingGroupOperations.get(pendingGroupId); DeviceId deviceId = DeviceId.deviceId(Dpid.uri(dpid)); if (operation != null) { OFGroupModFailedCode code =
private DriverHandler getDriver(Dpid dpid) { DeviceId deviceId = DeviceId.deviceId(Dpid.uri(dpid)); Driver driver = driverService.getDriver(deviceId); DriverHandler handler = new DefaultDriverHandler(new DefaultDriverData(driver, deviceId)); return handler; } }
private TrafficTreatment buildTreatment(List<OFAction> actions) { DriverHandler driverHandler = getDriver(dpid); TrafficTreatment.Builder builder = DefaultTrafficTreatment.builder(); // If this is a drop rule if (actions.size() == 0) { builder.drop(); return builder.build(); } return FlowEntryBuilder.configureTreatmentBuilder(actions, builder, driverHandler, DeviceId.deviceId(Dpid.uri(dpid))).build(); }
private void pushGroupMetrics(Dpid dpid, OFStatsReply statsReply) { DeviceId deviceId = DeviceId.deviceId(Dpid.uri(dpid));
private void pushFlowMetrics(Dpid dpid, OFFlowStatsReply replies) { DeviceId did = DeviceId.deviceId(Dpid.uri(dpid));
@Override public void handlePacket(OpenFlowPacketContext pktCtx) { DeviceId id = DeviceId.deviceId(Dpid.uri(pktCtx.dpid().value())); DefaultInboundPacket inPkt = new DefaultInboundPacket( new ConnectPoint(id, PortNumber.portNumber(pktCtx.inPort())), pktCtx.parsed(), ByteBuffer.wrap(pktCtx.unparsed()), pktCtx.cookie()); DefaultOutboundPacket outPkt = null; if (!pktCtx.isBuffered()) { outPkt = new DefaultOutboundPacket(id, null, ByteBuffer.wrap(pktCtx.unparsed())); } OpenFlowCorePacketContext corePktCtx = new OpenFlowCorePacketContext(System.currentTimeMillis(), inPkt, outPkt, pktCtx.isHandled(), pktCtx); providerService.processPacket(corePktCtx); }
DeviceId deviceId = DeviceId.deviceId(Dpid.uri(dpid)); switch (msg.getType()) { case FLOW_REMOVED:
driver = driverService.getDriver(DeviceId.deviceId(Dpid.uri(dpidObj))); } catch (ItemNotFoundException e) { driver = driverService.getDriver(desc.getMfrDesc(), desc.getHwDesc(), desc.getSwDesc()); Dpid did = new Dpid(dpid); DefaultDriverHandler handler = new DefaultDriverHandler(new DefaultDriverData(driver, deviceId(uri(did)))); OpenFlowSwitchDriver ofSwitchDriver = driver.createBehaviour(handler, OpenFlowSwitchDriver.class);
return; DeviceId did = deviceId(uri(dpid)); OpenFlowSwitch sw = controller.getSwitch(dpid); if (sw == null) {