Srikanth Vavilapalli | fb38ed6 | 2014-10-20 13:34:01 -0700 | [diff] [blame] | 1 | package net.onrc.onos.apps.segmentrouting; |
| 2 | |
Fahad Naeem Khan | a40f9b6 | 2014-10-20 18:33:45 -0700 | [diff] [blame] | 3 | import java.util.Collection; |
Fahad Naeem Khan | d1ac370 | 2014-10-22 15:59:31 -0700 | [diff] [blame] | 4 | import java.util.HashMap; |
Srikanth Vavilapalli | fb38ed6 | 2014-10-20 13:34:01 -0700 | [diff] [blame] | 5 | import java.util.List; |
| 6 | |
| 7 | import net.floodlightcontroller.core.module.IFloodlightService; |
| 8 | import net.floodlightcontroller.util.MACAddress; |
Fahad Naeem Khan | 4ff83d6 | 2014-10-28 16:18:07 -0700 | [diff] [blame] | 9 | import net.onrc.onos.apps.segmentrouting.SegmentRoutingManager.removeTunnelMessages; |
Sangho Shin | f65b4da | 2014-10-28 16:58:13 -0700 | [diff] [blame^] | 10 | import net.onrc.onos.apps.segmentrouting.SegmentRoutingPolicy.PolicyType; |
Srikanth Vavilapalli | fb38ed6 | 2014-10-20 13:34:01 -0700 | [diff] [blame] | 11 | import net.onrc.onos.core.util.IPv4Net; |
| 12 | |
| 13 | /** |
| 14 | * The API exported by the main SDN-IP class. This is the interface between the |
| 15 | * REST handlers and the SDN-IP module. |
| 16 | */ |
| 17 | public interface ISegmentRoutingService extends IFloodlightService { |
| 18 | |
| 19 | /** |
| 20 | * Create a tunnel for policy routing. |
| 21 | * |
| 22 | * @param tunnelId ID for the tunnel |
Srikanth Vavilapalli | 1f6a574 | 2014-10-21 13:45:11 -0700 | [diff] [blame] | 23 | * @param labelIds Node label IDs for the tunnel |
Srikanth Vavilapalli | fb38ed6 | 2014-10-20 13:34:01 -0700 | [diff] [blame] | 24 | * |
| 25 | * @return "true/false" depending tunnel creation status |
| 26 | */ |
Srikanth Vavilapalli | 1f6a574 | 2014-10-21 13:45:11 -0700 | [diff] [blame] | 27 | public boolean createTunnel(String tunnelId, List<Integer> labelIds); |
Srikanth Vavilapalli | fb38ed6 | 2014-10-20 13:34:01 -0700 | [diff] [blame] | 28 | |
| 29 | /** |
| 30 | * Remove a Segment Routing tunnel given a tunnel Id. |
| 31 | * |
| 32 | * @param tunnelId ID for the tunnel |
| 33 | * |
| 34 | * @return "true/false" depending tunnel deletion status |
| 35 | */ |
Fahad Naeem Khan | 4ff83d6 | 2014-10-28 16:18:07 -0700 | [diff] [blame] | 36 | public removeTunnelMessages removeTunnel(String tunnelId); |
Srikanth Vavilapalli | fb38ed6 | 2014-10-20 13:34:01 -0700 | [diff] [blame] | 37 | |
| 38 | /** |
| 39 | * Create a policy for policy based segment routing |
Srikanth Vavilapalli | 1f6a574 | 2014-10-21 13:45:11 -0700 | [diff] [blame] | 40 | * |
Srikanth Vavilapalli | fb38ed6 | 2014-10-20 13:34:01 -0700 | [diff] [blame] | 41 | * @param pid Unique Policy Identifier |
| 42 | * @param srcIP Source IP address in CIDR format |
| 43 | * @param dstIP Destination IP address in CIDR format |
| 44 | * @param ipProto IP protocol type |
| 45 | * @param srcPort Source L4 port |
| 46 | * @param dstPort Destination L4 port |
| 47 | * @param priority Priority of the policy |
| 48 | * @param tid SR Tunnel Id to be associated with this policy |
| 49 | * |
| 50 | * @return "true/false" depending tunnel creation status |
| 51 | */ |
| 52 | public boolean createPolicy(String pid, MACAddress srcMac, MACAddress dstMac, |
| 53 | Short etherType, IPv4Net srcIp, IPv4Net dstIp, Byte ipProto, |
Sangho Shin | f65b4da | 2014-10-28 16:58:13 -0700 | [diff] [blame^] | 54 | Short srcPort, Short dstPort, int priority, String tid, PolicyType type); |
| 55 | |
| 56 | /** |
| 57 | * Create a policy for policy based segment routing |
| 58 | * |
| 59 | * @param pid Unique Policy Identifier |
| 60 | * @param srcIP Source IP address in CIDR format |
| 61 | * @param dstIP Destination IP address in CIDR format |
| 62 | * @param ipProto IP protocol type |
| 63 | * @param srcPort Source L4 port |
| 64 | * @param dstPort Destination L4 port |
| 65 | * @param priority Priority of the policy |
| 66 | * @param tid SR Tunnel Id to be associated with this policy |
| 67 | * |
| 68 | * @return "true/false" depending tunnel creation status |
| 69 | */ |
| 70 | public boolean createPolicy(String pid, MACAddress srcMac, MACAddress dstMac, |
| 71 | Short etherType, IPv4Net srcIp, IPv4Net dstIp, Byte ipProto, |
Srikanth Vavilapalli | fb38ed6 | 2014-10-20 13:34:01 -0700 | [diff] [blame] | 72 | Short srcPort, Short dstPort, int priority, String tid); |
| 73 | |
Sangho Shin | f65b4da | 2014-10-28 16:58:13 -0700 | [diff] [blame^] | 74 | |
Srikanth Vavilapalli | fb38ed6 | 2014-10-20 13:34:01 -0700 | [diff] [blame] | 75 | /** |
| 76 | * Remove a policy given policy Id |
| 77 | * |
| 78 | * @param pid Unique Policy Identifier |
| 79 | * |
| 80 | * @return "true/false" depending tunnel deletion status |
| 81 | */ |
| 82 | public boolean removePolicy(String pid); |
Fahad Naeem Khan | a40f9b6 | 2014-10-20 18:33:45 -0700 | [diff] [blame] | 83 | /** |
| 84 | * Return the collection of TunnelInfo which contains |
| 85 | * info about tunnels |
| 86 | * @return Collection<TunnelInfo> |
| 87 | */ |
Srikanth Vavilapalli | 1f6a574 | 2014-10-21 13:45:11 -0700 | [diff] [blame] | 88 | |
Sangho Shin | f65b4da | 2014-10-28 16:58:13 -0700 | [diff] [blame^] | 89 | public Collection<SegmentRoutingTunnel> getTunnelTable(); |
Fahad Naeem Khan | 95aa401 | 2014-10-21 14:07:00 -0700 | [diff] [blame] | 90 | /** |
| 91 | * Get the first group ID for the tunnel for specific source router |
| 92 | * If Segment Stitching was required to create the tunnel, there are |
| 93 | * mutiple source routers. |
| 94 | * |
| 95 | * @param tunnelId ID for the tunnel |
| 96 | * @param dpid source router DPID |
| 97 | * @return the first group ID of the tunnel and -1 if sw with specifed |
| 98 | * dpid is not found |
| 99 | */ |
| 100 | public int getTunnelGroupId(String tunnelId, String dpid); |
Fahad Naeem Khan | 12fa63a | 2014-10-21 17:01:27 -0700 | [diff] [blame] | 101 | /** |
| 102 | * return list of all the policies currently there in Segment Router |
| 103 | * @return Collection<PolicyInfo> |
| 104 | */ |
Sangho Shin | f65b4da | 2014-10-28 16:58:13 -0700 | [diff] [blame^] | 105 | public Collection<SegmentRoutingPolicy> getPoclicyTable(); |
Fahad Naeem Khan | d1ac370 | 2014-10-22 15:59:31 -0700 | [diff] [blame] | 106 | /** |
| 107 | * Returns the Adjacency Info for the node |
| 108 | * |
| 109 | * @param nodeSid Node SID |
| 110 | * @return HashMap of <AdjacencyID, list of ports> |
| 111 | */ |
| 112 | public HashMap<Integer, List<Integer>> getAdjacencyInfo(int nodeSid); |
| 113 | /** |
| 114 | * Returns the Adjacency IDs for the node |
| 115 | * |
| 116 | * @param nodeSid Node SID |
| 117 | * @return Collection of Adjacency ID |
| 118 | */ |
| 119 | public Collection<Integer> getAdjacencyIds(int nodeSid); |
Srikanth Vavilapalli | fb38ed6 | 2014-10-20 13:34:01 -0700 | [diff] [blame] | 120 | } |