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; |
Toshio Koide | ad17d5e | 2014-02-11 11:36:02 -0800 | [diff] [blame] | 17 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 18 | /** |
Ray Milkey | b41100a | 2014-04-10 10:42:15 -0700 | [diff] [blame] | 19 | * Default constructor for Kryo deserialization. |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 20 | */ |
| 21 | protected ShortestPathIntent() { |
| 22 | } |
Toshio Koide | ad17d5e | 2014-02-11 11:36:02 -0800 | [diff] [blame] | 23 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 24 | public ShortestPathIntent(String id, |
| 25 | long srcSwitch, long srcPort, long srcMac, |
| 26 | long dstSwitch, long dstPort, long dstMac) { |
| 27 | super(id); |
| 28 | srcSwitchDpid = srcSwitch; |
| 29 | srcPortNumber = srcPort; |
| 30 | srcMacAddress = srcMac; |
| 31 | dstSwitchDpid = dstSwitch; |
| 32 | dstPortNumber = dstPort; |
| 33 | dstMacAddress = dstMac; |
| 34 | } |
Toshio Koide | ad17d5e | 2014-02-11 11:36:02 -0800 | [diff] [blame] | 35 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 36 | public long getSrcSwitchDpid() { |
| 37 | return srcSwitchDpid; |
| 38 | } |
Toshio Koide | ad17d5e | 2014-02-11 11:36:02 -0800 | [diff] [blame] | 39 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 40 | public long getSrcPortNumber() { |
| 41 | return srcPortNumber; |
| 42 | } |
Toshio Koide | ad17d5e | 2014-02-11 11:36:02 -0800 | [diff] [blame] | 43 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 44 | public long getSrcMac() { |
| 45 | return srcMacAddress; |
| 46 | } |
Toshio Koide | ad17d5e | 2014-02-11 11:36:02 -0800 | [diff] [blame] | 47 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 48 | public long getDstSwitchDpid() { |
| 49 | return dstSwitchDpid; |
| 50 | } |
Toshio Koide | 0e4d8d2 | 2014-02-14 10:56:10 -0800 | [diff] [blame] | 51 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 52 | public long getDstPortNumber() { |
| 53 | return dstPortNumber; |
| 54 | } |
Toshio Koide | 0e4d8d2 | 2014-02-14 10:56:10 -0800 | [diff] [blame] | 55 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 56 | public long getDstMac() { |
| 57 | return dstMacAddress; |
| 58 | } |
Toshio Koide | ad17d5e | 2014-02-11 11:36:02 -0800 | [diff] [blame] | 59 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 60 | public void setPathIntent(PathIntent pathIntent) { |
| 61 | pathIntentId = pathIntent.getId(); |
| 62 | } |
Toshio Koide | a10c037 | 2014-02-20 17:28:10 -0800 | [diff] [blame] | 63 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 64 | public String getPathIntentId() { |
| 65 | return pathIntentId; |
| 66 | } |
Toshio Koide | a10c037 | 2014-02-20 17:28:10 -0800 | [diff] [blame] | 67 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 68 | @Override |
| 69 | public String toString() { |
| 70 | return String.format("id:%s, state:%s, srcDpid:%s, srcPort:%d, srcMac:%s, dstDpid:%s, dstPort:%d, dstMac:%s", |
| 71 | getId(), getState(), |
| 72 | new Dpid(srcSwitchDpid), srcPortNumber, MACAddress.valueOf(srcMacAddress), |
| 73 | new Dpid(dstSwitchDpid), dstPortNumber, MACAddress.valueOf(dstMacAddress)); |
| 74 | } |
Toshio Koide | ad17d5e | 2014-02-11 11:36:02 -0800 | [diff] [blame] | 75 | } |