diff --git a/src/program/lwaftr/setup.lua b/src/program/lwaftr/setup.lua index de9fd77cd5..8546f05805 100644 --- a/src/program/lwaftr/setup.lua +++ b/src/program/lwaftr/setup.lua @@ -34,6 +34,11 @@ local lib = require("core.lib") local capabilities = {['ietf-softwire']={feature={'binding', 'br'}}} require('lib.yang.schema').set_default_capabilities(capabilities) +function read_config(filename) + return yang.load_configuration(filename, + {schema_name=lwaftr.LwAftr.yang_schema}) +end + local function convert_ipv4(addr) if addr ~= nil then return ipv4:pton(ipv4_ntop(addr)) end end diff --git a/src/program/lwaftr/tests/subcommands/run_nohw_test.py b/src/program/lwaftr/tests/subcommands/run_nohw_test.py deleted file mode 100644 index 9e7d37e94b..0000000000 --- a/src/program/lwaftr/tests/subcommands/run_nohw_test.py +++ /dev/null @@ -1,66 +0,0 @@ -""" -Test the "snabb lwaftr run-nohw" subcommand. -""" - -import unittest - -from random import randint -from subprocess import check_call -from test_env import DATA_DIR, SNABB_CMD, BaseTestCase - -CONFIG_PATH = str(DATA_DIR / 'icmp_on_fail.conf') - - -class TestRunNoHW(BaseTestCase): - - cmd_args = [ - str(SNABB_CMD), 'lwaftr', 'run-nohw', - ] - cmd_options = { - '--duration': '1', - '--bench-file': '/dev/null', - '--conf': CONFIG_PATH, - '--inet-if': '', - '--b4-if': '', - } - veths = [] - - @classmethod - def setUpClass(cls): - veth0 = cls.random_veth_name() - veth1 = cls.random_veth_name() - # Create veth pair. - check_call( - ('ip', 'link', 'add', veth0, 'type', 'veth', 'peer', 'name', veth1) - ) - # Set interfaces up. - check_call(('ip', 'link', 'set', veth0, 'up')) - check_call(('ip', 'link', 'set', veth1, 'up')) - # Add interface names to class. - cls.veths.append(veth0) - cls.veths.append(veth1) - - @classmethod - def random_veth_name(cls): - return 'veth%s' % randint(10000, 999999) - - def test_run_nohw(self): - self.cmd_options['--inet-if'] = self.veths[0] - self.cmd_options['--b4-if'] = self.veths[1] - output = self.run_cmd(self.build_cmd()) - self.assertIn(b'link report', output, - b'\n'.join((b'OUTPUT', output))) - - def build_cmd(self): - result = self.cmd_args - for key, value in self.cmd_options.items(): - result.extend((key, value)) - return result - - @classmethod - def tearDownClass(cls): - check_call(('ip', 'link', 'delete', cls.veths[0])) - - -if __name__ == '__main__': - unittest.main()