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
This commit is contained in:
Steven Hardy 2015-01-14 11:08:29 +00:00
parent d673f00ba1
commit cd7408e41e
3 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,13 @@
{"network_config": [
{
"type": "interface",
"name": "em1",
"use_dhcp": false,
"addresses": [
{
"ip_netmask": "192.0.2.1/24"
}
]
}
]
}

View File

@ -0,0 +1,8 @@
network_config:
-
type: interface
name: em1
use_dhcp: false
addresses:
-
ip_netmask: 192.0.2.1/24

View File

@ -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)