use of org.onosproject.net.packet.DefaultPacketRequest in project onos by opennetworkinglab.
the class PacketRequestCodec method decode.
@Override
public PacketRequest decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
return null;
}
final JsonCodec<TrafficSelector> trafficSelectorCodec = context.codec(TrafficSelector.class);
TrafficSelector trafficSelector = trafficSelectorCodec.decode(get(json, TRAFFIC_SELECTOR), context);
NodeId nodeId = NodeId.nodeId(extractMember(NODE_ID, json));
PacketPriority priority = PacketPriority.valueOf(extractMember(PRIORITY, json));
CoreService coreService = context.getService(CoreService.class);
// TODO check appId (currently hardcoded - should it be read from json node?)
ApplicationId appId = coreService.registerApplication(REST_APP_ID);
DeviceId deviceId = null;
JsonNode node = json.get(DEVICE_ID);
if (node != null) {
deviceId = DeviceId.deviceId(node.asText());
}
return new DefaultPacketRequest(trafficSelector, priority, appId, nodeId, Optional.ofNullable(deviceId));
}
use of org.onosproject.net.packet.DefaultPacketRequest in project onos by opennetworkinglab.
the class PacketManager method cancelPackets.
@Override
public void cancelPackets(TrafficSelector selector, PacketPriority priority, ApplicationId appId) {
checkPermission(PACKET_READ);
checkNotNull(selector, ERROR_NULL_SELECTOR);
checkNotNull(appId, ERROR_NULL_APP_ID);
PacketRequest request = new DefaultPacketRequest(selector, priority, appId, localNodeId, Optional.empty());
store.cancelPackets(request);
}
use of org.onosproject.net.packet.DefaultPacketRequest in project onos by opennetworkinglab.
the class PacketManager method cancelPackets.
@Override
public void cancelPackets(TrafficSelector selector, PacketPriority priority, ApplicationId appId, Optional<DeviceId> deviceId) {
checkPermission(PACKET_READ);
checkNotNull(selector, ERROR_NULL_SELECTOR);
checkNotNull(appId, ERROR_NULL_APP_ID);
checkNotNull(deviceId, ERROR_NULL_DEVICE_ID);
PacketRequest request = new DefaultPacketRequest(selector, priority, appId, localNodeId, deviceId);
store.cancelPackets(request);
}
use of org.onosproject.net.packet.DefaultPacketRequest in project onos by opennetworkinglab.
the class VirtualNetworkPacketManager method requestPackets.
@Override
public void requestPackets(TrafficSelector selector, PacketPriority priority, ApplicationId appId) {
PacketRequest request = new DefaultPacketRequest(selector, priority, appId, localNodeId, Optional.empty());
store.requestPackets(networkId(), request);
}
use of org.onosproject.net.packet.DefaultPacketRequest in project onos by opennetworkinglab.
the class VirtualNetworkPacketManager method cancelPackets.
@Override
public void cancelPackets(TrafficSelector selector, PacketPriority priority, ApplicationId appId) {
PacketRequest request = new DefaultPacketRequest(selector, priority, appId, localNodeId, Optional.empty());
store.cancelPackets(networkId(), request);
}
Aggregations