Weave Cihaz Yöneticisi

Kaynağı GitHub'da göster

weave-device-mgr (Weave Cihaz Yöneticisi) aracı, Weave ekosisteminde yardımcı bir cihaz olarak görev yapar. Ağ ve kumaş temel hazırlığı dahil cihaz eşlemeyi yönetir. Sağlayıcının işlevi, bir Nest cihazının temel hazırlık, eşleme ve Hizmet'e kaydetme rolündeki rolüyle benzerdir.

Weave Cihaz Yöneticisi, weave-tools derlemesinde yer alır. Bağımsız uygulama derlemesinde /src/device-manager/python adresinde bulunur.

Çalıştır

Yardım menüsü, araç işlemi sırasında kullanılabilir. Weave Cihaz Yöneticisi'ni başlatmak ve yardım menüsünü görüntülemek için:

./weave-device-mgr
help

Sahte bir cihaza bağlanma

Weave Cihaz Yöneticisi yardımcı bir işlev sunduğundan önce bir cihaza bağlamanız gerekir. Bu işlevi test etmek için, bir düğümün örnek bir Weave cihaz ve bir diğerinin Cihaz Yöneticisi çalıştırdığı Mutlu bir simüle edilmiş topoloji kullanın.

1. Mutlu bir topoloji oluşturun

Bu topolojide node01 örnek cihazı, node02 ise Cihaz Yöneticisi'ni çalıştıracak. Başlamadan önce Mutlu'yu yükleyin ve Weave desteği için yapılandırın.

Yükleme işleminden sonra basit bir Mutlu topoloji oluşturun:

weave-state-load <path-to-openweave-core>/src/test-apps/happy/topologies/standalone/three_nodes_on_thread_weave.json

Topolojiyi onaylamak için Mutlu ve Weave eyaletlerini kontrol edin:

happy-state
State Name:  happy

NETWORKS   Name         Type   State                                     Prefixes
           Home       thread      UP                       2001:0db8:0001:0002/64


NODES      Name    Interface    Type                                          IPs
         node01        wpan0  thread   fd00:0000:fab1:0006:1ab4:3000:0000:0004/64
                                       2001:0db8:0001:0002:0200:00ff:fe00:0001/64

         node02        wpan0  thread   fd00:0000:fab1:0006:1ab4:3000:0000:0005/64
                                       2001:0db8:0001:0002:0200:00ff:fe00:0002/64

         node03        wpan0  thread   2001:0db8:0001:0002:0200:00ff:fe00:0003/64
                                       fd00:0000:fab1:0006:1ab4:3000:0000:000a/64
weave-state
State Name: weave

NODES                Name       Weave Node Id    Pairing Code
                   node01    18B4300000000004          AAA123
                   node02    18B4300000000005          AAA123
                   node03    18B430000000000A          AAA123

FABRIC          Fabric Id           Global Prefix
                     fab1     fd00:0000:fab1::/48

2. Sahte cihazı başlat

node01 hizmetine giriş yapın:

happy-shell node01

node01 içinde, bu düğümün Weave IPv6 adresini ve geçerli bir Weave eşleme kodu kullanan bir örnek cihaz gösterin. Sahte cihaz ile Cihaz Yöneticisi arasında güvenli bir PASE oturumu oluşturmak için eşleme kodu gerekir:

./mock-device --node-addr fd00:0:fab1:6:1ab4:3000:0:4 --pairing-code AB713H
WEAVE:ML: Binding IPv6 TCP listen endpoint to [fd00:0:fab1:6:1ab4:3000:0:4]:11095
WEAVE:ML: Listening on IPv6 TCP endpoint
WEAVE:ML: Binding general purpose IPv4 UDP endpoint to [::]:11095
WEAVE:IN: IPV6_PKTINFO: 92
WEAVE:ML: Binding general purpose IPv6 UDP endpoint to [fd00:0:fab1:6:1ab4:3000:0:4]:11095 (wpan0)
WEAVE:ML: Listening on general purpose IPv6 UDP endpoint
WEAVE:ML: Binding IPv6 multicast receive endpoint to [ff02::1]:11095 (wpan0)
WEAVE:ML: Listening on IPv6 multicast receive endpoint
WEAVE:EM: Cannot listen for BLE connections, null BleLayer
Weave Node Configuration:
  Fabric Id: FAB1
  Subnet Number: 6
  Node Id: 18B4300000000004
