Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion framework/python/src/test_orc/test_orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ def _run_test_module(self, module):
environment={
"HOST_USER": self._host_user,
"DEVICE_MAC": device.mac_addr,
"IPV4_ADDR": device.ip_addr,
"DEVICE_TEST_MODULES": json.dumps(device.test_modules),
"IPV4_SUBNET": self._net_orc.network_config.ipv4_network,
"IPV6_SUBNET": self._net_orc.network_config.ipv6_network
Expand Down Expand Up @@ -397,7 +398,7 @@ def _load_test_module(self, module_dir):
try:
test_case = TestCase(
name=test_case_json["name"],
description=test_case_json["description"],
description=test_case_json["test_description"],
expected_behavior=test_case_json["expected_behavior"],
required_result=test_case_json["required_result"]
)
Expand Down
4 changes: 2 additions & 2 deletions local/system.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"log_level": "INFO",
"startup_timeout": 60,
"monitor_period": 300,
"runtime": 1200,
"runtime": 120,
"max_device_reports": 5
}
}
24 changes: 9 additions & 15 deletions modules/test/base/python/src/test_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class TestModule:
def __init__(self, module_name, log_name):
self._module_name = module_name
self._device_mac = os.environ['DEVICE_MAC']
self._ipv4_addr = os.environ['IPV4_ADDR']
self._ipv4_subnet = os.environ['IPV4_SUBNET']
self._ipv6_subnet = os.environ['IPV6_SUBNET']
self._add_logger(log_name=log_name, module_name=module_name)
Expand Down Expand Up @@ -74,14 +75,18 @@ def _get_device_test_module(self):
return None

def run_tests(self):

if self._config['config']['network']:
self._device_ipv4_addr = self._get_device_ipv4()
LOGGER.info('Device IP Resolved: ' + str(self._device_ipv4_addr))

tests = self._get_tests()
for test in tests:
test_method_name = '_' + test['name'].replace('.', '_')
result = None

test['start'] = datetime.now().isoformat()

if ('enabled' in test and test['enabled']) or 'enabled' not in test:
LOGGER.debug('Attempting to run test: ' + test['name'])
# Resolve the correct python method by test name and run test
Expand All @@ -101,30 +106,19 @@ def run_tests(self):
else:
if result[0] is None:
test['result'] = 'Skipped'
if len(result)>1:
test['result_details'] = result[1]
if len(result) > 1:
test['description'] = result[1]
else:
test['result'] = 'Compliant' if result[0] else 'Non-Compliant'
test['result_details'] = result[1]
test['description'] = result[1]
else:
test['result'] = 'Skipped'

# Generate the short result description based on result value
if test['result'] == 'Compliant':
test['result_description'] = test[
'short_description'] if 'short_description' in test else test[
'name'] + ' passed - see result details for more info'
elif test['result'] == 'Non-Compliant':
test['result_description'] = test[
'name'] + ' failed - see result details for more info'
else:
test['result_description'] = test[
'name'] + ' skipped - see result details for more info'

test['end'] = datetime.now().isoformat()
duration = datetime.fromisoformat(test['end']) - datetime.fromisoformat(
test['start'])
test['duration'] = str(duration)

json_results = json.dumps({'results': tests}, indent=2)
self._write_results(json_results)

