blob: 17f168f157303f596a5bc3bc20c24616032f5975 [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 /**
118 * Disconnects the switch by closing the TCP connection. Results in a call
119 * to the channel handler's channelDisconnected method for cleanup
120 */
121 public void disconnectSwitch();
122
Ayaka Koshibeab91cc42014-09-25 10:20:52 -0700123 /**
124 * Notifies the controller that role assertion has failed.
125 *
126 * @param role the failed role
127 */
Ayaka Koshibee8708e32014-10-22 13:40:18 -0700128 public void returnRoleAssertFailure(RoleState role);
Praseed Balakrishnana22eadf2014-10-20 14:21:45 -0700129
130 /**
131 * Indicates if this switch is optical.
132 *
133 * @return true if optical
134 */
135 public boolean isOptical();
136
tom7ef8ff92014-09-17 13:08:06 -0700137}