WEAVE:SD: init()
Weave Node Configuration:
  Fabric Id: FAB1
  Subnet Number: 6
  Node Id: 18B4300000000004
  Listening Addresses:
      fd00:0:fab1:6:1ab4:3000:0:4 (ipv6)
  Pairing Server: fd00:0:fab1:6:1ab4:3000:0:4
Mock Time Sync is disabled and not initialized
Mock System Time Offset initialized to: -4.802583 sec
Listening for requests...
Weave Node ready to service events; PID: 41116; PPID: 40703

3. Cihaz Yöneticisi'ni başlat

Yeni bir terminal penceresi açın ve node02 hizmetine giriş yapın

happy-shell node02

node02 cihazında Cihaz Yöneticisi'ni başlatın:

./weave-device-mgr
WEAVE:ML: Binding general purpose IPv4 UDP endpoint to [::]:11095
WEAVE:IN: IPV6_PKTINFO: 92
WEAVE:ML: Listening on general purpose IPv4 UDP endpoint
WEAVE:ML: Binding general purpose IPv6 UDP endpoint to [::]:11095 ()
WEAVE:ML: Listening on general purpose IPv6 UDP endpoint
WEAVE:ML: Adding wpan0 to interface table
WEAVE:ML: Binding IPv6 UDP interface endpoint to [fd00:0:fab1:6:1ab4:3000:0:5]:11095 (wpan0)
WEAVE:ML: Listening on IPv6 UDP interface endpoint
Weave Device Manager Shell

weave-device-mgr >

4. Sahte cihaza bağlan

Cihaz Yöneticisi'nde (node02) örnek cihazla güvenli bir PASE oturumu oluşturun. happy-state ve weave-state komutlarının sonucundan alınan örnek Weave IPv6 adresini ve Düğüm Kimliği'ni eşleme koduyla birlikte kullanın:

connect fd00:0:fab1:6:1ab4:3000:0:4 18B4300000000004 --pairing-code AB713H
WEAVE:DM: Initiating connection to device
WEAVE:ML: Binding general purpose IPv4 UDP endpoint to [::]:11095
WEAVE:IN: IPV6_PKTINFO: 92
WEAVE:ML: Listening on general purpose IPv4 UDP endpoint
WEAVE:ML: Binding general purpose IPv6 UDP endpoint to [::]:11095 ()
WEAVE:ML: Listening on general purpose IPv6 UDP endpoint
WEAVE:ML: Adding wpan0 to interface table
WEAVE:ML: Binding IPv6 UDP interface endpoint to [fd00:0:fab1:6:1ab4:3000:0:5]:11095 (wpan0)
WEAVE:ML: Listening on IPv6 UDP interface endpoint
WEAVE:EM: ec id: 1, AppState: 0x8d3777e0
WEAVE:DM: Sending IdentifyRequest to locate device
WEAVE:EM: Msg sent 0000000E:1 16 18B4300000000004 0000 986B 0 MsgId:23C64568
WEAVE:EM: Msg rcvd 0000000E:2 104 18B4300000000004 0000 986B 0 MsgId:8F1FC90B
WEAVE:DM: Received identify response from device 18B4300000000004 ([fd00:0:fab1:6:1ab4:3000:0:4]:11095%wpan0)
WEAVE:DM: Initiating weave connection to device 18B4300000000004 (fd00:0:fab1:6:1ab4:3000:0:4)
WEAVE:ML: Con start AFC0 18B4300000000004 0001
WEAVE:ML: TCP con start AFC0 fd00:0:fab1:6:1ab4:3000:0:4 11095
WEAVE:ML: TCP con complete AFC0 0
WEAVE:ML: Con complete AFC0
WEAVE:DM: Connected to device
WEAVE:DM: Initiating PASE session
WEAVE:EM: ec id: 1, AppState: 0x21da95c0
WEAVE:EM: Msg sent 00000004:1 296 18B4300000000004 AFC0 986C 0 MsgId:00000002
WEAVE:SM: StartSessionTimer
WEAVE:EM: Msg rcvd 00000004:2 284 18B4300000000004 AFC0 986C 0 MsgId:00000000
WEAVE:EM: Msg rcvd 00000004:3 144 18B4300000000004 AFC0 986C 0 MsgId:00000001
WEAVE:EM: Msg sent 00000004:4 176 18B4300000000004 AFC0 986C 0 MsgId:00000003
WEAVE:EM: Msg rcvd 00000004:5 32 18B4300000000004 AFC0 986C 0 MsgId:00000002
WEAVE:SM: CancelSessionTimer
WEAVE:DM: Secure session established
Connected to device.
weave-device-mgr (18B4300000000004 @ fd00:0:fab1:6:1ab4:3000:0:4) >

