blob: b7f7d612dda6a111db81e529d5168bf6d8a4453b [file] [log] [blame]
Jonathan Hartaa380972014-04-03 10:24:46 -07001package net.onrc.onos.core.intent;
Toshio Koidead17d5e2014-02-11 11:36:02 -08002
Toshio Koidead17d5e2014-02-11 11:36:02 -08003/**
Brian O'Connora581b9d2014-06-15 23:32:36 -07004 * The ConstrainedShortestPathIntent is a "high-level" intent that allows
Praseed Balakrishnan9748da92014-06-26 12:39:01 -07005 * applications to reserve bandwidth along the shortest available path between
Brian O'Connora581b9d2014-06-15 23:32:36 -07006 * specified endpoints.
Toshio Koidead17d5e2014-02-11 11:36:02 -08007 */
8public class ConstrainedShortestPathIntent extends ShortestPathIntent {
Ray Milkey269ffb92014-04-03 14:43:30 -07009 protected double bandwidth;
Toshio Koidead17d5e2014-02-11 11:36:02 -080010
Ray Milkey269ffb92014-04-03 14:43:30 -070011 /**
Ray Milkeyb41100a2014-04-10 10:42:15 -070012 * Default constructor for Kryo deserialization.
Ray Milkey269ffb92014-04-03 14:43:30 -070013 */
14 protected ConstrainedShortestPathIntent() {
15 }
Toshio Koidec406e792014-02-14 16:52:42 -080016
Brian O'Connora581b9d2014-06-15 23:32:36 -070017 /**
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 Milkey269ffb92014-04-03 14:43:30 -070030 public ConstrainedShortestPathIntent(String id,
31 long srcSwitch, long srcPort, long srcMac,
32 long dstSwitch, long dstPort, long dstMac,
33 double bandwidth) {
34 super(id, srcSwitch, srcPort, srcMac, dstSwitch, dstPort, dstMac);
35 this.bandwidth = bandwidth;
36 }
Toshio Koidead17d5e2014-02-11 11:36:02 -080037
Brian O'Connora581b9d2014-06-15 23:32:36 -070038 /**
39 * Get the bandwidth specified for this Intent.
40 * TODO: specify unit
41 *
42 * @return this Intent's bandwidth
43 */
Ray Milkey269ffb92014-04-03 14:43:30 -070044 public double getBandwidth() {
45 return bandwidth;
46 }
Pavlin Radoslavov7fb16412014-04-11 18:45:19 -070047
Brian O'Connora581b9d2014-06-15 23:32:36 -070048 /**
49 * Generates a hash code using the Intent ID.
50 *
51 * @return hashcode
52 */
Pavlin Radoslavov7fb16412014-04-11 18:45:19 -070053 @Override
54 public int hashCode() {
Brian O'Connora581b9d2014-06-15 23:32:36 -070055 return super.hashCode();
Pavlin Radoslavov7fb16412014-04-11 18:45:19 -070056 }
57
Brian O'Connora581b9d2014-06-15 23:32:36 -070058 /**
59 * Compares two intent object by type (class) and Intent ID.
60 *
61 * @param obj other Intent
62 * @return true if equal, false otherwise
63 */
Pavlin Radoslavov7fb16412014-04-11 18:45:19 -070064 @Override
65 public boolean equals(Object obj) {
Brian O'Connora581b9d2014-06-15 23:32:36 -070066 return super.equals(obj);
Pavlin Radoslavov7fb16412014-04-11 18:45:19 -070067 }
Toshio Koidead17d5e2014-02-11 11:36:02 -080068}