def test_connect(self):
     i_a = InterfaceNetconnect(ZMQ_IFACE)
     i_a.connect({
         'lte': {
             'name': 'ppp',
             'metric': 300,
             'lte': {
                 'apn': 'internet',
                 'number': '*99#',
                 'user': None,
                 'password': None,
             }
         }
     })
 def test_connect(self):
     i_a = InterfaceNetconnect(ZMQ_IFACE)
     i_a.connect({
         'wifi_ap': {
             'name': 'wlan0',
             'wifi_ap': {
                 'ssid': 'TESTAP',
                 'channel': 6
             },
             'ipv4': {
                 'ip': '10.10.10.10',
                 'netmask': '255.255.255.0',
             },
         }
     })
 def test_connect(self):
     i_a = InterfaceNetconnect(ZMQ_IFACE)
     i_a.connect({
         'lan': {
             'name': 'eth0',
             'lan': {},
             'ipv4': {
                 'dhcp': True,
             },
             #'ipv4': {
             #    'ip': '192.168.1.200',
             #    'netmask': '255.255.255.0',
             #    'gw': '10.10.10.1',
             #    'dns': ['8.8.8.8', '8.8.4.4']
             #},
         }
     })
 def test_connect(self):
     i_a = InterfaceNetconnect(ZMQ_IFACE)
     i_a.connect({
         'wifi_client': {
             'usb_port': '4-1:1.0',
             'wifi_client': {
                 'ssid': 'huawei-p10',
                 'key': 'hrnek123'
             },
             'ipv4': {
                 'dhcp': True
             },
             #'ipv4': {
             #    'ip': '10.10.10.10',
             #    'netmask': '255.255.255.0',
             #    'gw': '10.10.10.1',
             #    'dns': ['8.8.8.8', '8.8.4.4']
             #},
         }
     })
Exemple #5
0
def status():
    log = logging.getLogger(__name__)
    i_n = InterfaceNetconnect()
    ret = {}
    try:
        ret['lan'] = i_n.connection_info('lan')
        ret['wifi_client'] = i_n.connection_info('wifi_client')
        ret['lte'] = i_n.connection_info('lte')
        ret['ncstatus'] = i_n.status()
        ret['counter'] = store['counter']
    except Exception as e:
        log.error('Cannot get status information: ' + str(e))
        return {}, 405

    return ret
Exemple #6
0
Process(target=netconnect_app).start()

config = defconfig

try:
    with open(CONFIG, 'r') as f:
        config = json.loads(f.read())
except Exception as e:
    log.warning('Configuration file is not available yet')

log.info(json.dumps(config, indent=4, sort_keys=True))
store = Manager().dict()
store['config'] = config
store['counter'] = config['ap_timeout']

i_n = InterfaceNetconnect()
i_n.wait_for_ready()
ncfg = get_netconnect_config(config)
# scan for wifi network
i_n.connect({
    'wifi_client': {
        'name': 'wlan0',
        'wifi_client': {
            'ssid': 'scan'
        },
        'ipv4': {
            'dhcp': True
        }
    },
    'wifi_ap': None
})
 def test_scan(self):
     i_a = InterfaceNetconnect(ZMQ_IFACE)
     ret = i_a.wifi_scan()
     for i in ret:
         print(i)
 def test_info(self):
     i_a = InterfaceNetconnect(ZMQ_IFACE)
     print(i_a.connection_info('wifi_client'))
 def test_disconnect(self):
     i_a = InterfaceNetconnect(ZMQ_IFACE)
     i_a.connect({'wifi_client': None})
 def test_info(self):
     i_a = InterfaceNetconnect(ZMQ_IFACE)
     print(i_a.connection_info('lte'))
 def test_disconnect(self):
     i_a = InterfaceNetconnect(ZMQ_IFACE)
     i_a.connect({'lte': None})
 def test_config(self):
     i_a = InterfaceNetconnect(ZMQ_IFACE)
     i_a.config({'test_host': 'www.seznam.cz'})
 def test_online_check(self):
     i_a = InterfaceNetconnect(ZMQ_IFACE)
     i_a.online_check()
 def test_interfaces(self):
     i_a = InterfaceNetconnect(ZMQ_IFACE)
     ret = i_a.interfaces()
     for i in ret:
         print(i)
 def test_status(self):
     i_a = InterfaceNetconnect(ZMQ_IFACE)
     ret = i_a.status()
     print(ret)
 def test_echo(self):
     i_a = InterfaceNetconnect(ZMQ_IFACE)
     ret = i_a.echo('a', 'b')
     print(ret)