blob: 0d842eba65f4d5e60174dc9279a6e2c0a95c4a1c [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
5 * applications to reserve bandwith along the shortest available path between
6 * 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 Milkeya5450cc2014-04-17 14:31:30 -070030 // CHECKSTYLE:OFF suppress the warning about too many parameters
Ray Milkey269ffb92014-04-03 14:43:30 -070031 public ConstrainedShortestPathIntent(String id,
32 long srcSwitch, long srcPort, long srcMac,
33 long dstSwitch, long dstPort, long dstMac,
34 double bandwidth) {
Ray Milkeya5450cc2014-04-17 14:31:30 -070035 // CHECKSTYLE:ON
Ray Milkey269ffb92014-04-03 14:43:30 -070036 super(id, srcSwitch, srcPort, srcMac, dstSwitch, dstPort, dstMac);
37 this.bandwidth = bandwidth;
38 }
Toshio Koidead17d5e2014-02-11 11:36:02 -080039
Brian O'Connora581b9d2014-06-15 23:32:36 -070040 /**
41 * Get the bandwidth specified for this Intent.
42 * TODO: specify unit
43 *
44 * @return this Intent's bandwidth
45 */
Ray Milkey269ffb92014-04-03 14:43:30 -070046 public double getBandwidth() {
47 return bandwidth;
48 }
Pavlin Radoslavov7fb16412014-04-11 18:45:19 -070049
Brian O'Connora581b9d2014-06-15 23:32:36 -070050 /**
51 * Generates a hash code using the Intent ID.
52 *
53 * @return hashcode
54 */
Pavlin Radoslavov7fb16412014-04-11 18:45:19 -070055 @Override
56 public int hashCode() {
Brian O'Connora581b9d2014-06-15 23:32:36 -070057 return super.hashCode();
Pavlin Radoslavov7fb16412014-04-11 18:45:19 -070058 }
59
Brian O'Connora581b9d2014-06-15 23:32:36 -070060 /**
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 Radoslavov7fb16412014-04-11 18:45:19 -070066 @Override
67 public boolean equals(Object obj) {
Brian O'Connora581b9d2014-06-15 23:32:36 -070068 return super.equals(obj);
Pavlin Radoslavov7fb16412014-04-11 18:45:19 -070069 }
Toshio Koidead17d5e2014-02-11 11:36:02 -080070}