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 | |
Toshio Koide | ad17d5e | 2014-02-11 11:36:02 -0800 | [diff] [blame] | 3 | /** |
Brian O'Connor | a581b9d | 2014-06-15 23:32:36 -0700 | [diff] [blame] | 4 | * The ConstrainedShortestPathIntent is a "high-level" intent that allows |
Praseed Balakrishnan | 9748da9 | 2014-06-26 12:39:01 -0700 | [diff] [blame] | 5 | * applications to reserve bandwidth along the shortest available path between |
Brian O'Connor | a581b9d | 2014-06-15 23:32:36 -0700 | [diff] [blame] | 6 | * specified endpoints. |
Toshio Koide | ad17d5e | 2014-02-11 11:36:02 -0800 | [diff] [blame] | 7 | */ |
| 8 | public class ConstrainedShortestPathIntent extends ShortestPathIntent { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 9 | protected double bandwidth; |
Toshio Koide | ad17d5e | 2014-02-11 11:36:02 -0800 | [diff] [blame] | 10 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 11 | /** |
Ray Milkey | b41100a | 2014-04-10 10:42:15 -0700 | [diff] [blame] | 12 | * Default constructor for Kryo deserialization. |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 13 | */ |
| 14 | protected ConstrainedShortestPathIntent() { |
| 15 | } |
Toshio Koide | c406e79 | 2014-02-14 16:52:42 -0800 | [diff] [blame] | 16 | |
Brian O'Connor | a581b9d | 2014-06-15 23:32:36 -0700 | [diff] [blame] | 17 | /** |
| 18 | * Constructor. |
| 19 | * |
| 20 | * @param id the ID for this Intent |
| 21 | * @param srcSwitch Source Switch DPID |
| 22 | * @param srcPort Source Port |
| 23 | * @param srcMac Source Host MAC Address |
| 24 | * @param dstSwitch Destination Switch DPID |
| 25 | * @param dstPort Destination Port |
| 26 | * @param dstMac Destination Host MAC Address |
| 27 | * @param bandwidth bandwidth which should be allocated for the path. |
| 28 | * If 0, no intent for bandwidth allocation (best effort). |
| 29 | */ |
Ray Milkey | a5450cc | 2014-04-17 14:31:30 -0700 | [diff] [blame] | 30 | // CHECKSTYLE:OFF suppress the warning about too many parameters |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 31 | public ConstrainedShortestPathIntent(String id, |
| 32 | long srcSwitch, long srcPort, long srcMac, |
| 33 | long dstSwitch, long dstPort, long dstMac, |
| 34 | double bandwidth) { |
Ray Milkey | a5450cc | 2014-04-17 14:31:30 -0700 | [diff] [blame] | 35 | // CHECKSTYLE:ON |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 36 | super(id, srcSwitch, srcPort, srcMac, dstSwitch, dstPort, dstMac); |
| 37 | this.bandwidth = bandwidth; |
| 38 | } |
Toshio Koide | ad17d5e | 2014-02-11 11:36:02 -0800 | [diff] [blame] | 39 | |
Brian O'Connor | a581b9d | 2014-06-15 23:32:36 -0700 | [diff] [blame] | 40 | /** |
| 41 | * Get the bandwidth specified for this Intent. |
| 42 | * TODO: specify unit |
| 43 | * |
| 44 | * @return this Intent's bandwidth |
| 45 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 46 | public double getBandwidth() { |
| 47 | return bandwidth; |
| 48 | } |
Pavlin Radoslavov | 7fb1641 | 2014-04-11 18:45:19 -0700 | [diff] [blame] | 49 | |
Brian O'Connor | a581b9d | 2014-06-15 23:32:36 -0700 | [diff] [blame] | 50 | /** |
| 51 | * Generates a hash code using the Intent ID. |
| 52 | * |
| 53 | * @return hashcode |
| 54 | */ |
Pavlin Radoslavov | 7fb1641 | 2014-04-11 18:45:19 -0700 | [diff] [blame] | 55 | @Override |
| 56 | public int hashCode() { |
Brian O'Connor | a581b9d | 2014-06-15 23:32:36 -0700 | [diff] [blame] | 57 | return super.hashCode(); |
Pavlin Radoslavov | 7fb1641 | 2014-04-11 18:45:19 -0700 | [diff] [blame] | 58 | } |
| 59 | |
Brian O'Connor | a581b9d | 2014-06-15 23:32:36 -0700 | [diff] [blame] | 60 | /** |
| 61 | * Compares two intent object by type (class) and Intent ID. |
| 62 | * |
| 63 | * @param obj other Intent |
| 64 | * @return true if equal, false otherwise |
| 65 | */ |
Pavlin Radoslavov | 7fb1641 | 2014-04-11 18:45:19 -0700 | [diff] [blame] | 66 | @Override |
| 67 | public boolean equals(Object obj) { |
Brian O'Connor | a581b9d | 2014-06-15 23:32:36 -0700 | [diff] [blame] | 68 | return super.equals(obj); |
Pavlin Radoslavov | 7fb1641 | 2014-04-11 18:45:19 -0700 | [diff] [blame] | 69 | } |
Toshio Koide | ad17d5e | 2014-02-11 11:36:02 -0800 | [diff] [blame] | 70 | } |