Retrieves information on the current type of network connection that the device is using
13624
protected NetworkInfo getActiveNetworkInfo() {
        ConnectivityManager connectivityManager
                = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
        return connectivityManager.getActiveNetworkInfo();
    }
1021197
def info(self):
        

        return (self.start_pc, self.end_pc,
                self.handler_pc, self.get_catch_type())
985342
def get_hardware_router_type_id(self, context):
        """"""
        cctxt = self.client.prepare()
        return cctxt.call(context,
                          'get_hardware_router_type_id',
                          host=self.host)
460001
def get_ip_addr(self) -> str:
        ''''''
        output, _ = self._execute(
            '-s', self.device_sn, 'shell', 'ip', '-f', 'inet', 'addr', 'show', 'wlan0')
        ip_addr = re.findall(
            r"\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b", output)
        if not ip_addr:
            raise ConnectionError(
                'The device is not connected to WLAN or not connected via USB.')
        return ip_addr[0]
762209
def _node_info(conn):
    '''
    
    '''
    raw = conn.getInfo()
    info = {'cpucores': raw[6],
            'cpumhz': raw[3],
            'cpumodel': six.text_type(raw[0]),
            'cpus': raw[2],
            'cputhreads': raw[7],
            'numanodes': raw[4],
            'phymemory': raw[1],
            'sockets': raw[5]}
    return info
865332
def get_default_connection_info(self, provider_name):
        
        provider = self._provider_client.get_by_name(provider_name)
        if provider:
            return provider['defaultConnectionInfo']
        else:
            return {}
1023896
def calc_device_links(self):
        
        for connection in self.interfaces:
            int_type = connection['from'][0]
            int_name = connection['from'].replace(int_type,
                                                  PORT_TYPES[int_type.upper()])
            # Get the source port id
            src_port = None
            for port in self.node['ports']:
                if int_name == port['name']:
                    src_port = port['id']
                    break
            dest_temp = connection['to'].split(' ')

            if len(dest_temp) == 2:
                conn_to = {'device': dest_temp[0],
                           'port': dest_temp[1]}
            else:
                conn_to = {'device': 'NIO',
                           'port': dest_temp[0]}

            self.calc_link(self.node['id'], src_port, int_name, conn_to)
127122
def get_connectware_id(self, use_cached=True):
        """"""
        device_json = self.get_device_json(use_cached)
        return device_json.get("devConnectwareId")
181445
def get_device_index_based_on_prompt(self, prompt):
        """"""
        conn_info = ""
        for device in self.devices:
            conn_info += str(device) + "->"
            if device.prompt == prompt:
                self.connection.log("Connected: {}".format(conn_info))
                return self.devices.index(device)
        else:
            return None
837719
def __get_connection_info():
    '''
    
    '''
    conn_info = {}

    try:
        conn_info['hostname'] = __opts__['mysql_auth']['hostname']
        conn_info['username'] = __opts__['mysql_auth']['username']
        conn_info['password'] = __opts__['mysql_auth']['password']
        conn_info['database'] = __opts__['mysql_auth']['database']

        conn_info['auth_sql'] = __opts__['mysql_auth']['auth_sql']
    except KeyError as e:
        log.error('%s does not exist', e)
        return None

    return conn_info
1252255
def device_info(self):
        
        info = {
            'serial': self.serial,
            'model': self.model,
            'build_info': self.build_info,
            'user_added_info': self._user_added_device_info
        }
        return info
772904
def is_connected(self):
        """"""
        self._connected = self._connected and self._conn.is_connected()
        return self._connected
809088
def device_typename(item):
        

        dev_type = {'ROUTER': {'from': 'ROUTER',
                               'desc': 'Router',
                               'type': 'Router',
                               'label_x': 19.5},
                    'QEMU': {'from': 'QEMU',
                             'desc': 'QEMU VM',
                             'type': 'QemuVM',
                             'ext_conf': 'QemuDevice',
                             'label_x': -12},
                    'ASA': {'from': 'ASA',
                            'desc': 'QEMU VM',
                            'type': 'QemuVM',
                            'ext_conf': '5520',
                            'label_x': 2.5},
                    'PIX': {'from': 'PIX',
                            'desc': 'QEMU VM',
                            'type': 'QemuVM',
                            'ext_conf': '525',
                            'label_x': -12},
                    'JUNOS': {'from': 'JUNOS',
                              'desc': 'QEMU VM',
                              'type': 'QemuVM',
                              'ext_conf': 'O-series',
                              'label_x': -12},
                    'IDS': {'from': 'IDS',
                            'desc': 'QEMU VM',
                            'type': 'QemuVM',
                            'ext_conf': 'IDS-4215',
                            'label_x': -12},
                    'VBOX': {'from': 'VBOX',
                             'desc': 'VirtualBox VM',
                             'type': 'VirtualBoxVM',
                             'ext_conf': 'VBoxDevice',
                             'label_x': -4.5},
                    'FRSW': {'from': 'FRSW',
                             'desc': 'Frame Relay switch',
                             'type': 'FrameRelaySwitch',
                             'label_x': 7.5},
                    'ETHSW': {'from': 'ETHSW',
                              'desc': 'Ethernet switch',
                              'type': 'EthernetSwitch',
                              'label_x': 15.5},
                    'Hub': {'from': 'Hub',
                            'desc': 'Ethernet hub',
                            'type': 'EthernetHub',
                            'label_x': 12.0},
                    'ATMSW': {'from': 'ATMSW',
                              'desc': 'ATM switch',
                              'type': 'ATMSwitch',
                              'label_x': 2.0},
                    'ATMBR': {'from': 'ATMBR',  # TODO: Investigate ATM Bridge
                              'desc': 'ATMBR',
                              'type': 'ATMBR'},
                    'Cloud': {'from': 'Cloud',
                              'desc': 'Cloud',
                              'type': 'Cloud',
                              'label_x': 47.5}}

        item_type = item.split(' ')[0]
        name = item.replace('%s ' % dev_type[item_type]['from'], '')
        return name, dev_type[item_type]
