Jonathan Hart | aa38097 | 2014-04-03 10:24:46 -0700 | [diff] [blame] | 1 | package net.onrc.onos.core.intent; |
Toshio Koide | ad17d5e | 2014-02-11 11:36:02 -0800 | [diff] [blame] | 2 | |
| 3 | import net.floodlightcontroller.util.MACAddress; |
Jonathan Hart | 23701d1 | 2014-04-03 10:45:48 -0700 | [diff] [blame] | 4 | import net.onrc.onos.core.util.Dpid; |
Toshio Koide | ad17d5e | 2014-02-11 11:36:02 -0800 | [diff] [blame] | 5 | |
| 6 | /** |
| 7 | * @author Toshio Koide (t-koide@onlab.us) |
| 8 | */ |
| 9 | public class ShortestPathIntent extends Intent { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 10 | protected long srcSwitchDpid; |
| 11 | protected long srcPortNumber; |
| 12 | protected long srcMacAddress; |
| 13 | protected long dstSwitchDpid; |
| 14 | protected long dstPortNumber; |
| 15 | protected long dstMacAddress; |
| 16 | protected String pathIntentId = null; |
TeruU | 30c0c93 | 2014-05-15 16:47:41 -0700 | [diff] [blame] | 17 | protected int idleTimeout; |
| 18 | protected int hardTimeout; |
| 19 | protected int firstSwitchIdleTimeout; |
| 20 | protected int firstSwitchHardTimetout; |
Toshio Koide | ad17d5e | 2014-02-11 11:36:02 -0800 | [diff] [blame] | 21 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 22 | /** |
Ray Milkey | b41100a | 2014-04-10 10:42:15 -0700 | [diff] [blame] | 23 | * Default constructor for Kryo deserialization. |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 24 | */ |
| 25 | protected ShortestPathIntent() { |
| 26 | } |
Toshio Koide | ad17d5e | 2014-02-11 11:36:02 -0800 | [diff] [blame] | 27 | |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 28 | /** |
| 29 | * Constructor for ShortestPathIntent. |
| 30 | * |
| 31 | * @param id Intent ID |
| 32 | * @param srcSwitch Source Switch DPID |
| 33 | * @param srcPort Source Port |
| 34 | * @param srcMac Source Host MAC Address |
| 35 | * @param dstSwitch Destination Switch DPID |
| 36 | * @param dstPort Destination Port |
| 37 | * @param dstMac Destination Host MAC Address |
| 38 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 39 | public ShortestPathIntent(String id, |
| 40 | long srcSwitch, long srcPort, long srcMac, |
| 41 | long dstSwitch, long dstPort, long dstMac) { |
| 42 | super(id); |
| 43 | srcSwitchDpid = srcSwitch; |
| 44 | srcPortNumber = srcPort; |
| 45 | srcMacAddress = srcMac; |
| 46 | dstSwitchDpid = dstSwitch; |
| 47 | dstPortNumber = dstPort; |
| 48 | dstMacAddress = dstMac; |
| 49 | } |
Toshio Koide | ad17d5e | 2014-02-11 11:36:02 -0800 | [diff] [blame] | 50 | |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 51 | /** |
| 52 | * Gets the source Switch DPID. |
| 53 | * |
| 54 | * @return Source Switch DPID |
| 55 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 56 | public long getSrcSwitchDpid() { |
| 57 | return srcSwitchDpid; |
| 58 | } |
Toshio Koide | ad17d5e | 2014-02-11 11:36:02 -0800 | [diff] [blame] | 59 | |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 60 | /** |
| 61 | * Gets the source Port. |
| 62 | * |
| 63 | * @return Source Port |
| 64 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 65 | public long getSrcPortNumber() { |
| 66 | return srcPortNumber; |
| 67 | } |
Toshio Koide | ad17d5e | 2014-02-11 11:36:02 -0800 | [diff] [blame] | 68 | |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 69 | /** |
| 70 | * Gets the source Host MAC Address. |
| 71 | * |
| 72 | * @return Source Host MAC Address |
| 73 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 74 | public long getSrcMac() { |
| 75 | return srcMacAddress; |
| 76 | } |
Toshio Koide | ad17d5e | 2014-02-11 11:36:02 -0800 | [diff] [blame] | 77 | |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 78 | /** |
| 79 | * Gets the destination Switch DPID. |
| 80 | * |
| 81 | * @return Destination Switch DPID |
| 82 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 83 | public long getDstSwitchDpid() { |
| 84 | return dstSwitchDpid; |
| 85 | } |
Toshio Koide | 0e4d8d2 | 2014-02-14 10:56:10 -0800 | [diff] [blame] | 86 | |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 87 | /** |
| 88 | * Gets the destination Port. |
| 89 | * |
| 90 | * @return Destination Port |
| 91 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 92 | public long getDstPortNumber() { |
| 93 | return dstPortNumber; |
| 94 | } |
Toshio Koide | 0e4d8d2 | 2014-02-14 10:56:10 -0800 | [diff] [blame] | 95 | |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 96 | /** |
| 97 | * Gets the destination Host MAC Address. |
| 98 | * |
| 99 | * @return Destination Host MAC Address |
| 100 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 101 | public long getDstMac() { |
| 102 | return dstMacAddress; |
| 103 | } |
Toshio Koide | ad17d5e | 2014-02-11 11:36:02 -0800 | [diff] [blame] | 104 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 105 | public void setPathIntent(PathIntent pathIntent) { |
| 106 | pathIntentId = pathIntent.getId(); |
| 107 | } |
Toshio Koide | a10c037 | 2014-02-20 17:28:10 -0800 | [diff] [blame] | 108 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 109 | public String getPathIntentId() { |
| 110 | return pathIntentId; |
| 111 | } |
Toshio Koide | a10c037 | 2014-02-20 17:28:10 -0800 | [diff] [blame] | 112 | |
Ray Milkey | ff73514 | 2014-05-22 19:06:02 -0700 | [diff] [blame^] | 113 | // TODO - this is intended to be refactored and removed |
TeruU | 30c0c93 | 2014-05-15 16:47:41 -0700 | [diff] [blame] | 114 | public int getIdleTimeout() { |
| 115 | return idleTimeout; |
| 116 | } |
| 117 | |
Ray Milkey | ff73514 | 2014-05-22 19:06:02 -0700 | [diff] [blame^] | 118 | // TODO - this is intended to be refactored and removed |
TeruU | 30c0c93 | 2014-05-15 16:47:41 -0700 | [diff] [blame] | 119 | public int getHardTimeout() { |
| 120 | return hardTimeout; |
| 121 | } |
| 122 | |
Ray Milkey | ff73514 | 2014-05-22 19:06:02 -0700 | [diff] [blame^] | 123 | // TODO - this is intended to be refactored and removed |
TeruU | 30c0c93 | 2014-05-15 16:47:41 -0700 | [diff] [blame] | 124 | public void setIdleTimeout(int idleTimeout) { |
| 125 | this.idleTimeout = idleTimeout; |
| 126 | } |
| 127 | |
Ray Milkey | ff73514 | 2014-05-22 19:06:02 -0700 | [diff] [blame^] | 128 | // TODO - this is intended to be refactored and removed |
TeruU | 30c0c93 | 2014-05-15 16:47:41 -0700 | [diff] [blame] | 129 | public void setHardTimeout(int hardTimeout) { |
| 130 | this.hardTimeout = hardTimeout; |
| 131 | } |
| 132 | |
Ray Milkey | ff73514 | 2014-05-22 19:06:02 -0700 | [diff] [blame^] | 133 | // TODO - this is intended to be refactored and removed |
TeruU | 30c0c93 | 2014-05-15 16:47:41 -0700 | [diff] [blame] | 134 | public int getFirstSwitchIdleTimeout() { |
| 135 | return firstSwitchIdleTimeout; |
| 136 | } |
| 137 | |
Ray Milkey | ff73514 | 2014-05-22 19:06:02 -0700 | [diff] [blame^] | 138 | // TODO - this is intended to be refactored and removed |
TeruU | 30c0c93 | 2014-05-15 16:47:41 -0700 | [diff] [blame] | 139 | public int getFirstSwitchHardTimetout() { |
| 140 | return firstSwitchHardTimetout; |
| 141 | } |
| 142 | |
Ray Milkey | ff73514 | 2014-05-22 19:06:02 -0700 | [diff] [blame^] | 143 | // TODO - this is intended to be refactored and removed |
TeruU | 30c0c93 | 2014-05-15 16:47:41 -0700 | [diff] [blame] | 144 | public void setFirstSwitchIdleTimeout(int firstSwitchIdleTimeout) { |
| 145 | this.firstSwitchIdleTimeout = firstSwitchIdleTimeout; |
| 146 | } |
| 147 | |
Ray Milkey | ff73514 | 2014-05-22 19:06:02 -0700 | [diff] [blame^] | 148 | // TODO - this is intended to be refactored and removed |
TeruU | 30c0c93 | 2014-05-15 16:47:41 -0700 | [diff] [blame] | 149 | public void setFirstSwitchHardTimetout(int firstSwitchHardTimetout) { |
| 150 | this.firstSwitchHardTimetout = firstSwitchHardTimetout; |
| 151 | } |
| 152 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 153 | @Override |
Pavlin Radoslavov | 7fb1641 | 2014-04-11 18:45:19 -0700 | [diff] [blame] | 154 | public int hashCode() { |
| 155 | // TODO: Is this the intended behavior? |
| 156 | return (super.hashCode()); |
| 157 | } |
| 158 | |
| 159 | @Override |
| 160 | public boolean equals(Object obj) { |
| 161 | // TODO: Is this the intended behavior? |
| 162 | return (super.equals(obj)); |
| 163 | } |
| 164 | |
| 165 | @Override |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 166 | public String toString() { |
| 167 | return String.format("id:%s, state:%s, srcDpid:%s, srcPort:%d, srcMac:%s, dstDpid:%s, dstPort:%d, dstMac:%s", |
| 168 | getId(), getState(), |
| 169 | new Dpid(srcSwitchDpid), srcPortNumber, MACAddress.valueOf(srcMacAddress), |
| 170 | new Dpid(dstSwitchDpid), dstPortNumber, MACAddress.valueOf(dstMacAddress)); |
| 171 | } |
Toshio Koide | ad17d5e | 2014-02-11 11:36:02 -0800 | [diff] [blame] | 172 | } |