Sangho Shin | 177e64f | 2014-10-28 17:49:23 -0700 | [diff] [blame] | 1 | package net.onrc.onos.apps.segmentrouting; |
| 2 | |
| 3 | import net.onrc.onos.core.matchaction.match.PacketMatch; |
| 4 | |
| 5 | public class SegmentRoutingPolicy { |
| 6 | |
| 7 | /** |
| 8 | * Enums for policy type |
| 9 | * |
| 10 | */ |
| 11 | public enum PolicyType{ |
| 12 | TUNNEL_FLOW, |
| 13 | LOADBALANCE, |
| 14 | AVOID, |
| 15 | DENY |
| 16 | } |
| 17 | |
| 18 | protected SegmentRoutingManager srManager; |
| 19 | protected String policyId; |
| 20 | protected PacketMatch match; |
| 21 | protected int priority; |
| 22 | protected PolicyType type; |
| 23 | |
Sangho Shin | be3c361 | 2014-10-30 14:20:36 -0700 | [diff] [blame^] | 24 | /** |
| 25 | * Constructor |
| 26 | * |
| 27 | * @param srm Segment Routing Manager object |
| 28 | * @param pid Policy ID |
| 29 | * @param type Policy type |
| 30 | * @param match PacketMatch for the policy |
| 31 | * @param priority Priority |
| 32 | */ |
Sangho Shin | 177e64f | 2014-10-28 17:49:23 -0700 | [diff] [blame] | 33 | public SegmentRoutingPolicy(SegmentRoutingManager srm, String pid, |
| 34 | PolicyType type, PacketMatch match, int priority) { |
| 35 | this.srManager = srm; |
| 36 | this.policyId = pid; |
| 37 | this.match = match; |
| 38 | this.priority = priority; |
| 39 | this.type = type; |
| 40 | } |
| 41 | |
Sangho Shin | be3c361 | 2014-10-30 14:20:36 -0700 | [diff] [blame^] | 42 | /** |
| 43 | * Get the policy ID |
| 44 | * |
| 45 | * @return policy ID |
| 46 | */ |
Sangho Shin | 177e64f | 2014-10-28 17:49:23 -0700 | [diff] [blame] | 47 | public String getPolicyId(){ |
| 48 | return this.policyId; |
| 49 | } |
| 50 | |
Sangho Shin | be3c361 | 2014-10-30 14:20:36 -0700 | [diff] [blame^] | 51 | /** |
| 52 | * Get Match |
| 53 | * |
| 54 | * @return PacketMatch object |
| 55 | */ |
Sangho Shin | 177e64f | 2014-10-28 17:49:23 -0700 | [diff] [blame] | 56 | public PacketMatch getMatch(){ |
| 57 | return this.match; |
| 58 | } |
| 59 | |
Sangho Shin | be3c361 | 2014-10-30 14:20:36 -0700 | [diff] [blame^] | 60 | /** |
| 61 | * Get the priority of the policy |
| 62 | * |
| 63 | * @return priority |
| 64 | */ |
Sangho Shin | 177e64f | 2014-10-28 17:49:23 -0700 | [diff] [blame] | 65 | public int getPriority(){ |
| 66 | return this.priority; |
| 67 | } |
| 68 | |
Sangho Shin | be3c361 | 2014-10-30 14:20:36 -0700 | [diff] [blame^] | 69 | /** |
| 70 | * Get the policy type |
| 71 | * |
| 72 | * @return policy type |
| 73 | */ |
Sangho Shin | 177e64f | 2014-10-28 17:49:23 -0700 | [diff] [blame] | 74 | public PolicyType getType(){ |
| 75 | return this.type; |
| 76 | } |
| 77 | |
Sangho Shin | be3c361 | 2014-10-30 14:20:36 -0700 | [diff] [blame^] | 78 | /** |
| 79 | * Create a policy |
| 80 | * |
| 81 | * @return true if succeeds, false otherwise |
| 82 | */ |
Sangho Shin | 177e64f | 2014-10-28 17:49:23 -0700 | [diff] [blame] | 83 | public boolean createPolicy() { |
| 84 | return false; |
| 85 | } |
| 86 | |
Sangho Shin | be3c361 | 2014-10-30 14:20:36 -0700 | [diff] [blame^] | 87 | /** |
| 88 | * Remove the policy |
| 89 | * |
| 90 | * @return true if succeeds, false otherwise |
| 91 | */ |
Sangho Shin | 177e64f | 2014-10-28 17:49:23 -0700 | [diff] [blame] | 92 | public boolean removePolicy() { |
| 93 | return false; |
| 94 | } |
| 95 | |
| 96 | } |