tom

Moving /of to /openflow

Showing 1000 changed files with 4808 additions and 0 deletions

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<project xmlns="http://maven.apache.org/POM/4.0.0"
3 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
5 + <modelVersion>4.0.0</modelVersion>
6 +
7 + <parent>
8 + <groupId>org.onlab.onos</groupId>
9 + <artifactId>onos-of</artifactId>
10 + <version>1.0.0-SNAPSHOT</version>
11 + <relativePath>../pom.xml</relativePath>
12 + </parent>
13 +
14 + <artifactId>onos-of-api</artifactId>
15 + <packaging>bundle</packaging>
16 +
17 + <description>ONOS OpenFlow controller subsystem API</description>
18 +
19 + <dependencies>
20 + <dependency>
21 + <groupId>org.projectfloodlight</groupId>
22 + <artifactId>openflowj</artifactId>
23 + <version>0.3.8-SNAPSHOT</version>
24 + </dependency>
25 + <dependency>
26 + <groupId>io.netty</groupId>
27 + <artifactId>netty</artifactId>
28 + <version>3.9.0.Final</version>
29 + </dependency>
30 + </dependencies>
31 +
32 + <build>
33 + <plugins>
34 + <plugin>
35 + <groupId>org.apache.maven.plugins</groupId>
36 + <artifactId>maven-shade-plugin</artifactId>
37 + <version>2.3</version>
38 + <configuration>
39 + <artifactSet>
40 + <excludes>
41 + <exclude>io.netty:netty</exclude>
42 + <exclude>com.google.guava:guava</exclude>
43 + <exclude>org.slf4j:slfj-api</exclude>
44 + <exclude>ch.qos.logback:logback-core</exclude>
45 + <exclude>ch.qos.logback:logback-classic</exclude>
46 + <exclude>com.google.code.findbugs:annotations</exclude>
47 + </excludes>
48 + </artifactSet>
49 + </configuration>
50 + <executions>
51 + <execution>
52 + <phase>package</phase>
53 + <goals>
54 + <goal>shade</goal>
55 + </goals>
56 + </execution>
57 + </executions>
58 + </plugin>
59 + <plugin>
60 + <groupId>org.apache.felix</groupId>
61 + <artifactId>maven-bundle-plugin</artifactId>
62 + <configuration>
63 + <instructions>
64 + <Export-Package>
65 + org.onlab.onos.of.*,org.projectfloodlight.openflow.*
66 + </Export-Package>
67 + </instructions>
68 + </configuration>
69 + </plugin>
70 + </plugins>
71 + </build>
72 +
73 +</project>
1 +package org.onlab.onos.of.controller;
2 +
3 +import static org.slf4j.LoggerFactory.getLogger;
4 +
5 +import java.util.Collections;
6 +import java.util.concurrent.atomic.AtomicBoolean;
7 +
8 +import org.onlab.packet.Ethernet;
9 +import org.projectfloodlight.openflow.protocol.OFPacketIn;
10 +import org.projectfloodlight.openflow.protocol.OFPacketOut;
11 +import org.projectfloodlight.openflow.protocol.action.OFAction;
12 +import org.projectfloodlight.openflow.protocol.action.OFActionOutput;
13 +import org.projectfloodlight.openflow.protocol.match.MatchField;
14 +import org.projectfloodlight.openflow.types.OFBufferId;
15 +import org.projectfloodlight.openflow.types.OFPort;
16 +import org.slf4j.Logger;
17 +
18 +public final class DefaultOpenFlowPacketContext implements OpenFlowPacketContext {
19 +
20 + private final Logger log = getLogger(getClass());
21 +
22 + private final AtomicBoolean free = new AtomicBoolean(true);
23 + private final AtomicBoolean isBuilt = new AtomicBoolean(false);
24 + private final OpenFlowSwitch sw;
25 + private final OFPacketIn pktin;
26 + private OFPacketOut pktout = null;
27 +
28 + private DefaultOpenFlowPacketContext(OpenFlowSwitch s, OFPacketIn pkt) {
29 + this.sw = s;
30 + this.pktin = pkt;
31 + }
32 +
33 + @Override
34 + public void send() {
35 + if (block() && isBuilt.get()) {
36 + sw.sendMsg(pktout);
37 + }
38 + }
39 +
40 + @Override
41 + public void build(OFPort outPort) {
42 + if (isBuilt.getAndSet(true)) {
43 + return;
44 + }
45 + OFPacketOut.Builder builder = sw.factory().buildPacketOut();
46 + OFAction act = buildOutput(outPort.getPortNumber());
47 + pktout = builder.setXid(pktin.getXid())
48 + .setInPort(pktin.getInPort())
49 + .setBufferId(pktin.getBufferId())
50 + .setActions(Collections.singletonList(act))
51 + .build();
52 + }
53 +
54 + @Override
55 + public void build(Ethernet ethFrame, OFPort outPort) {
56 + if (isBuilt.getAndSet(true)) {
57 + return;
58 + }
59 + OFPacketOut.Builder builder = sw.factory().buildPacketOut();
60 + OFAction act = buildOutput(outPort.getPortNumber());
61 + pktout = builder.setXid(pktin.getXid())
62 + .setBufferId(OFBufferId.NO_BUFFER)
63 + .setInPort(pktin.getInPort())
64 + .setActions(Collections.singletonList(act))
65 + .setData(ethFrame.serialize())
66 + .build();
67 + }
68 +
69 + @Override
70 + public Ethernet parsed() {
71 + Ethernet eth = new Ethernet();
72 + eth.deserialize(pktin.getData(), 0, pktin.getTotalLen());
73 + return eth;
74 + }
75 +
76 + @Override
77 + public Dpid dpid() {
78 + return new Dpid(sw.getId());
79 + }
80 +
81 + public static OpenFlowPacketContext packetContextFromPacketIn(OpenFlowSwitch s,
82 + OFPacketIn pkt) {
83 + return new DefaultOpenFlowPacketContext(s, pkt);
84 + }
85 +
86 + @Override
87 + public Integer inPort() {
88 + try {
89 + return pktin.getInPort().getPortNumber();
90 + } catch (UnsupportedOperationException e) {
91 + return pktin.getMatch().get(MatchField.IN_PORT).getPortNumber();
92 + }
93 + }
94 +
95 + @Override
96 + public byte[] unparsed() {
97 +
98 + return pktin.getData().clone();
99 +
100 + }
101 +
102 + private OFActionOutput buildOutput(Integer port) {
103 + OFActionOutput act = sw.factory().actions()
104 + .buildOutput()
105 + .setPort(OFPort.of(port))
106 + .build();
107 + return act;
108 + }
109 +
110 + @Override
111 + public boolean block() {
112 + return free.getAndSet(false);
113 + }
114 +
115 + @Override
116 + public boolean isHandled() {
117 + return !free.get();
118 + }
119 +
120 +}
1 +package org.onlab.onos.of.controller;
2 +
3 +import org.projectfloodlight.openflow.util.HexString;
4 +
5 +import java.net.URI;
6 +import java.net.URISyntaxException;
7 +
8 +import static com.google.common.base.Preconditions.checkArgument;
9 +import static org.onlab.util.Tools.fromHex;
10 +import static org.onlab.util.Tools.toHex;
11 +
12 +/**
13 + * The class representing a network switch DPID.
14 + * This class is immutable.
15 + */
16 +public final class Dpid {
17 +
18 + private static final String SCHEME = "of";
19 + private static final long UNKNOWN = 0;
20 + private final long value;
21 +
22 + /**
23 + * Default constructor.
24 + */
25 + public Dpid() {
26 + this.value = Dpid.UNKNOWN;
27 + }
28 +
29 + /**
30 + * Constructor from a long value.
31 + *
32 + * @param value the value to use.
33 + */
34 + public Dpid(long value) {
35 + this.value = value;
36 + }
37 +
38 + /**
39 + * Constructor from a string.
40 + *
41 + * @param value the value to use.
42 + */
43 + public Dpid(String value) {
44 + this.value = HexString.toLong(value);
45 + }
46 +
47 + /**
48 + * Get the value of the DPID.
49 + *
50 + * @return the value of the DPID.
51 + */
52 + public long value() {
53 + return value;
54 + }
55 +
56 + /**
57 + * Convert the DPID value to a ':' separated hexadecimal string.
58 + *
59 + * @return the DPID value as a ':' separated hexadecimal string.
60 + */
61 + @Override
62 + public String toString() {
63 + return HexString.toHexString(this.value);
64 + }
65 +
66 + @Override
67 + public boolean equals(Object other) {
68 + if (!(other instanceof Dpid)) {
69 + return false;
70 + }
71 +
72 + Dpid otherDpid = (Dpid) other;
73 +
74 + return value == otherDpid.value;
75 + }
76 +
77 + @Override
78 + public int hashCode() {
79 + int hash = 17;
80 + hash += 31 * hash + (int) (value ^ value >>> 32);
81 + return hash;
82 + }
83 +
84 + /**
85 + * Returns DPID created from the given device URI.
86 + *
87 + * @param uri device URI
88 + * @return dpid
89 + */
90 + public static Dpid dpid(URI uri) {
91 + checkArgument(uri.getScheme().equals(SCHEME), "Unsupported URI scheme");
92 + return new Dpid(fromHex(uri.getSchemeSpecificPart()));
93 + }
94 +
95 + /**
96 + * Produces device URI from the given DPID.
97 + *
98 + * @param dpid device dpid
99 + * @return device URI
100 + */
101 + public static URI uri(Dpid dpid) {
102 + return uri(dpid.value);
103 + }
104 +
105 + /**
106 + * Produces device URI from the given DPID long.
107 + *
108 + * @param value device dpid as long
109 + * @return device URI
110 + */
111 + public static URI uri(long value) {
112 + try {
113 + return new URI(SCHEME, toHex(value), null);
114 + } catch (URISyntaxException e) {
115 + return null;
116 + }
117 + }
118 +
119 +}
1 +package org.onlab.onos.of.controller;
2 +
3 +import org.projectfloodlight.openflow.protocol.OFMessage;
4 +
5 +/**
6 + * Abstraction of an OpenFlow controller. Serves as a one stop
7 + * shop for obtaining OpenFlow devices and (un)register listeners
8 + * on OpenFlow events
9 + */
10 +public interface OpenFlowController {
11 +
12 + /**
13 + * Returns all switches known to this OF controller.
14 + * @return Iterable of dpid elements
15 + */
16 + public Iterable<OpenFlowSwitch> getSwitches();
17 +
18 + /**
19 + * Returns all master switches known to this OF controller.
20 + * @return Iterable of dpid elements
21 + */
22 + public Iterable<OpenFlowSwitch> getMasterSwitches();
23 +
24 + /**
25 + * Returns all equal switches known to this OF controller.
26 + * @return Iterable of dpid elements
27 + */
28 + public Iterable<OpenFlowSwitch> getEqualSwitches();
29 +
30 +
31 + /**
32 + * Returns the actual switch for the given Dpid.
33 + * @param dpid the switch to fetch
34 + * @return the interface to this switch
35 + */
36 + public OpenFlowSwitch getSwitch(Dpid dpid);
37 +
38 + /**
39 + * Returns the actual master switch for the given Dpid, if one exists.
40 + * @param dpid the switch to fetch
41 + * @return the interface to this switch
42 + */
43 + public OpenFlowSwitch getMasterSwitch(Dpid dpid);
44 +
45 + /**
46 + * Returns the actual equal switch for the given Dpid, if one exists.
47 + * @param dpid the switch to fetch
48 + * @return the interface to this switch
49 + */
50 + public OpenFlowSwitch getEqualSwitch(Dpid dpid);
51 +
52 + /**
53 + * Register a listener for meta events that occur to OF
54 + * devices.
55 + * @param listener the listener to notify
56 + */
57 + public void addListener(OpenFlowSwitchListener listener);
58 +
59 + /**
60 + * Unregister a listener.
61 + *
62 + * @param listener the listener to unregister
63 + */
64 + public void removeListener(OpenFlowSwitchListener listener);
65 +
66 + /**
67 + * Register a listener for packet events.
68 + * @param priority the importance of this listener, lower values are more important
69 + * @param listener the listener to notify
70 + */
71 + public void addPacketListener(int priority, PacketListener listener);
72 +
73 + /**
74 + * Unregister a listener.
75 + *
76 + * @param listener the listener to unregister
77 + */
78 + public void removePacketListener(PacketListener listener);
79 +
80 + /**
81 + * Send a message to a particular switch.
82 + * @param dpid the switch to send to.
83 + * @param msg the message to send
84 + */
85 + public void write(Dpid dpid, OFMessage msg);
86 +
87 + /**
88 + * Process a message and notify the appropriate listeners.
89 + *
90 + * @param dpid the dpid the message arrived on
91 + * @param msg the message to process.
92 + */
93 + public void processPacket(Dpid dpid, OFMessage msg);
94 +
95 + /**
96 + * Sets the role for a given switch.
97 + * @param role the desired role
98 + * @param dpid the switch to set the role for.
99 + */
100 + public void setRole(Dpid dpid, RoleState role);
101 +}
1 +package org.onlab.onos.of.controller;
2 +
3 +import org.onlab.packet.Ethernet;
4 +import org.projectfloodlight.openflow.types.OFPort;
5 +
6 +/**
7 + * A representation of a packet context which allows any provider
8 + * to view the packet in event but may block the response to the
9 + * event if blocked has been called.
10 + */
11 +public interface OpenFlowPacketContext {
12 +
13 + //TODO: may want to support sending packet out other switches than
14 + // the one it came in on.
15 + /**
16 + * Blocks further responses (ie. send() calls) on this
17 + * packet in event.
18 + */
19 + public boolean block();
20 +
21 + /**
22 + * Checks whether the packet has been handled.
23 + * @return true if handled, false otherwise.
24 + */
25 + public boolean isHandled();
26 +
27 + /**
28 + * Provided build has been called send the packet
29 + * out the switch it came in on.
30 + */
31 + public void send();
32 +
33 + /**
34 + * Build the packet out in response to this packet in event.
35 + * @param outPort the out port to send to packet out of.
36 + */
37 + public void build(OFPort outPort);
38 +
39 + /**
40 + * Build the packet out in response to this packet in event.
41 + * @param ethFrame the actual packet to send out.
42 + * @param outPort the out port to send to packet out of.
43 + */
44 + public void build(Ethernet ethFrame, OFPort outPort);
45 +
46 + /**
47 + * Provided a handle onto the parsed payload.
48 + * @return the parsed form of the payload.
49 + */
50 + public Ethernet parsed();
51 +
52 + /**
53 + * Provide an unparsed copy of the data.
54 + * @return the unparsed form of the payload.
55 + */
56 + public byte[] unparsed();
57 +
58 + /**
59 + * Provide the dpid of the switch where the packet in arrived.
60 + * @return the dpid of the switch.
61 + */
62 + public Dpid dpid();
63 +
64 + /**
65 + * Provide the port on which the packet arrived.
66 + * @return the port
67 + */
68 + public Integer inPort();
69 +}
1 +package org.onlab.onos.of.controller;
2 +
3 +import java.util.List;
4 +
5 +import org.projectfloodlight.openflow.protocol.OFFactory;
6 +import org.projectfloodlight.openflow.protocol.OFMessage;
7 +import org.projectfloodlight.openflow.protocol.OFPortDesc;
8 +
9 +/**
10 + * Represents to provider facing side of a switch.
11 + */
12 +public interface OpenFlowSwitch {
13 +
14 + /**
15 + * Writes the message to the driver.
16 + *
17 + * @param msg the message to write
18 + */
19 + public void sendMsg(OFMessage msg);
20 +
21 + /**
22 + * Writes to the OFMessage list to the driver.
23 + *
24 + * @param msgs the messages to be written
25 + */
26 + public void sendMsg(List<OFMessage> msgs);
27 +
28 + /**
29 + * Handle a message from the switch.
30 + * @param fromSwitch the message to handle
31 + */
32 + public void handleMessage(OFMessage fromSwitch);
33 +
34 + /**
35 + * Sets the role for this switch.
36 + * @param role the role to set.
37 + */
38 + public void setRole(RoleState role);
39 +
40 + /**
41 + * Fetch the role for this switch.
42 + * @return the role.
43 + */
44 + public RoleState getRole();
45 +
46 + /**
47 + * Fetches the ports of this switch.
48 + * @return unmodifiable list of the ports.
49 + */
50 + public List<OFPortDesc> getPorts();
51 +
52 + /**
53 + * Provides the factory for this OF version.
54 + * @return OF version specific factory.
55 + */
56 + public OFFactory factory();
57 +
58 + /**
59 + * Gets a string version of the ID for this switch.
60 + *
61 + * @return string version of the ID
62 + */
63 + public String getStringId();
64 +
65 + /**
66 + * Gets the datapathId of the switch.
67 + *
68 + * @return the switch dpid in long format
69 + */
70 + public long getId();
71 +
72 + /**
73 + * fetch the manufacturer description.
74 + * @return the description
75 + */
76 + public String manfacturerDescription();
77 +
78 + /**
79 + * fetch the datapath description.
80 + * @return the description
81 + */
82 + public String datapathDescription();
83 +
84 + /**
85 + * fetch the hardware description.
86 + * @return the description
87 + */
88 + public String hardwareDescription();
89 +
90 + /**
91 + * fetch the software description.
92 + * @return the description
93 + */
94 + public String softwareDescription();
95 +
96 + /**
97 + * fetch the serial number.
98 + * @return the serial
99 + */
100 + public String serialNumber();
101 +
102 + /**
103 + * Disconnects the switch by closing the TCP connection. Results in a call
104 + * to the channel handler's channelDisconnected method for cleanup
105 + */
106 + public void disconnectSwitch();
107 +
108 +}
1 +package org.onlab.onos.of.controller;
2 +
3 +import org.projectfloodlight.openflow.protocol.OFPortStatus;
4 +
5 +/**
6 + * Allows for providers interested in Switch events to be notified.
7 + */
8 +public interface OpenFlowSwitchListener {
9 +
10 + /**
11 + * Notify that the switch was added.
12 + * @param dpid the switch where the event occurred
13 + */
14 + public void switchAdded(Dpid dpid);
15 +
16 + /**
17 + * Notify that the switch was removed.
18 + * @param dpid the switch where the event occurred.
19 + */
20 + public void switchRemoved(Dpid dpid);
21 +
22 + /**
23 + * Notify that a port has changed.
24 + * @param dpid the switch on which the change happened.
25 + * @param status the new state of the port.
26 + */
27 + public void portChanged(Dpid dpid, OFPortStatus status);
28 +}
1 +package org.onlab.onos.of.controller;
2 +
3 +/**
4 + * Notifies providers about Packet in events.
5 + */
6 +public interface PacketListener {
7 +
8 + /**
9 + * Handles the packet.
10 + *
11 + * @param pktCtx the packet context
12 + */
13 + public void handlePacket(OpenFlowPacketContext pktCtx);
14 +}
1 +package org.onlab.onos.of.controller;
2 +
3 +import org.projectfloodlight.openflow.protocol.OFControllerRole;
4 +
5 +/**
6 + * The role of the controller as it pertains to a particular switch.
7 + * Note that this definition of the role enum is different from the
8 + * OF1.3 definition. It is maintained here to be backward compatible to
9 + * earlier versions of the controller code. This enum is translated
10 + * to the OF1.3 enum, before role messages are sent to the switch.
11 + * See sendRoleRequestMessage method in OFSwitchImpl
12 + */
13 +public enum RoleState {
14 + EQUAL(OFControllerRole.ROLE_EQUAL),
15 + MASTER(OFControllerRole.ROLE_MASTER),
16 + SLAVE(OFControllerRole.ROLE_SLAVE);
17 +
18 + private RoleState(OFControllerRole nxRole) {
19 + nxRole.ordinal();
20 + }
21 +
22 +}
23 +
24 +
25 +
1 +/**
2 + * Copyright 2011, Big Switch Networks, Inc.
3 + * Originally created by David Erickson, Stanford University
4 + *
5 + * Licensed under the Apache License, Version 2.0 (the "License"); you may
6 + * not use this file except in compliance with the License. You may obtain
7 + * a copy of the License at
8 + *
9 + * http://www.apache.org/licenses/LICENSE-2.0
10 + *
11 + * Unless required by applicable law or agreed to in writing, software
12 + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 + * License for the specific language governing permissions and limitations
15 + * under the License.
16 + **/
17 +
18 +package org.onlab.onos.of.controller.driver;
19 +
20 +import java.io.IOException;
21 +import java.util.Collections;
22 +import java.util.List;
23 +import java.util.concurrent.atomic.AtomicInteger;
24 +
25 +import org.jboss.netty.channel.Channel;
26 +import org.onlab.onos.of.controller.Dpid;
27 +import org.onlab.onos.of.controller.RoleState;
28 +import org.projectfloodlight.openflow.protocol.OFDescStatsReply;
29 +import org.projectfloodlight.openflow.protocol.OFErrorMsg;
30 +import org.projectfloodlight.openflow.protocol.OFExperimenter;
31 +import org.projectfloodlight.openflow.protocol.OFFactories;
32 +import org.projectfloodlight.openflow.protocol.OFFactory;
33 +import org.projectfloodlight.openflow.protocol.OFFeaturesReply;
34 +import org.projectfloodlight.openflow.protocol.OFMessage;
35 +import org.projectfloodlight.openflow.protocol.OFPortDesc;
36 +import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply;
37 +import org.projectfloodlight.openflow.protocol.OFRoleReply;
38 +import org.projectfloodlight.openflow.protocol.OFVersion;
39 +import org.slf4j.Logger;
40 +import org.slf4j.LoggerFactory;
41 +
42 +/**
43 + * An abstract representation of an OpenFlow switch. Can be extended by others
44 + * to serve as a base for their vendor specific representation of a switch.
45 + */
46 +public abstract class AbstractOpenFlowSwitch implements OpenFlowSwitchDriver {
47 +
48 + private static Logger log =
49 + LoggerFactory.getLogger(AbstractOpenFlowSwitch.class);
50 +
51 + protected Channel channel;
52 +
53 + private boolean connected;
54 + protected boolean startDriverHandshakeCalled = false;
55 + private final Dpid dpid;
56 + private OpenFlowAgent agent;
57 + private final AtomicInteger xidCounter = new AtomicInteger(0);
58 +
59 + private OFVersion ofVersion;
60 +
61 + protected OFPortDescStatsReply ports;
62 +
63 + protected boolean tableFull;
64 +
65 + private RoleHandler roleMan;
66 +
67 + protected RoleState role;
68 +
69 + protected OFFeaturesReply features;
70 + protected OFDescStatsReply desc;
71 +
72 + /**
73 + * Given a dpid build this switch.
74 + * @param dp the dpid
75 + */
76 + protected AbstractOpenFlowSwitch(Dpid dp) {
77 + this.dpid = dp;
78 + }
79 +
80 + public AbstractOpenFlowSwitch(Dpid dpid, OFDescStatsReply desc) {
81 + this.dpid = dpid;
82 + this.desc = desc;
83 + }
84 +
85 + //************************
86 + // Channel related
87 + //************************
88 +
89 + @Override
90 + public final void disconnectSwitch() {
91 + this.channel.close();
92 + }
93 +
94 + @Override
95 + public final void sendMsg(OFMessage m) {
96 + this.write(m);
97 + }
98 +
99 + @Override
100 + public final void sendMsg(List<OFMessage> msgs) {
101 + this.write(msgs);
102 + }
103 +
104 + @Override
105 + public abstract void write(OFMessage msg);
106 +
107 + @Override
108 + public abstract void write(List<OFMessage> msgs);
109 +
110 + @Override
111 + public final boolean isConnected() {
112 + return this.connected;
113 + }
114 +
115 + @Override
116 + public final void setConnected(boolean connected) {
117 + this.connected = connected;
118 + };
119 +
120 + @Override
121 + public final void setChannel(Channel channel) {
122 + this.channel = channel;
123 + };
124 +
125 + //************************
126 + // Switch features related
127 + //************************
128 +
129 + @Override
130 + public final long getId() {
131 + return this.dpid.value();
132 + };
133 +
134 + @Override
135 + public final String getStringId() {
136 + return this.dpid.toString();
137 + }
138 +
139 + @Override
140 + public final void setOFVersion(OFVersion ofV) {
141 + this.ofVersion = ofV;
142 + }
143 +
144 + @Override
145 + public void setTableFull(boolean full) {
146 + this.tableFull = full;
147 + }
148 +
149 + @Override
150 + public void setFeaturesReply(OFFeaturesReply featuresReply) {
151 + this.features = featuresReply;
152 + }
153 +
154 + @Override
155 + public abstract Boolean supportNxRole();
156 +
157 + //************************
158 + // Message handling
159 + //************************
160 + /**
161 + * Handle the message coming from the dataplane.
162 + *
163 + * @param m the actual message
164 + */
165 + @Override
166 + public final void handleMessage(OFMessage m) {
167 + this.agent.processMessage(dpid, m);
168 + }
169 +
170 + @Override
171 + public RoleState getRole() {
172 + return role;
173 + };
174 +
175 + @Override
176 + public final boolean connectSwitch() {
177 + return this.agent.addConnectedSwitch(dpid, this);
178 + }
179 +
180 + @Override
181 + public final boolean activateMasterSwitch() {
182 + return this.agent.addActivatedMasterSwitch(dpid, this);
183 + }
184 +
185 + @Override
186 + public final boolean activateEqualSwitch() {
187 + return this.agent.addActivatedEqualSwitch(dpid, this);
188 + }
189 +
190 + @Override
191 + public final void transitionToEqualSwitch() {
192 + this.agent.transitionToEqualSwitch(dpid);
193 + }
194 +
195 + @Override
196 + public final void transitionToMasterSwitch() {
197 + this.agent.transitionToMasterSwitch(dpid);
198 + }
199 +
200 + @Override
201 + public final void removeConnectedSwitch() {
202 + this.agent.removeConnectedSwitch(dpid);
203 + }
204 +
205 + @Override
206 + public OFFactory factory() {
207 + return OFFactories.getFactory(ofVersion);
208 + }
209 +
210 + @Override
211 + public void setPortDescReply(OFPortDescStatsReply portDescReply) {
212 + this.ports = portDescReply;
213 + }
214 +
215 + @Override
216 + public abstract void startDriverHandshake();
217 +
218 + @Override
219 + public abstract boolean isDriverHandshakeComplete();
220 +
221 + @Override
222 + public abstract void processDriverHandshakeMessage(OFMessage m);
223 +
224 + @Override
225 + public void setRole(RoleState role) {
226 + try {
227 + log.info("Sending role {} to switch {}", role, getStringId());
228 + if (this.roleMan.sendRoleRequest(role, RoleRecvStatus.MATCHED_SET_ROLE)) {
229 + this.role = role;
230 + }
231 + } catch (IOException e) {
232 + log.error("Unable to write to switch {}.", this.dpid);
233 + }
234 + }
235 +
236 + // Role Handling
237 +
238 + @Override
239 + public void handleRole(OFMessage m) throws SwitchStateException {
240 + RoleReplyInfo rri = roleMan.extractOFRoleReply((OFRoleReply) m);
241 + RoleRecvStatus rrs = roleMan.deliverRoleReply(rri);
242 + if (rrs == RoleRecvStatus.MATCHED_SET_ROLE) {
243 + if (rri.getRole() == RoleState.MASTER) {
244 + this.transitionToMasterSwitch();
245 + } else if (rri.getRole() == RoleState.EQUAL ||
246 + rri.getRole() == RoleState.MASTER) {
247 + this.transitionToEqualSwitch();
248 + }
249 + }
250 + }
251 +
252 + @Override
253 + public void handleNiciraRole(OFMessage m) throws SwitchStateException {
254 + RoleState r = this.roleMan.extractNiciraRoleReply((OFExperimenter) m);
255 + if (r == null) {
256 + // The message wasn't really a Nicira role reply. We just
257 + // dispatch it to the OFMessage listeners in this case.
258 + this.handleMessage(m);
259 + }
260 +
261 + RoleRecvStatus rrs = this.roleMan.deliverRoleReply(
262 + new RoleReplyInfo(r, null, m.getXid()));
263 + if (rrs == RoleRecvStatus.MATCHED_SET_ROLE) {
264 + if (r == RoleState.MASTER) {
265 + this.transitionToMasterSwitch();
266 + } else if (r == RoleState.EQUAL ||
267 + r == RoleState.SLAVE) {
268 + this.transitionToEqualSwitch();
269 + }
270 + }
271 + }
272 +
273 + @Override
274 + public boolean handleRoleError(OFErrorMsg error) {
275 + try {
276 + return RoleRecvStatus.OTHER_EXPECTATION != this.roleMan.deliverError(error);
277 + } catch (SwitchStateException e) {
278 + this.disconnectSwitch();
279 + }
280 + return true;
281 + }
282 +
283 + @Override
284 + public void reassertRole() {
285 + if (this.getRole() == RoleState.MASTER) {
286 + this.setRole(RoleState.MASTER);
287 + }
288 + }
289 +
290 + @Override
291 + public final void setAgent(OpenFlowAgent ag) {
292 + if (this.agent == null) {
293 + this.agent = ag;
294 + }
295 + }
296 +
297 + @Override
298 + public final void setRoleHandler(RoleHandler roleHandler) {
299 + if (this.roleMan == null) {
300 + this.roleMan = roleHandler;
301 + }
302 + }
303 +
304 + @Override
305 + public void setSwitchDescription(OFDescStatsReply d) {
306 + this.desc = d;
307 + }
308 +
309 + @Override
310 + public int getNextTransactionId() {
311 + return this.xidCounter.getAndIncrement();
312 + }
313 +
314 + @Override
315 + public List<OFPortDesc> getPorts() {
316 + return Collections.unmodifiableList(ports.getEntries());
317 + }
318 +
319 + @Override
320 + public String manfacturerDescription() {
321 + return this.desc.getMfrDesc();
322 + }
323 +
324 +
325 + @Override
326 + public String datapathDescription() {
327 + return this.desc.getDpDesc();
328 + }
329 +
330 +
331 + @Override
332 + public String hardwareDescription() {
333 + return this.desc.getHwDesc();
334 + }
335 +
336 + @Override
337 + public String softwareDescription() {
338 + return this.desc.getSwDesc();
339 + }
340 +
341 + @Override
342 + public String serialNumber() {
343 + return this.desc.getSerialNum();
344 + }
345 +
346 +}
1 +package org.onlab.onos.of.controller.driver;
2 +
3 +import org.onlab.onos.of.controller.Dpid;
4 +import org.onlab.onos.of.controller.OpenFlowSwitch;
5 +import org.projectfloodlight.openflow.protocol.OFMessage;
6 +
7 +/**
8 + * Responsible for keeping track of the current set of switches
9 + * connected to the system. As well as whether they are in Master
10 + * role or not.
11 + *
12 + */
13 +public interface OpenFlowAgent {
14 +
15 + /**
16 + * Add a switch that has just connected to the system.
17 + * @param dpid the dpid to add
18 + * @param sw the actual switch object.
19 + * @return true if added, false otherwise.
20 + */
21 + public boolean addConnectedSwitch(Dpid dpid, OpenFlowSwitch sw);
22 +
23 + /**
24 + * Checks if the activation for this switch is valid.
25 + * @param dpid the dpid to check
26 + * @return true if valid, false otherwise
27 + */
28 + public boolean validActivation(Dpid dpid);
29 +
30 + /**
31 + * Called when a switch is activated, with this controller's role as MASTER.
32 + * @param dpid the dpid to add.
33 + * @param sw the actual switch
34 + * @return true if added, false otherwise.
35 + */
36 + public boolean addActivatedMasterSwitch(Dpid dpid, OpenFlowSwitch sw);
37 +
38 + /**
39 + * Called when a switch is activated, with this controller's role as EQUAL.
40 + * @param dpid the dpid to add.
41 + * @param sw the actual switch
42 + * @return true if added, false otherwise.
43 + */
44 + public boolean addActivatedEqualSwitch(Dpid dpid, OpenFlowSwitch sw);
45 +
46 + /**
47 + * Called when this controller's role for a switch transitions from equal
48 + * to master. For 1.0 switches, we internally refer to the role 'slave' as
49 + * 'equal' - so this transition is equivalent to 'addActivatedMasterSwitch'.
50 + * @param dpid the dpid to transistion.
51 + */
52 + public void transitionToMasterSwitch(Dpid dpid);
53 +
54 + /**
55 + * Called when this controller's role for a switch transitions to equal.
56 + * For 1.0 switches, we internally refer to the role 'slave' as
57 + * 'equal'.
58 + * @param dpid the dpid to transistion.
59 + */
60 + public void transitionToEqualSwitch(Dpid dpid);
61 +
62 + /**
63 + * Clear all state in controller switch maps for a switch that has
64 + * disconnected from the local controller. Also release control for
65 + * that switch from the global repository. Notify switch listeners.
66 + * @param dpid the dpid to remove.
67 + */
68 + public void removeConnectedSwitch(Dpid dpid);
69 +
70 + /**
71 + * Process a message coming from a switch.
72 + *
73 + * @param dpid the dpid the message came on.
74 + * @param m the message to process
75 + */
76 + public void processMessage(Dpid dpid, OFMessage m);
77 +}
1 +package org.onlab.onos.of.controller.driver;
2 +
3 +import java.util.List;
4 +
5 +import org.jboss.netty.channel.Channel;
6 +import org.onlab.onos.of.controller.OpenFlowSwitch;
7 +import org.projectfloodlight.openflow.protocol.OFDescStatsReply;
8 +import org.projectfloodlight.openflow.protocol.OFErrorMsg;
9 +import org.projectfloodlight.openflow.protocol.OFFeaturesReply;
10 +import org.projectfloodlight.openflow.protocol.OFMessage;
11 +import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply;
12 +import org.projectfloodlight.openflow.protocol.OFVersion;
13 +
14 +/**
15 + * Represents the driver side of an OpenFlow switch.
16 + * This interface should never be exposed to consumers.
17 + *
18 + */
19 +public interface OpenFlowSwitchDriver extends OpenFlowSwitch {
20 +
21 + /**
22 + * Sets the OpenFlow agent to be used. This method
23 + * can only be called once.
24 + * @param agent the agent to set.
25 + */
26 + public void setAgent(OpenFlowAgent agent);
27 +
28 + /**
29 + * Sets the Role handler object.
30 + * This method can only be called once.
31 + * @param roleHandler the roleHandler class
32 + */
33 + public void setRoleHandler(RoleHandler roleHandler);
34 +
35 + /**
36 + * Reasserts this controllers role to the switch.
37 + * Useful in cases where the switch no longer agrees
38 + * that this controller has the role it claims.
39 + */
40 + public void reassertRole();
41 +
42 + /**
43 + * Handle the situation where the role request triggers an error.
44 + * @param error the error to handle.
45 + * @return true if handled, false if not.
46 + */
47 + public boolean handleRoleError(OFErrorMsg error);
48 +
49 + /**
50 + * If this driver know of Nicira style role messages, these should
51 + * be handled here.
52 + * @param m the role message to handle.
53 + * @throws SwitchStateException if the message received was
54 + * not a nicira role or was malformed.
55 + */
56 + public void handleNiciraRole(OFMessage m) throws SwitchStateException;
57 +
58 + /**
59 + * Handle OF 1.x (where x > 0) role messages.
60 + * @param m the role message to handle
61 + * @throws SwitchStateException if the message received was
62 + * not a nicira role or was malformed.
63 + */
64 + public void handleRole(OFMessage m) throws SwitchStateException;
65 +
66 + /**
67 + * Starts the driver specific handshake process.
68 + */
69 + public void startDriverHandshake();
70 +
71 + /**
72 + * Checks whether the driver specific handshake is complete.
73 + * @return true is finished, false if not.
74 + */
75 + public boolean isDriverHandshakeComplete();
76 +
77 + /**
78 + * Process a message during the driver specific handshake.
79 + * @param m the message to process.
80 + */
81 + public void processDriverHandshakeMessage(OFMessage m);
82 +
83 + /**
84 + * Announce to the OpenFlow agent that this switch has connected.
85 + * @return true if successful, false if duplicate switch.
86 + */
87 + public boolean connectSwitch();
88 +
89 + /**
90 + * Activate this MASTER switch-controller relationship in the OF agent.
91 + * @return true is successful, false is switch has not
92 + * connected or is unknown to the system.
93 + */
94 + public boolean activateMasterSwitch();
95 +
96 + /**
97 + * Activate this EQUAL switch-controller relationship in the OF agent.
98 + * @return true is successful, false is switch has not
99 + * connected or is unknown to the system.
100 + */
101 + public boolean activateEqualSwitch();
102 +
103 + /**
104 + * Transition this switch-controller relationship to an EQUAL state.
105 + */
106 + public void transitionToEqualSwitch();
107 +
108 + /**
109 + * Transition this switch-controller relationship to an Master state.
110 + */
111 + public void transitionToMasterSwitch();
112 +
113 + /**
114 + * Remove this switch from the openflow agent.
115 + */
116 + public void removeConnectedSwitch();
117 +
118 + /**
119 + * Sets the ports on this switch.
120 + * @param portDescReply the port set and descriptions
121 + */
122 + public void setPortDescReply(OFPortDescStatsReply portDescReply);
123 +
124 + /**
125 + * Sets the features reply for this switch.
126 + * @param featuresReply the features to set.
127 + */
128 + public void setFeaturesReply(OFFeaturesReply featuresReply);
129 +
130 + /**
131 + * Sets the switch description.
132 + * @param desc the descriptions
133 + */
134 + public void setSwitchDescription(OFDescStatsReply desc);
135 +
136 + /**
137 + * Gets the next transaction id to use.
138 + * @return the xid
139 + */
140 + public int getNextTransactionId();
141 +
142 +
143 + /**
144 + * Does this switch support Nicira Role messages.
145 + * @return true if supports, false otherwise.
146 + */
147 + public Boolean supportNxRole();
148 +
149 + /**
150 + * Sets the OF version for this switch.
151 + * @param ofV the version to set.
152 + */
153 + public void setOFVersion(OFVersion ofV);
154 +
155 + /**
156 + * Sets this switch has having a full flowtable.
157 + * @param full true if full, false otherswise.
158 + */
159 + public void setTableFull(boolean full);
160 +
161 + /**
162 + * Sets the associated Netty channel for this switch.
163 + * @param channel the Netty channel
164 + */
165 + public void setChannel(Channel channel);
166 +
167 + /**
168 + * Sets whether the switch is connected.
169 + *
170 + * @param connected whether the switch is connected
171 + */
172 + public void setConnected(boolean connected);
173 +
174 + /**
175 + * Checks if the switch is still connected.
176 + *
177 + * @return whether the switch is still connected
178 + */
179 + public boolean isConnected();
180 +
181 + /**
182 + * Writes the message to the output stream
183 + * in a driver specific manner.
184 + *
185 + * @param msg the message to write
186 + */
187 + public void write(OFMessage msg);
188 +
189 + /**
190 + * Writes to the OFMessage list to the output stream
191 + * in a driver specific manner.
192 + *
193 + * @param msgs the messages to be written
194 + */
195 + public void write(List<OFMessage> msgs);
196 +
197 +}
1 +package org.onlab.onos.of.controller.driver;
2 +
3 +import org.onlab.onos.of.controller.Dpid;
4 +import org.projectfloodlight.openflow.protocol.OFDescStatsReply;
5 +import org.projectfloodlight.openflow.protocol.OFVersion;
6 +
7 +/**
8 + * Switch factory which returns concrete switch objects for the
9 + * physical openflow switch in use.
10 + *
11 + */
12 +public interface OpenFlowSwitchDriverFactory {
13 +
14 +
15 + /**
16 + * Constructs the real openflow switch representation.
17 + * @param dpid the dpid for this switch.
18 + * @param desc its description.
19 + * @param ofv the OF version in use
20 + * @return the openflow switch representation.
21 + */
22 + public OpenFlowSwitchDriver getOFSwitchImpl(Dpid dpid,
23 + OFDescStatsReply desc, OFVersion ofv);
24 +}
1 +package org.onlab.onos.of.controller.driver;
2 +
3 +import java.io.IOException;
4 +
5 +import org.onlab.onos.of.controller.RoleState;
6 +import org.projectfloodlight.openflow.protocol.OFErrorMsg;
7 +import org.projectfloodlight.openflow.protocol.OFExperimenter;
8 +import org.projectfloodlight.openflow.protocol.OFRoleReply;
9 +
10 +/**
11 + * Role handling.
12 + *
13 + */
14 +public interface RoleHandler {
15 +
16 + /**
17 + * Extract the role from an OFVendor message.
18 + *
19 + * Extract the role from an OFVendor message if the message is a
20 + * Nicira role reply. Otherwise return null.
21 + *
22 + * @param experimenterMsg The vendor message to parse.
23 + * @return The role in the message if the message is a Nicira role
24 + * reply, null otherwise.
25 + * @throws SwitchStateException If the message is a Nicira role reply
26 + * but the numeric role value is unknown.
27 + */
28 + public RoleState extractNiciraRoleReply(OFExperimenter experimenterMsg)
29 + throws SwitchStateException;
30 +
31 + /**
32 + * Send a role request with the given role to the switch and update
33 + * the pending request and timestamp.
34 + * Sends an OFPT_ROLE_REQUEST to an OF1.3 switch, OR
35 + * Sends an NX_ROLE_REQUEST to an OF1.0 switch if configured to support it
36 + * in the IOFSwitch driver. If not supported, this method sends nothing
37 + * and returns 'false'. The caller should take appropriate action.
38 + *
39 + * One other optimization we do here is that for OF1.0 switches with
40 + * Nicira role message support, we force the Role.EQUAL to become
41 + * Role.SLAVE, as there is no defined behavior for the Nicira role OTHER.
42 + * We cannot expect it to behave like SLAVE. We don't have this problem with
43 + * OF1.3 switches, because Role.EQUAL is well defined and we can simulate
44 + * SLAVE behavior by using ASYNC messages.
45 + *
46 + * @param role
47 + * @throws IOException
48 + * @return false if and only if the switch does not support role-request
49 + * messages, according to the switch driver; true otherwise.
50 + */
51 + public boolean sendRoleRequest(RoleState role, RoleRecvStatus exp)
52 + throws IOException;
53 +
54 + /**
55 + * Extract the role information from an OF1.3 Role Reply Message.
56 + * @param rrmsg role reply message
57 + * @return RoleReplyInfo object
58 + * @throws SwitchStateException
59 + */
60 + public RoleReplyInfo extractOFRoleReply(OFRoleReply rrmsg)
61 + throws SwitchStateException;
62 +
63 + /**
64 + * Deliver a received role reply.
65 + *
66 + * Check if a request is pending and if the received reply matches the
67 + * the expected pending reply (we check both role and xid) we set
68 + * the role for the switch/channel.
69 + *
70 + * If a request is pending but doesn't match the reply we ignore it, and
71 + * return
72 + *
73 + * If no request is pending we disconnect with a SwitchStateException
74 + *
75 + * @param rri information about role-reply in format that
76 + * controller can understand.
77 + * @throws SwitchStateException if no request is pending
78 + */
79 + public RoleRecvStatus deliverRoleReply(RoleReplyInfo rri)
80 + throws SwitchStateException;
81 +
82 +
83 + /**
84 + * Called if we receive an error message. If the xid matches the
85 + * pending request we handle it otherwise we ignore it.
86 + *
87 + * Note: since we only keep the last pending request we might get
88 + * error messages for earlier role requests that we won't be able
89 + * to handle
90 + */
91 + public RoleRecvStatus deliverError(OFErrorMsg error)
92 + throws SwitchStateException;
93 +
94 +}
1 +package org.onlab.onos.of.controller.driver;
2 +
3 +/**
4 + * When we remove a pending role request we use this enum to indicate how we
5 + * arrived at the decision. When we send a role request to the switch, we
6 + * also use this enum to indicate what we expect back from the switch, so the
7 + * role changer can match the reply to our expectation.
8 + */
9 +public enum RoleRecvStatus {
10 + /** The switch returned an error indicating that roles are not.
11 + * supported*/
12 + UNSUPPORTED,
13 + /** The request timed out. */
14 + NO_REPLY,
15 + /** The reply was old, there is a newer request pending. */
16 + OLD_REPLY,
17 + /**
18 + * The reply's role matched the role that this controller set in the
19 + * request message - invoked either initially at startup or to reassert
20 + * current role.
21 + */
22 + MATCHED_CURRENT_ROLE,
23 + /**
24 + * The reply's role matched the role that this controller set in the
25 + * request message - this is the result of a callback from the
26 + * global registry, followed by a role request sent to the switch.
27 + */
28 + MATCHED_SET_ROLE,
29 + /**
30 + * The reply's role was a response to the query made by this controller.
31 + */
32 + REPLY_QUERY,
33 + /** We received a role reply message from the switch
34 + * but the expectation was unclear, or there was no expectation.
35 + */
36 + OTHER_EXPECTATION,
37 +}
1 +package org.onlab.onos.of.controller.driver;
2 +
3 +import org.onlab.onos.of.controller.RoleState;
4 +import org.projectfloodlight.openflow.types.U64;
5 +
6 +/**
7 + * Helper class returns role reply information in the format understood
8 + * by the controller.
9 + */
10 +public class RoleReplyInfo {
11 + private final RoleState role;
12 + private final U64 genId;
13 + private final long xid;
14 +
15 + public RoleReplyInfo(RoleState role, U64 genId, long xid) {
16 + this.role = role;
17 + this.genId = genId;
18 + this.xid = xid;
19 + }
20 + public RoleState getRole() { return role; }
21 + public U64 getGenId() { return genId; }
22 + public long getXid() { return xid; }
23 + @Override
24 + public String toString() {
25 + return "[Role:" + role + " GenId:" + genId + " Xid:" + xid + "]";
26 + }
27 +}
1 +package org.onlab.onos.of.controller.driver;
2 +
3 +/**
4 + * Thrown when IOFSwitch.startDriverHandshake() is called more than once.
5 + *
6 + */
7 +public class SwitchDriverSubHandshakeAlreadyStarted extends
8 + SwitchDriverSubHandshakeException {
9 + private static final long serialVersionUID = -5491845708752443501L;
10 +
11 + public SwitchDriverSubHandshakeAlreadyStarted() {
12 + super();
13 + }
14 +}
1 +package org.onlab.onos.of.controller.driver;
2 +
3 +import org.projectfloodlight.openflow.protocol.OFMessage;
4 +
5 +
6 +/**
7 + * Indicates that a message was passed to a switch driver's subhandshake
8 + * handling code but the driver has already completed the sub-handshake.
9 + *
10 + */
11 +public class SwitchDriverSubHandshakeCompleted
12 + extends SwitchDriverSubHandshakeException {
13 + private static final long serialVersionUID = -8817822245846375995L;
14 +
15 + public SwitchDriverSubHandshakeCompleted(OFMessage m) {
16 + super("Sub-Handshake is already complete but received message "
17 + + m.getType());
18 + }
19 +}
1 +package org.onlab.onos.of.controller.driver;
2 +
3 +/**
4 + * Base class for exception thrown by switch driver sub-handshake processing.
5 + *
6 + */
7 +public class SwitchDriverSubHandshakeException extends RuntimeException {
8 + private static final long serialVersionUID = -6257836781419604438L;
9 +
10 + protected SwitchDriverSubHandshakeException() {
11 + super();
12 + }
13 +
14 + protected SwitchDriverSubHandshakeException(String arg0, Throwable arg1) {
15 + super(arg0, arg1);
16 + }
17 +
18 + protected SwitchDriverSubHandshakeException(String arg0) {
19 + super(arg0);
20 + }
21 +
22 + protected SwitchDriverSubHandshakeException(Throwable arg0) {
23 + super(arg0);
24 + }
25 +
26 +}
1 +package org.onlab.onos.of.controller.driver;
2 +
3 +/**
4 + * Thrown when a switch driver's sub-handshake has not been started but an
5 + * operation requiring the sub-handshake has been attempted.
6 + *
7 + */
8 +public class SwitchDriverSubHandshakeNotStarted extends
9 + SwitchDriverSubHandshakeException {
10 + private static final long serialVersionUID = -5491845708752443501L;
11 +
12 + public SwitchDriverSubHandshakeNotStarted() {
13 + super();
14 + }
15 +}
1 +package org.onlab.onos.of.controller.driver;
2 +
3 +/**
4 + * Thrown when a switch driver's sub-handshake state-machine receives an
5 + * unexpected OFMessage and/or is in an invald state.
6 + *
7 + */
8 +public class SwitchDriverSubHandshakeStateException extends
9 + SwitchDriverSubHandshakeException {
10 + private static final long serialVersionUID = -8249926069195147051L;
11 +
12 + public SwitchDriverSubHandshakeStateException(String msg) {
13 + super(msg);
14 + }
15 +}
1 +/**
2 + * Copyright 2011, Big Switch Networks, Inc.
3 + * Originally created by David Erickson, Stanford University
4 + *
5 + * Licensed under the Apache License, Version 2.0 (the "License"); you may
6 + * not use this file except in compliance with the License. You may obtain
7 + * a copy of the License at
8 + *
9 + * http://www.apache.org/licenses/LICENSE-2.0
10 + *
11 + * Unless required by applicable law or agreed to in writing, software
12 + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 + * License for the specific language governing permissions and limitations
15 + * under the License.
16 + **/
17 +
18 +package org.onlab.onos.of.controller.driver;
19 +
20 +/**
21 + * This exception indicates an error or unexpected message during
22 + * message handling. E.g., if an OFMessage is received that is illegal or
23 + * unexpected given the current handshake state.
24 + *
25 + * We don't allow wrapping other exception in a switch state exception. We
26 + * only log the SwitchStateExceptions message so the causing exceptions
27 + * stack trace is generally not available.
28 + *
29 + */
30 +public class SwitchStateException extends Exception {
31 +
32 + private static final long serialVersionUID = 9153954512470002631L;
33 +
34 + public SwitchStateException() {
35 + super();
36 + }
37 +
38 + public SwitchStateException(String arg0, Throwable arg1) {
39 + super(arg0, arg1);
40 + }
41 +
42 + public SwitchStateException(String arg0) {
43 + super(arg0);
44 + }
45 +
46 + public SwitchStateException(Throwable arg0) {
47 + super(arg0);
48 + }
49 +
50 +}
1 +/**
2 + * OpenFlow controller switch driver API.
3 + */
4 +package org.onlab.onos.of.controller.driver;
1 +/**
2 + * OpenFlow controller API.
3 + */
4 +package org.onlab.onos.of.controller;
1 +package org.onlab.onos.of.controller;
2 +
3 +import org.projectfloodlight.openflow.protocol.OFMessage;
4 +
5 +/**
6 + * Test adapter for the OpenFlow controller interface.
7 + */
8 +public class OpenflowControllerAdapter implements OpenFlowController {
9 + @Override
10 + public Iterable<OpenFlowSwitch> getSwitches() {
11 + return null;
12 + }
13 +
14 + @Override
15 + public Iterable<OpenFlowSwitch> getMasterSwitches() {
16 + return null;
17 + }
18 +
19 + @Override
20 + public Iterable<OpenFlowSwitch> getEqualSwitches() {
21 + return null;
22 + }
23 +
24 + @Override
25 + public OpenFlowSwitch getSwitch(Dpid dpid) {
26 + return null;
27 + }
28 +
29 + @Override
30 + public OpenFlowSwitch getMasterSwitch(Dpid dpid) {
31 + return null;
32 + }
33 +
34 + @Override
35 + public OpenFlowSwitch getEqualSwitch(Dpid dpid) {
36 + return null;
37 + }
38 +
39 + @Override
40 + public void addListener(OpenFlowSwitchListener listener) {
41 + }
42 +
43 + @Override
44 + public void removeListener(OpenFlowSwitchListener listener) {
45 + }
46 +
47 + @Override
48 + public void addPacketListener(int priority, PacketListener listener) {
49 + }
50 +
51 + @Override
52 + public void removePacketListener(PacketListener listener) {
53 + }
54 +
55 + @Override
56 + public void write(Dpid dpid, OFMessage msg) {
57 + }
58 +
59 + @Override
60 + public void processPacket(Dpid dpid, OFMessage msg) {
61 + }
62 +
63 + @Override
64 + public void setRole(Dpid dpid, RoleState role) {
65 + }
66 +}
1 +<project xmlns="http://maven.apache.org/POM/4.0.0"
2 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4 + <modelVersion>4.0.0</modelVersion>
5 +
6 + <parent>
7 + <groupId>org.onlab.onos</groupId>
8 + <artifactId>onos-of</artifactId>
9 + <version>1.0.0-SNAPSHOT</version>
10 + <relativePath>../pom.xml</relativePath>
11 + </parent>
12 +
13 + <artifactId>onos-of-ctl</artifactId>
14 + <packaging>bundle</packaging>
15 +
16 + <description>ONOS OpenFlow controller subsystem API</description>
17 +
18 + <properties>
19 + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
20 + <powermock.version>1.5.5</powermock.version>
21 + <restlet.version>2.1.4</restlet.version>
22 + <cobertura-maven-plugin.version>2.6</cobertura-maven-plugin.version>
23 + <!-- Following 2 findbugs version needs to be updated in sync to match the
24 + findbugs version used in findbugs-plugin -->
25 + <findbugs.version>3.0.0</findbugs.version>
26 + <findbugs-plugin.version>3.0.0</findbugs-plugin.version>
27 + <findbugs.effort>Max</findbugs.effort>
28 + <findbugs.excludeFilterFile>${project.basedir}/conf/findbugs/exclude.xml
29 + </findbugs.excludeFilterFile>
30 + <checkstyle-plugin.version>2.12</checkstyle-plugin.version>
31 + <!-- To publish javadoc to github,
32 + uncomment com.github.github site-maven-plugin and
33 + see https://github.com/OPENNETWORKINGLAB/ONOS/pull/425
34 + <github.global.server>github</github.global.server>
35 + -->
36 + <metrics.version>3.0.2</metrics.version>
37 + <maven.surefire.plugin.version>2.16</maven.surefire.plugin.version>
38 + </properties>
39 +
40 + <dependencies>
41 + <dependency>
42 + <groupId>org.onlab.onos</groupId>
43 + <artifactId>onos-of-api</artifactId>
44 + </dependency>
45 + <!-- ONOS's direct dependencies -->
46 + <dependency>
47 + <groupId>org.apache.felix</groupId>
48 + <artifactId>org.apache.felix.scr.annotations</artifactId>
49 + <version>1.9.6</version>
50 + </dependency>
51 + <dependency>
52 + <groupId>ch.qos.logback</groupId>
53 + <artifactId>logback-classic</artifactId>
54 + <version>1.1.2</version>
55 + </dependency>
56 + <dependency>
57 + <groupId>ch.qos.logback</groupId>
58 + <artifactId>logback-core</artifactId>
59 + <version>1.1.2</version>
60 + </dependency>
61 + <dependency>
62 + <groupId>org.slf4j</groupId>
63 + <artifactId>slf4j-api</artifactId>
64 + <version>1.7.5</version>
65 + </dependency>
66 + <dependency>
67 + <!-- findbugs suppression annotation and @GuardedBy, etc. -->
68 + <groupId>com.google.code.findbugs</groupId>
69 + <artifactId>annotations</artifactId>
70 + <version>${findbugs.version}</version>
71 + </dependency>
72 + <dependency>
73 + <groupId>org.projectfloodlight</groupId>
74 + <artifactId>openflowj</artifactId>
75 + <version>0.3.8-SNAPSHOT</version>
76 + </dependency>
77 + <!-- Floodlight's dependencies -->
78 + <dependency>
79 + <!-- dependency to old version of netty? -->
80 + <groupId>io.netty</groupId>
81 + <artifactId>netty</artifactId>
82 + <version>3.9.2.Final</version>
83 + </dependency>
84 + <!-- Dependency for libraries used for testing -->
85 + <dependency>
86 + <groupId>junit</groupId>
87 + <artifactId>junit</artifactId>
88 + <version>4.11</version>
89 + <scope>test</scope>
90 + </dependency>
91 + <dependency>
92 + <groupId>org.easymock</groupId>
93 + <artifactId>easymock</artifactId>
94 + <version>3.2</version>
95 + <scope>test</scope>
96 + </dependency>
97 + <dependency>
98 + <groupId>org.powermock</groupId>
99 + <artifactId>powermock-module-junit4</artifactId>
100 + <version>${powermock.version}</version>
101 + <scope>test</scope>
102 + </dependency>
103 + <dependency>
104 + <groupId>org.powermock</groupId>
105 + <artifactId>powermock-api-easymock</artifactId>
106 + <version>${powermock.version}</version>
107 + <scope>test</scope>
108 + </dependency>
109 + </dependencies>
110 +
111 +
112 + <build>
113 + <plugins>
114 + <plugin>
115 + <groupId>org.apache.felix</groupId>
116 + <artifactId>maven-scr-plugin</artifactId>
117 + </plugin>
118 +
119 + </plugins>
120 + </build>
121 +
122 +</project>
1 +/**
2 + * Copyright 2011, Big Switch Networks, Inc.
3 + * Originally created by David Erickson, Stanford University
4 + *
5 + * Licensed under the Apache License, Version 2.0 (the "License"); you may
6 + * not use this file except in compliance with the License. You may obtain
7 + * a copy of the License at
8 + *
9 + * http://www.apache.org/licenses/LICENSE-2.0
10 + *
11 + * Unless required by applicable law or agreed to in writing, software
12 + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 + * License for the specific language governing permissions and limitations
15 + * under the License.
16 + **/
17 +
18 +package org.onlab.onos.of.controller.impl;
19 +
20 +import java.lang.management.ManagementFactory;
21 +import java.lang.management.RuntimeMXBean;
22 +import java.net.InetSocketAddress;
23 +import java.util.HashMap;
24 +import java.util.Map;
25 +import java.util.concurrent.Executors;
26 +
27 +import org.jboss.netty.bootstrap.ServerBootstrap;
28 +import org.jboss.netty.channel.ChannelPipelineFactory;
29 +import org.jboss.netty.channel.group.ChannelGroup;
30 +import org.jboss.netty.channel.group.DefaultChannelGroup;
31 +import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
32 +import org.onlab.onos.of.controller.Dpid;
33 +import org.onlab.onos.of.controller.driver.OpenFlowAgent;
34 +import org.onlab.onos.of.controller.driver.OpenFlowSwitchDriver;
35 +import org.onlab.onos.of.drivers.impl.DriverManager;
36 +import org.projectfloodlight.openflow.protocol.OFDescStatsReply;
37 +import org.projectfloodlight.openflow.protocol.OFFactories;
38 +import org.projectfloodlight.openflow.protocol.OFFactory;
39 +import org.projectfloodlight.openflow.protocol.OFVersion;
40 +import org.slf4j.Logger;
41 +import org.slf4j.LoggerFactory;
42 +
43 +
44 +/**
45 + * The main controller class. Handles all setup and network listeners
46 + * - Distributed ownership control of switch through IControllerRegistryService
47 + */
48 +public class Controller {
49 +
50 + protected static final Logger log = LoggerFactory.getLogger(Controller.class);
51 + static final String ERROR_DATABASE =
52 + "The controller could not communicate with the system database.";
53 + protected static final OFFactory FACTORY13 = OFFactories.getFactory(OFVersion.OF_13);
54 + protected static final OFFactory FACTORY10 = OFFactories.getFactory(OFVersion.OF_10);
55 +
56 + // The controllerNodeIPsCache maps Controller IDs to their IP address.
57 + // It's only used by handleControllerNodeIPsChanged
58 + protected HashMap<String, String> controllerNodeIPsCache;
59 +
60 + private ChannelGroup cg;
61 +
62 + // Configuration options
63 + protected int openFlowPort = 6633;
64 + protected int workerThreads = 0;
65 +
66 + // Start time of the controller
67 + protected long systemStartTime;
68 +
69 + private OpenFlowAgent agent;
70 +
71 + private NioServerSocketChannelFactory execFactory;
72 +
73 + // Perf. related configuration
74 + protected static final int SEND_BUFFER_SIZE = 4 * 1024 * 1024;
75 +
76 + // ***************
77 + // Getters/Setters
78 + // ***************
79 +
80 + public OFFactory getOFMessageFactory10() {
81 + return FACTORY10;
82 + }
83 +
84 +
85 + public OFFactory getOFMessageFactory13() {
86 + return FACTORY13;
87 + }
88 +
89 +
90 +
91 + public Map<String, String> getControllerNodeIPs() {
92 + // We return a copy of the mapping so we can guarantee that
93 + // the mapping return is the same as one that will be (or was)
94 + // dispatched to IHAListeners
95 + HashMap<String, String> retval = new HashMap<String, String>();
96 + synchronized (controllerNodeIPsCache) {
97 + retval.putAll(controllerNodeIPsCache);
98 + }
99 + return retval;
100 + }
101 +
102 +
103 + public long getSystemStartTime() {
104 + return (this.systemStartTime);
105 + }
106 +
107 + // **************
108 + // Initialization
109 + // **************
110 +
111 + /**
112 + * Tell controller that we're ready to accept switches loop.
113 + */
114 + public void run() {
115 +
116 + try {
117 + final ServerBootstrap bootstrap = createServerBootStrap();
118 +
119 + bootstrap.setOption("reuseAddr", true);
120 + bootstrap.setOption("child.keepAlive", true);
121 + bootstrap.setOption("child.tcpNoDelay", true);
122 + bootstrap.setOption("child.sendBufferSize", Controller.SEND_BUFFER_SIZE);
123 +
124 + ChannelPipelineFactory pfact =
125 + new OpenflowPipelineFactory(this, null);
126 + bootstrap.setPipelineFactory(pfact);
127 + InetSocketAddress sa = new InetSocketAddress(openFlowPort);
128 + cg = new DefaultChannelGroup();
129 + cg.add(bootstrap.bind(sa));
130 +
131 + log.info("Listening for switch connections on {}", sa);
132 + } catch (Exception e) {
133 + throw new RuntimeException(e);
134 + }
135 +
136 + }
137 +
138 + private ServerBootstrap createServerBootStrap() {
139 +
140 + if (workerThreads == 0) {
141 + execFactory = new NioServerSocketChannelFactory(
142 + Executors.newCachedThreadPool(),
143 + Executors.newCachedThreadPool());
144 + return new ServerBootstrap(execFactory);
145 + } else {
146 + execFactory = new NioServerSocketChannelFactory(
147 + Executors.newCachedThreadPool(),
148 + Executors.newCachedThreadPool(), workerThreads);
149 + return new ServerBootstrap(execFactory);
150 + }
151 + }
152 +
153 + public void setConfigParams(Map<String, String> configParams) {
154 + String ofPort = configParams.get("openflowport");
155 + if (ofPort != null) {
156 + this.openFlowPort = Integer.parseInt(ofPort);
157 + }
158 + log.debug("OpenFlow port set to {}", this.openFlowPort);
159 + String threads = configParams.get("workerthreads");
160 + if (threads != null) {
161 + this.workerThreads = Integer.parseInt(threads);
162 + }
163 + log.debug("Number of worker threads set to {}", this.workerThreads);
164 + }
165 +
166 +
167 + /**
168 + * Initialize internal data structures.
169 + */
170 + public void init(Map<String, String> configParams) {
171 + // These data structures are initialized here because other
172 + // module's startUp() might be called before ours
173 + this.controllerNodeIPsCache = new HashMap<String, String>();
174 +
175 + setConfigParams(configParams);
176 + this.systemStartTime = System.currentTimeMillis();
177 +
178 +
179 + }
180 +
181 + // **************
182 + // Utility methods
183 + // **************
184 +
185 + public Map<String, Long> getMemory() {
186 + Map<String, Long> m = new HashMap<String, Long>();
187 + Runtime runtime = Runtime.getRuntime();
188 + m.put("total", runtime.totalMemory());
189 + m.put("free", runtime.freeMemory());
190 + return m;
191 + }
192 +
193 +
194 + public Long getUptime() {
195 + RuntimeMXBean rb = ManagementFactory.getRuntimeMXBean();
196 + return rb.getUptime();
197 + }
198 +
199 + /**
200 + * Forward to the driver-manager to get an IOFSwitch instance.
201 + * @param desc
202 + * @return switch instance
203 + */
204 + protected OpenFlowSwitchDriver getOFSwitchInstance(long dpid,
205 + OFDescStatsReply desc, OFVersion ofv) {
206 + OpenFlowSwitchDriver sw = DriverManager.getSwitch(new Dpid(dpid),
207 + desc, ofv);
208 + sw.setAgent(agent);
209 + sw.setRoleHandler(new RoleManager(sw));
210 + return sw;
211 + }
212 +
213 + public void start(OpenFlowAgent ag) {
214 + log.info("Starting OpenFlow IO");
215 + this.agent = ag;
216 + this.init(new HashMap<String, String>());
217 + this.run();
218 + }
219 +
220 +
221 + public void stop() {
222 + log.info("Stopping OpenFlow IO");
223 + execFactory.shutdown();
224 + cg.close();
225 + }
226 +
227 +}
1 +/**
2 + * Copyright 2011, Big Switch Networks, Inc.
3 + * Originally created by David Erickson, Stanford University
4 + *
5 + * Licensed under the Apache License, Version 2.0 (the "License"); you may
6 + * not use this file except in compliance with the License. You may obtain
7 + * a copy of the License at
8 + *
9 + * http://www.apache.org/licenses/LICENSE-2.0
10 + *
11 + * Unless required by applicable law or agreed to in writing, software
12 + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 + * License for the specific language governing permissions and limitations
15 + * under the License.
16 + **/
17 +
18 +package org.onlab.onos.of.controller.impl;
19 +
20 +/**
21 + * Exception is thrown when the handshake fails to complete.
22 + * before a specified time
23 + *
24 + */
25 +public class HandshakeTimeoutException extends Exception {
26 +
27 + private static final long serialVersionUID = 6859880268940337312L;
28 +
29 +}
1 +/**
2 +* Copyright 2011, Big Switch Networks, Inc.
3 +* Originally created by David Erickson, Stanford University
4 +*
5 +* Licensed under the Apache License, Version 2.0 (the "License"); you may
6 +* not use this file except in compliance with the License. You may obtain
7 +* a copy of the License at
8 +*
9 +* http://www.apache.org/licenses/LICENSE-2.0
10 +*
11 +* Unless required by applicable law or agreed to in writing, software
12 +* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 +* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 +* License for the specific language governing permissions and limitations
15 +* under the License.
16 +**/
17 +
18 +package org.onlab.onos.of.controller.impl;
19 +
20 +import java.util.concurrent.TimeUnit;
21 +
22 +import org.jboss.netty.channel.ChannelHandlerContext;
23 +import org.jboss.netty.channel.ChannelStateEvent;
24 +import org.jboss.netty.channel.Channels;
25 +import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
26 +import org.jboss.netty.util.Timeout;
27 +import org.jboss.netty.util.Timer;
28 +import org.jboss.netty.util.TimerTask;
29 +
30 +/**
31 + * Trigger a timeout if a switch fails to complete handshake soon enough.
32 + */
33 +public class HandshakeTimeoutHandler
34 + extends SimpleChannelUpstreamHandler {
35 + static final HandshakeTimeoutException EXCEPTION =
36 + new HandshakeTimeoutException();
37 +
38 + final OFChannelHandler channelHandler;
39 + final Timer timer;
40 + final long timeoutNanos;
41 + volatile Timeout timeout;
42 +
43 + public HandshakeTimeoutHandler(OFChannelHandler channelHandler,
44 + Timer timer,
45 + long timeoutSeconds) {
46 + super();
47 + this.channelHandler = channelHandler;
48 + this.timer = timer;
49 + this.timeoutNanos = TimeUnit.SECONDS.toNanos(timeoutSeconds);
50 +
51 + }
52 +
53 + @Override
54 + public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e)
55 + throws Exception {
56 + if (timeoutNanos > 0) {
57 + timeout = timer.newTimeout(new HandshakeTimeoutTask(ctx),
58 + timeoutNanos, TimeUnit.NANOSECONDS);
59 + }
60 + ctx.sendUpstream(e);
61 + }
62 +
63 + @Override
64 + public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e)
65 + throws Exception {
66 + if (timeout != null) {
67 + timeout.cancel();
68 + timeout = null;
69 + }
70 + }
71 +
72 + private final class HandshakeTimeoutTask implements TimerTask {
73 +
74 + private final ChannelHandlerContext ctx;
75 +
76 + HandshakeTimeoutTask(ChannelHandlerContext ctx) {
77 + this.ctx = ctx;
78 + }
79 +
80 + @Override
81 + public void run(Timeout t) throws Exception {
82 + if (t.isCancelled()) {
83 + return;
84 + }
85 +
86 + if (!ctx.getChannel().isOpen()) {
87 + return;
88 + }
89 + if (!channelHandler.isHandshakeComplete()) {
90 + Channels.fireExceptionCaught(ctx, EXCEPTION);
91 + }
92 + }
93 + }
94 +}
1 +/**
2 + * Copyright 2011, Big Switch Networks, Inc.
3 + * Originally created by David Erickson, Stanford University
4 + *
5 + * Licensed under the Apache License, Version 2.0 (the "License"); you may
6 + * not use this file except in compliance with the License. You may obtain
7 + * a copy of the License at
8 + *
9 + * http://www.apache.org/licenses/LICENSE-2.0
10 + *
11 + * Unless required by applicable law or agreed to in writing, software
12 + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 + * License for the specific language governing permissions and limitations
15 + * under the License.
16 + **/
17 +
18 +package org.onlab.onos.of.controller.impl;
19 +
20 +
21 +import org.jboss.netty.buffer.ChannelBuffer;
22 +import org.jboss.netty.channel.Channel;
23 +import org.jboss.netty.channel.ChannelHandlerContext;
24 +import org.jboss.netty.handler.codec.frame.FrameDecoder;
25 +import org.projectfloodlight.openflow.protocol.OFFactories;
26 +import org.projectfloodlight.openflow.protocol.OFMessage;
27 +import org.projectfloodlight.openflow.protocol.OFMessageReader;
28 +
29 +/**
30 + * Decode an openflow message from a Channel, for use in a netty pipeline.
31 + */
32 +public class OFMessageDecoder extends FrameDecoder {
33 +
34 + @Override
35 + protected Object decode(ChannelHandlerContext ctx, Channel channel,
36 + ChannelBuffer buffer) throws Exception {
37 + if (!channel.isConnected()) {
38 + // In testing, I see decode being called AFTER decode last.
39 + // This check avoids that from reading corrupted frames
40 + return null;
41 + }
42 +
43 + // Note that a single call to decode results in reading a single
44 + // OFMessage from the channel buffer, which is passed on to, and processed
45 + // by, the controller (in OFChannelHandler).
46 + // This is different from earlier behavior (with the original openflowj),
47 + // where we parsed all the messages in the buffer, before passing on
48 + // a list of the parsed messages to the controller.
49 + // The performance *may or may not* not be as good as before.
50 + OFMessageReader<OFMessage> reader = OFFactories.getGenericReader();
51 + OFMessage message = reader.readFrom(buffer);
52 +
53 + return message;
54 + }
55 +
56 +}
1 +/**
2 + * Copyright 2011, Big Switch Networks, Inc.
3 + * Originally created by David Erickson, Stanford University
4 + *
5 + * Licensed under the Apache License, Version 2.0 (the "License"); you may
6 + * not use this file except in compliance with the License. You may obtain
7 + * a copy of the License at
8 + *
9 + * http://www.apache.org/licenses/LICENSE-2.0
10 + *
11 + * Unless required by applicable law or agreed to in writing, software
12 + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 + * License for the specific language governing permissions and limitations
15 + * under the License.
16 + **/
17 +
18 +package org.onlab.onos.of.controller.impl;
19 +
20 +import java.util.List;
21 +
22 +import org.jboss.netty.buffer.ChannelBuffer;
23 +import org.jboss.netty.buffer.ChannelBuffers;
24 +import org.jboss.netty.channel.Channel;
25 +import org.jboss.netty.channel.ChannelHandlerContext;
26 +import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
27 +import org.projectfloodlight.openflow.protocol.OFMessage;
28 +
29 +
30 +/**
31 + * Encode an openflow message for output into a ChannelBuffer, for use in a
32 + * netty pipeline.
33 + */
34 +public class OFMessageEncoder extends OneToOneEncoder {
35 +
36 + @Override
37 + protected Object encode(ChannelHandlerContext ctx, Channel channel,
38 + Object msg) throws Exception {
39 + if (!(msg instanceof List)) {
40 + return msg;
41 + }
42 +
43 + @SuppressWarnings("unchecked")
44 + List<OFMessage> msglist = (List<OFMessage>) msg;
45 + /* XXX S can't get length of OFMessage in loxigen's openflowj??
46 + int size = 0;
47 + for (OFMessage ofm : msglist) {
48 + size += ofm.getLengthU();
49 + }*/
50 +
51 + ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
52 +
53 + for (OFMessage ofm : msglist) {
54 + ofm.writeTo(buf);
55 + }
56 + return buf;
57 + }
58 +
59 +}
1 +package org.onlab.onos.of.controller.impl;
2 +
3 +import java.util.HashSet;
4 +import java.util.Set;
5 +import java.util.concurrent.ConcurrentHashMap;
6 +import java.util.concurrent.locks.Lock;
7 +import java.util.concurrent.locks.ReentrantLock;
8 +
9 +import org.apache.felix.scr.annotations.Activate;
10 +import org.apache.felix.scr.annotations.Component;
11 +import org.apache.felix.scr.annotations.Deactivate;
12 +import org.apache.felix.scr.annotations.Service;
13 +import org.onlab.onos.of.controller.DefaultOpenFlowPacketContext;
14 +import org.onlab.onos.of.controller.Dpid;
15 +import org.onlab.onos.of.controller.OpenFlowController;
16 +import org.onlab.onos.of.controller.OpenFlowPacketContext;
17 +import org.onlab.onos.of.controller.OpenFlowSwitch;
18 +import org.onlab.onos.of.controller.OpenFlowSwitchListener;
19 +import org.onlab.onos.of.controller.PacketListener;
20 +import org.onlab.onos.of.controller.RoleState;
21 +import org.onlab.onos.of.controller.driver.OpenFlowAgent;
22 +import org.projectfloodlight.openflow.protocol.OFMessage;
23 +import org.projectfloodlight.openflow.protocol.OFPacketIn;
24 +import org.projectfloodlight.openflow.protocol.OFPortStatus;
25 +import org.slf4j.Logger;
26 +import org.slf4j.LoggerFactory;
27 +
28 +import com.google.common.collect.ArrayListMultimap;
29 +import com.google.common.collect.Multimap;
30 +
31 +@Component(immediate = true)
32 +@Service
33 +public class OpenFlowControllerImpl implements OpenFlowController {
34 +
35 + private static final Logger log =
36 + LoggerFactory.getLogger(OpenFlowControllerImpl.class);
37 +
38 + protected ConcurrentHashMap<Dpid, OpenFlowSwitch> connectedSwitches =
39 + new ConcurrentHashMap<Dpid, OpenFlowSwitch>();
40 + protected ConcurrentHashMap<Dpid, OpenFlowSwitch> activeMasterSwitches =
41 + new ConcurrentHashMap<Dpid, OpenFlowSwitch>();
42 + protected ConcurrentHashMap<Dpid, OpenFlowSwitch> activeEqualSwitches =
43 + new ConcurrentHashMap<Dpid, OpenFlowSwitch>();
44 +
45 + protected OpenFlowSwitchAgent agent = new OpenFlowSwitchAgent();
46 + protected Set<OpenFlowSwitchListener> ofEventListener = new HashSet<>();
47 +
48 + protected Multimap<Integer, PacketListener> ofPacketListener =
49 + ArrayListMultimap.create();
50 +
51 +
52 + private final Controller ctrl = new Controller();
53 +
54 + @Activate
55 + public void activate() {
56 + ctrl.start(agent);
57 + }
58 +
59 + @Deactivate
60 + public void deactivate() {
61 + ctrl.stop();
62 + }
63 +
64 + @Override
65 + public Iterable<OpenFlowSwitch> getSwitches() {
66 + return connectedSwitches.values();
67 + }
68 +
69 + @Override
70 + public Iterable<OpenFlowSwitch> getMasterSwitches() {
71 + return activeMasterSwitches.values();
72 + }
73 +
74 + @Override
75 + public Iterable<OpenFlowSwitch> getEqualSwitches() {
76 + return activeEqualSwitches.values();
77 + }
78 +
79 + @Override
80 + public OpenFlowSwitch getSwitch(Dpid dpid) {
81 + return connectedSwitches.get(dpid);
82 + }
83 +
84 + @Override
85 + public OpenFlowSwitch getMasterSwitch(Dpid dpid) {
86 + return activeMasterSwitches.get(dpid);
87 + }
88 +
89 + @Override
90 + public OpenFlowSwitch getEqualSwitch(Dpid dpid) {
91 + return activeEqualSwitches.get(dpid);
92 + }
93 +
94 + @Override
95 + public void addListener(OpenFlowSwitchListener listener) {
96 + if (!ofEventListener.contains(listener)) {
97 + this.ofEventListener.add(listener);
98 + }
99 + }
100 +
101 + @Override
102 + public void removeListener(OpenFlowSwitchListener listener) {
103 + this.ofEventListener.remove(listener);
104 + }
105 +
106 + @Override
107 + public void addPacketListener(int priority, PacketListener listener) {
108 + ofPacketListener.put(priority, listener);
109 + }
110 +
111 + @Override
112 + public void removePacketListener(PacketListener listener) {
113 + ofPacketListener.values().remove(listener);
114 + }
115 +
116 + @Override
117 + public void write(Dpid dpid, OFMessage msg) {
118 + this.getSwitch(dpid).sendMsg(msg);
119 + }
120 +
121 + @Override
122 + public void processPacket(Dpid dpid, OFMessage msg) {
123 + switch (msg.getType()) {
124 + case PORT_STATUS:
125 + for (OpenFlowSwitchListener l : ofEventListener) {
126 + l.portChanged(dpid, (OFPortStatus) msg);
127 + }
128 + break;
129 + case PACKET_IN:
130 + OpenFlowPacketContext pktCtx = DefaultOpenFlowPacketContext
131 + .packetContextFromPacketIn(this.getSwitch(dpid),
132 + (OFPacketIn) msg);
133 + for (PacketListener p : ofPacketListener.values()) {
134 + p.handlePacket(pktCtx);
135 + }
136 + break;
137 + default:
138 + log.warn("Handling message type {} not yet implemented {}",
139 + msg.getType(), msg);
140 + }
141 + }
142 +
143 + @Override
144 + public void setRole(Dpid dpid, RoleState role) {
145 + getSwitch(dpid).setRole(role);
146 + }
147 +
148 + /**
149 + * Implementation of an OpenFlow Agent which is responsible for
150 + * keeping track of connected switches and the state in which
151 + * they are.
152 + */
153 + public class OpenFlowSwitchAgent implements OpenFlowAgent {
154 +
155 + private final Logger log = LoggerFactory.getLogger(OpenFlowSwitchAgent.class);
156 + private final Lock switchLock = new ReentrantLock();
157 +
158 + @Override
159 + public boolean addConnectedSwitch(Dpid dpid, OpenFlowSwitch sw) {
160 + if (connectedSwitches.get(dpid) != null) {
161 + log.error("Trying to add connectedSwitch but found a previous "
162 + + "value for dpid: {}", dpid);
163 + return false;
164 + } else {
165 + log.error("Added switch {}", dpid);
166 + connectedSwitches.put(dpid, sw);
167 + for (OpenFlowSwitchListener l : ofEventListener) {
168 + l.switchAdded(dpid);
169 + }
170 + return true;
171 + }
172 + }
173 +
174 + @Override
175 + public boolean validActivation(Dpid dpid) {
176 + if (connectedSwitches.get(dpid) == null) {
177 + log.error("Trying to activate switch but is not in "
178 + + "connected switches: dpid {}. Aborting ..",
179 + dpid);
180 + return false;
181 + }
182 + if (activeMasterSwitches.get(dpid) != null ||
183 + activeEqualSwitches.get(dpid) != null) {
184 + log.error("Trying to activate switch but it is already "
185 + + "activated: dpid {}. Found in activeMaster: {} "
186 + + "Found in activeEqual: {}. Aborting ..", new Object[]{
187 + dpid,
188 + (activeMasterSwitches.get(dpid) == null) ? 'N' : 'Y',
189 + (activeEqualSwitches.get(dpid) == null) ? 'N' : 'Y'});
190 + return false;
191 + }
192 + return true;
193 + }
194 +
195 +
196 + @Override
197 + public boolean addActivatedMasterSwitch(Dpid dpid, OpenFlowSwitch sw) {
198 + switchLock.lock();
199 + try {
200 + if (!validActivation(dpid)) {
201 + return false;
202 + }
203 + activeMasterSwitches.put(dpid, sw);
204 + return true;
205 + } finally {
206 + switchLock.unlock();
207 + }
208 + }
209 +
210 + @Override
211 + public boolean addActivatedEqualSwitch(Dpid dpid, OpenFlowSwitch sw) {
212 + switchLock.lock();
213 + try {
214 + if (!validActivation(dpid)) {
215 + return false;
216 + }
217 + activeEqualSwitches.put(dpid, sw);
218 + log.info("Added Activated EQUAL Switch {}", dpid);
219 + return true;
220 + } finally {
221 + switchLock.unlock();
222 + }
223 + }
224 +
225 + @Override
226 + public void transitionToMasterSwitch(Dpid dpid) {
227 + switchLock.lock();
228 + try {
229 + if (activeMasterSwitches.containsKey(dpid)) {
230 + return;
231 + }
232 + OpenFlowSwitch sw = activeEqualSwitches.remove(dpid);
233 + if (sw == null) {
234 + sw = getSwitch(dpid);
235 + if (sw == null) {
236 + log.error("Transition to master called on sw {}, but switch "
237 + + "was not found in controller-cache", dpid);
238 + return;
239 + }
240 + }
241 + log.info("Transitioned switch {} to MASTER", dpid);
242 + activeMasterSwitches.put(dpid, sw);
243 + } finally {
244 + switchLock.unlock();
245 + }
246 + }
247 +
248 +
249 + @Override
250 + public void transitionToEqualSwitch(Dpid dpid) {
251 + switchLock.lock();
252 + try {
253 + if (activeEqualSwitches.containsKey(dpid)) {
254 + return;
255 + }
256 + OpenFlowSwitch sw = activeMasterSwitches.remove(dpid);
257 + if (sw == null) {
258 + sw = getSwitch(dpid);
259 + if (sw == null) {
260 + log.error("Transition to equal called on sw {}, but switch "
261 + + "was not found in controller-cache", dpid);
262 + return;
263 + }
264 + }
265 + log.info("Transitioned switch {} to EQUAL", dpid);
266 + activeEqualSwitches.put(dpid, sw);
267 + } finally {
268 + switchLock.unlock();
269 + }
270 +
271 + }
272 +
273 + @Override
274 + public void removeConnectedSwitch(Dpid dpid) {
275 + connectedSwitches.remove(dpid);
276 + OpenFlowSwitch sw = activeMasterSwitches.remove(dpid);
277 + if (sw == null) {
278 + sw = activeEqualSwitches.remove(dpid);
279 + }
280 + for (OpenFlowSwitchListener l : ofEventListener) {
281 + l.switchRemoved(dpid);
282 + }
283 + }
284 +
285 + @Override
286 + public void processMessage(Dpid dpid, OFMessage m) {
287 + processPacket(dpid, m);
288 + }
289 + }
290 +
291 +
292 +}
1 +/**
2 +* Copyright 2011, Big Switch Networks, Inc.
3 +* Originally created by David Erickson, Stanford University
4 +*
5 +* Licensed under the Apache License, Version 2.0 (the "License"); you may
6 +* not use this file except in compliance with the License. You may obtain
7 +* a copy of the License at
8 +*
9 +* http://www.apache.org/licenses/LICENSE-2.0
10 +*
11 +* Unless required by applicable law or agreed to in writing, software
12 +* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 +* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 +* License for the specific language governing permissions and limitations
15 +* under the License.
16 +**/
17 +
18 +package org.onlab.onos.of.controller.impl;
19 +
20 +import java.util.concurrent.ThreadPoolExecutor;
21 +
22 +import org.jboss.netty.channel.ChannelPipeline;
23 +import org.jboss.netty.channel.ChannelPipelineFactory;
24 +import org.jboss.netty.channel.Channels;
25 +import org.jboss.netty.handler.execution.ExecutionHandler;
26 +import org.jboss.netty.handler.timeout.IdleStateHandler;
27 +import org.jboss.netty.handler.timeout.ReadTimeoutHandler;
28 +import org.jboss.netty.util.ExternalResourceReleasable;
29 +import org.jboss.netty.util.HashedWheelTimer;
30 +import org.jboss.netty.util.Timer;
31 +
32 +/**
33 + * Creates a ChannelPipeline for a server-side openflow channel.
34 + */
35 +public class OpenflowPipelineFactory
36 + implements ChannelPipelineFactory, ExternalResourceReleasable {
37 +
38 + protected Controller controller;
39 + protected ThreadPoolExecutor pipelineExecutor;
40 + protected Timer timer;
41 + protected IdleStateHandler idleHandler;
42 + protected ReadTimeoutHandler readTimeoutHandler;
43 +
44 + public OpenflowPipelineFactory(Controller controller,
45 + ThreadPoolExecutor pipelineExecutor) {
46 + super();
47 + this.controller = controller;
48 + this.pipelineExecutor = pipelineExecutor;
49 + this.timer = new HashedWheelTimer();
50 + this.idleHandler = new IdleStateHandler(timer, 20, 25, 0);
51 + this.readTimeoutHandler = new ReadTimeoutHandler(timer, 30);
52 + }
53 +
54 + @Override
55 + public ChannelPipeline getPipeline() throws Exception {
56 + OFChannelHandler handler = new OFChannelHandler(controller);
57 +
58 + ChannelPipeline pipeline = Channels.pipeline();
59 + pipeline.addLast("ofmessagedecoder", new OFMessageDecoder());
60 + pipeline.addLast("ofmessageencoder", new OFMessageEncoder());
61 + pipeline.addLast("idle", idleHandler);
62 + pipeline.addLast("timeout", readTimeoutHandler);
63 + // XXX S ONOS: was 15 increased it to fix Issue #296
64 + pipeline.addLast("handshaketimeout",
65 + new HandshakeTimeoutHandler(handler, timer, 60));
66 + if (pipelineExecutor != null) {
67 + pipeline.addLast("pipelineExecutor",
68 + new ExecutionHandler(pipelineExecutor));
69 + }
70 + pipeline.addLast("handler", handler);
71 + return pipeline;
72 + }
73 +
74 + @Override
75 + public void releaseExternalResources() {
76 + timer.stop();
77 + }
78 +}
1 +/**
2 + * Implementation of the OpenFlow controller IO subsystem.
3 + */
4 +package org.onlab.onos.of.controller.impl;
1 +package org.onlab.onos.of.drivers.impl;
2 +
3 +
4 +
5 +import java.util.Collections;
6 +import java.util.List;
7 +
8 +import org.onlab.onos.of.controller.Dpid;
9 +import org.onlab.onos.of.controller.driver.AbstractOpenFlowSwitch;
10 +import org.onlab.onos.of.controller.driver.OpenFlowSwitchDriver;
11 +import org.onlab.onos.of.controller.driver.OpenFlowSwitchDriverFactory;
12 +import org.projectfloodlight.openflow.protocol.OFDescStatsReply;
13 +import org.projectfloodlight.openflow.protocol.OFMessage;
14 +import org.projectfloodlight.openflow.protocol.OFPortDesc;
15 +import org.projectfloodlight.openflow.protocol.OFVersion;
16 +import org.slf4j.Logger;
17 +import org.slf4j.LoggerFactory;
18 +
19 +/**
20 + * A simple implementation of a driver manager that differentiates between
21 + * connected switches using the OF Description Statistics Reply message.
22 + */
23 +public final class DriverManager implements OpenFlowSwitchDriverFactory {
24 +
25 + private static final Logger log = LoggerFactory.getLogger(DriverManager.class);
26 +
27 + // Whether to use an OF 1.3 configured TTP, or to use an OF 1.0-style
28 + // single table with packet-ins.
29 + private static boolean cpqdUsePipeline13 = false;
30 +
31 + /**
32 + * Return an IOFSwitch object based on switch's manufacturer description
33 + * from OFDescStatsReply.
34 + *
35 + * @param desc DescriptionStatistics reply from the switch
36 + * @return A IOFSwitch instance if the driver found an implementation for
37 + * the given description. Otherwise it returns OFSwitchImplBase
38 + */
39 + @Override
40 + public OpenFlowSwitchDriver getOFSwitchImpl(Dpid dpid,
41 + OFDescStatsReply desc, OFVersion ofv) {
42 + String vendor = desc.getMfrDesc();
43 + String hw = desc.getHwDesc();
44 + if (vendor.startsWith("Stanford University, Ericsson Research and CPqD Research")
45 + &&
46 + hw.startsWith("OpenFlow 1.3 Reference Userspace Switch")) {
47 + return new OFSwitchImplCPqD13(dpid, desc, cpqdUsePipeline13);
48 + }
49 +
50 + if (vendor.startsWith("Nicira") &&
51 + hw.startsWith("Open vSwitch")) {
52 + if (ofv == OFVersion.OF_10) {
53 + return new OFSwitchImplOVS10(dpid, desc);
54 + } else if (ofv == OFVersion.OF_13) {
55 + return new OFSwitchImplOVS13(dpid, desc);
56 + }
57 + }
58 +
59 + log.warn("DriverManager could not identify switch desc: {}. "
60 + + "Assigning AbstractOpenFlowSwich", desc);
61 + return new AbstractOpenFlowSwitch(dpid, desc) {
62 +
63 + @Override
64 + public void write(List<OFMessage> msgs) {
65 + channel.write(msgs);
66 + }
67 +
68 + @Override
69 + public void write(OFMessage msg) {
70 + channel.write(Collections.singletonList(msg));
71 +
72 + }
73 +
74 + @Override
75 + public Boolean supportNxRole() {
76 + return false;
77 + }
78 +
79 + @Override
80 + public void startDriverHandshake() {}
81 +
82 + @Override
83 + public void processDriverHandshakeMessage(OFMessage m) {}
84 +
85 + @Override
86 + public boolean isDriverHandshakeComplete() {
87 + return true;
88 + }
89 +
90 + @Override
91 + public List<OFPortDesc> getPorts() {
92 + if (this.factory().getVersion() == OFVersion.OF_10) {
93 + return Collections.unmodifiableList(features.getPorts());
94 + } else {
95 + return Collections.unmodifiableList(ports.getEntries());
96 + }
97 + }
98 + };
99 + }
100 +
101 + /**
102 + * Private constructor to avoid instantiation.
103 + */
104 + private DriverManager() {
105 + }
106 +
107 + /**
108 + * Sets the configuration parameter which determines how the CPqD switch
109 + * is set up. If usePipeline13 is true, a 1.3 pipeline will be set up on
110 + * the switch. Otherwise, the switch will be set up in a 1.0 style with
111 + * a single table where missed packets are sent to the controller.
112 + *
113 + * @param usePipeline13 whether to use a 1.3 pipeline or not
114 + */
115 + public static void setConfigForCpqd(boolean usePipeline13) {
116 + cpqdUsePipeline13 = usePipeline13;
117 + }
118 +
119 + public static OpenFlowSwitchDriver getSwitch(Dpid dpid,
120 + OFDescStatsReply desc, OFVersion ofv) {
121 + return new DriverManager().getOFSwitchImpl(dpid, desc, ofv);
122 + }
123 +
124 +}
1 +package org.onlab.onos.of.drivers.impl;
2 +
3 +import java.util.Collections;
4 +import java.util.List;
5 +
6 +import org.onlab.onos.of.controller.Dpid;
7 +import org.onlab.onos.of.controller.driver.AbstractOpenFlowSwitch;
8 +import org.projectfloodlight.openflow.protocol.OFDescStatsReply;
9 +import org.projectfloodlight.openflow.protocol.OFMessage;
10 +import org.projectfloodlight.openflow.protocol.OFPortDesc;
11 +
12 +/**
13 + * OFDescriptionStatistics Vendor (Manufacturer Desc.): Nicira, Inc. Make
14 + * (Hardware Desc.) : Open vSwitch Model (Datapath Desc.) : None Software :
15 + * 1.11.90 (or whatever version + build) Serial : None
16 + */
17 +public class OFSwitchImplOVS10 extends AbstractOpenFlowSwitch {
18 +
19 + public OFSwitchImplOVS10(Dpid dpid, OFDescStatsReply desc) {
20 + super(dpid);
21 + setSwitchDescription(desc);
22 +
23 + }
24 +
25 + /* (non-Javadoc)
26 + * @see java.lang.Object#toString()
27 + */
28 + @Override
29 + public String toString() {
30 + return "OFSwitchImplOVS10 [" + ((channel != null)
31 + ? channel.getRemoteAddress() : "?")
32 + + " DPID[" + ((getStringId() != null) ? getStringId() : "?") + "]]";
33 + }
34 +
35 + @Override
36 + public Boolean supportNxRole() {
37 + return true;
38 + }
39 +
40 + @Override
41 + public void startDriverHandshake() {}
42 +
43 + @Override
44 + public boolean isDriverHandshakeComplete() {
45 + return true;
46 + }
47 +
48 + @Override
49 + public void processDriverHandshakeMessage(OFMessage m) {}
50 +
51 + @Override
52 + public void write(OFMessage msg) {
53 + channel.write(Collections.singletonList(msg));
54 + }
55 +
56 + @Override
57 + public void write(List<OFMessage> msgs) {
58 + channel.write(msgs);
59 + }
60 +
61 + @Override
62 + public List<OFPortDesc> getPorts() {
63 + return Collections.unmodifiableList(features.getPorts());
64 + }
65 +
66 +
67 +}
1 +package org.onlab.onos.of.drivers.impl;
2 +
3 +import java.util.ArrayList;
4 +import java.util.Collections;
5 +import java.util.List;
6 +import java.util.concurrent.atomic.AtomicBoolean;
7 +
8 +import org.onlab.onos.of.controller.Dpid;
9 +import org.onlab.onos.of.controller.driver.AbstractOpenFlowSwitch;
10 +import org.onlab.onos.of.controller.driver.SwitchDriverSubHandshakeAlreadyStarted;
11 +import org.onlab.onos.of.controller.driver.SwitchDriverSubHandshakeCompleted;
12 +import org.onlab.onos.of.controller.driver.SwitchDriverSubHandshakeNotStarted;
13 +import org.projectfloodlight.openflow.protocol.OFBarrierRequest;
14 +import org.projectfloodlight.openflow.protocol.OFDescStatsReply;
15 +import org.projectfloodlight.openflow.protocol.OFFactory;
16 +import org.projectfloodlight.openflow.protocol.OFMatchV3;
17 +import org.projectfloodlight.openflow.protocol.OFMessage;
18 +import org.projectfloodlight.openflow.protocol.OFOxmList;
19 +import org.projectfloodlight.openflow.protocol.action.OFAction;
20 +import org.projectfloodlight.openflow.protocol.instruction.OFInstruction;
21 +import org.projectfloodlight.openflow.types.OFBufferId;
22 +import org.projectfloodlight.openflow.types.OFPort;
23 +import org.projectfloodlight.openflow.types.TableId;
24 +import org.slf4j.Logger;
25 +import org.slf4j.LoggerFactory;
26 +
27 +/**
28 + * OFDescriptionStatistics Vendor (Manufacturer Desc.): Nicira, Inc. Make
29 + * (Hardware Desc.) : Open vSwitch Model (Datapath Desc.) : None Software :
30 + * 2.1.0 (or whatever version + build) Serial : None
31 + */
32 +public class OFSwitchImplOVS13 extends AbstractOpenFlowSwitch {
33 +
34 + private static Logger log =
35 + LoggerFactory.getLogger(OFSwitchImplOVS13.class);
36 +
37 + private final AtomicBoolean driverHandshakeComplete;
38 + private OFFactory factory;
39 + private long barrierXidToWaitFor = -1;
40 +
41 + private static final short MIN_PRIORITY = 0x0;
42 + private static final int OFPCML_NO_BUFFER = 0xffff;
43 +
44 + public OFSwitchImplOVS13(Dpid dpid, OFDescStatsReply desc) {
45 + super(dpid);
46 + driverHandshakeComplete = new AtomicBoolean(false);
47 + setSwitchDescription(desc);
48 + }
49 +
50 + @Override
51 + public String toString() {
52 + return "OFSwitchImplOVS13 [" + ((channel != null)
53 + ? channel.getRemoteAddress() : "?")
54 + + " DPID[" + ((getStringId() != null) ? getStringId() : "?") + "]]";
55 + }
56 +
57 + @Override
58 + public void startDriverHandshake() {
59 + log.debug("Starting driver handshake for sw {}", getStringId());
60 + if (startDriverHandshakeCalled) {
61 + throw new SwitchDriverSubHandshakeAlreadyStarted();
62 + }
63 + startDriverHandshakeCalled = true;
64 + factory = factory();
65 + configureSwitch();
66 + }
67 +
68 + @Override
69 + public boolean isDriverHandshakeComplete() {
70 + if (!startDriverHandshakeCalled) {
71 + throw new SwitchDriverSubHandshakeNotStarted();
72 + }
73 + return driverHandshakeComplete.get();
74 + }
75 +
76 + @Override
77 + public void processDriverHandshakeMessage(OFMessage m) {
78 + if (!startDriverHandshakeCalled) {
79 + throw new SwitchDriverSubHandshakeNotStarted();
80 + }
81 + if (driverHandshakeComplete.get()) {
82 + throw new SwitchDriverSubHandshakeCompleted(m);
83 + }
84 +
85 + switch (m.getType()) {
86 + case BARRIER_REPLY:
87 + if (m.getXid() == barrierXidToWaitFor) {
88 + driverHandshakeComplete.set(true);
89 + }
90 + break;
91 +
92 + case ERROR:
93 + log.error("Switch {} Error {}", getStringId(), m);
94 + break;
95 +
96 + case FEATURES_REPLY:
97 + break;
98 + case FLOW_REMOVED:
99 + break;
100 + case GET_ASYNC_REPLY:
101 + // OFAsyncGetReply asrep = (OFAsyncGetReply)m;
102 + // decodeAsyncGetReply(asrep);
103 + break;
104 +
105 + case PACKET_IN:
106 + break;
107 + case PORT_STATUS:
108 + break;
109 + case QUEUE_GET_CONFIG_REPLY:
110 + break;
111 + case ROLE_REPLY:
112 + break;
113 +
114 + case STATS_REPLY:
115 + // processStatsReply((OFStatsReply) m);
116 + break;
117 +
118 + default:
119 + log.debug("Received message {} during switch-driver subhandshake "
120 + + "from switch {} ... Ignoring message", m, getStringId());
121 +
122 + }
123 + }
124 +
125 +
126 + private void configureSwitch() {
127 + populateTableMissEntry(0, true, false, false, 0);
128 + sendBarrier(true);
129 + }
130 +
131 +
132 + private void sendBarrier(boolean finalBarrier) {
133 + int xid = getNextTransactionId();
134 + if (finalBarrier) {
135 + barrierXidToWaitFor = xid;
136 + }
137 + OFBarrierRequest br = factory
138 + .buildBarrierRequest()
139 + .setXid(xid)
140 + .build();
141 + sendMsg(br);
142 + }
143 +
144 + @Override
145 + public Boolean supportNxRole() {
146 + return false;
147 + }
148 +
149 + @Override
150 + public void write(OFMessage msg) {
151 + channel.write(Collections.singletonList(msg));
152 +
153 + }
154 +
155 + @Override
156 + public void write(List<OFMessage> msgs) {
157 + channel.write(msgs);
158 + }
159 +
160 + /**
161 + * By default if none of the booleans in the call are set, then the
162 + * table-miss entry is added with no instructions, which means that pipeline
163 + * execution will stop, and the action set associated with the packet will
164 + * be executed.
165 + *
166 + * @param tableToAdd
167 + * @param toControllerNow as an APPLY_ACTION instruction
168 + * @param toControllerWrite as a WRITE_ACITION instruction
169 + * @param toTable as a GOTO_TABLE instruction
170 + * @param tableToSend
171 + */
172 + @SuppressWarnings("unchecked")
173 + private void populateTableMissEntry(int tableToAdd, boolean toControllerNow,
174 + boolean toControllerWrite,
175 + boolean toTable, int tableToSend) {
176 + OFOxmList oxmList = OFOxmList.EMPTY;
177 + OFMatchV3 match = factory.buildMatchV3()
178 + .setOxmList(oxmList)
179 + .build();
180 + OFAction outc = factory.actions()
181 + .buildOutput()
182 + .setPort(OFPort.CONTROLLER)
183 + .setMaxLen(OFPCML_NO_BUFFER)
184 + .build();
185 + List<OFInstruction> instructions = new ArrayList<OFInstruction>();
186 + if (toControllerNow) {
187 + // table-miss instruction to send to controller immediately
188 + OFInstruction instr = factory.instructions()
189 + .buildApplyActions()
190 + .setActions(Collections.singletonList(outc))
191 + .build();
192 + instructions.add(instr);
193 + }
194 +
195 + if (toControllerWrite) {
196 + // table-miss instruction to write-action to send to controller
197 + // this will be executed whenever the action-set gets executed
198 + OFInstruction instr = factory.instructions()
199 + .buildWriteActions()
200 + .setActions(Collections.singletonList(outc))
201 + .build();
202 + instructions.add(instr);
203 + }
204 +
205 + if (toTable) {
206 + // table-miss instruction to goto-table x
207 + OFInstruction instr = factory.instructions()
208 + .gotoTable(TableId.of(tableToSend));
209 + instructions.add(instr);
210 + }
211 +
212 + if (!toControllerNow && !toControllerWrite && !toTable) {
213 + // table-miss has no instruction - at which point action-set will be
214 + // executed - if there is an action to output/group in the action
215 + // set
216 + // the packet will be sent there, otherwise it will be dropped.
217 + instructions = Collections.EMPTY_LIST;
218 + }
219 +
220 + OFMessage tableMissEntry = factory.buildFlowAdd()
221 + .setTableId(TableId.of(tableToAdd))
222 + .setMatch(match) // match everything
223 + .setInstructions(instructions)
224 + .setPriority(MIN_PRIORITY)
225 + .setBufferId(OFBufferId.NO_BUFFER)
226 + .setIdleTimeout(0)
227 + .setHardTimeout(0)
228 + .setXid(getNextTransactionId())
229 + .build();
230 + sendMsg(tableMissEntry);
231 + }
232 +
233 +}
1 +/**
2 + * OpenFlow base switch drivers implementations.
3 + */
4 +package org.onlab.onos.of.drivers.impl;
1 +<project xmlns="http://maven.apache.org/POM/4.0.0"
2 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4 + <modelVersion>4.0.0</modelVersion>
5 +
6 + <parent>
7 + <groupId>org.onlab.onos</groupId>
8 + <artifactId>onos-of</artifactId>
9 + <version>1.0.0-SNAPSHOT</version>
10 + <relativePath>../pom.xml</relativePath>
11 + </parent>
12 +
13 + <artifactId>onos-of-drivers</artifactId>
14 + <packaging>bundle</packaging>
15 +
16 + <description>ONOS OpenFlow switch drivers &amp; factory</description>
17 +
18 + <dependencies>
19 + <dependency>
20 + <groupId>org.onlab.onos</groupId>
21 + <artifactId>onos-of-api</artifactId>
22 + </dependency>
23 + </dependencies>
24 +
25 + <build>
26 +<!--
27 + <plugins>
28 + <plugin>
29 + <groupId>org.apache.felix</groupId>
30 + <artifactId>maven-scr-plugin</artifactId>
31 + </plugin>
32 + </plugins>
33 +-->
34 + </build>
35 +
36 +</project>
1 +package org.onlab.onos.of.drivers.impl;
2 +
3 +/**
4 + * Created by tom on 9/2/14.
5 + */
6 +public class DeleteMe {
7 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template const.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +
27 +public enum OFActionType {
28 + OUTPUT,
29 + SET_VLAN_VID,
30 + SET_VLAN_PCP,
31 + STRIP_VLAN,
32 + SET_DL_SRC,
33 + SET_DL_DST,
34 + SET_NW_SRC,
35 + SET_NW_DST,
36 + SET_NW_TOS,
37 + SET_TP_SRC,
38 + SET_TP_DST,
39 + ENQUEUE,
40 + EXPERIMENTER,
41 + SET_NW_ECN,
42 + COPY_TTL_OUT,
43 + COPY_TTL_IN,
44 + SET_MPLS_LABEL,
45 + SET_MPLS_TC,
46 + SET_MPLS_TTL,
47 + DEC_MPLS_TTL,
48 + PUSH_VLAN,
49 + POP_VLAN,
50 + PUSH_MPLS,
51 + POP_MPLS,
52 + SET_QUEUE,
53 + GROUP,
54 + SET_NW_TTL,
55 + DEC_NW_TTL,
56 + SET_FIELD,
57 + PUSH_PBB,
58 + POP_PBB;
59 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template of_interface.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +import java.util.Set;
27 +import org.jboss.netty.buffer.ChannelBuffer;
28 +
29 +public interface OFAggregateStatsReply extends OFObject, OFStatsReply {
30 + OFVersion getVersion();
31 + OFType getType();
32 + long getXid();
33 + OFStatsType getStatsType();
34 + Set<OFStatsReplyFlags> getFlags();
35 + U64 getPacketCount();
36 + U64 getByteCount();
37 + long getFlowCount();
38 +
39 + void writeTo(ChannelBuffer channelBuffer);
40 +
41 + Builder createBuilder();
42 + public interface Builder extends OFStatsReply.Builder {
43 + OFAggregateStatsReply build();
44 + OFVersion getVersion();
45 + OFType getType();
46 + long getXid();
47 + Builder setXid(long xid);
48 + OFStatsType getStatsType();
49 + Set<OFStatsReplyFlags> getFlags();
50 + Builder setFlags(Set<OFStatsReplyFlags> flags);
51 + U64 getPacketCount();
52 + Builder setPacketCount(U64 packetCount);
53 + U64 getByteCount();
54 + Builder setByteCount(U64 byteCount);
55 + long getFlowCount();
56 + Builder setFlowCount(long flowCount);
57 + }
58 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template of_interface.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +import java.util.Set;
27 +import org.jboss.netty.buffer.ChannelBuffer;
28 +
29 +public interface OFAggregateStatsRequest extends OFObject, OFStatsRequest<OFAggregateStatsReply>, OFRequest<OFAggregateStatsReply> {
30 + OFVersion getVersion();
31 + OFType getType();
32 + long getXid();
33 + OFStatsType getStatsType();
34 + Set<OFStatsRequestFlags> getFlags();
35 + TableId getTableId();
36 + OFPort getOutPort();
37 + OFGroup getOutGroup() throws UnsupportedOperationException;
38 + U64 getCookie() throws UnsupportedOperationException;
39 + U64 getCookieMask() throws UnsupportedOperationException;
40 + Match getMatch();
41 +
42 + void writeTo(ChannelBuffer channelBuffer);
43 +
44 + Builder createBuilder();
45 + public interface Builder extends OFStatsRequest.Builder<OFAggregateStatsReply> {
46 + OFAggregateStatsRequest build();
47 + OFVersion getVersion();
48 + OFType getType();
49 + long getXid();
50 + Builder setXid(long xid);
51 + OFStatsType getStatsType();
52 + Set<OFStatsRequestFlags> getFlags();
53 + Builder setFlags(Set<OFStatsRequestFlags> flags);
54 + TableId getTableId();
55 + Builder setTableId(TableId tableId);
56 + OFPort getOutPort();
57 + Builder setOutPort(OFPort outPort);
58 + OFGroup getOutGroup() throws UnsupportedOperationException;
59 + Builder setOutGroup(OFGroup outGroup) throws UnsupportedOperationException;
60 + U64 getCookie() throws UnsupportedOperationException;
61 + Builder setCookie(U64 cookie) throws UnsupportedOperationException;
62 + U64 getCookieMask() throws UnsupportedOperationException;
63 + Builder setCookieMask(U64 cookieMask) throws UnsupportedOperationException;
64 + Match getMatch();
65 + Builder setMatch(Match match);
66 + }
67 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template of_interface.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +import org.jboss.netty.buffer.ChannelBuffer;
27 +
28 +public interface OFAsyncGetReply extends OFObject, OFMessage {
29 + OFVersion getVersion();
30 + OFType getType();
31 + long getXid();
32 + long getPacketInMaskEqualMaster();
33 + long getPacketInMaskSlave();
34 + long getPortStatusMaskEqualMaster();
35 + long getPortStatusMaskSlave();
36 + long getFlowRemovedMaskEqualMaster();
37 + long getFlowRemovedMaskSlave();
38 +
39 + void writeTo(ChannelBuffer channelBuffer);
40 +
41 + Builder createBuilder();
42 + public interface Builder extends OFMessage.Builder {
43 + OFAsyncGetReply build();
44 + OFVersion getVersion();
45 + OFType getType();
46 + long getXid();
47 + Builder setXid(long xid);
48 + long getPacketInMaskEqualMaster();
49 + Builder setPacketInMaskEqualMaster(long packetInMaskEqualMaster);
50 + long getPacketInMaskSlave();
51 + Builder setPacketInMaskSlave(long packetInMaskSlave);
52 + long getPortStatusMaskEqualMaster();
53 + Builder setPortStatusMaskEqualMaster(long portStatusMaskEqualMaster);
54 + long getPortStatusMaskSlave();
55 + Builder setPortStatusMaskSlave(long portStatusMaskSlave);
56 + long getFlowRemovedMaskEqualMaster();
57 + Builder setFlowRemovedMaskEqualMaster(long flowRemovedMaskEqualMaster);
58 + long getFlowRemovedMaskSlave();
59 + Builder setFlowRemovedMaskSlave(long flowRemovedMaskSlave);
60 + }
61 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template of_interface.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +import org.jboss.netty.buffer.ChannelBuffer;
27 +
28 +public interface OFAsyncGetRequest extends OFObject, OFMessage, OFRequest<OFAsyncGetReply> {
29 + OFVersion getVersion();
30 + OFType getType();
31 + long getXid();
32 + long getPacketInMaskEqualMaster();
33 + long getPacketInMaskSlave();
34 + long getPortStatusMaskEqualMaster();
35 + long getPortStatusMaskSlave();
36 + long getFlowRemovedMaskEqualMaster();
37 + long getFlowRemovedMaskSlave();
38 +
39 + void writeTo(ChannelBuffer channelBuffer);
40 +
41 + Builder createBuilder();
42 + public interface Builder extends OFMessage.Builder {
43 + OFAsyncGetRequest build();
44 + OFVersion getVersion();
45 + OFType getType();
46 + long getXid();
47 + Builder setXid(long xid);
48 + long getPacketInMaskEqualMaster();
49 + Builder setPacketInMaskEqualMaster(long packetInMaskEqualMaster);
50 + long getPacketInMaskSlave();
51 + Builder setPacketInMaskSlave(long packetInMaskSlave);
52 + long getPortStatusMaskEqualMaster();
53 + Builder setPortStatusMaskEqualMaster(long portStatusMaskEqualMaster);
54 + long getPortStatusMaskSlave();
55 + Builder setPortStatusMaskSlave(long portStatusMaskSlave);
56 + long getFlowRemovedMaskEqualMaster();
57 + Builder setFlowRemovedMaskEqualMaster(long flowRemovedMaskEqualMaster);
58 + long getFlowRemovedMaskSlave();
59 + Builder setFlowRemovedMaskSlave(long flowRemovedMaskSlave);
60 + }
61 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template of_interface.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +import java.util.Set;
27 +import org.jboss.netty.buffer.ChannelBuffer;
28 +
29 +public interface OFAsyncSet extends OFObject, OFMessage {
30 + OFVersion getVersion();
31 + OFType getType();
32 + long getXid();
33 + long getPacketInMaskEqualMaster();
34 + long getPacketInMaskSlave();
35 + long getPortStatusMaskEqualMaster();
36 + long getPortStatusMaskSlave();
37 + long getFlowRemovedMaskEqualMaster();
38 + long getFlowRemovedMaskSlave();
39 +
40 + void writeTo(ChannelBuffer channelBuffer);
41 +
42 + Builder createBuilder();
43 + public interface Builder extends OFMessage.Builder {
44 + OFAsyncSet build();
45 + OFVersion getVersion();
46 + OFType getType();
47 + long getXid();
48 + Builder setXid(long xid);
49 + long getPacketInMaskEqualMaster();
50 + Builder setPacketInMaskEqualMaster(long packetInMaskEqualMaster);
51 + long getPacketInMaskSlave();
52 + Builder setPacketInMaskSlave(long packetInMaskSlave);
53 + long getPortStatusMaskEqualMaster();
54 + Builder setPortStatusMaskEqualMaster(long portStatusMaskEqualMaster);
55 + long getPortStatusMaskSlave();
56 + Builder setPortStatusMaskSlave(long portStatusMaskSlave);
57 + long getFlowRemovedMaskEqualMaster();
58 + Builder setFlowRemovedMaskEqualMaster(long flowRemovedMaskEqualMaster);
59 + long getFlowRemovedMaskSlave();
60 + Builder setFlowRemovedMaskSlave(long flowRemovedMaskSlave);
61 + }
62 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template const.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +
27 +public enum OFBadActionCode {
28 + BAD_TYPE,
29 + BAD_LEN,
30 + BAD_EXPERIMENTER,
31 + BAD_EXPERIMENTER_TYPE,
32 + BAD_OUT_PORT,
33 + BAD_ARGUMENT,
34 + EPERM,
35 + TOO_MANY,
36 + BAD_QUEUE,
37 + BAD_OUT_GROUP,
38 + MATCH_INCONSISTENT,
39 + UNSUPPORTED_ORDER,
40 + BAD_TAG,
41 + BAD_SET_TYPE,
42 + BAD_SET_LEN,
43 + BAD_SET_ARGUMENT;
44 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template const.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +
27 +public enum OFBadInstructionCode {
28 + UNKNOWN_INST,
29 + UNSUP_INST,
30 + BAD_TABLE_ID,
31 + UNSUP_METADATA,
32 + UNSUP_METADATA_MASK,
33 + UNSUP_EXP_INST,
34 + BAD_EXPERIMENTER,
35 + BAD_EXPERIMENTER_TYPE,
36 + BAD_LEN,
37 + EPERM;
38 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template const.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +
27 +public enum OFBadMatchCode {
28 + BAD_TYPE,
29 + BAD_LEN,
30 + BAD_TAG,
31 + BAD_DL_ADDR_MASK,
32 + BAD_NW_ADDR_MASK,
33 + BAD_WILDCARDS,
34 + BAD_FIELD,
35 + BAD_VALUE,
36 + BAD_MASK,
37 + BAD_PREREQ,
38 + DUP_FIELD,
39 + EPERM;
40 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template const.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +
27 +public enum OFBadRequestCode {
28 + BAD_VERSION,
29 + BAD_TYPE,
30 + BAD_STAT,
31 + BAD_EXPERIMENTER,
32 + BAD_SUBTYPE,
33 + EPERM,
34 + BAD_LEN,
35 + BUFFER_EMPTY,
36 + BUFFER_UNKNOWN,
37 + BAD_TABLE_ID,
38 + BAD_EXPERIMENTER_TYPE,
39 + IS_SLAVE,
40 + BAD_PORT,
41 + BAD_PACKET,
42 + MULTIPART_BUFFER_OVERFLOW;
43 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template of_interface.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +import org.jboss.netty.buffer.ChannelBuffer;
27 +
28 +public interface OFBarrierReply extends OFObject, OFMessage {
29 + OFVersion getVersion();
30 + OFType getType();
31 + long getXid();
32 +
33 + void writeTo(ChannelBuffer channelBuffer);
34 +
35 + Builder createBuilder();
36 + public interface Builder extends OFMessage.Builder {
37 + OFBarrierReply build();
38 + OFVersion getVersion();
39 + OFType getType();
40 + long getXid();
41 + Builder setXid(long xid);
42 + }
43 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template of_interface.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +import org.jboss.netty.buffer.ChannelBuffer;
27 +
28 +public interface OFBarrierRequest extends OFObject, OFMessage, OFRequest<OFBarrierReply> {
29 + OFVersion getVersion();
30 + OFType getType();
31 + long getXid();
32 +
33 + void writeTo(ChannelBuffer channelBuffer);
34 +
35 + Builder createBuilder();
36 + public interface Builder extends OFMessage.Builder {
37 + OFBarrierRequest build();
38 + OFVersion getVersion();
39 + OFType getType();
40 + long getXid();
41 + Builder setXid(long xid);
42 + }
43 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template of_interface.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +import org.jboss.netty.buffer.ChannelBuffer;
27 +
28 +public interface OFBsnArpIdle extends OFObject, OFBsnHeader {
29 + OFVersion getVersion();
30 + OFType getType();
31 + long getXid();
32 + long getExperimenter();
33 + long getSubtype();
34 + int getVlanVid();
35 + IPv4Address getIpv4Addr();
36 +
37 + void writeTo(ChannelBuffer channelBuffer);
38 +
39 + Builder createBuilder();
40 + public interface Builder extends OFBsnHeader.Builder {
41 + OFBsnArpIdle build();
42 + OFVersion getVersion();
43 + OFType getType();
44 + long getXid();
45 + Builder setXid(long xid);
46 + long getExperimenter();
47 + long getSubtype();
48 + int getVlanVid();
49 + Builder setVlanVid(int vlanVid);
50 + IPv4Address getIpv4Addr();
51 + Builder setIpv4Addr(IPv4Address ipv4Addr);
52 + }
53 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template of_interface.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +import org.jboss.netty.buffer.ChannelBuffer;
27 +
28 +public interface OFBsnBwClearDataReply extends OFObject, OFBsnHeader {
29 + OFVersion getVersion();
30 + OFType getType();
31 + long getXid();
32 + long getExperimenter();
33 + long getSubtype();
34 + long getStatus();
35 +
36 + void writeTo(ChannelBuffer channelBuffer);
37 +
38 + Builder createBuilder();
39 + public interface Builder extends OFBsnHeader.Builder {
40 + OFBsnBwClearDataReply build();
41 + OFVersion getVersion();
42 + OFType getType();
43 + long getXid();
44 + Builder setXid(long xid);
45 + long getExperimenter();
46 + long getSubtype();
47 + long getStatus();
48 + Builder setStatus(long status);
49 + }
50 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template of_interface.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +import org.jboss.netty.buffer.ChannelBuffer;
27 +
28 +public interface OFBsnBwClearDataRequest extends OFObject, OFBsnHeader, OFRequest<OFBsnBwClearDataReply> {
29 + OFVersion getVersion();
30 + OFType getType();
31 + long getXid();
32 + long getExperimenter();
33 + long getSubtype();
34 +
35 + void writeTo(ChannelBuffer channelBuffer);
36 +
37 + Builder createBuilder();
38 + public interface Builder extends OFBsnHeader.Builder {
39 + OFBsnBwClearDataRequest build();
40 + OFVersion getVersion();
41 + OFType getType();
42 + long getXid();
43 + Builder setXid(long xid);
44 + long getExperimenter();
45 + long getSubtype();
46 + }
47 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template of_interface.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +import org.jboss.netty.buffer.ChannelBuffer;
27 +
28 +public interface OFBsnBwEnableGetReply extends OFObject, OFBsnHeader {
29 + OFVersion getVersion();
30 + OFType getType();
31 + long getXid();
32 + long getExperimenter();
33 + long getSubtype();
34 + long getEnabled();
35 +
36 + void writeTo(ChannelBuffer channelBuffer);
37 +
38 + Builder createBuilder();
39 + public interface Builder extends OFBsnHeader.Builder {
40 + OFBsnBwEnableGetReply build();
41 + OFVersion getVersion();
42 + OFType getType();
43 + long getXid();
44 + Builder setXid(long xid);
45 + long getExperimenter();
46 + long getSubtype();
47 + long getEnabled();
48 + Builder setEnabled(long enabled);
49 + }
50 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template of_interface.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +import org.jboss.netty.buffer.ChannelBuffer;
27 +
28 +public interface OFBsnBwEnableGetRequest extends OFObject, OFBsnHeader, OFRequest<OFBsnBwEnableGetReply> {
29 + OFVersion getVersion();
30 + OFType getType();
31 + long getXid();
32 + long getExperimenter();
33 + long getSubtype();
34 +
35 + void writeTo(ChannelBuffer channelBuffer);
36 +
37 + Builder createBuilder();
38 + public interface Builder extends OFBsnHeader.Builder {
39 + OFBsnBwEnableGetRequest build();
40 + OFVersion getVersion();
41 + OFType getType();
42 + long getXid();
43 + Builder setXid(long xid);
44 + long getExperimenter();
45 + long getSubtype();
46 + }
47 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template of_interface.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +import java.util.Set;
27 +import org.jboss.netty.buffer.ChannelBuffer;
28 +
29 +public interface OFBsnBwEnableSetReply extends OFObject, OFBsnHeader {
30 + OFVersion getVersion();
31 + OFType getType();
32 + long getXid();
33 + long getExperimenter();
34 + long getSubtype();
35 + long getEnable();
36 + long getStatus();
37 +
38 + void writeTo(ChannelBuffer channelBuffer);
39 +
40 + Builder createBuilder();
41 + public interface Builder extends OFBsnHeader.Builder {
42 + OFBsnBwEnableSetReply build();
43 + OFVersion getVersion();
44 + OFType getType();
45 + long getXid();
46 + Builder setXid(long xid);
47 + long getExperimenter();
48 + long getSubtype();
49 + long getEnable();
50 + Builder setEnable(long enable);
51 + long getStatus();
52 + Builder setStatus(long status);
53 + }
54 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template of_interface.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +import java.util.Set;
27 +import org.jboss.netty.buffer.ChannelBuffer;
28 +
29 +public interface OFBsnBwEnableSetRequest extends OFObject, OFBsnHeader, OFRequest<OFBsnBwEnableSetReply> {
30 + OFVersion getVersion();
31 + OFType getType();
32 + long getXid();
33 + long getExperimenter();
34 + long getSubtype();
35 + long getEnable();
36 +
37 + void writeTo(ChannelBuffer channelBuffer);
38 +
39 + Builder createBuilder();
40 + public interface Builder extends OFBsnHeader.Builder {
41 + OFBsnBwEnableSetRequest build();
42 + OFVersion getVersion();
43 + OFType getType();
44 + long getXid();
45 + Builder setXid(long xid);
46 + long getExperimenter();
47 + long getSubtype();
48 + long getEnable();
49 + Builder setEnable(long enable);
50 + }
51 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template of_interface.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +import org.jboss.netty.buffer.ChannelBuffer;
27 +
28 +public interface OFBsnControllerConnection extends OFObject {
29 + OFBsnControllerConnectionState getState();
30 + OFAuxId getAuxiliaryId();
31 + OFControllerRole getRole();
32 + String getUri();
33 + OFVersion getVersion();
34 +
35 + void writeTo(ChannelBuffer channelBuffer);
36 +
37 + Builder createBuilder();
38 + public interface Builder {
39 + OFBsnControllerConnection build();
40 + OFBsnControllerConnectionState getState();
41 + Builder setState(OFBsnControllerConnectionState state);
42 + OFAuxId getAuxiliaryId();
43 + Builder setAuxiliaryId(OFAuxId auxiliaryId);
44 + OFControllerRole getRole();
45 + Builder setRole(OFControllerRole role);
46 + String getUri();
47 + Builder setUri(String uri);
48 + OFVersion getVersion();
49 + }
50 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template const.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +
27 +public enum OFBsnControllerConnectionState {
28 + BSN_CONTROLLER_CONNECTION_STATE_DISCONNECTED,
29 + BSN_CONTROLLER_CONNECTION_STATE_CONNECTED;
30 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template of_interface.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +import java.util.List;
27 +import org.jboss.netty.buffer.ChannelBuffer;
28 +
29 +public interface OFBsnControllerConnectionsReply extends OFObject, OFBsnHeader {
30 + OFVersion getVersion();
31 + OFType getType();
32 + long getXid();
33 + long getExperimenter();
34 + long getSubtype();
35 + List<OFBsnControllerConnection> getConnections();
36 +
37 + void writeTo(ChannelBuffer channelBuffer);
38 +
39 + Builder createBuilder();
40 + public interface Builder extends OFBsnHeader.Builder {
41 + OFBsnControllerConnectionsReply build();
42 + OFVersion getVersion();
43 + OFType getType();
44 + long getXid();
45 + Builder setXid(long xid);
46 + long getExperimenter();
47 + long getSubtype();
48 + List<OFBsnControllerConnection> getConnections();
49 + Builder setConnections(List<OFBsnControllerConnection> connections);
50 + }
51 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template of_interface.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +import org.jboss.netty.buffer.ChannelBuffer;
27 +
28 +public interface OFBsnControllerConnectionsRequest extends OFObject, OFBsnHeader, OFRequest<OFBsnControllerConnectionsReply> {
29 + OFVersion getVersion();
30 + OFType getType();
31 + long getXid();
32 + long getExperimenter();
33 + long getSubtype();
34 +
35 + void writeTo(ChannelBuffer channelBuffer);
36 +
37 + Builder createBuilder();
38 + public interface Builder extends OFBsnHeader.Builder {
39 + OFBsnControllerConnectionsRequest build();
40 + OFVersion getVersion();
41 + OFType getType();
42 + long getXid();
43 + Builder setXid(long xid);
44 + long getExperimenter();
45 + long getSubtype();
46 + }
47 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template const.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +
27 +public enum OFBsnControllerRoleReason {
28 + BSN_CONTROLLER_ROLE_REASON_MASTER_REQUEST,
29 + BSN_CONTROLLER_ROLE_REASON_CONFIG,
30 + BSN_CONTROLLER_ROLE_REASON_EXPERIMENTER;
31 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template of_interface.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +import org.jboss.netty.buffer.ChannelBuffer;
27 +
28 +public interface OFBsnDebugCounterDescStatsEntry extends OFObject {
29 + U64 getCounterId();
30 + String getName();
31 + String getDescription();
32 + OFVersion getVersion();
33 +
34 + void writeTo(ChannelBuffer channelBuffer);
35 +
36 + Builder createBuilder();
37 + public interface Builder {
38 + OFBsnDebugCounterDescStatsEntry build();
39 + U64 getCounterId();
40 + Builder setCounterId(U64 counterId);
41 + String getName();
42 + Builder setName(String name);
43 + String getDescription();
44 + Builder setDescription(String description);
45 + OFVersion getVersion();
46 + }
47 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template of_interface.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +import java.util.Set;
27 +import java.util.List;
28 +import org.jboss.netty.buffer.ChannelBuffer;
29 +
30 +public interface OFBsnDebugCounterDescStatsReply extends OFObject, OFBsnStatsReply {
31 + OFVersion getVersion();
32 + OFType getType();
33 + long getXid();
34 + OFStatsType getStatsType();
35 + Set<OFStatsReplyFlags> getFlags();
36 + long getExperimenter();
37 + long getSubtype();
38 + List<OFBsnDebugCounterDescStatsEntry> getEntries();
39 +
40 + void writeTo(ChannelBuffer channelBuffer);
41 +
42 + Builder createBuilder();
43 + public interface Builder extends OFBsnStatsReply.Builder {
44 + OFBsnDebugCounterDescStatsReply build();
45 + OFVersion getVersion();
46 + OFType getType();
47 + long getXid();
48 + Builder setXid(long xid);
49 + OFStatsType getStatsType();
50 + Set<OFStatsReplyFlags> getFlags();
51 + Builder setFlags(Set<OFStatsReplyFlags> flags);
52 + long getExperimenter();
53 + long getSubtype();
54 + List<OFBsnDebugCounterDescStatsEntry> getEntries();
55 + Builder setEntries(List<OFBsnDebugCounterDescStatsEntry> entries);
56 + }
57 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template of_interface.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +import java.util.Set;
27 +import org.jboss.netty.buffer.ChannelBuffer;
28 +
29 +public interface OFBsnDebugCounterDescStatsRequest extends OFObject, OFBsnStatsRequest<OFBsnDebugCounterDescStatsReply>, OFRequest<OFBsnDebugCounterDescStatsReply> {
30 + OFVersion getVersion();
31 + OFType getType();
32 + long getXid();
33 + OFStatsType getStatsType();
34 + Set<OFStatsRequestFlags> getFlags();
35 + long getExperimenter();
36 + long getSubtype();
37 +
38 + void writeTo(ChannelBuffer channelBuffer);
39 +
40 + Builder createBuilder();
41 + public interface Builder extends OFBsnStatsRequest.Builder<OFBsnDebugCounterDescStatsReply> {
42 + OFBsnDebugCounterDescStatsRequest build();
43 + OFVersion getVersion();
44 + OFType getType();
45 + long getXid();
46 + Builder setXid(long xid);
47 + OFStatsType getStatsType();
48 + Set<OFStatsRequestFlags> getFlags();
49 + Builder setFlags(Set<OFStatsRequestFlags> flags);
50 + long getExperimenter();
51 + long getSubtype();
52 + }
53 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template of_interface.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +import org.jboss.netty.buffer.ChannelBuffer;
27 +
28 +public interface OFBsnDebugCounterStatsEntry extends OFObject {
29 + U64 getCounterId();
30 + U64 getValue();
31 + OFVersion getVersion();
32 +
33 + void writeTo(ChannelBuffer channelBuffer);
34 +
35 + Builder createBuilder();
36 + public interface Builder {
37 + OFBsnDebugCounterStatsEntry build();
38 + U64 getCounterId();
39 + Builder setCounterId(U64 counterId);
40 + U64 getValue();
41 + Builder setValue(U64 value);
42 + OFVersion getVersion();
43 + }
44 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template of_interface.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +import java.util.Set;
27 +import java.util.List;
28 +import org.jboss.netty.buffer.ChannelBuffer;
29 +
30 +public interface OFBsnDebugCounterStatsReply extends OFObject, OFBsnStatsReply {
31 + OFVersion getVersion();
32 + OFType getType();
33 + long getXid();
34 + OFStatsType getStatsType();
35 + Set<OFStatsReplyFlags> getFlags();
36 + long getExperimenter();
37 + long getSubtype();
38 + List<OFBsnDebugCounterStatsEntry> getEntries();
39 +
40 + void writeTo(ChannelBuffer channelBuffer);
41 +
42 + Builder createBuilder();
43 + public interface Builder extends OFBsnStatsReply.Builder {
44 + OFBsnDebugCounterStatsReply build();
45 + OFVersion getVersion();
46 + OFType getType();
47 + long getXid();
48 + Builder setXid(long xid);
49 + OFStatsType getStatsType();
50 + Set<OFStatsReplyFlags> getFlags();
51 + Builder setFlags(Set<OFStatsReplyFlags> flags);
52 + long getExperimenter();
53 + long getSubtype();
54 + List<OFBsnDebugCounterStatsEntry> getEntries();
55 + Builder setEntries(List<OFBsnDebugCounterStatsEntry> entries);
56 + }
57 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template of_interface.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +import java.util.Set;
27 +import org.jboss.netty.buffer.ChannelBuffer;
28 +
29 +public interface OFBsnDebugCounterStatsRequest extends OFObject, OFBsnStatsRequest<OFBsnDebugCounterStatsReply>, OFRequest<OFBsnDebugCounterStatsReply> {
30 + OFVersion getVersion();
31 + OFType getType();
32 + long getXid();
33 + OFStatsType getStatsType();
34 + Set<OFStatsRequestFlags> getFlags();
35 + long getExperimenter();
36 + long getSubtype();
37 +
38 + void writeTo(ChannelBuffer channelBuffer);
39 +
40 + Builder createBuilder();
41 + public interface Builder extends OFBsnStatsRequest.Builder<OFBsnDebugCounterStatsReply> {
42 + OFBsnDebugCounterStatsRequest build();
43 + OFVersion getVersion();
44 + OFType getType();
45 + long getXid();
46 + Builder setXid(long xid);
47 + OFStatsType getStatsType();
48 + Set<OFStatsRequestFlags> getFlags();
49 + Builder setFlags(Set<OFStatsRequestFlags> flags);
50 + long getExperimenter();
51 + long getSubtype();
52 + }
53 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template of_interface.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +import org.jboss.netty.buffer.ChannelBuffer;
27 +
28 +public interface OFBsnFlowChecksumBucketStatsEntry extends OFObject {
29 + U64 getChecksum();
30 + OFVersion getVersion();
31 +
32 + void writeTo(ChannelBuffer channelBuffer);
33 +
34 + Builder createBuilder();
35 + public interface Builder {
36 + OFBsnFlowChecksumBucketStatsEntry build();
37 + U64 getChecksum();
38 + Builder setChecksum(U64 checksum);
39 + OFVersion getVersion();
40 + }
41 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template of_interface.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +import java.util.Set;
27 +import java.util.List;
28 +import org.jboss.netty.buffer.ChannelBuffer;
29 +
30 +public interface OFBsnFlowChecksumBucketStatsReply extends OFObject, OFBsnStatsReply {
31 + OFVersion getVersion();
32 + OFType getType();
33 + long getXid();
34 + OFStatsType getStatsType();
35 + Set<OFStatsReplyFlags> getFlags();
36 + long getExperimenter();
37 + long getSubtype();
38 + List<OFBsnFlowChecksumBucketStatsEntry> getEntries();
39 +
40 + void writeTo(ChannelBuffer channelBuffer);
41 +
42 + Builder createBuilder();
43 + public interface Builder extends OFBsnStatsReply.Builder {
44 + OFBsnFlowChecksumBucketStatsReply build();
45 + OFVersion getVersion();
46 + OFType getType();
47 + long getXid();
48 + Builder setXid(long xid);
49 + OFStatsType getStatsType();
50 + Set<OFStatsReplyFlags> getFlags();
51 + Builder setFlags(Set<OFStatsReplyFlags> flags);
52 + long getExperimenter();
53 + long getSubtype();
54 + List<OFBsnFlowChecksumBucketStatsEntry> getEntries();
55 + Builder setEntries(List<OFBsnFlowChecksumBucketStatsEntry> entries);
56 + }
57 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template of_interface.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +import java.util.Set;
27 +import org.jboss.netty.buffer.ChannelBuffer;
28 +
29 +public interface OFBsnFlowChecksumBucketStatsRequest extends OFObject, OFBsnStatsRequest<OFBsnFlowChecksumBucketStatsReply>, OFRequest<OFBsnFlowChecksumBucketStatsReply> {
30 + OFVersion getVersion();
31 + OFType getType();
32 + long getXid();
33 + OFStatsType getStatsType();
34 + Set<OFStatsRequestFlags> getFlags();
35 + long getExperimenter();
36 + long getSubtype();
37 + TableId getTableId();
38 +
39 + void writeTo(ChannelBuffer channelBuffer);
40 +
41 + Builder createBuilder();
42 + public interface Builder extends OFBsnStatsRequest.Builder<OFBsnFlowChecksumBucketStatsReply> {
43 + OFBsnFlowChecksumBucketStatsRequest build();
44 + OFVersion getVersion();
45 + OFType getType();
46 + long getXid();
47 + Builder setXid(long xid);
48 + OFStatsType getStatsType();
49 + Set<OFStatsRequestFlags> getFlags();
50 + Builder setFlags(Set<OFStatsRequestFlags> flags);
51 + long getExperimenter();
52 + long getSubtype();
53 + TableId getTableId();
54 + Builder setTableId(TableId tableId);
55 + }
56 +}
1 +// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2 +// Copyright (c) 2011, 2012 Open Networking Foundation
3 +// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4 +// This library was generated by the LoxiGen Compiler.
5 +// See the file LICENSE.txt which should have been included in the source distribution
6 +
7 +// Automatically generated by LOXI from template of_interface.java
8 +// Do not modify
9 +
10 +package org.projectfloodlight.openflow.protocol;
11 +
12 +import org.projectfloodlight.openflow.protocol.*;
13 +import org.projectfloodlight.openflow.protocol.action.*;
14 +import org.projectfloodlight.openflow.protocol.actionid.*;
15 +import org.projectfloodlight.openflow.protocol.bsntlv.*;
16 +import org.projectfloodlight.openflow.protocol.errormsg.*;
17 +import org.projectfloodlight.openflow.protocol.meterband.*;
18 +import org.projectfloodlight.openflow.protocol.instruction.*;
19 +import org.projectfloodlight.openflow.protocol.instructionid.*;
20 +import org.projectfloodlight.openflow.protocol.match.*;
21 +import org.projectfloodlight.openflow.protocol.oxm.*;
22 +import org.projectfloodlight.openflow.protocol.queueprop.*;
23 +import org.projectfloodlight.openflow.types.*;
24 +import org.projectfloodlight.openflow.util.*;
25 +import org.projectfloodlight.openflow.exceptions.*;
26 +import org.jboss.netty.buffer.ChannelBuffer;
27 +
28 +public interface OFBsnFlowIdle extends OFObject, OFBsnHeader {
29 + OFVersion getVersion();
30 + OFType getType();
31 + long getXid();
32 + long getExperimenter();
33 + long getSubtype();
34 + U64 getCookie();
35 + int getPriority();
36 + TableId getTableId();
37 + Match getMatch();
38 +
39 + void writeTo(ChannelBuffer channelBuffer);
40 +
41 + Builder createBuilder();
42 + public interface Builder extends OFBsnHeader.Builder {
43 + OFBsnFlowIdle build();
44 + OFVersion getVersion();
45 + OFType getType();
46 + long getXid();
47 + Builder setXid(long xid);
48 + long getExperimenter();
49 + long getSubtype();
50 + U64 getCookie();
51 + Builder setCookie(U64 cookie);
52 + int getPriority();
53 + Builder setPriority(int priority);
54 + TableId getTableId();
55 + Builder setTableId(TableId tableId);
56 + Match getMatch();
57 + Builder setMatch(Match match);
58 + }
59 +}