Örnek cihazdaki (node01) çıkışı, bağlantının başarılı olduğunu onaylamak için kullanılır:

WEAVE:EM: Msg rcvd 0000000E:1 16 0000000000000001 0000 986B 0 MsgId:23C64568
WEAVE:EM: ec id: 1, AppState: 0x3aadf480
IdentifyRequest received from node 1 (fd00:0:fab1:6:1ab4:3000:0:5)
  Target Fabric Id: FFFFFFFFFFFFFFFF
  Target Modes: 00000000
  Target Vendor Id: FFFF
  Target Product Id: FFFF
Sending IdentifyResponse
WEAVE:EM: Msg sent 0000000E:2 104 0000000000000001 0000 986B 0 MsgId:8F1FC90B
WEAVE:ML: Con rcvd 3960 fd00:0:fab1:6:1ab4:3000:0:5 38798
Connection received from node 18B4300000000005 (fd00:0:fab1:6:1ab4:3000:0:5)
WEAVE:EM: Msg rcvd 00000004:1 296 0000000000000001 3960 986C 0 MsgId:00000002
WEAVE:EM: ec id: 1, AppState: 0x3aaf1f60
WEAVE:SM: StartSessionTimer
WEAVE:EM: Msg sent 00000004:2 284 0000000000000001 3960 986C 0 MsgId:00000000
WEAVE:EM: Msg sent 00000004:3 144 0000000000000001 3960 986C 0 MsgId:00000001
WEAVE:EM: Msg rcvd 00000004:4 176 0000000000000001 3960 986C 0 MsgId:00000003
WEAVE:EM: Msg sent 00000004:5 32 0000000000000001 3960 986C 0 MsgId:00000002
WEAVE:ML: Message Encryption Key: Id=2C51 Type=SessionKey Peer=0000000000000001 EncType=01 Key=BB00C9BE96F188D7672255A2DC6AC14F,B0615B2BD5F97FC1B7AEC8C6FD59207D3B7CBFE6
WEAVE:SM: CancelSessionTimer
Secure session established with node 1 (fd00:0:fab1:6:1ab4:3000:0:5)
WEAVE:SM: Release session key: Id=2C51 Peer=0000000000000001 Reserve=0

5. Bağlantıyı test edin

Bağlantıyı test etmek için Cihaz Yöneticisi'nden (node02) örnek bir Weave Echo isteği gönderin:

ping
WEAVE:DM: DataLength: 0, payload: 0, next: (nil)
WEAVE:EM: ec id: 1, AppState: 0x8d3777e0
WEAVE:EM: Msg sent 00000001:1 0 18B4300000000004 AFC0 986F 0 MsgId:00000000
WEAVE:EM: Msg rcvd 00000001:2 0 18B4300000000004 AFC0 986F 0 MsgId:00000000
Ping complete

Örnek cihazdaki (node01) çıkış, başarılı yankı durumunu doğrular:

WEAVE:EM: Msg rcvd 00000001:1 0 0000000000000001 3960 986F 0 MsgId:00000000
WEAVE:EM: ec id: 1, AppState: 0x3aadfbb0
WEAVE:SM: Reserve session key: Id=2CFF Peer=0000000000000001 Reserve=1
Echo Request from node 1 (fd00:0:fab1:6:1ab4:3000:0:5): len=0 ... sending response.
WEAVE:EM: Msg sent 00000001:2 0 0000000000000001 3960 986F 0 MsgId:00000000
WEAVE:SM: Release session key: Id=2CFF Peer=0000000000000001 Reserve=0

6. Sahte cihazla bağlantıyı kes

Sahte cihazla bağlantıyı kesmek için Cihaz Yöneticisi'ni kullanın:

close
WEAVE:DM: Closing connection to device
WEAVE:ML: Con closed 8FC0 4002
WEAVE:ML: Removing session key: Id=2873 Peer=18B4300000000004
WEAVE:ML: Closing endpoints
weave-device-mgr >