

def _extract_networks(self, compute):
    '\n        Extract networks from a compute node XML representation.\n\n        Extract network descriptions from a compute node XML representation,\n        converting each network to an OpenNebulaNetwork object.\n\n        :type  compute: :class:`ElementTree`\n        :param compute: XML representation of a compute node.\n\n        :rtype:  ``list`` of :class:`OpenNebulaNetwork`\n        :return: List of virtual networks attached to the compute node.\n        '
    networks = []
    for element in compute.findall('NIC'):
        network = element.find('NETWORK')
        network_id = network.attrib['href'].partition('/network/')[2]
        networks.append(OpenNebulaNetwork(id=network_id, name=network.attrib.get('name', None), address=element.findtext('IP'), size=1, driver=self.connection.driver, extra={
            'mac': element.findtext('MAC'),
        }))
    return networks

dataset/ETHPy150Open apache/libcloud/libcloud/compute/drivers/opennebula.py OpenNebula_2_0_NodeDriver._extract_networks/original