Binds OpenFlow and OVSDB IPs 78/76478/1
authorTim Rozet <trozet@redhat.com>
Fri, 28 Sep 2018 01:51:23 +0000 (21:51 -0400)
committerTim Rozet <trozet@redhat.com>
Fri, 28 Sep 2018 01:51:23 +0000 (21:51 -0400)
The odl_bind_ip has been used to bind the northbound HTTP REST server to
a fixed IP, however the OVSDB and OpenFlow services were running on
0.0.0.0. This patch binds those services as well.

Change-Id: I7173706b3e812adc0ad899f2a3b6f4b28b91897f
Signed-off-by: Tim Rozet <trozet@redhat.com>
CHANGELOG
manifests/config.pp
manifests/init.pp
metadata.json
spec/classes/opendaylight_spec.rb
spec/spec_helper.rb
spec/spec_helper_acceptance.rb
templates/default-openflow-connection-config.xml.erb
templates/org.opendaylight.ovsdb.library.cfg.erb [moved from files/org.opendaylight.ovsdb.library.cfg with 92% similarity]

index 36fb52a76821ed58aa581404c3f8ac85a665060e..a20fe9848b895d5416cd8866e3abc44dc48d35e5 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -84,3 +84,5 @@
 - Enable IPv6 deployment
 2018-09-18 Release 8.4.1
 - Fix opendaylight karaf log file rotation
+2018-09-27 Release 8.4.2
+- Bind OVSDB and OpenFlow addresses to specific IP
index fba6e55c0c203e3bc3b8c722db873f7683b558e8..a3b33cab4e8f633f28b6d20f6f31bc99124bd62a 100644 (file)
@@ -131,15 +131,6 @@ class opendaylight::config {
       require => File['org.ops4j.pax.web.cfg']
     }
 
-    # Enable TLS with OVSDB
-    file { 'org.opendaylight.ovsdb.library.cfg':
-      ensure => file,
-      path   => '/opt/opendaylight/etc/org.opendaylight.ovsdb.library.cfg',
-      owner  => 'odl',
-      group  => 'odl',
-      source => 'puppet:///modules/opendaylight/org.opendaylight.ovsdb.library.cfg',
-    }
-
     # Configure OpenFlow plugin to use TLS
     $transport_protocol = 'TLS'
   } else {
@@ -161,6 +152,16 @@ class opendaylight::config {
       require => File['org.ops4j.pax.web.cfg']
     }
   }
+
+  # Configure OVSDB
+  file { 'org.opendaylight.ovsdb.library.cfg':
+    ensure  => file,
+    path    => '/opt/opendaylight/etc/org.opendaylight.ovsdb.library.cfg',
+    owner   => 'odl',
+    group   => 'odl',
+    content => template('opendaylight/org.opendaylight.ovsdb.library.cfg.erb'),
+  }
+
   # Configure OpenFlow plugin to use TCP/TLS
   file { 'default-openflow-connection-config.xml':
     ensure  => file,
index e80bc5aee259cb156e8a129cb0b923bd69b74fec..f485edda64f605fbf0b99beffabc7e5e31e751f2 100644 (file)
@@ -11,7 +11,7 @@
 # [*odl_rest_port *]
 #   Port for ODL northbound REST interface to listen on.
 # [*odl_bind_ip *]
-#   IP for ODL northbound REST interface to bind to.
+#   IP for ODL northbound REST interface and southbound OVSDB/OpenFlow to bind to.
 # [*rpm_repo*]
 #   Repo URL to install ODL RPM from, in .repo baseurl format.
 # [*deb_repo*]
index 667feaceb924426bcbdd1529890872667a1a3b70..45408dd6073e91f15e6a1cb0929a776f635fdb75 100644 (file)
@@ -1,6 +1,6 @@
 {
     "name": "opendaylight-opendaylight",
-    "version": "8.4.1",
+    "version": "8.4.2",
     "author": "Daniel Farrell",
     "summary": "Puppet module that installs and configures the OpenDaylight SDN controller",
     "license": "BSD-2-Clause",
index 7013d2204f992616e1742ad517cd2f4deeb0bf50..ace2dacff62daed0ead97759ea07cfe31431415b 100644 (file)
@@ -365,7 +365,7 @@ describe 'opendaylight' do
 
       # Run shared tests applicable to all supported OSs
       # Note that this function is defined in spec_helper
-      generic_tests
+      generic_tests(odl_bind_ip: '127.0.0.1')
 
       # Run test that specialize in checking ODL REST port config
       # Note that this function is defined in spec_helper
@@ -1033,7 +1033,7 @@ describe 'opendaylight' do
 
       # Run shared tests applicable to all supported OSs
       # Note that this function is defined in spec_helper
-      generic_tests
+      generic_tests(odl_bind_ip: '127.0.0.1')
 
       # Run test that specialize in checking websocket address
       # Note that this function is defined in spec_helper
index 06dbf1cb5d474f427ae418c0dfacf41078164e77..1000321d4bbe2c898cf54cc04b1de7d38de2ccf4 100644 (file)
@@ -15,7 +15,7 @@ RSpec::Puppet::Coverage.filters.push(*custom_filters)
 # Tests that are common to all possible configurations
 def generic_tests(options = {})
   java_opts = options.fetch(:java_opts, '')
-  odl_bind_ip = options.fetch(:odl_bind_ip, '127.0.0.1')
+  odl_bind_ip = options.fetch(:odl_bind_ip, '0.0.0.0')
 
   # Confirm that module compiles
   it { should compile }
@@ -79,6 +79,26 @@ def generic_tests(options = {})
     )
   }
 
