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