blob: 1677e5e6ca95134e38a0b65008dc727b4a31c4d4 [file] [log] [blame]
Yuta HIGUCHI6ee6b8c2017-05-09 14:44:30 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2017-present Open Networking Foundation
Yuta HIGUCHI6ee6b8c2017-05-09 14:44:30 -07003 *
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 */
16package org.onosproject.openflow.controller;
17
18import java.util.Collections;
19
20import org.projectfloodlight.openflow.protocol.OFMessage;
21
22/**
23 * Represents to OpenFlow session.
24 */
25public interface OpenFlowSession {
26
27 /**
28 * Returns session state.
29 *
30 * @return true if active.
31 */
32 boolean isActive();
33
34 /**
35 * Requests to close this OpenFlow session.
36 */
37 void closeSession();
38
39 /**
40 * Sends messages over this session.
41 * @param msgs to send
42 * @return true is messages were sent
43 */
44 boolean sendMsg(Iterable<OFMessage> msgs);
45
46 /**
47 * Sends message over this session.
48 *
49 * @param msg to send
50 * @return true is messages were sent
51 */
52 default boolean sendMsg(OFMessage msg) {
53 return sendMsg(Collections.singletonList(msg));
54 }
55
56 /**
57 * Returns debug information about this session.
58 *
59 * @return debug information
60 */
61 CharSequence sessionInfo();
62
Anton Chigrin4af4f872019-01-14 17:29:56 +020063 /**
64 * Add classifier to runtime store of classifiers.
65 *
66 * @param classifier the OpenFlow classifier to add
67 */
68 void addClassifier(OpenFlowClassifier classifier);
Yuta HIGUCHI6ee6b8c2017-05-09 14:44:30 -070069
Anton Chigrin4af4f872019-01-14 17:29:56 +020070 /**
71 * Remove classifier from runtime store of classifiers.
72 *
73 * @param classifier the OpenFlow classifier to remove
74 */
75 void removeClassifier(OpenFlowClassifier classifier);
Yuta HIGUCHI6ee6b8c2017-05-09 14:44:30 -070076}