+  it {
+    should contain_file('org.opendaylight.ovsdb.library.cfg').with(
+      'ensure'  => 'file',
+      'path'    => '/opt/opendaylight/etc/org.opendaylight.ovsdb.library.cfg',
+      'owner'   => 'odl',
+      'group'   => 'odl',
+      'content' =>  /ovsdb-listener-ip = #{odl_bind_ip}/
+    )
+  }
+
+  it {
+    should contain_file('default-openflow-connection-config.xml').with(
+      'ensure'  => 'file',
+      'path'    => '/opt/opendaylight/etc/opendaylight/datastore/initial/config/default-openflow-connection-config.xml',
+      'owner'   => 'odl',
+      'group'   => 'odl',
+      'content' =>  /<address>#{odl_bind_ip}<\/address>/
+    )
+  }
+
 end
 
 # Shared tests that specialize in testing log file size and rollover
@@ -587,11 +607,11 @@ def odl_tls_tests(options = {})
         'group'   => 'odl',
       )
       should contain_file('org.opendaylight.ovsdb.library.cfg').with(
-        'ensure' => 'file',
-        'path'   => '/opt/opendaylight/etc/org.opendaylight.ovsdb.library.cfg',
-        'owner'  => 'odl',
-        'group'  => 'odl',
-        'source' => 'puppet:///modules/opendaylight/org.opendaylight.ovsdb.library.cfg'
+        'ensure'  => 'file',
+        'path'    => '/opt/opendaylight/etc/org.opendaylight.ovsdb.library.cfg',
+        'owner'   => 'odl',
+        'group'   => 'odl',
+        'content' =>  /use-ssl = true/
       )
       should contain_file('/opt/opendaylight/configuration/ssl').with(
         'ensure' => 'directory',
@@ -651,4 +671,4 @@ def stats_polling_enablement_tests(options = {})
       'match'  => '^is-statistics-polling-on=.*$',
     )
   }
-end
\ No newline at end of file
+end
index 339ed420faa50b3e5fc7c6866df0f3f31a1d8ac8..389fabc6843b731c0b983b18eb0996ea1a860a95 100644 (file)
@@ -322,9 +322,31 @@ def odl_bind_ip_validation(options = {})
       its(:content) { should match /sshHost = #{odl_bind_ip}/ }
     end
 
+    describe file('/opt/opendaylight/etc/org.opendaylight.ovsdb.library.cfg') do
+      it { should be_file }
+      it { should be_owned_by 'odl' }
+      it { should be_grouped_into 'odl' }
+      its(:content) { should match /ovsdb-listener-ip = #{odl_bind_ip}/ }
+    end
+
+    describe file('/opt/opendaylight/etc/opendaylight/datastore/initial/config/default-openflow-connection-config.xml') do
+      it { should be_file }
+      it { should be_owned_by 'odl' }
+      it { should be_grouped_into 'odl' }
+      its(:content) { should match /<address>#{odl_bind_ip}<\/address>/ }
+    end
+
     describe command("loop_count=0; until [[ \$loop_count -ge 30 ]]; do netstat -punta | grep 8101 | grep #{odl_bind_ip} && break; loop_count=\$[\$loop_count+1]; sleep 1; done; echo \"Waited \$loop_count seconds to detect ODL karaf bound to IP\"") do
       its(:exit_status) { should eq 0 }
     end
+
+    describe command("loop_count=0; until [[ \$loop_count -ge 60 ]]; do netstat -punta | grep 6653 | grep #{odl_bind_ip} && break; loop_count=\$[\$loop_count+1]; sleep 1; done; echo \"Waited \$loop_count seconds to detect ODL karaf bound to IP\"") do
+      its(:exit_status) { should eq 0 }
+    end
+
+    describe command("loop_count=0; until [[ \$loop_count -ge 60 ]]; do netstat -punta | grep 6640 | grep #{odl_bind_ip} && break; loop_count=\$[\$loop_count+1]; sleep 1; done; echo \"Waited \$loop_count seconds to detect ODL karaf bound to IP\"") do
+      its(:exit_status) { should eq 0 }
+    end
   end
 end
 
index 3736fb551a47b0727f50f64362bea2f6df7942cb..2912ca9b7e1bb348b88a8a14c89513fdd4126eb3 100644 (file)
@@ -1,6 +1,7 @@
 <switch-connection-config xmlns="urn:opendaylight:params:xml:ns:yang:openflow:switch:connection:config">
   <instance-name>openflow-switch-connection-provider-default-impl</instance-name>
   <port>6653</port>
+  <address><%= scope.lookupvar('opendaylight::odl_bind_ip') %></address>
   <transport-protocol><%= scope.lookupvar('opendaylight::config::transport_protocol') %></transport-protocol>
   <tls>
      <keystore>configuration/ssl/ctl.jks</keystore>
similarity index 92%
rename from files/org.opendaylight.ovsdb.library.cfg
rename to templates/org.opendaylight.ovsdb.library.cfg.erb
index cdb9b17978c780373699f4560218395bf131f744..ead2c83c153181202297aa186cada83709ca5dab 100644 (file)
@@ -7,10 +7,12 @@
 #default listens on port 6640 for switch initiated connection. Please use following config
 #knob for changing this default port.
 ovsdb-listener-port = 6640
+ovsdb-listener-ip = <%= scope.lookupvar('opendaylight::odl_bind_ip') %>
 
 #This flag will be enforced across all the connection's (passive and active) if set to true
+<%- if scope.lookupvar('opendaylight::enable_tls') -%>
 use-ssl = true
-
+<%- end -%>
 #Set Json Rpc decoder max frame length value. If the OVSDB node contains large configurations
 #that can cause connection related issue while reading the configuration from the OVSDB node
 #database. Increasing the max frame lenge helps resolve the issue. Please see following bug