From cd7408e41e16fe06038b6529e7206483f67061a3 Mon Sep 17 00:00:00 2001 From: Steven Hardy Date: Wed, 14 Jan 2015 11:08:29 +0000 Subject: Add sample and cli test for simple interface config Adds a simple example showing how an individual interface can be configured, e.g outside of a bond etc. Change-Id: I05dcb4fabe718686e306bdc719b32f0fb40c1b5e --- etc/os-net-config/samples/interface.json | 13 +++++++++++++ etc/os-net-config/samples/interface.yaml | 8 ++++++++ os_net_config/tests/test_cli.py | 9 +++++++++ 3 files changed, 30 insertions(+) create mode 100644 etc/os-net-config/samples/interface.json create mode 100644 etc/os-net-config/samples/interface.yaml diff --git a/etc/os-net-config/samples/interface.json b/etc/os-net-config/samples/interface.json new file mode 100644 index 0000000..9fd5cf3 --- /dev/null +++ b/etc/os-net-config/samples/interface.json @@ -0,0 +1,13 @@ +{"network_config": [ + { + "type": "interface", + "name": "em1", + "use_dhcp": false, + "addresses": [ + { + "ip_netmask": "192.0.2.1/24" + } + ] + } + ] +} diff --git a/etc/os-net-config/samples/interface.yaml b/etc/os-net-config/samples/interface.yaml new file mode 100644 index 0000000..2e24ccc --- /dev/null +++ b/etc/os-net-config/samples/interface.yaml @@ -0,0 +1,8 @@ +network_config: + - + type: interface + name: em1 + use_dhcp: false + addresses: + - + ip_netmask: 192.0.2.1/24 diff --git a/os_net_config/tests/test_cli.py b/os_net_config/tests/test_cli.py index 6c13068..609f0ab 100644 --- a/os_net_config/tests/test_cli.py +++ b/os_net_config/tests/test_cli.py @@ -70,3 +70,12 @@ class TestCli(base.TestCase): stdout_yaml, stderr = self.run_cli('ARG0 -d --noop -c %s' % vlan_yaml) stdout_json, stderr = self.run_cli('ARG0 -d --noop -c %s' % vlan_json) self.assertEqual(stdout_yaml, stdout_json) + + def test_interface_noop_output(self): + interface_yaml = os.path.join(SAMPLE_BASE, 'interface.yaml') + interface_json = os.path.join(SAMPLE_BASE, 'interface.json') + stdout_yaml, stderr = self.run_cli('ARG0 -d --noop -c %s' + % interface_yaml) + stdout_json, stderr = self.run_cli('ARG0 -d --noop -c %s' + % interface_json) + self.assertEqual(stdout_yaml, stdout_json) -- cgit 1.2.3-korg