Exemplo n.º 1
0
def network_interfaces_to_test(session, config):
    """Return a list of all the ethernet devices that must be tested by the
    auto cert kit. In turn, each device must be the 'primary' interface,
    upon which we run our cert tests."""

    # Extract from netconf the network interfaces that the user
    # has specified.
    ifaces_to_test = [iface.strip() for iface in config['netconf'].keys() 
                      if iface.startswith('eth')]

    devices = utils.get_master_network_devices(session)

    # Filter the list of devices available on the master by the interfaces
    # specified by the caller in their netconf file.
    devices_to_test = [dev for dev in devices 
                      if dev['Kernel_name'] in ifaces_to_test]
    
    device_groups_list = []
    for key, items in itertools.groupby(devices_to_test, operator.itemgetter('PCI_id')):
        device_groups_list.append(list(items))

    ifaces = []
    for grp in device_groups_list:
        dev = grp[0] #we can use any of the devices in the group
        ifaces.append(dev['Kernel_name']) 
    return ifaces
Exemplo n.º 2
0
def network_interfaces_to_test(session, config):
    """Return a list of all the ethernet devices that must be tested by the
    auto cert kit. In turn, each device must be the 'primary' interface,
    upon which we run our cert tests."""

    # Extract from netconf the network interfaces that the user
    # has specified.
    ifaces_to_test = [
        iface.strip() for iface in config['netconf'].keys()
        if iface.startswith('eth')
    ]

    devices = utils.get_master_network_devices(session)

    # Filter the list of devices available on the master by the interfaces
    # specified by the caller in their netconf file.
    devices_to_test = [
        dev for dev in devices if dev['Kernel_name'] in ifaces_to_test
    ]

    device_groups_list = []
    for key, items in itertools.groupby(devices_to_test,
                                        operator.itemgetter('PCI_id')):
        device_groups_list.append(list(items))

    ifaces = []
    for grp in device_groups_list:
        dev = grp[0]  # we can use any of the devices in the group
        ifaces.append(dev['Kernel_name'])
    return ifaces
Exemplo n.º 3
0
 def get_device_config(self):
     """Retrieve info about interface from biosdevname"""
     devices = utils.get_master_network_devices(self.session)
     for device_rec in devices:
         print device_rec
         if device_rec['Kernel_name'] == self.interface:
             return device_rec
     raise Exception("Specified interface %s appears not to exist on master" %
                     self.interface)
Exemplo n.º 4
0
 def get_device_config(self):
     """Retrieve info about interface from biosdevname"""
     if not self.interface:
         return {}
     devices = utils.get_master_network_devices(self.session)
     for device_rec in devices:
         print device_rec
         if device_rec['Kernel_name'] == self.interface:
             return device_rec
     raise Exception("Specified interface %s appears not to exist on master" %
                     self.interface)