blob: 7bf225871c12eaab936afc70bb26f7ceb889e77f [file] [log] [blame]
Andrea Campanella378e21a2017-06-07 12:09:59 +02001/*
2 * Copyright 2017-present Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.onosproject.drivers.bmv2;
18
Andrea Campanella378e21a2017-06-07 12:09:59 +020019import org.onosproject.net.driver.AbstractHandlerBehaviour;
Andrea Campanella378e21a2017-06-07 12:09:59 +020020import org.onosproject.net.packet.OutboundPacket;
21import org.onosproject.net.packet.PacketProgrammable;
22
Andrea Campanella378e21a2017-06-07 12:09:59 +020023/**
24 * Packet Programmable behaviour for BMv2 devices.
25 */
26public class Bmv2PacketProgrammable extends AbstractHandlerBehaviour implements PacketProgrammable {
Carmelo Cascone59f57de2017-07-11 19:55:09 -040027
Andrea Campanella378e21a2017-06-07 12:09:59 +020028 @Override
29 public void emit(OutboundPacket packet) {
Carmelo Cascone59f57de2017-07-11 19:55:09 -040030 // TODO: implement using P4runtime client.
31 // DriverHandler handler = handler();
32 // GrpcController controller = handler.get(GrpcController.class);
33 // DeviceId deviceId = handler.data().deviceId();
34 // GrpcChannelId channelId = GrpcChannelId.of(deviceId, "bmv2");
35 // GrpcServiceId serviceId = GrpcServiceId.of(channelId, "p4runtime");
36 // GrpcStreamObserverId observerId = GrpcStreamObserverId.of(serviceId,
37 // this.getClass().getSimpleName());
38 // Optional<GrpcObserverHandler> manager = controller.getObserverManager(observerId);
39 // if (!manager.isPresent()) {
40 // //this is the first time the behaviour is called
41 // controller.addObserver(observerId, new Bmv2PacketInObserverHandler());
42 // }
43 // //other already registered the observer for us.
44 // Optional<StreamObserver> observer = manager.get().requestStreamObserver();
45 // observer.ifPresent(objectStreamObserver -> objectStreamObserver.onNext(packet));
Andrea Campanella378e21a2017-06-07 12:09:59 +020046 }
47}