[odl] Set conntrack as netvirt nat mode 37/66337/3
authorMichael Polenchuk <mpolenchuk@mirantis.com>
Fri, 11 Jan 2019 10:30:52 +0000 (14:30 +0400)
committerMichael Polenchuk <mpolenchuk@mirantis.com>
Mon, 14 Jan 2019 13:26:32 +0000 (17:26 +0400)
The conntrack-based SNAT uses the Linux netfilter framework to
do the NAPT and track the connection. The first packet in a traffic is
passed to the netfilter to be translated with the external IP. The
following packets will use the netfilter for further inbound and
outbound translation.

Change-Id: I1090b4fe041f8d9533aa4ce1964284a4a5c073ce
Signed-off-by: Michael Polenchuk <mpolenchuk@mirantis.com>
mcp/reclass/classes/cluster/mcp-odl-ha/opendaylight/control.yml.j2
mcp/reclass/classes/cluster/mcp-odl-noha/opendaylight/control.yml.j2
mcp/salt-formulas/salt-formula-opendaylight/opendaylight/files/netvirt-natservice-config.xml [new file with mode: 0644]
mcp/salt-formulas/salt-formula-opendaylight/opendaylight/server.sls

index 107965e..3c8a35e 100644 (file)
@@ -22,6 +22,7 @@ parameters:
       java_min_mem: 6g
       java_max_mem: 6g
       router_enabled: true
+      netvirt_nat_mode: conntrack
       karaf_features:
         odl_default:
           - odl-restconf-all
index aba648c..7826348 100644 (file)
@@ -22,6 +22,7 @@ parameters:
       java_min_mem: 3g
       java_max_mem: 3g
       router_enabled: true
+      netvirt_nat_mode: conntrack
       karaf_features:
         odl_default:
           - odl-restconf-all
diff --git a/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/files/netvirt-natservice-config.xml b/mcp/salt-formulas/salt-formula-opendaylight/opendaylight/files/netvirt-natservice-config.xml
new file mode 100644 (file)
index 0000000..266689e
--- /dev/null
@@ -0,0 +1,23 @@
+{%- from "opendaylight/map.jinja" import server with context -%}
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<natservice-config xmlns="urn:opendaylight:netvirt:natservice:config">
+  <nat-mode>{{ server.netvirt_nat_mode }}</nat-mode>
+  <snat-punt-timeout>5</snat-punt-timeout>
+</natservice-config>
index e4ebecf..e688575 100644 (file)
@@ -147,6 +147,17 @@ opendaylight:
       - service: opendaylight
 {%- endif %}
 
+{%- if server.netvirt_nat_mode is defined %}
+/opt/opendaylight/etc/opendaylight/datastore/initial/config/netvirt-natservice-config.xml:
+  file.managed:
+  - source: salt://opendaylight/files/netvirt-natservice-config.xml
+  - makedirs: true
+  - watch_in:
+    - service: opendaylight
+  - use:
+    - file: /opt/opendaylight/etc/jetty.xml
+{%- endif %}
+
 {%- if server.dhcp.enabled %}
 /opt/opendaylight/etc/opendaylight/datastore/initial/config/netvirt-dhcpservice-config.xml:
   file.managed: