Hi, 

I have been doing a little python app based on GObject Introspection using
libmm-glib for configured and connected a Quectel (5G) modem to the Vodafone
Spain network …

-----------------------

mmcli -m 0

  -----------------------------------

  General  |                    path: /org/freedesktop/ModemManager1/Modem/0

           |               device id:
a72005907e3dffab644853164b7098cb203e4d84

  -----------------------------------

  Hardware |            manufacturer: Quectel

           |                   model: RM510QGLHA_VB

           |       firmware revision: RM510QGLHAR11A03M4G

           |          carrier config: Germany-VoLTE-Vodafone

           | carrier config revision: 0A010449

           |            h/w revision: 20000

           |               supported: gsm-umts, lte, 5gnr

           |                 current: gsm-umts, lte, 5gnr

           |            equipment id: 867034040029614

  -----------------------------------

  System   |                  device:
/sys/devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1.1

           |                 drivers: option, qmi_wwan

           |                  plugin: quectel

           |            primary port: cdc-wdm0

           |                   ports: cdc-wdm0 (qmi), ttyUSB0 (qcdm),
ttyUSB1 (gps),

           |                          ttyUSB2 (at), ttyUSB3 (at), wwan0
(net)

  -----------------------------------

  Status   |                    lock: sim-pin2

           |          unlock retries: sim-pin (3), sim-puk (10), sim-pin2
(3), sim-puk2 (10)

           |                   state: connected

           |             power state: on

           |             access tech: lte

           |          signal quality: 100% (cached)

  -----------------------------------

  Modes    |               supported: allowed: 3g; preferred: none

…

           |                 current: allowed: 3g, 4g, 5g; preferred: 5g

  -----------------------------------

  Bands    |               supported: utran-1, utran-3, utran-4, utran-6,
utran-5, utran-8,

           |                          utran-9, utran-2, eutran-1, eutran-2,
eutran-3, eutran-4, eutran-5,

           |                          eutran-7, eutran-8, eutran-12,
eutran-13, eutran-14, eutran-17,

           |                          eutran-18, eutran-19, eutran-20,
eutran-25, eutran-26, eutran-28,

           |                          eutran-29, eutran-30, eutran-32,
eutran-34, eutran-38, eutran-39,

           |                          eutran-40, eutran-41, eutran-42,
eutran-43, eutran-46, eutran-48,

           |                          eutran-66, eutran-71, utran-19

           |                 current: utran-1, utran-3, utran-4, utran-6,
utran-5, utran-8,

           |                          utran-2, eutran-1, eutran-2, eutran-3,
eutran-4, eutran-5, eutran-7,

           |                          eutran-8, eutran-12, eutran-13,
eutran-14, eutran-17, eutran-18,

           |                          eutran-19, eutran-20, eutran-25,
eutran-26, eutran-28, eutran-29,

           |                          eutran-30, eutran-32, eutran-34,
eutran-38, eutran-39, eutran-40,

           |                          eutran-41, eutran-42, eutran-43,
eutran-46, eutran-48, eutran-66,

           |                          eutran-71, utran-19

  -----------------------------------

  IP       |               supported: ipv4, ipv6, ipv4v6

  -----------------------------------

  3GPP     |                    imei: 867034040029614

           |           enabled locks: fixed-dialing

           |             operator id: 21401

           |           operator name: vodafone ES

           |            registration: home

  -----------------------------------

  3GPP EPS |    ue mode of operation: csps-2

           |     initial bearer path:
/org/freedesktop/ModemManager1/Bearer/0

           |  initial bearer ip type: ipv4v6

  -----------------------------------

  SIM      |        primary sim path: /org/freedesktop/ModemManager1/SIM/0

           |          sim slot paths: slot 1:
/org/freedesktop/ModemManager1/SIM/0 (active)

           |                          slot 2: none

  -----------------------------------

  Bearer   |                   paths:
/org/freedesktop/ModemManager1/Bearer/2

mmcli -m 0 --bearer 2

  ------------------------------------

  General            |           path:
/org/freedesktop/ModemManager1/Bearer/2

                     |           type: default

  ------------------------------------

  Status             |      connected: yes

                     |      suspended: no

                     |    multiplexed: no

                     |      interface: wwan0

                     |     ip timeout: 20

  ------------------------------------

  Properties         |            apn: airtelwap.es

                     |        roaming: allowed

                     |        ip type: ipv4v6

  ------------------------------------

  IPv4 configuration |         method: static

                     |        address: 100.71.123.241

                     |         prefix: 30

                     |        gateway: 100.71.123.242

                     |            dns: 212.166.128.198, 212.166.167.71

                     |            mtu: 1500

  ------------------------------------

  Statistics         |       duration: 450

                     |       attempts: 34

                     |       attempts: 1

                     | total-duration: 26124

 

I have very little experience with all of this, I thought to use ‘pyroute2’
or similar to do next command line instructions (from an app python) in
order to connect the operating system to the packet data connection that the
modem has established with the mobile phone network (it is already done
using libmm-glib):

•             Getting iface access like as: sudo ip link set dev wwan0 up

•             Setting ip address associated to the bearer: sudo ip address
add 100.71.123.241/30 dev wwan0

•             Setting the route: sudo ip route add default via
100.71.123.242 dev wwan0

•             Setting the available dns...

Is good option use ‘pyroute2’ or do you recommend another API (python based)
from a performance/learning perspective?

 

Thanks in advance for your recommendations.

Fran Arroyo

Reply via email to