Toshio Koide | ad17d5e | 2014-02-11 11:36:02 -0800 | [diff] [blame] | 1 | package net.onrc.onos.intent; |
| 2 | |
| 3 | import net.floodlightcontroller.util.MACAddress; |
Toshio Koide | 0e4d8d2 | 2014-02-14 10:56:10 -0800 | [diff] [blame] | 4 | import net.onrc.onos.ofcontroller.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 { |
Toshio Koide | 0e4d8d2 | 2014-02-14 10:56:10 -0800 | [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; |
Toshio Koide | ad17d5e | 2014-02-11 11:36:02 -0800 | [diff] [blame] | 16 | |
Toshio Koide | 0e4d8d2 | 2014-02-14 10:56:10 -0800 | [diff] [blame] | 17 | /** |
| 18 | * Default constructor for Kryo deserialization |
| 19 | */ |
Toshio Koide | c406e79 | 2014-02-14 16:52:42 -0800 | [diff] [blame] | 20 | protected ShortestPathIntent() { |
Toshio Koide | ad17d5e | 2014-02-11 11:36:02 -0800 | [diff] [blame] | 21 | } |
| 22 | |
Toshio Koide | 0e4d8d2 | 2014-02-14 10:56:10 -0800 | [diff] [blame] | 23 | public ShortestPathIntent(String id, |
Toshio Koide | 13986d1 | 2014-02-11 20:25:32 -0800 | [diff] [blame] | 24 | long srcSwitch, long srcPort, long srcMac, |
| 25 | long dstSwitch, long dstPort, long dstMac) { |
| 26 | super(id); |
Toshio Koide | 0e4d8d2 | 2014-02-14 10:56:10 -0800 | [diff] [blame] | 27 | srcSwitchDpid = srcSwitch; |
| 28 | srcPortNumber = srcPort; |
| 29 | srcMacAddress = srcMac; |
| 30 | dstSwitchDpid = dstSwitch; |
| 31 | dstPortNumber = dstPort; |
| 32 | dstMacAddress = dstMac; |
Toshio Koide | ad17d5e | 2014-02-11 11:36:02 -0800 | [diff] [blame] | 33 | } |
| 34 | |
Toshio Koide | 0e4d8d2 | 2014-02-14 10:56:10 -0800 | [diff] [blame] | 35 | public long getSrcSwitchDpid() { |
| 36 | return srcSwitchDpid; |
Toshio Koide | ad17d5e | 2014-02-11 11:36:02 -0800 | [diff] [blame] | 37 | } |
| 38 | |
Toshio Koide | 0e4d8d2 | 2014-02-14 10:56:10 -0800 | [diff] [blame] | 39 | public long getSrcPortNumber() { |
| 40 | return srcPortNumber; |
Toshio Koide | ad17d5e | 2014-02-11 11:36:02 -0800 | [diff] [blame] | 41 | } |
| 42 | |
Toshio Koide | 0e4d8d2 | 2014-02-14 10:56:10 -0800 | [diff] [blame] | 43 | public long getSrcMac() { |
| 44 | return srcMacAddress; |
Toshio Koide | ad17d5e | 2014-02-11 11:36:02 -0800 | [diff] [blame] | 45 | } |
| 46 | |
Toshio Koide | 0e4d8d2 | 2014-02-14 10:56:10 -0800 | [diff] [blame] | 47 | public long getDstSwitchDpid() { |
| 48 | return dstSwitchDpid; |
| 49 | } |
| 50 | |
| 51 | public long getDstPortNumber() { |
| 52 | return dstPortNumber; |
| 53 | } |
| 54 | |
| 55 | public long getDstMac() { |
| 56 | return dstMacAddress; |
Toshio Koide | ad17d5e | 2014-02-11 11:36:02 -0800 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | @Override |
| 60 | public String toString() { |
Toshio Koide | 0e4d8d2 | 2014-02-14 10:56:10 -0800 | [diff] [blame] | 61 | return String.format("srcDpid:%s, srcPort:%d, srcMac:%s, dstDpid:%s, dstPort:%d, dstMac:%s", |
| 62 | new Dpid(srcSwitchDpid), srcPortNumber, MACAddress.valueOf(srcMacAddress), |
| 63 | new Dpid(dstSwitchDpid), dstPortNumber, MACAddress.valueOf(dstMacAddress)); |
Toshio Koide | ebdbb62 | 2014-02-12 20:28:38 -0800 | [diff] [blame] | 64 | } |
Toshio Koide | ad17d5e | 2014-02-11 11:36:02 -0800 | [diff] [blame] | 65 | } |