lishuai | 6c56f5e | 2015-11-17 16:38:19 +0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
lishuai | 6c56f5e | 2015-11-17 16:38:19 +0800 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | package org.onosproject.vtn.table; |
| 17 | |
lishuai | 7547db4 | 2015-11-20 14:56:11 +0800 | [diff] [blame] | 18 | import org.onlab.packet.IpAddress; |
Wu wenbin | acc10ea | 2016-05-06 16:48:56 +0800 | [diff] [blame] | 19 | import org.onlab.packet.IpPrefix; |
lishuai | 6c56f5e | 2015-11-17 16:38:19 +0800 | [diff] [blame] | 20 | import org.onlab.packet.MacAddress; |
| 21 | import org.onosproject.core.ApplicationId; |
| 22 | import org.onosproject.net.DeviceId; |
Bob zhou | 59a2106 | 2016-05-12 19:40:05 +0800 | [diff] [blame^] | 23 | import org.onosproject.net.Port; |
lishuai | 6c56f5e | 2015-11-17 16:38:19 +0800 | [diff] [blame] | 24 | import org.onosproject.net.PortNumber; |
| 25 | import org.onosproject.net.flowobjective.Objective; |
Bob zhou | 59a2106 | 2016-05-12 19:40:05 +0800 | [diff] [blame^] | 26 | import org.onosproject.net.flowobjective.Objective.Operation; |
lishuai | 6c56f5e | 2015-11-17 16:38:19 +0800 | [diff] [blame] | 27 | import org.onosproject.vtnrsc.SegmentationId; |
| 28 | |
| 29 | /** |
lishuai | 7547db4 | 2015-11-20 14:56:11 +0800 | [diff] [blame] | 30 | * Applies classifier flows to the device. Classifier table is Table(0). |
lishuai | 6c56f5e | 2015-11-17 16:38:19 +0800 | [diff] [blame] | 31 | */ |
| 32 | public interface ClassifierService { |
| 33 | |
| 34 | /** |
| 35 | * The port rule that message from host matches Table(0) Match: host mac and |
lishuai | 7547db4 | 2015-11-20 14:56:11 +0800 | [diff] [blame] | 36 | * ingress port Action: set vnid and go to L2Forward Table(50). |
lishuai | 6c56f5e | 2015-11-17 16:38:19 +0800 | [diff] [blame] | 37 | * |
| 38 | * @param deviceId Device Id |
| 39 | * @param segmentationId the vnid of the host belong to |
| 40 | * @param inPort the ingress port of the host |
| 41 | * @param srcMac the mac of the host |
| 42 | * @param appId the application ID of the vtn |
| 43 | * @param type the operation of the flow |
| 44 | */ |
| 45 | void programLocalIn(DeviceId deviceId, SegmentationId segmentationId, |
| 46 | PortNumber inPort, MacAddress srcMac, |
| 47 | ApplicationId appId, Objective.Operation type); |
| 48 | |
| 49 | /** |
| 50 | * The port rule that message from tunnel Table(0) Match: tunnel port and |
lishuai | 7547db4 | 2015-11-20 14:56:11 +0800 | [diff] [blame] | 51 | * vnid Action: go to L2Forward Table(50). |
lishuai | 6c56f5e | 2015-11-17 16:38:19 +0800 | [diff] [blame] | 52 | * |
| 53 | * @param deviceId Device Id |
| 54 | * @param segmentationId the vnid of the host belong to |
| 55 | * @param localTunnelPorts the tunnel pors of the device |
| 56 | * @param type the operation of the flow |
| 57 | */ |
| 58 | void programTunnelIn(DeviceId deviceId, SegmentationId segmentationId, |
| 59 | Iterable<PortNumber> localTunnelPorts, |
| 60 | Objective.Operation type); |
| 61 | |
lishuai | 7547db4 | 2015-11-20 14:56:11 +0800 | [diff] [blame] | 62 | /** |
| 63 | * Assemble the L3 Classifier table rules which are sended from external port. |
| 64 | * Match: ipv4 type, ingress port and destination ip. |
| 65 | * Action: go to DNAT Table(20). |
| 66 | * |
| 67 | * @param deviceId Device Id |
| 68 | * @param inPort external port |
| 69 | * @param dstIp floating ip |
| 70 | * @param type the operation type of the flow rules |
| 71 | */ |
| 72 | void programL3ExPortClassifierRules(DeviceId deviceId, PortNumber inPort, |
| 73 | IpAddress dstIp, |
| 74 | Objective.Operation type); |
| 75 | |
| 76 | /** |
| 77 | * Assemble the L3 Classifier table rules which are sended from internal port. |
| 78 | * Match: ingress port, source mac and destination mac. |
| 79 | * Action: set vnid and go to L3Forward Table(30). |
| 80 | * |
| 81 | * @param deviceId Device Id |
| 82 | * @param inPort the ingress port of the host |
| 83 | * @param srcMac source mac |
| 84 | * @param dstMac destination vm gateway mac |
| 85 | * @param actionVni the vni of L3 network |
| 86 | * @param type the operation type of the flow rules |
| 87 | */ |
| 88 | void programL3InPortClassifierRules(DeviceId deviceId, |
| 89 | PortNumber inPort, MacAddress srcMac, |
| 90 | MacAddress dstMac, |
| 91 | SegmentationId actionVni, |
| 92 | Objective.Operation type); |
| 93 | |
| 94 | /** |
| 95 | * Assemble the Arp Classifier table rules. |
| 96 | * Match: arp type and destination ip. |
| 97 | * Action: set vnid and go to ARP Table(10). |
| 98 | * |
| 99 | * @param deviceId Device Id |
| 100 | * @param dstIp source gateway ip |
| 101 | * @param actionVni the vni of the source network (l2vni) |
| 102 | * @param type the operation type of the flow rules |
| 103 | */ |
| 104 | void programArpClassifierRules(DeviceId deviceId, IpAddress dstIp, |
| 105 | SegmentationId actionVni, |
| 106 | Objective.Operation type); |
| 107 | |
Wu wenbin | acc10ea | 2016-05-06 16:48:56 +0800 | [diff] [blame] | 108 | /** |
lishuai | cfd96d2 | 2016-05-09 16:00:01 +0800 | [diff] [blame] | 109 | * Assemble the Arp Classifier table rules. |
| 110 | * Match: arp type and destination ip. |
| 111 | * Action: set vnid and go to ARP Table(10). |
| 112 | * |
| 113 | * @param deviceId Device Id |
| 114 | * @param inPort the ingress port of the host |
| 115 | * @param dstIp source gateway ip |
| 116 | * @param actionVni the vni of the source network (l2vni) |
| 117 | * @param type the operation type of the flow rules |
| 118 | */ |
| 119 | void programArpClassifierRules(DeviceId deviceId, PortNumber inPort, |
| 120 | IpAddress dstIp, SegmentationId actionVni, |
| 121 | Objective.Operation type); |
| 122 | |
| 123 | /** |
Wu wenbin | acc10ea | 2016-05-06 16:48:56 +0800 | [diff] [blame] | 124 | * Assemble the Userdata Classifier table rules. |
| 125 | * Match: subnet ip prefix and destination ip. |
| 126 | * Action: add flow rule to specific ip for userdata. |
| 127 | * |
| 128 | * @param deviceId Device Id |
| 129 | * @param ipPrefix source ip prefix |
| 130 | * @param dstIp userdata ip |
| 131 | * @param dstmac dst mac |
| 132 | * @param actionVni the vni of the source network (l2vni) |
| 133 | * @param type the operation type of the flow rules |
| 134 | */ |
| 135 | void programUserdataClassifierRules(DeviceId deviceId, IpPrefix ipPrefix, |
| 136 | IpAddress dstIp, MacAddress dstmac, |
| 137 | SegmentationId actionVni, |
| 138 | Objective.Operation type); |
Bob zhou | 59a2106 | 2016-05-12 19:40:05 +0800 | [diff] [blame^] | 139 | |
| 140 | /** |
| 141 | * Assemble the export port Arp Classifier table rules. |
| 142 | * Match: export port. |
| 143 | * Action: upload packet to controller. |
| 144 | * |
| 145 | * @param exportPort export port of ovs |
| 146 | * @param deviceId Device Id |
| 147 | * @param type the operation type of the flow rules |
| 148 | */ |
| 149 | void programExportPortArpClassifierRules(Port exportPort, DeviceId deviceId, |
| 150 | Operation type); |
lishuai | 6c56f5e | 2015-11-17 16:38:19 +0800 | [diff] [blame] | 151 | } |