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