diff options
author | 2015-01-14 11:08:29 +0000 | |
---|---|---|
committer | 2015-01-14 11:51:42 +0000 | |
commit | cd7408e41e16fe06038b6529e7206483f67061a3 (patch) | |
tree | dd1abd8cdf196ba3996c01fa7d1c2f84a525c4aa | |
parent | d673f00ba1af04daabc58762c059c1312ce8cfdc (diff) |
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
-rw-r--r-- | etc/os-net-config/samples/interface.json | 13 | ||||
-rw-r--r-- | etc/os-net-config/samples/interface.yaml | 8 | ||||
-rw-r--r-- | os_net_config/tests/test_cli.py | 9 |
3 files changed, 30 insertions, 0 deletions
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) |