blob: bd902413c0fda277e913ef6bd55eb3cf8df066df [file] [log] [blame]
Thomas Vachuska781d18b2014-10-27 10:31:25 -07001/*
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07002 * Copyright 2014 Open Networking Laboratory
Thomas Vachuska781d18b2014-10-27 10:31:25 -07003 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07004 * 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
Thomas Vachuska781d18b2014-10-27 10:31:25 -07007 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07008 * 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.
Thomas Vachuska781d18b2014-10-27 10:31:25 -070015 */
tom9c94c5b2014-09-17 13:14:42 -070016package org.onlab.onos.openflow.controller;
tom7ef8ff92014-09-17 13:08:06 -070017
18import java.util.List;
19
20import org.projectfloodlight.openflow.protocol.OFFactory;
21import org.projectfloodlight.openflow.protocol.OFMessage;
22import org.projectfloodlight.openflow.protocol.OFPortDesc;
23
24/**
25 * Represents to provider facing side of a switch.
26 */
27public interface OpenFlowSwitch {
28
29 /**
30 * Writes the message to the driver.
31 *
32 * @param msg the message to write
33 */
34 public void sendMsg(OFMessage msg);
35
36 /**
37 * Writes to the OFMessage list to the driver.
38 *
39 * @param msgs the messages to be written
40 */
41 public void sendMsg(List<OFMessage> msgs);
42
43 /**
44 * Handle a message from the switch.
45 * @param fromSwitch the message to handle
46 */
47 public void handleMessage(OFMessage fromSwitch);
48
49 /**
50 * Sets the role for this switch.
51 * @param role the role to set.
52 */
53 public void setRole(RoleState role);
54
55 /**
56 * Fetch the role for this switch.
57 * @return the role.
58 */
59 public RoleState getRole();
60
61 /**
62 * Fetches the ports of this switch.
63 * @return unmodifiable list of the ports.
64 */
65 public List<OFPortDesc> getPorts();
66
67 /**
68 * Provides the factory for this OF version.
69 * @return OF version specific factory.
70 */
71 public OFFactory factory();
72
73 /**
74 * Gets a string version of the ID for this switch.
75 *
76 * @return string version of the ID
77 */
78 public String getStringId();
79
80 /**
81 * Gets the datapathId of the switch.
82 *
83 * @return the switch dpid in long format
84 */
85 public long getId();
86
87 /**
88 * fetch the manufacturer description.
89 * @return the description
90 */
91 public String manfacturerDescription();
92
93 /**
94 * fetch the datapath description.
95 * @return the description
96 */
97 public String datapathDescription();
98
99 /**
100 * fetch the hardware description.
101 * @return the description
102 */
103 public String hardwareDescription();
104
105 /**
106 * fetch the software description.
107 * @return the description
108 */
109 public String softwareDescription();
110
111 /**
112 * fetch the serial number.
113 * @return the serial
114 */
115 public String serialNumber();
116
117 /**
Yuta HIGUCHI69a27352014-10-31 15:48:37 -0700118 * Checks if the switch is still connected.
119 *
120 * @return whether the switch is still connected
121 */
122 public boolean isConnected();
123
124 /**
tom7ef8ff92014-09-17 13:08:06 -0700125 * Disconnects the switch by closing the TCP connection. Results in a call
126 * to the channel handler's channelDisconnected method for cleanup
127 */
128 public void disconnectSwitch();
129
Ayaka Koshibeab91cc42014-09-25 10:20:52 -0700130 /**
Ayaka Koshibe3ef2b0d2014-10-31 13:58:27 -0700131 * Notifies the controller that the device has responded to a set-role request.
Ayaka Koshibeab91cc42014-09-25 10:20:52 -0700132 *
Ayaka Koshibe3ef2b0d2014-10-31 13:58:27 -0700133 * @param requested the role requested by the controller
134 * @param response the role set at the device
Ayaka Koshibeab91cc42014-09-25 10:20:52 -0700135 */
Yuta HIGUCHI5c947272014-11-03 21:39:21 -0800136 public void returnRoleReply(RoleState requested, RoleState response);
Praseed Balakrishnana22eadf2014-10-20 14:21:45 -0700137
138 /**
139 * Indicates if this switch is optical.
140 *
141 * @return true if optical
142 */
143 public boolean isOptical();
144
tom7ef8ff92014-09-17 13:08:06 -0700145}