Pankaj Berde | 1b8a42f | 2013-02-15 08:25:03 -0800 | [diff] [blame^] | 1 | package net.floodlightcontroller.core; |
| 2 | |
| 3 | import org.codehaus.jackson.annotate.JsonIgnore; |
| 4 | import org.codehaus.jackson.annotate.JsonProperty; |
| 5 | |
| 6 | import com.tinkerpop.blueprints.Direction; |
| 7 | import com.tinkerpop.frames.Adjacency; |
| 8 | import com.tinkerpop.frames.Incidence; |
| 9 | import com.tinkerpop.frames.Property; |
| 10 | import com.tinkerpop.frames.annotations.gremlin.GremlinGroovy; |
| 11 | import com.tinkerpop.frames.VertexFrame; |
| 12 | |
| 13 | public interface INetMapTopologyObjects { |
| 14 | |
| 15 | public interface IBaseObject extends VertexFrame { |
| 16 | |
| 17 | @JsonProperty("state") |
| 18 | @Property("state") |
| 19 | public String getState(); |
| 20 | @Property("state") |
| 21 | public void setState(final String state); |
| 22 | |
| 23 | @JsonIgnore |
| 24 | @Property("type") |
| 25 | public String getType(); |
| 26 | @Property("type") |
| 27 | public void setType(final String type); |
| 28 | |
| 29 | } |
| 30 | |
| 31 | public interface ISwitchObject extends IBaseObject{ |
| 32 | |
| 33 | @JsonProperty("dpid") |
| 34 | @Property("dpid") |
| 35 | public String getDPID(); |
| 36 | |
| 37 | @Property("dpid") |
| 38 | public void setDPID(String dpid); |
| 39 | |
| 40 | @JsonProperty("ports") |
| 41 | @Adjacency(label="on") |
| 42 | public Iterable<IPortObject> getPorts(); |
| 43 | |
| 44 | @Adjacency(label="on") |
| 45 | public void addPort(final IPortObject port); |
| 46 | |
| 47 | @Adjacency(label="on") |
| 48 | public void removePort(final IPortObject port); |
| 49 | |
| 50 | @JsonIgnore |
| 51 | @GremlinGroovy("_().out('on').out('host')") |
| 52 | public Iterable<IDeviceObject> getDevices(); |
| 53 | } |
| 54 | |
| 55 | public interface IPortObject extends IBaseObject{ |
| 56 | |
| 57 | @JsonProperty("number") |
| 58 | @Property("number") |
| 59 | public Short getNumber(); |
| 60 | |
| 61 | @JsonProperty("desc") |
| 62 | @Property("desc") |
| 63 | public String getDesc(); |
| 64 | |
| 65 | @JsonIgnore |
| 66 | @Incidence(label="on",direction = Direction.IN) |
| 67 | public ISwitchObject getSwitch(); |
| 68 | |
| 69 | @JsonIgnore |
| 70 | @Adjacency(label="host") |
| 71 | public Iterable<IDeviceObject> getDevices(); |
| 72 | |
| 73 | @Adjacency(label="host") |
| 74 | public void setDevice(final IDeviceObject device); |
| 75 | |
| 76 | @Adjacency(label="host") |
| 77 | public void removeDevice(final IDeviceObject device); |
| 78 | |
| 79 | // @JsonIgnore |
| 80 | // @Adjacency(label="link") |
| 81 | // public Iterable<ILinkObject> getLinks(); |
| 82 | } |
| 83 | |
| 84 | public interface IDeviceObject extends IBaseObject { |
| 85 | |
| 86 | @JsonProperty("mac") |
| 87 | @Property("dl_addr") |
| 88 | public String getMACAddress(); |
| 89 | @Property("dl_addr") |
| 90 | public void setMACAddress(); |
| 91 | |
| 92 | @JsonProperty("ipv4") |
| 93 | @Property("nw_addr") |
| 94 | public String getIPAddress(); |
| 95 | @Property("dl_addr") |
| 96 | public void setIPAddress(); |
| 97 | |
| 98 | @JsonIgnore |
| 99 | @Incidence(label="host",direction = Direction.IN) |
| 100 | public IPortObject getPort(); |
| 101 | |
| 102 | @JsonIgnore |
| 103 | @GremlinGroovy("_().in('host').in('on')") |
| 104 | public ISwitchObject getSwitch(); |
| 105 | |
| 106 | public interface AttachmentPoint { |
| 107 | @GremlinGroovy("_().in('host').in('on').dpid") |
| 108 | public String getDPID(); |
| 109 | @GremlinGroovy("_().in('host').number") |
| 110 | public Short getPortNumber(); |
| 111 | } |
| 112 | } |
| 113 | } |