コード例 #1
0
 def test_generate_network_config(self):
     expected = {
         'version': 1,
         'config': [
             {
                 'subnets': [
                     {'control': 'auto',
                      'dns_nameservers': ['8.8.8.8', '8.8.4.4'],
                      'netmask': '255.255.248.0',
                      'address': '62.181.8.174',
                      'type': 'static', 'gateway': '62.181.8.1'}
                 ],
                 'type': 'physical',
                 'name': 'eth0',
                 'mac_address': '00:15:5d:ff:0f:03'
             },
             {
                 'subnets': [
                     {'control': 'auto',
                      'dns_nameservers': ['9.9.9.9', '8.8.8.8'],
                      'netmask': '255.255.255.0',
                      'address': '10.209.78.11',
                      'type': 'static',
                      'gateway': '10.209.78.1'}
                 ],
                 'type': 'physical',
                 'name': 'eth1',
                 'mac_address': '00:15:5d:ff:0f:24'
             }
         ]
     }
     self.assertTrue(
         ds.generate_network_config(CLOUD_METADATA['netadp']),
         expected
     )
コード例 #2
0
 def test_generate_network_config(self):
     expected = {
         "version":
         1,
         "config": [
             {
                 "subnets": [{
                     "control": "auto",
                     "dns_nameservers": ["8.8.8.8", "8.8.4.4"],
                     "netmask": "255.255.248.0",
                     "address": "62.181.8.174",
                     "type": "static",
                     "gateway": "62.181.8.1",
                 }],
                 "type":
                 "physical",
                 "name":
                 "eth0",
                 "mac_address":
                 "00:15:5d:ff:0f:03",
             },
             {
                 "subnets": [{
                     "control": "auto",
                     "dns_nameservers": ["9.9.9.9", "8.8.8.8"],
                     "netmask": "255.255.255.0",
                     "address": "10.209.78.11",
                     "type": "static",
                     "gateway": "10.209.78.1",
                 }],
                 "type":
                 "physical",
                 "name":
                 "eth1",
                 "mac_address":
                 "00:15:5d:ff:0f:24",
             },
         ],
     }
     self.assertTrue(ds.generate_network_config(CLOUD_METADATA["netadp"]),
                     expected)