lishuai
Committed by li shuai

[ONOS-2835] Define a SnatService interface providing the rules in SNAT

table.

Change-Id: Ib7be8684ce2dfdc7b22526163c1e4b2f2b8aceba
1 +/*
2 + * Copyright 2015 Open Networking Laboratory
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 +
18 +import org.onlab.packet.IpAddress;
19 +import org.onlab.packet.MacAddress;
20 +import org.onosproject.net.DeviceId;
21 +import org.onosproject.net.flowobjective.Objective;
22 +import org.onosproject.vtnrsc.SegmentationId;
23 +
24 +/**
25 + * SnatService interface provides the rules in SNAT table which is Table(40) for ovs pipeline.
26 + * SNAT means Source Network Address Translation, it is acronym for network terminology.
27 + * Handle the upward flows.
28 + */
29 +public interface SnatService {
30 +
31 + /**
32 + * Assemble the SNAT table rules.
33 + * Match: ipv4 type, vnid and source ip.
34 + * Action: set eth_src, set eth_dst, set ip_src, set vnid and goto L2Forward Table(50).
35 + *
36 + * @param deviceId Device Id
37 + * @param matchVni the vni of L3 network
38 + * @param srcIP source ip
39 + * @param ethDst external gateway mac
40 + * @param ethSrc external port mac
41 + * @param ipSrc floating ip
42 + * @param actionVni external network VNI
43 + * @param type the operation type of the flow rules
44 + */
45 + void programRules(DeviceId deviceId, SegmentationId matchVni,
46 + IpAddress srcIP, MacAddress ethDst,
47 + MacAddress ethSrc, IpAddress ipSrc,
48 + SegmentationId actionVni, Objective.Operation type);
49 +}