blob: b967fe9154bf64b7a0ae6cadc9d097caa07f2553 [file] [log] [blame]
Thomas Vachuska781d18b2014-10-27 10:31:25 -07001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
tom9c94c5b2014-09-17 13:14:42 -070019package org.onlab.onos.openflow.controller;
tom7ef8ff92014-09-17 13:08:06 -070020
21import java.util.List;
22
23import org.projectfloodlight.openflow.protocol.OFFactory;
24import org.projectfloodlight.openflow.protocol.OFMessage;
25import org.projectfloodlight.openflow.protocol.OFPortDesc;
26
27/**
28 * Represents to provider facing side of a switch.
29 */
30public interface OpenFlowSwitch {
31
32 /**
33 * Writes the message to the driver.
34 *
35 * @param msg the message to write
36 */
37 public void sendMsg(OFMessage msg);
38
39 /**
40 * Writes to the OFMessage list to the driver.
41 *
42 * @param msgs the messages to be written
43 */
44 public void sendMsg(List<OFMessage> msgs);
45
46 /**
47 * Handle a message from the switch.
48 * @param fromSwitch the message to handle
49 */
50 public void handleMessage(OFMessage fromSwitch);
51
52 /**
53 * Sets the role for this switch.
54 * @param role the role to set.
55 */
56 public void setRole(RoleState role);
57
58 /**
59 * Fetch the role for this switch.
60 * @return the role.
61 */
62 public RoleState getRole();
63
64 /**
65 * Fetches the ports of this switch.
66 * @return unmodifiable list of the ports.
67 */
68 public List<OFPortDesc> getPorts();
69
70 /**
71 * Provides the factory for this OF version.
72 * @return OF version specific factory.
73 */
74 public OFFactory factory();
75
76 /**
77 * Gets a string version of the ID for this switch.
78 *
79 * @return string version of the ID
80 */
81 public String getStringId();
82
83 /**
84 * Gets the datapathId of the switch.
85 *
86 * @return the switch dpid in long format
87 */
88 public long getId();
89
90 /**
91 * fetch the manufacturer description.
92 * @return the description
93 */
94 public String manfacturerDescription();
95
96 /**
97 * fetch the datapath description.
98 * @return the description
99 */
100 public String datapathDescription();
101
102 /**
103 * fetch the hardware description.
104 * @return the description
105 */
106 public String hardwareDescription();
107
108 /**
109 * fetch the software description.
110 * @return the description
111 */
112 public String softwareDescription();
113
114 /**
115 * fetch the serial number.
116 * @return the serial
117 */
118 public String serialNumber();
119
120 /**
121 * Disconnects the switch by closing the TCP connection. Results in a call
122 * to the channel handler's channelDisconnected method for cleanup
123 */
124 public void disconnectSwitch();
125
Ayaka Koshibeab91cc42014-09-25 10:20:52 -0700126 /**
127 * Notifies the controller that role assertion has failed.
128 *
129 * @param role the failed role
130 */
Ayaka Koshibee8708e32014-10-22 13:40:18 -0700131 public void returnRoleAssertFailure(RoleState role);
Praseed Balakrishnana22eadf2014-10-20 14:21:45 -0700132
133 /**
134 * Indicates if this switch is optical.
135 *
136 * @return true if optical
137 */
138 public boolean isOptical();
139
tom7ef8ff92014-09-17 13:08:06 -0700140}