921519
def get_network_interface(name=None, network_interface_id=None, region=None,
                          key=None, keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
    r = {}
    result = _get_network_interface(conn, name, network_interface_id)
    if 'error' in result:
        if result['error']['message'] == 'No ENIs found.':
            r['result'] = None
            return r
        return result
    eni = result['result']
    r['result'] = _describe_network_interface(eni)
    return r
884297
public int getConnectionType()
    {
        int iConnectionType = DEFAULT_CONNECTION_TYPE;
        if (this.getMuffinManager() != null)
            if (this.getMuffinManager().isServiceAvailable())
                iConnectionType = PROXY;    // HACK - Webstart gives a warning when using RMI
        String strConnectionType = this.getProperty(Params.CONNECTION_TYPE);
        if (strConnectionType != null)
        {
            if ("proxy".equalsIgnoreCase(strConnectionType))
                iConnectionType = PROXY;
//x                 if ("rmi".equalsIgnoreCase(strConnectionType))
//x                     iConnectionType = RMI;
            if (Util.isNumeric(strConnectionType))
                iConnectionType = Integer.parseInt(strConnectionType);
        }
        if (ClassServiceUtility.getClassService().getClassFinder(null) == null)
            iConnectionType = PROXY;    // No OSGi
        /*                if (iConnectionType == RMI)
        {
            try {
                Hashtable<String,String> env = new Hashtable<String,String>();
                env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.rmi.registry.RegistryContextFactory");
                env.put(Context.PROVIDER_URL, "rmi://" + strServer);    // + ":1099");  // The RMI server port
                Context initial = new InitialContext(env);
                Object objref = initial.lookup(strRemoteApp);
                if (objref == null)
                    return null;    // Ahhhhh, The app is not registered.
    
                appServer = (ApplicationServer)PortableRemoteObject.narrow(objref, org.jbundle.thin.base.remote.ApplicationServer.class);
            } catch (NameNotFoundException ex) {
                return null;    // Error - not found
            } catch (ServiceUnavailableException ex) {
                return null;    // Error - not found
            } catch (Exception ex) {
                ex.printStackTrace();
    //        } catch (java.net.ConnectException ex) {
                // Try tunneling through http
                iConnectionType = PROXY;
            }
        } */
        return iConnectionType;
    }
822318
public boolean isNetworkConnected() {
		try {
			if (connMan == null) {
				connMan = (ConnectivityManager) context
						.getSystemService(Context.CONNECTIVITY_SERVICE);
			}

			NetworkInfo niMobile = connMan.getNetworkInfo(TYPE_MOBILE);
			NetworkInfo niWifi = connMan.getNetworkInfo(TYPE_WIFI);
			NetworkInfo niMms = connMan.getNetworkInfo(TYPE_MOBILE_MMS);
			NetworkInfo niSupl = connMan.getNetworkInfo(TYPE_MOBILE_SUPL);
			NetworkInfo niDun = connMan.getNetworkInfo(TYPE_MOBILE_DUN);
			NetworkInfo niHipri = connMan.getNetworkInfo(TYPE_MOBILE_HIPRI);
			NetworkInfo niWimax = connMan.getNetworkInfo(TYPE_WIMAX);
			NetworkInfo niBlueTooth = connMan.getNetworkInfo(TYPE_BLUETOOTH);
			NetworkInfo niDummy = connMan.getNetworkInfo(TYPE_DUMMY);
			NetworkInfo niEthernet = connMan.getNetworkInfo(TYPE_ETHERNET);

			if ((niMobile != null && niMobile.isConnected())
					|| (niWifi != null && niWifi.isConnected())
					|| (niMms != null && niMms.isConnected())
					|| (niSupl != null && niSupl.isConnected())
					|| (niDun != null && niDun.isConnected())
					|| (niHipri != null && niHipri.isConnected())
					|| (niWimax != null && niWimax.isConnected())
					|| (niBlueTooth != null && niBlueTooth.isConnected())
					|| (niDummy != null && niDummy.isConnected())
					|| (niEthernet != null && niEthernet.isConnected())) {
				return true;
			}

			return false;
		} catch (Exception e) {
			Log.e(TAG,
					"Exception during isMobileConnected(). - "
							+ e.getLocalizedMessage());
		}
		return false;
	}
1090222
def get_connected(self):
        
        connected = c_int32()
        result = self.library.Cli_GetConnected(self.pointer, byref(connected))
        check_error(result, context="client")
        return bool(connected)