blob: 30db4ec1c6a581d1ced5039fa4665dac52af53ee [file] [log] [blame]
lishuai7e6b3172015-11-20 15:42:28 +08001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
lishuai7e6b3172015-11-20 15:42:28 +08003 *
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 */
16package org.onosproject.vtn.table;
17
18import org.onlab.packet.IpAddress;
Bob zhou59a21062016-05-12 19:40:05 +080019import org.onlab.packet.IpPrefix;
lishuai7e6b3172015-11-20 15:42:28 +080020import org.onlab.packet.MacAddress;
21import org.onosproject.net.DeviceId;
Bob zhou59a21062016-05-12 19:40:05 +080022import org.onosproject.net.flow.TrafficSelector;
23import org.onosproject.net.flow.TrafficTreatment;
lishuai7e6b3172015-11-20 15:42:28 +080024import org.onosproject.net.flowobjective.Objective;
25import org.onosproject.vtnrsc.SegmentationId;
26
27/**
28 * SnatService interface provides the rules in SNAT table which is Table(40) for ovs pipeline.
29 * SNAT means Source Network Address Translation, it is acronym for network terminology.
30 * Handle the upward flows.
31 */
32public interface SnatService {
33
34 /**
35 * Assemble the SNAT table rules.
Bob zhou59a21062016-05-12 19:40:05 +080036 * Match: ipv4 type, vnid, destination ip and source ip.
37 * Action: set eth_src, set eth_dst, set ip_src, set vnid and goto L2Forward Table(50).
38 *
39 * @param deviceId Device Id
40 * @param matchVni the vni of L3 network
41 * @param srcIP source ip
42 * @param dstIP destination ip
43 * @param ethDst external gateway mac
44 * @param ethSrc external port mac
45 * @param ipSrc floating ip
46 * @param actionVni external network VNI
47 * @param type the operation type of the flow rules
48 */
49 void programSnatSameSegmentRules(DeviceId deviceId, SegmentationId matchVni,
50 IpAddress srcIP, IpAddress dstIP, MacAddress ethDst,
51 MacAddress ethSrc, IpAddress ipSrc,
52 SegmentationId actionVni, Objective.Operation type);
53 /**
54 * Assemble the SNAT table rules.
lishuai7e6b3172015-11-20 15:42:28 +080055 * Match: ipv4 type, vnid and source ip.
56 * Action: set eth_src, set eth_dst, set ip_src, set vnid and goto L2Forward Table(50).
57 *
58 * @param deviceId Device Id
59 * @param matchVni the vni of L3 network
60 * @param srcIP source ip
61 * @param ethDst external gateway mac
62 * @param ethSrc external port mac
63 * @param ipSrc floating ip
64 * @param actionVni external network VNI
65 * @param type the operation type of the flow rules
66 */
Bob zhou59a21062016-05-12 19:40:05 +080067 void programSnatDiffSegmentRules(DeviceId deviceId, SegmentationId matchVni,
lishuai7e6b3172015-11-20 15:42:28 +080068 IpAddress srcIP, MacAddress ethDst,
69 MacAddress ethSrc, IpAddress ipSrc,
70 SegmentationId actionVni, Objective.Operation type);
Bob zhou59a21062016-05-12 19:40:05 +080071
72 /**
73 * Assemble the SNAT table rules.
74 * Match: ipv4 type, vnid, destination ip and source ip.
75 * Action: upload to controller.
76 *
77 * @param deviceId Device Id
78 * @param matchVni the vni of L3 network
79 * @param srcIP source ip
80 * @param dstIP destination ip
Avantika-Huawei09a6a2e2016-05-16 19:14:30 +053081 * @param prefix prefix
Bob zhou59a21062016-05-12 19:40:05 +080082 * @param type the operation type of the flow rules
83 */
84 void programSnatSameSegmentUploadControllerRules(DeviceId deviceId,
85 SegmentationId matchVni,
86 IpAddress srcIP,
87 IpAddress dstIP,
88 IpPrefix prefix,
89 Objective.Operation type);
90
91 /**
92 * Remove the SNAT table rules.
93 *
94 * @param deviceId Device Id
95 * @param selector selector of rules
96 * @param treatment treatment of rules
97 * @param priority priority of rules
98 * @param type the operation type of the flow rules
99 */
100 void removeSnatRules(DeviceId deviceId, TrafficSelector selector,
101 TrafficTreatment treatment, int priority,
102 Objective.Operation type);
lishuai7e6b3172015-11-20 15:42:28 +0800103}