Changeset - 8d67cca58871
[Not reviewed]
0 3 0
Branko Majic (branko) - 2 months ago 2025-01-21 23:13:11
branko@majic.rs
MAR-233: Replace hping3 with nmap and add IPv6 connectivity tests in the ldap_server role.
3 files changed with 24 insertions and 8 deletions:
0 comments (0 inline, 0 general) First comment
roles/ldap_server/molecule/default/molecule.yml
Show inline comments
 
@@ -20,6 +20,11 @@ platforms:
 
        ip: 192.168.56.11
 
        network_name: private_network
 
        type: static
 
      - auto_config: true
 
        ip: fd00::192:168:56:11
 
        network_name: private_network
 
        netmask: 116
 
        type: static
 

	
 
  - name: parameters-mandatory-bookworm
 
    groups:
 
@@ -32,6 +37,11 @@ platforms:
 
        ip: 192.168.56.21
 
        network_name: private_network
 
        type: static
 
      - auto_config: true
 
        ip: fd00::192:168:56:21
 
        network_name: private_network
 
        netmask: 116
 
        type: static
 

	
 
  - name: parameters-optional-bookworm
 
    groups:
 
@@ -45,6 +55,11 @@ platforms:
 
        ip: 192.168.56.22
 
        network_name: private_network
 
        type: static
 
      - auto_config: true
 
        ip: fd00::192:168:56:22
 
        network_name: private_network
 
        netmask: 116
 
        type: static
 

	
 
provisioner:
 
  name: ansible
roles/ldap_server/molecule/default/prepare.yml
Show inline comments
 
@@ -70,11 +70,6 @@
 
  become: true
 
  tasks:
 

	
 
    - name: Install tool for teting TCP connectivity
 
      ansible.builtin.apt:
 
        name: hping3
 
        state: present
 

	
 
    - name: Set-up /etc/hosts with entries for all servers
 
      ansible.builtin.lineinfile:
 
        path: /etc/hosts
 
@@ -87,6 +82,9 @@
 
      with_dict:
 
        192.168.56.21: parameters-mandatory-bookworm
 
        192.168.56.22: parameters-optional-bookworm
 
        fd00::192:168:56:21: parameters-mandatory-bookworm
 
        fd00::192:168:56:22: parameters-optional-bookworm
 

	
 

	
 
- name: Prepare, test fixtures
 
  hosts: parameters-optional
roles/ldap_server/molecule/default/tests/test_client.py
Show inline comments
 
@@ -12,12 +12,15 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
 
@pytest.mark.parametrize('server', testinfra.utils.ansible_runner.AnsibleRunner(
 
    os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('parameters-*')
 
)
 
def test_connectivity(host, server):
 
@pytest.mark.parametrize('ip_protocol', [4, 6])
 
def test_connectivity(host, server, ip_protocol):
 

	
 
    with host.sudo():
 

	
 
        ping = host.run('hping3 -S -p 389 -c 1 %s', server)
 
        ping = host.run('nmap -%s -p 389 -oG - %s', str(ip_protocol), server)
 
        assert ping.rc == 0
 
        assert "Ports: 389/open/tcp//ldap/" in ping.stdout
 

	
 
        ping = host.run('hping3 -S -p 636 -c 1 %s', server)
 
        ping = host.run('nmap -%s -p 636 -oG - %s', str(ip_protocol), server)
 
        assert ping.rc == 0
 
        assert "Ports: 636/open/tcp//ldapssl/" in ping.stdout
0 comments (0 inline, 0 general) First comment
You need to be logged in to comment. Login now