From f8397fe71bae28a4126bbdf38da0731ba529b4c0 Mon Sep 17 00:00:00 2001
From: Nicolas Alvarez <nicolas.alvarez@windriver.com>
Date: Thu, 26 Nov 2020 16:51:32 -0300
Subject: [PATCH] Delete SNMP Host-Based entries.

Delete entries related with SNMP Host-Based.

Story: 2008132
Task: 41323
Signed-off-by: Nicolas Alvarez <nicolas.alvarez@windriver.com>
Depends-On: https://review.opendev.org/766094

Change-Id: I2c4a89fd7c4bac9895311787663a6d693600b090
---
 .../modules/platform/manifests/firewall.pp    |  3 +-
 .../src/modules/platform/manifests/snmp.pp    | 28 ----------------
 .../platform/templates/fm.snmp.conf.erb       |  6 ----
 .../platform/templates/remotelogging.conf.erb |  1 -
 .../modules/platform/templates/snmpd.conf.erb | 33 -------------------
 5 files changed, 1 insertion(+), 70 deletions(-)
 delete mode 100644 puppet-manifests/src/modules/platform/manifests/snmp.pp
 delete mode 100644 puppet-manifests/src/modules/platform/templates/fm.snmp.conf.erb
 delete mode 100644 puppet-manifests/src/modules/platform/templates/snmpd.conf.erb

diff --git a/puppet-manifests/src/modules/platform/manifests/firewall.pp b/puppet-manifests/src/modules/platform/manifests/firewall.pp
index 51dca6241..b4bc0175e 100644
--- a/puppet-manifests/src/modules/platform/manifests/firewall.pp
+++ b/puppet-manifests/src/modules/platform/manifests/firewall.pp
@@ -103,7 +103,6 @@ class platform::firewall::calico::oam::services {
   # udp
   $sm_port = [2222, 2223]
   $ntp_port = [123]
-  $snmp_port = [161, 162]
   $ptp_port = [319, 320]
 
   # tcp
@@ -153,7 +152,7 @@ class platform::firewall::calico::oam::services {
   }
 
   $t_ip_version = $ip_version
-  $t_udp_ports = concat($sm_port, $ntp_port, $snmp_port, $ptp_port)
+  $t_udp_ports = concat($sm_port, $ntp_port, $ptp_port)
   $t_tcp_ports = concat($ssh_port,
                         $fm_port, $nfv_vim_port, $patching_port, $sysinv_port, $sm_api_port,
                         $kube_apiserver_port, $docker_registry_port, $docker_token_port,
diff --git a/puppet-manifests/src/modules/platform/manifests/snmp.pp b/puppet-manifests/src/modules/platform/manifests/snmp.pp
deleted file mode 100644
index efbbaf732..000000000
--- a/puppet-manifests/src/modules/platform/manifests/snmp.pp
+++ /dev/null
@@ -1,28 +0,0 @@
-class platform::snmp::params (
-  $community_strings = [],
-  $trap_destinations = [],
-  $system_name = '',
-  $system_location = '?',
-  $system_contact = '?',
-  $system_info = '',
-  $software_version = '',
-) { }
-
-class platform::snmp::runtime
-  inherits ::platform::snmp::params {
-
-  $software_version = $::platform::params::software_version
-  $system_info = $::system_info
-
-  file { '/etc/snmp/snmpd.conf':
-      ensure  => 'present',
-      replace => true,
-      content => template('platform/snmpd.conf.erb')
-  }
-
-  # send HUP signal to snmpd if it is running
-  -> exec { 'notify-snmp':
-    command => '/usr/bin/pkill -HUP snmpd',
-    onlyif  => 'ps -ef | pgrep snmpd'
-  }
-}
diff --git a/puppet-manifests/src/modules/platform/templates/fm.snmp.conf.erb b/puppet-manifests/src/modules/platform/templates/fm.snmp.conf.erb
deleted file mode 100644
index 6822b9aff..000000000
--- a/puppet-manifests/src/modules/platform/templates/fm.snmp.conf.erb
+++ /dev/null
@@ -1,6 +0,0 @@
-[snmp]
-<%- @trap_destinations.each do |destination| -%>
-trap2sink=<%= destination %>
-<%- end -%>
-
-
diff --git a/puppet-manifests/src/modules/platform/templates/remotelogging.conf.erb b/puppet-manifests/src/modules/platform/templates/remotelogging.conf.erb
index ec0d571a8..e111aa6e1 100644
--- a/puppet-manifests/src/modules/platform/templates/remotelogging.conf.erb
+++ b/puppet-manifests/src/modules/platform/templates/remotelogging.conf.erb
@@ -61,7 +61,6 @@ rewrite r_rewrite_set{
   set("<%= @system_name %> syslog ${HOST}", value("HOST") condition(filter(f_syslog)));
   set("<%= @system_name %> user.log ${HOST}", value("HOST") condition(filter(f_user)));
   set("<%= @system_name %> uucp.log ${HOST}", value("HOST") condition(filter(f_uucp)));
-  set("<%= @system_name %> snmp-api.log ${HOST}", value("HOST") condition(filter(f_snmpat)));
   # Most logs write log level to the message field. some writes it to the PRIORITY field
   # The priority field is not sent remotely. This is because tcp/udp destinations don't
   # work well with templates, which we use to write the priority field to log files on the
diff --git a/puppet-manifests/src/modules/platform/templates/snmpd.conf.erb b/puppet-manifests/src/modules/platform/templates/snmpd.conf.erb
deleted file mode 100644
index 7acfcb8c4..000000000
--- a/puppet-manifests/src/modules/platform/templates/snmpd.conf.erb
+++ /dev/null
@@ -1,33 +0,0 @@
-###########################################################################
-#
-# snmpd.conf
-#
-#   - This file is managed by Puppet. DO NOT EDIT.
-#
-###########################################################################
-#           incl/excl subtree                          mask
-view all    included  .1                               80
-
-sysDescr <%= @software_version %> <%= @system_info %>
-sysObjectID  1.3.6.1.4.1.731.3
-sysContact <%= @system_contact %>
-sysName <%= @system_name %>
-sysLocation <%= @system_location %>
-sysServices 72
-
-[snmp] clientaddr oamcontroller
-dlmod cgtsAgentPlugin /usr/lib64/libcgtsAgentPlugin.so.1
-dlmod snmpAuditPlugin /usr/lib64/libsnmpAuditPlugin.so.1
-
-# Insert the snmpAudit hander into specific sections of the mib tree
-injectHandler snmpAudit null
-injectHandler snmpAudit bulk_to_next
-<%- @community_strings.each do |community| -%>
-rocommunity <%= community %>
-rocommunity6 <%= community %>
-<%- end -%>
-<%- @trap_destinations.each do |destination| -%>
-trap2sink <%= destination %>
-<%- end -%>
-
-