コード例 #1
0
 def test__populates_interface_type_for_each_interface(self):
     # Note: this is more of an end-to-end test, since we call
     # "/sbin/ip addr" on the host running the tests.
     ip_addr_output = check_output(["ip", "addr"])
     interfaces = parse_ip_addr(ip_addr_output)
     interfaces_with_types = annotate_with_driver_information(interfaces)
     for name in interfaces:
         iface = interfaces_with_types[name]
         self.assertThat(iface, Contains("type"))
         if iface["type"] == "ethernet.vlan":
             self.expectThat(iface, Contains("vid"))
         elif iface["type"] == "ethernet.bond":
             self.expectThat(iface, Contains("bonded_interfaces"))
         elif iface["type"] == "ethernet.bridge":
             self.expectThat(iface, Contains("bridged_interfaces"))
コード例 #2
0
ファイル: test_ipaddr.py プロジェクト: tjjh89017/maas
 def test__populates_interface_type_for_each_interface(self):
     # Note: this is more of an end-to-end test, since we call
     # "/sbin/ip addr" on the host running the tests.
     ip_addr_output = check_output(['ip', 'addr'])
     interfaces = parse_ip_addr(ip_addr_output)
     interfaces_with_types = annotate_with_driver_information(interfaces)
     for name in interfaces:
         iface = interfaces_with_types[name]
         self.assertThat(iface, Contains('type'))
         if iface['type'] == 'ethernet.vlan':
             self.expectThat(iface, Contains('vid'))
         elif iface['type'] == 'ethernet.bond':
             self.expectThat(iface, Contains('bonded_interfaces'))
         elif iface['type'] == 'ethernet.bridge':
             self.expectThat(iface, Contains('bridged_interfaces'))