Expand Down
6 changes: 3 additions & 3 deletions modules/test/baseline/conf/module_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
"tests":[
{
"name": "baseline.compliant",
"description": "Simulate a compliant test",
"test_description": "Simulate a compliant test",
"expected_behavior": "A compliant test result is generated",
"required_result": "Required"
},
{
"name": "baseline.non-compliant",
"description": "Simulate a non-compliant test",
"test_description": "Simulate a non-compliant test",
"expected_behavior": "A non-compliant test result is generated",
"required_result": "Required"
},
{
"name": "baseline.informational",
"description": "Simulate an informational test",
"test_description": "Simulate an informational test",
"expected_behavior": "An informational test result is generated",
"required_result": "Informational"
}
Expand Down
6 changes: 3 additions & 3 deletions modules/test/baseline/python/src/baseline_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ def _baseline_non_compliant(self):
return False, 'Baseline non-compliant test ran successfully'

def _baseline_informational(self):
LOGGER.info('Running baseline skip test')
LOGGER.info('Baseline skip test finished')
return None, 'Baseline skip test ran successfully'
LOGGER.info('Running baseline informational test')
LOGGER.info('Baseline informational test finished')
return None, 'Baseline informational test ran successfully'
28 changes: 14 additions & 14 deletions modules/test/conn/conf/module_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,37 @@
"tests": [
{
"name": "connection.dhcp.disconnect",
"description": "The device under test has received an IP address from the DHCP server and responds to an ICMP echo (ping) request",
"test_description": "The device under test has received an IP address from the DHCP server and responds to an ICMP echo (ping) request",
"expected_behavior": "The device is not setup with a static IP address. The device accepts an IP address from a DHCP server (RFC 2131) and responds succesfully to an ICMP echo (ping) request.",
"required_result": "Required"
},
{
"name": "connection.dhcp.disconnect_ip_change",
"description": "Update device IP on the DHCP server and reconnect the device. Does the device receive the new IP address?",
"test_description": "Update device IP on the DHCP server and reconnect the device. Does the device receive the new IP address?",
"expected_behavior": "Device recieves a new IP address within the range that is specified on the DHCP server. Device should respond to aping on this new address.",
"required_result": "Required"
},
{
"name": "connection.dhcp_address",
"description": "The device under test has received an IP address from the DHCP server and responds to an ICMP echo (ping) request",
"test_description": "The device under test has received an IP address from the DHCP server and responds to an ICMP echo (ping) request",
"expected_behavior": "The device is not setup with a static IP address. The device accepts an IP address from a DHCP server (RFC 2131) and responds succesfully to an ICMP echo (ping) request.",
"required_result": "Required"
},
{
"name": "connection.mac_address",
"description": "Check and note device physical address.",
"test_description": "Check and note device physical address.",
"expected_behavior": "N/A",
"required_result": "Required"
},
{
"name": "connection.mac_oui",
"description": "The device under test hs a MAC address prefix that is registered against a known manufacturer.",
"test_description": "The device under test hs a MAC address prefix that is registered against a known manufacturer.",
"expected_behavior": "The MAC address prefix is registered in the IEEE Organizationally Unique Identifier database.",
"required_result": "Required"
},
{
"name": "connection.private_address",
"description": "The device under test accepts an IP address that is compliant with RFC 1918 Address Allocation for Private Internets.",
"test_description": "The device under test accepts an IP address that is compliant with RFC 1918 Address Allocation for Private Internets.",
"expected_behavior": "The device under test accepts IP addresses within all ranges specified in RFC 1918 and communicates using these addresses. The Internet Assigned Numbers Authority (IANA) has reserved the following three blocks of the IP address space for private internets. 10.0.0.0 - 10.255.255.255.255 (10/8 prefix). 172.16.0.0 - 172.31.255.255 (172.16/12 prefix). 192.168.0.0 - 192.168.255.255 (192.168/16 prefix)",
"required_result": "Required",
"config": {
Expand All @@ -67,7 +67,7 @@
},
{
"name": "connection.shared_address",
"description": "Ensure the device supports RFC 6598 IANA-Reserved IPv4 Prefix for Shared Address Space",
"test_description": "Ensure the device supports RFC 6598 IANA-Reserved IPv4 Prefix for Shared Address Space",
"expected_behavior": "The device under test accepts IP addresses within the ranges specified in RFC 6598 and communicates using these addresses",
"required_result": "Required",
"config": {
Expand All @@ -81,7 +81,7 @@
},
{
"name": "connection.private_address",
"description": "The device under test accepts an IP address that is compliant with RFC 1918 Address Allocation for Private Internets.",
"test_description": "The device under test accepts an IP address that is compliant with RFC 1918 Address Allocation for Private Internets.",
"expected_behavior": "The device under test accepts IP addresses within all ranges specified in RFC 1918 and communicates using these addresses. The Internet Assigned Numbers Authority (IANA) has reserved the following three blocks of the IP address space for private internets. 10.0.0.0 - 10.255.255.255.255 (10/8 prefix). 172.16.0.0 - 172.31.255.255 (172.16/12 prefix). 192.168.0.0 - 192.168.255.255 (192.168/16 prefix)",
"required_result": "Required",
"config": [
Expand All @@ -101,37 +101,37 @@
},
{
"name": "connection.single_ip",
"description": "The network switch port connected to the device reports only one IP address for the device under test.",
"test_description": "The network switch port connected to the device reports only one IP address for the device under test.",
"expected_behavior": "The device under test does not behave as a network switch and only requets one IP address. This test is to avoid that devices implement network switches that allow connecting strings of daisy chained devices to one single network port, as this would not make 802.1x port based authentication possible.",
"required_result": "Required"
},
{
"name": "connection.target_ping",
"description": "The device under test responds to an ICMP echo (ping) request.",
"test_description": "The device under test responds to an ICMP echo (ping) request.",
"expected_behavior": "The device under test responds to an ICMP echo (ping) request.",
"required_result": "Required"
},
{
"name": "connection.ipaddr.ip_change",
"description": "The device responds to a ping (ICMP echo request) to the new IP address it has received after the initial DHCP lease has expired.",
"test_description": "The device responds to a ping (ICMP echo request) to the new IP address it has received after the initial DHCP lease has expired.",
"expected_behavior": "If the lease expires before the client receiveds a DHCPACK, the client moves to INIT state, MUST immediately stop any other network processing and requires network initialization parameters as if the client were uninitialized. If the client then receives a DHCPACK allocating the client its previous network addres, the client SHOULD continue network processing. If the client is given a new network address, it MUST NOT continue using the previous network address and SHOULD notify the local users of the problem.",
"required_result": "Required"
},
{
"name": "connection.ipaddr.dhcp_failover",
"description": "The device has requested a DHCPREQUEST/REBIND to the DHCP failover server after the primary DHCP server has been brought down.",
"test_description": "The device has requested a DHCPREQUEST/REBIND to the DHCP failover server after the primary DHCP server has been brought down.",
"expected_behavior": "",
"required_result": "Required"
},
{
"name": "connection.ipv6_slaac",
"description": "The device forms a valid IPv6 address as a combination of the IPv6 router prefix and the device interface identifier",
"test_description": "The device forms a valid IPv6 address as a combination of the IPv6 router prefix and the device interface identifier",
"expected_behavior": "The device under test complies with RFC4862 and forms a valid IPv6 SLAAC address",
"required_result": "Required"
},
{
"name": "connection.ipv6_ping",
"description": "The device responds to an IPv6 ping (ICMPv6 Echo) request to the SLAAC address",
"test_description": "The device responds to an IPv6 ping (ICMPv6 Echo) request to the SLAAC address",
"expected_behavior": "The device responds to the ping as per RFC4443",
"required_result": "Required"
}
Expand Down
6 changes: 3 additions & 3 deletions modules/test/dns/conf/module_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
"tests":[
{
"name": "dns.network.hostname_resolution",
"description": "Verify the device sends DNS requests",
"test_description": "Verify the device sends DNS requests",
"expected_behavior": "The device sends DNS requests.",
"required_result": "Required"
},
{
"name": "dns.network.from_dhcp",
"description": "Verify the device allows for a DNS server to be entered automatically",
"test_description": "Verify the device allows for a DNS server to be entered automatically",
"expected_behavior": "The device sends DNS requests to the DNS server provided by the DHCP server",
"required_result": "Roadmap"
},
{
"name": "dns.mdns",
"description": "If the device has MDNS (or any kind of IP multicast), can it be disabled",
"test_description": "If the device has MDNS (or any kind of IP multicast), can it be disabled",
"expected_behavior": "Device may send MDNS requests",
"required_result": "Recommended"
}
Expand Down
Loading