diff --git a/bin/fake-snmp-reset b/bin/fake-snmp-reset new file mode 100755 index 00000000..cec8a97e --- /dev/null +++ b/bin/fake-snmp-reset @@ -0,0 +1,50 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# Intended to be usable as a standalone script +# it is not a part of the AutoHCK module + +require 'json' +require 'logger' +require 'socket' + +@logger = Logger.new('fake-snmp-reset.txt') + +qmp_socket_file = ARGV[0] + +def send_cmd(qmp_socket, cmd) + @logger.info "Sending #{cmd} via QMP" + qmp_socket.write JSON.dump({ 'execute' => cmd }) + qmp_socket.flush + + loop do + response = JSON.parse(qmp_socket.readline) + break response['return'] if response.key?('return') + + @logger.error(response['error'].to_s) if response.key?('error') + end +end + +count = 0 + +@logger.info 'Initializing UDP socket' +UDPSocket.open do |socket| + socket.bind('0.0.0.0', 'snmp') + @logger.info "Listening on #{socket.local_address.inspect_sockaddr}" + + loop do + _, addr = socket.recvfrom(0) + @logger.info "Received data from #{addr[3]}:#{addr[1]}" + + # Emulate that we do not get the UDP packet immediately + sleep 2 + + @logger.info "Initializing QMP session for #{qmp_socket_file}" + UNIXSocket.open(qmp_socket_file) do |qmp_socket| + send_cmd(qmp_socket, 'qmp_capabilities') + send_cmd(qmp_socket, 'system_reset') + count += 1 + @logger.info "Rebooting... #{count}" + end + end +end diff --git a/bin/ns_unshared b/bin/ns_unshared index c952ba5f..522f5668 100755 --- a/bin/ns_unshared +++ b/bin/ns_unshared @@ -40,6 +40,10 @@ module AutoHCK %w[ip link set br_world up], %w[ip route add default via 10.0.2.2], %w[ip link add br_ctrl type bridge], + # See HLK-Setup-Scripts IP configuration + # https://github.com/HCK-CI/HLK-Setup-Scripts/blob/master/client.ps1 + # needed for access to host without full Internet access + %w[ip addr add 192.168.100.100/24 dev br_ctrl], %w[ip link set br_ctrl up], %w[ip link add br_test type bridge], %w[ip link set br_test up] diff --git a/lib/engines/hcktest/drivers/vioscsi.json b/lib/engines/hcktest/drivers/vioscsi.json index 3f60de54..09091d09 100644 --- a/lib/engines/hcktest/drivers/vioscsi.json +++ b/lib/engines/hcktest/drivers/vioscsi.json @@ -32,7 +32,6 @@ } ], "reject_test_names": [ - "Flush Test", "DF - Embedded Signature Verification Test (Certification)", "DF - Embedded Signature Verification Test (Tuning and Validation)", "Storage HBA Firmware Update", diff --git a/lib/engines/hcktest/drivers/viostor.json b/lib/engines/hcktest/drivers/viostor.json index 161e2a00..452b4dc3 100644 --- a/lib/engines/hcktest/drivers/viostor.json +++ b/lib/engines/hcktest/drivers/viostor.json @@ -32,7 +32,6 @@ } ], "reject_test_names": [ - "Flush Test", "DF - Embedded Signature Verification Test (Certification)", "DF - Embedded Signature Verification Test (Tuning and Validation)", "Thin Provisioning SCSI Compliance Test (LOGO)", diff --git a/lib/engines/hcktest/hcktest.json b/lib/engines/hcktest/hcktest.json index ff149e50..a7843df0 100644 --- a/lib/engines/hcktest/hcktest.json +++ b/lib/engines/hcktest/hcktest.json @@ -20,6 +20,21 @@ "value": 0 } ] + }, + { + "tests": [ + "Flush Test" + ], + "parameters": [ + { + "name": "IP", + "value": "192.168.100.100" + }, + { + "name": "Outlet", + "value": "161" + } + ] } ] } diff --git a/lib/setupmanagers/qemuhck/devices/virtio-blk-pci.json b/lib/setupmanagers/qemuhck/devices/virtio-blk-pci.json index 106c9b41..4c348861 100644 --- a/lib/setupmanagers/qemuhck/devices/virtio-blk-pci.json +++ b/lib/setupmanagers/qemuhck/devices/virtio-blk-pci.json @@ -1,8 +1,17 @@ { "name": "virtio-blk-pci", "type": "storage", + "define_variables": { + "@blk_qmp_socket@": "blk_qmp_@run_id@_@client_id@_sock" + }, + "pre_start_commands": [ + "rm -vf @blk_qmp_socket@", + "@source@/bin/fake-snmp-reset @blk_qmp_socket@ &" + ], "command_line": [ "-drive file=@image_path@,if=none,format=@image_format@,id=virtio_blk_@run_id@_@client_id@@drive_cache_options@", - "-device virtio-blk-pci@device_extra_param@@iommu_device_param@,bus=@bus_name@.0,drive=virtio_blk_@run_id@_@client_id@,serial=@client_id@blk@run_id@@bootindex@" + "-device virtio-blk-pci@device_extra_param@@iommu_device_param@,bus=@bus_name@.0,drive=virtio_blk_@run_id@_@client_id@,serial=@client_id@blk@run_id@@bootindex@", + "-chardev socket,id=blk_qmp,path=@blk_qmp_socket@,server=on,wait=off", + "-mon chardev=blk_qmp,mode=control" ] } diff --git a/lib/setupmanagers/qemuhck/devices/virtio-scsi-pci.json b/lib/setupmanagers/qemuhck/devices/virtio-scsi-pci.json index 90d3fd2f..884c798c 100644 --- a/lib/setupmanagers/qemuhck/devices/virtio-scsi-pci.json +++ b/lib/setupmanagers/qemuhck/devices/virtio-scsi-pci.json @@ -1,9 +1,18 @@ { "name": "virtio-scsi-pci", "type": "storage", + "define_variables": { + "@scsi_qmp_socket@": "scsi_qmp_@run_id@_@client_id@_sock" + }, + "pre_start_commands": [ + "rm -vf @scsi_qmp_socket@", + "@source@/bin/fake-snmp-reset @scsi_qmp_socket@ &" + ], "command_line": [ "-drive file=@image_path@,if=none,format=@image_format@,id=virtio_scsi_@run_id@_@client_id@@drive_cache_options@", "-device virtio-scsi-pci@device_extra_param@@iommu_device_param@,id=scsi,bus=@bus_name@.0", - "-device scsi-hd,drive=virtio_scsi_@run_id@_@client_id@,serial=@client_id@scsi@run_id@@bootindex@" + "-device scsi-hd,drive=virtio_scsi_@run_id@_@client_id@,serial=@client_id@scsi@run_id@@bootindex@", + "-chardev socket,id=scsi_qmp,path=@scsi_qmp_socket@,server=on,wait=off", + "-mon chardev=scsi_qmp,mode=control" ] }