Skip to content

Commit

Permalink
Syslog over TLS (ansible-collections#423)
Browse files Browse the repository at this point in the history
* Update logging.py

* Update sonic_logging.py

* Update main.yml

* Update sonic_logging.yaml

* Create 423-syslog-over-TLS.yaml
  • Loading branch information
arulkumar9690 authored Sep 5, 2024
1 parent 87a0e1b commit 4206b03
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelogs/fragments/423-syslog-over-TLS.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- sonic_logging - Add TLS protocol in sonic_logging module(https://github.com/ansible-collections/dellemc.enterprise_sonic/pull/423)
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def __init__(self, **kwargs):
'remote_port': {'type': 'int'},
'source_interface': {'type': 'str'},
'vrf': {'type': 'str'},
'protocol': {'choices': ['TCP', 'UDP'],
'protocol': {'choices': ['TCP', 'UDP', 'TLS'],
'type': 'str'},
},
'type': 'list'
Expand Down
9 changes: 9 additions & 0 deletions plugins/modules/sonic_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
- Type of the protocol for sending the messages.
choices:
- TCP
- TLS
- UDP
vrf:
type: str
Expand Down Expand Up @@ -109,6 +110,7 @@
#---------------------------------------------------------------------------------------
#10.11.0.2 5 Ethernet24 - event udp
#10.11.1.1 616 Ethernet8 - log tcp
#10.11.1.2 116 Ethernet6 - log tls
#log1.dell.com 6 Ethernet28 - log udp
#
- name: Delete logging server configuration
Expand All @@ -127,6 +129,7 @@
#HOST PORT SOURCE-INTERFACE VRF MESSAGE-TYPE PROTOCOL
#---------------------------------------------------------------------------------------
#10.11.1.1 616 Ethernet8 - log tcp
#10.11.1.2 116 Ethernet6 - log tls
#
#
# Using merged
Expand All @@ -149,6 +152,10 @@
protocol: TCP
source_interface: Ethernet24
message_type: event
- host: 10.11.0.1
remote_port: 4
protocol: TLS
source_interface: Ethernet2
- host: log1.dell.com
remote_port: 6
protocol: udp
Expand All @@ -163,6 +170,7 @@
#HOST PORT SOURCE-INTERFACE VRF MESSAGE-TYPE PROTOCOL
#-------------------------------------------------------------------------------------
#10.11.0.2 5 Ethernet24 - event udp
#10.11.0.1 4 Ethernet2 - log tls
#10.11.1.1 616 Ethernet8 - log tcp
#log1.dell.com 6 Ethernet28 - log udp
#
Expand All @@ -178,6 +186,7 @@
#--------------------------------------------------------------------------------------
#10.11.1.1 616 Ethernet8 - log tcp
#10.11.1.2 626 Ethernet16 - event udp
#10.11.1.3 626 Ethernet14 - log tls
#
- name: Replace logging server configuration
sonic_logging:
Expand Down
13 changes: 13 additions & 0 deletions tests/regression/roles/sonic_logging/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ logging_ip_server_3: 10.11.0.3
logging_ip_server_4: 10.11.0.4
logging_ip_server_5: 10.11.0.5
logging_ip_server_6: 10.11.0.6
logging_ip_server_7: 10.11.0.7
logging_ip_server_8: 10.11.0.8
logging_host_server: logging.dell.com

tests:
Expand Down Expand Up @@ -41,6 +43,11 @@ tests:
protocol: TCP
message_type: event
vrf: Vrf_logging_2
- host: "{{ logging_ip_server_7 }}"
source_interface: "{{ vlan1 }}"
remote_port: 808
protocol: TLS
message_type: event
- host: "{{ logging_ip_server_4 }}"
source_interface: "{{ mgmt }}"
message_type: event
Expand Down Expand Up @@ -79,6 +86,11 @@ tests:
remote_port: 868
protocol: TCP
message_type: event
- host: "{{ logging_ip_server_8 }}"
source_interface: "{{ interface5 }}"
remote_port: 818
protocol: TLS
message_type: event

- name: test_case_05
description: Overridden logging remote servers
Expand Down Expand Up @@ -129,6 +141,7 @@ tests:
remote_servers:
- host: "{{ logging_ip_server_2 }}"
- host: "{{ logging_ip_server_3 }}"
- host: "{{ logging_ip_server_7 }}"
- host: "{{ logging_host_server }}"

- name: test_case_09
Expand Down
25 changes: 25 additions & 0 deletions tests/unit/modules/network/sonic/fixtures/sonic_logging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ merged_01:
protocol: TCP
source_interface: Eth1/24
message_type: event
- host: 10.11.0.3
remote_port: 4
protocol: TLS
source_interface: Eth1/22
message_type: log
- host: log1.dell.com
remote_port: 6
protocol: UDP
Expand All @@ -29,6 +34,13 @@ merged_01:
message-type: event
remote-port: 5
protocol: TCP
- host: 10.11.0.3
config:
host: 10.11.0.3
source-interface: Eth1/22
message-type: log
remote-port: 4
protocol: TLS
- host: log1.dell.com
config:
host: log1.dell.com
Expand Down Expand Up @@ -107,6 +119,11 @@ replaced_01:
source_interface: Eth1/25
message_type: log
protocol: TCP
- host: 10.11.0.3
remote_port: 8
source_interface: Eth1/26
message_type: log
protocol: TLS
existing_logging_config:
- path: "data/openconfig-system:system/logging"
response:
Expand Down Expand Up @@ -134,6 +151,14 @@ replaced_01:
data:
openconfig-system:remote-servers:
remote-server:
- host: 10.11.0.3
config:
host: 10.11.0.3
source-interface: Eth1/26
message-type: log
remote-port: 8
protocol: TLS
vrf-name:
- host: 10.11.0.2
config:
host: 10.11.0.2
Expand Down

0 comments on commit 4206b03

Please sign in to comment.