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