blob: 5e81000560d8ad10a465d94150f32f56005b91d7 [file] [log] [blame]
Pankaj Berdee73452c2013-01-03 14:57:07 -08001package net.floodlightcontroller.core;
2
3import java.util.Collection;
Pankaj Berdeff421802013-01-29 20:28:52 -08004import org.codehaus.jackson.annotate.JsonIgnore;
5import org.codehaus.jackson.annotate.JsonProperty;
Pankaj Berdee73452c2013-01-03 14:57:07 -08006import org.openflow.protocol.OFPhysicalPort;
7
Pankaj Berdeff421802013-01-29 20:28:52 -08008import com.tinkerpop.blueprints.Direction;
9import com.tinkerpop.frames.Adjacency;
10import com.tinkerpop.frames.Incidence;
11import com.tinkerpop.frames.Property;
Pankaj Berde5024ec12013-01-31 17:07:29 -080012import com.tinkerpop.frames.VertexFrame;
Pankaj Berdeff421802013-01-29 20:28:52 -080013
Pankaj Berdee73452c2013-01-03 14:57:07 -080014public interface ISwitchStorage extends INetMapStorage {
15
Pankaj Berde28cc61c2013-01-08 18:19:33 -080016 public enum SwitchState {
Pankaj Berde8557a462013-01-07 08:59:31 -080017 INACTIVE,
18 ACTIVE
19 }
Pankaj Berdeff421802013-01-29 20:28:52 -080020
Pankaj Berde5024ec12013-01-31 17:07:29 -080021 public interface ISwitchObject extends VertexFrame{
Pankaj Berdeff421802013-01-29 20:28:52 -080022
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 Berde8557a462013-01-07 08:59:31 -080039
Pankaj Berde5024ec12013-01-31 17:07:29 -080040 public interface IPortObject extends VertexFrame{
Pankaj Berdeff421802013-01-29 20:28:52 -080041
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 Berde5024ec12013-01-31 17:07:29 -080061
62// @JsonIgnore
63// @Adjacency(label="link")
64// public Iterable<ILinkObject> getLinks();
Pankaj Berdeff421802013-01-29 20:28:52 -080065 }
Pankaj Berdee73452c2013-01-03 14:57:07 -080066 /*
67 * Update the switch details
68 */
Pankaj Berde8557a462013-01-07 08:59:31 -080069 public void update(String dpid,SwitchState state, DM_OPERATION op);
Pankaj Berdee73452c2013-01-03 14:57:07 -080070 /*
71 * Associate a port on switch
72 */
Pankaj Berde4dea3462013-01-03 18:02:38 -080073 public void addPort(String dpid, OFPhysicalPort port);
Pankaj Berdee73452c2013-01-03 14:57:07 -080074 /*
75 * Get all ports associated on a switch
76 */
77 public Collection<OFPhysicalPort> getPorts(long dpid);
78 /*
79 * Get Port by Number
80 */
Pankaj Berde4dea3462013-01-03 18:02:38 -080081 public OFPhysicalPort getPort(String dpid, short portnum);
Pankaj Berdee73452c2013-01-03 14:57:07 -080082 /*
83 * Get port by name
84 */
Pankaj Berde4dea3462013-01-03 18:02:38 -080085 public OFPhysicalPort getPort(String dpid, String portName);
86 /*
87 * Add a switch
88 */
89 public void addSwitch(String dpid);
Pankaj Berdee73452c2013-01-03 14:57:07 -080090 /*
91 * Delete switch and associated ports
92 */
Pankaj Berde4dea3462013-01-03 18:02:38 -080093 public void deleteSwitch(String dpid);
Pankaj Berdee73452c2013-01-03 14:57:07 -080094 /*
95 * Delete a port on a switch by num
96 */
Pankaj Berde4dea3462013-01-03 18:02:38 -080097 public void deletePort(String dpid, short port);
Pankaj Berdee73452c2013-01-03 14:57:07 -080098 /*
99 * Delete port on a switch by name
100 */
Pankaj Berde4dea3462013-01-03 18:02:38 -0800101 public void deletePort(String dpid, String portName);
102
Pankaj Berdeff421802013-01-29 20:28:52 -0800103 public Iterable<ISwitchObject> getActiveSwitches();
104 public Iterable<ISwitchObject> getAllSwitches();
105 public Iterable<ISwitchObject> getInactiveSwitches();
Pankaj Berde8557a462013-01-07 08:59:31 -0800106
Pankaj Berde4dea3462013-01-03 18:02:38 -0800107 /*
108 * Initialize
109 */
110 public void init(String conf);
Pankaj Berded1259e82013-01-23 14:10:00 -0800111
112
Pankaj Berdee73452c2013-01-03 14:57:07 -0800113}