...
Code Block | ||
---|---|---|
| ||
OFQueueGetConfigRequest cr = factory.buildQueueGetConfigRequest().setPort(OFPort.ALLANY).build(); /* Get allRequest queues on all ports any port (i.e. don't care) */ ListenableFuture<OFQueueGetConfigReply> future = switchService.getSwitch(DatpathId.of(1)).writeRequest(cr); /* Send request to switch 1 */ try { /* Wait up to 10s for a reply; return when received; else exception thrown */ OFQueueGetConfigReply reply = future.get(10, TimeUnit.SECONDS); /* Iterate over all queues */ for (OFPacketQueue q : reply.getQueues()) { OFPort p = q.getPort(); /* The switch port the queue is on */ long id = q.getQueueId(); /* The ID of the queue */ /* Determine if the queue rates */ for (OFQueueProp qp : q.getProperties()) { int rate; /* This is a bit clunky now -- need to improve API in Loxi */ switch (qp.getType()) { case OFQueuePropertiesSerializerVer13.MIN_RATE_VAL: /* min rate */ OFQueuePropMinRate min = (OFQueuePropMinRate) qp; rate = min.getRate(); break; case OFQueuePropertiesSerializerVer13.MAX_RATE_VAL: /* max rate */ OFQueuePropMaxRate max = (OFQueuePropMaxRate) qp; rate = max.getRate(); break; } } } } catch (InterruptedException | ExecutionException | TimeoutException e) { /* catch e.g. timeout */ e.printStackTrace(); } |
...