Pankaj Berde | e73452c | 2013-01-03 14:57:07 -0800 | [diff] [blame] | 1 | package net.floodlightcontroller.core; |
| 2 | |
| 3 | import java.util.Collection; |
Pankaj Berde | 8557a46 | 2013-01-07 08:59:31 -0800 | [diff] [blame] | 4 | import java.util.List; |
Pankaj Berde | e73452c | 2013-01-03 14:57:07 -0800 | [diff] [blame] | 5 | |
Pankaj Berde | ff42180 | 2013-01-29 20:28:52 -0800 | [diff] [blame^] | 6 | import org.codehaus.jackson.annotate.JsonAutoDetect; |
| 7 | import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility; |
| 8 | import org.codehaus.jackson.annotate.JsonIgnore; |
| 9 | import org.codehaus.jackson.annotate.JsonProperty; |
| 10 | import org.codehaus.jackson.map.annotate.JsonSerialize; |
| 11 | import org.codehaus.jackson.map.ser.StdSerializers; |
Pankaj Berde | e73452c | 2013-01-03 14:57:07 -0800 | [diff] [blame] | 12 | import org.openflow.protocol.OFPhysicalPort; |
| 13 | |
Pankaj Berde | ff42180 | 2013-01-29 20:28:52 -0800 | [diff] [blame^] | 14 | import com.tinkerpop.blueprints.Direction; |
| 15 | import com.tinkerpop.frames.Adjacency; |
| 16 | import com.tinkerpop.frames.Incidence; |
| 17 | import com.tinkerpop.frames.Property; |
| 18 | |
Pankaj Berde | e73452c | 2013-01-03 14:57:07 -0800 | [diff] [blame] | 19 | public interface ISwitchStorage extends INetMapStorage { |
| 20 | |
Pankaj Berde | 28cc61c | 2013-01-08 18:19:33 -0800 | [diff] [blame] | 21 | public enum SwitchState { |
Pankaj Berde | 8557a46 | 2013-01-07 08:59:31 -0800 | [diff] [blame] | 22 | INACTIVE, |
| 23 | ACTIVE |
| 24 | } |
Pankaj Berde | ff42180 | 2013-01-29 20:28:52 -0800 | [diff] [blame^] | 25 | |
| 26 | public interface ISwitchObject { |
| 27 | |
| 28 | @JsonProperty("dpid") |
| 29 | @Property("dpid") |
| 30 | public String getDPID(); |
| 31 | |
| 32 | @JsonProperty("state") |
| 33 | @Property("state") |
| 34 | public String getState(); |
| 35 | |
| 36 | @JsonIgnore |
| 37 | @Property("type") |
| 38 | public String getType(); |
| 39 | |
| 40 | @JsonProperty("ports") |
| 41 | @Adjacency(label="on") |
| 42 | public Iterable<IPortObject> getPorts(); |
| 43 | } |
Pankaj Berde | 8557a46 | 2013-01-07 08:59:31 -0800 | [diff] [blame] | 44 | |
Pankaj Berde | ff42180 | 2013-01-29 20:28:52 -0800 | [diff] [blame^] | 45 | public interface IPortObject { |
| 46 | |
| 47 | @JsonProperty("state") |
| 48 | @Property("state") |
| 49 | public int getState(); |
| 50 | |
| 51 | @JsonIgnore |
| 52 | @Property("type") |
| 53 | public String getType(); |
| 54 | |
| 55 | @JsonProperty("number") |
| 56 | @Property("number") |
| 57 | public Short getNumber(); |
| 58 | |
| 59 | @JsonProperty("desc") |
| 60 | @Property("desc") |
| 61 | public String getDesc(); |
| 62 | |
| 63 | @JsonIgnore |
| 64 | @Incidence(label="on",direction = Direction.IN) |
| 65 | public ISwitchObject getSwitch(); |
| 66 | } |
Pankaj Berde | e73452c | 2013-01-03 14:57:07 -0800 | [diff] [blame] | 67 | /* |
| 68 | * Update the switch details |
| 69 | */ |
Pankaj Berde | 8557a46 | 2013-01-07 08:59:31 -0800 | [diff] [blame] | 70 | public void update(String dpid,SwitchState state, DM_OPERATION op); |
Pankaj Berde | e73452c | 2013-01-03 14:57:07 -0800 | [diff] [blame] | 71 | /* |
| 72 | * Associate a port on switch |
| 73 | */ |
Pankaj Berde | 4dea346 | 2013-01-03 18:02:38 -0800 | [diff] [blame] | 74 | public void addPort(String dpid, OFPhysicalPort port); |
Pankaj Berde | e73452c | 2013-01-03 14:57:07 -0800 | [diff] [blame] | 75 | /* |
| 76 | * Get all ports associated on a switch |
| 77 | */ |
| 78 | public Collection<OFPhysicalPort> getPorts(long dpid); |
| 79 | /* |
| 80 | * Get Port by Number |
| 81 | */ |
Pankaj Berde | 4dea346 | 2013-01-03 18:02:38 -0800 | [diff] [blame] | 82 | public OFPhysicalPort getPort(String dpid, short portnum); |
Pankaj Berde | e73452c | 2013-01-03 14:57:07 -0800 | [diff] [blame] | 83 | /* |
| 84 | * Get port by name |
| 85 | */ |
Pankaj Berde | 4dea346 | 2013-01-03 18:02:38 -0800 | [diff] [blame] | 86 | public OFPhysicalPort getPort(String dpid, String portName); |
| 87 | /* |
| 88 | * Add a switch |
| 89 | */ |
| 90 | public void addSwitch(String dpid); |
Pankaj Berde | e73452c | 2013-01-03 14:57:07 -0800 | [diff] [blame] | 91 | /* |
| 92 | * Delete switch and associated ports |
| 93 | */ |
Pankaj Berde | 4dea346 | 2013-01-03 18:02:38 -0800 | [diff] [blame] | 94 | public void deleteSwitch(String dpid); |
Pankaj Berde | e73452c | 2013-01-03 14:57:07 -0800 | [diff] [blame] | 95 | /* |
| 96 | * Delete a port on a switch by num |
| 97 | */ |
Pankaj Berde | 4dea346 | 2013-01-03 18:02:38 -0800 | [diff] [blame] | 98 | public void deletePort(String dpid, short port); |
Pankaj Berde | e73452c | 2013-01-03 14:57:07 -0800 | [diff] [blame] | 99 | /* |
| 100 | * Delete port on a switch by name |
| 101 | */ |
Pankaj Berde | 4dea346 | 2013-01-03 18:02:38 -0800 | [diff] [blame] | 102 | public void deletePort(String dpid, String portName); |
| 103 | |
Pankaj Berde | ff42180 | 2013-01-29 20:28:52 -0800 | [diff] [blame^] | 104 | public Iterable<ISwitchObject> getActiveSwitches(); |
| 105 | public Iterable<ISwitchObject> getAllSwitches(); |
| 106 | public Iterable<ISwitchObject> getInactiveSwitches(); |
Pankaj Berde | 8557a46 | 2013-01-07 08:59:31 -0800 | [diff] [blame] | 107 | |
Pankaj Berde | 4dea346 | 2013-01-03 18:02:38 -0800 | [diff] [blame] | 108 | /* |
| 109 | * Initialize |
| 110 | */ |
| 111 | public void init(String conf); |
Pankaj Berde | d1259e8 | 2013-01-23 14:10:00 -0800 | [diff] [blame] | 112 | |
| 113 | |
Pankaj Berde | e73452c | 2013-01-03 14:57:07 -0800 | [diff] [blame] | 114 | } |